Build: Added -Wall,extra,-pedantic, fixed warnings and peeves.
This commit is contained in:
+2
-1
@@ -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])
|
||||
|
||||
@@ -32,7 +32,7 @@ std::ostream& operator<<(
|
||||
return os;
|
||||
}
|
||||
|
||||
const std::string DeviceManager::printDeviceSpecs(void)
|
||||
const std::string DeviceManager::stringifyDeviceSpecs(void)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
|
||||
|
||||
@@ -23,11 +23,12 @@ std::string DeviceManager::readDeviceFile(const std::string& filename)
|
||||
(std::istreambuf_iterator<char>(file)),
|
||||
std::istreambuf_iterator<char>());
|
||||
|
||||
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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
+17
-11
@@ -5,6 +5,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <sys/stat.h>
|
||||
#include <sstream>
|
||||
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user