diff --git a/configure.ac b/configure.ac index 668c3bd..3de1738 100644 --- a/configure.ac +++ b/configure.ac @@ -57,7 +57,8 @@ AC_SEARCH_LIBS([dlopen], [dl ldl], [], [ AC_SEARCH_LIBS([dlsym], [dl ldl], [], [ AC_MSG_ERROR([dlsym() not found in libdl or libldl.])]) -AM_CPPFLAGS=m4_normalize(["-I\"\$(top_srcdir)/include\""]) +AM_CPPFLAGS=m4_normalize(["-I\"\$(top_srcdir)/include\" + -Wall -Wextra -pedantic"]) AC_SUBST([AM_CPPFLAGS]) AC_SUBST([YACC]) diff --git a/hcore/deviceManager/deviceManager.cpp b/hcore/deviceManager/deviceManager.cpp index ff602e4..3852ae1 100644 --- a/hcore/deviceManager/deviceManager.cpp +++ b/hcore/deviceManager/deviceManager.cpp @@ -32,7 +32,7 @@ std::ostream& operator<<( return os; } -const std::string DeviceManager::printDeviceSpecs(void) +const std::string DeviceManager::stringifyDeviceSpecs(void) { std::ostringstream oss; diff --git a/hcore/deviceManager/deviceSpecParser.cpp b/hcore/deviceManager/deviceSpecParser.cpp index 12d3f90..3f2a385 100644 --- a/hcore/deviceManager/deviceSpecParser.cpp +++ b/hcore/deviceManager/deviceSpecParser.cpp @@ -23,11 +23,12 @@ std::string DeviceManager::readDeviceFile(const std::string& filename) (std::istreambuf_iterator(file)), std::istreambuf_iterator()); - return std::move(content); + return content; } -void DeviceManager::collateAllDeviceSpecs(const OptionParser& options) +void DeviceManager::collateAllDeviceSpecs(void) { + OptionParser &options = OptionParser::getOptions(); allDeviceSpecs = options.deviceSpecs; for (const auto& file : options.deviceSpecFiles) diff --git a/hcore/include/deviceManager/deviceManager.h b/hcore/include/deviceManager/deviceManager.h index 5adc720..262ad0e 100644 --- a/hcore/include/deviceManager/deviceManager.h +++ b/hcore/include/deviceManager/deviceManager.h @@ -40,9 +40,9 @@ public: } std::string readDeviceFile(const std::string& filename); - void collateAllDeviceSpecs(const OptionParser& options); + void collateAllDeviceSpecs(void); void parseAllDeviceSpecs(void); - static const std::string printDeviceSpecs(); + static const std::string stringifyDeviceSpecs(void); private: DeviceManager() = default; diff --git a/hcore/include/opts.h b/hcore/include/opts.h index 6f21621..22b597d 100644 --- a/hcore/include/opts.h +++ b/hcore/include/opts.h @@ -12,8 +12,8 @@ public: OptionParser() : verbose(false), printUsage(false) {} ~OptionParser() = default; - void parseArguments(int argc, char *argv[]); - void dumpOptions() const; + void parseArguments(int argc, char *argv[], char **envp); + std::string stringifyOptions(void) const; std::string getUsage() const; static OptionParser &getOptions(void) diff --git a/hcore/opts.cpp b/hcore/opts.cpp index 7a82389..53e4623 100644 --- a/hcore/opts.cpp +++ b/hcore/opts.cpp @@ -5,6 +5,7 @@ #include #include #include +#include struct option OptionParser::longOptions[] = { @@ -21,8 +22,9 @@ struct option OptionParser::longOptions[] = { {0, 0, 0, 0} }; -void OptionParser::parseArguments(int argc, char *argv[]) +void OptionParser::parseArguments(int argc, char *argv[], char **envp) { + (void)envp; int opt; int optionIndex = 0; @@ -91,24 +93,28 @@ std::string OptionParser::getUsage() const "[-?|--help]"; } -void OptionParser::dumpOptions() const +std::string OptionParser::stringifyOptions(void) const { + std::ostringstream oss; + if (verbose) { - std::cout << "Verbose mode is on" << std::endl; + oss << "Verbose mode is on" << std::endl; } - std::cout << "Device Specs: " << deviceSpecs << std::endl; + oss << "Device Specs: " << deviceSpecs << std::endl; - std::cout << "Device Spec Files: "; + oss << "Device Spec Files: "; for (const auto& file : deviceSpecFiles) { - std::cout << file << " "; + oss << file << " "; } - std::cout << std::endl; + oss << std::endl; - std::cout << "Sense API Library Path: " << senseApiLibPath << std::endl; - std::cout << "Sense API Libraries: "; + oss << "Sense API Library Path: " << senseApiLibPath << std::endl; + oss << "Sense API Libraries: "; for (const auto& lib : senseApiLibs) { - std::cout << lib << " "; + oss << lib << " "; } - std::cout << std::endl; + oss << std::endl; + + return oss.str(); } diff --git a/include/user/senseApiDesc.h b/include/user/senseApiDesc.h index bc720cb..f2ca6f6 100644 --- a/include/user/senseApiDesc.h +++ b/include/user/senseApiDesc.h @@ -73,6 +73,7 @@ struct CSenseApiDesc static bool CSenseApiDesc_sanityCheck(const CSenseApiDesc *desc) { + (void)CSenseApiDesc_sanityCheck; if (!desc || !desc->name || desc->numExportedImplexorApis < 1 ||!desc->exportedImplexorApis || !desc->sal_mgmt_libOps) { @@ -85,6 +86,7 @@ static bool CSenseApiDesc_sanityCheck(const CSenseApiDesc *desc) static bool CExportedImplexorApiDesc_sanityCheck( const CExportedImplexorApiDesc *desc) { + (void)CExportedImplexorApiDesc_sanityCheck; if (!desc || !desc->name) { return false; @@ -95,6 +97,7 @@ static bool CExportedImplexorApiDesc_sanityCheck( static bool Csal_mgmt_libOps_sanityCheck(const Csal_mgmt_libOps *ops) { + (void)Csal_mgmt_libOps_sanityCheck; if (!ops || !ops->initializeInd || !ops->finalizeInd || !ops->attachDeviceReq || !ops->detachDeviceReq) { diff --git a/main.cpp b/main.cpp index fb2d9bf..819d28f 100644 --- a/main.cpp +++ b/main.cpp @@ -62,7 +62,7 @@ static int initializeHarikoff(int argc, char **argv, char **envp) std::cout << PACKAGE_NAME << " " << PACKAGE_VERSION << std::endl; try { - options.parseArguments(argc, argv); + options.parseArguments(argc, argv, envp); } catch (const std::invalid_argument& e) { std::cerr << __func__ << ": Exception occurred: " << e.what() << '\n' << options.getUsage() << '\n'; @@ -74,10 +74,10 @@ static int initializeHarikoff(int argc, char **argv, char **envp) return EXIT_SUCCESS; } - options.dumpOptions(); - DeviceManager::getInstance().collateAllDeviceSpecs(options); + std::cout << options.stringifyOptions() << std::endl; + DeviceManager::getInstance().collateAllDeviceSpecs(); DeviceManager::getInstance().parseAllDeviceSpecs(); - std::cout << DeviceManager::printDeviceSpecs() << std::endl; + std::cout << DeviceManager::stringifyDeviceSpecs() << std::endl; sense_api::SenseApiManager::getInstance().loadAllSenseApiLibsFromOptions(); std::cout << __func__ << ": Exiting" << std::endl; diff --git a/senseApis/xcbXorg/Makefile.am b/senseApis/xcbXorg/Makefile.am index 3b8dfac..10bbcff 100644 --- a/senseApis/xcbXorg/Makefile.am +++ b/senseApis/xcbXorg/Makefile.am @@ -1,2 +1,5 @@ pkglib_LTLIBRARIES=libxcbXorg.la libxcbXorg_la_SOURCES=xcbXorg.cpp + +xcbXorg.$(OBJEXT): CPPFLAGS+=-Wno-c++20-extensions +xcbXorg.l$(OBJEXT): CPPFLAGS+=-Wno-c++20-extensions diff --git a/senseApis/xcbXorg/xcbXorg.cpp b/senseApis/xcbXorg/xcbXorg.cpp index 7a198aa..463e74e 100644 --- a/senseApis/xcbXorg/xcbXorg.cpp +++ b/senseApis/xcbXorg/xcbXorg.cpp @@ -43,6 +43,7 @@ const CSenseApiDesc *HK_GET_SENSE_API_DESC_FN_NAME(void) static sal_mlo_initializeIndFn xcbXorg_initializeInd; int xcbXorg_initializeInd(Csal_mgmt_hkOps *hkOps) { + (void)hkOps; std::cerr << "XcbXorg::sal_mlo_initializeInd\n"; return 0; }