Build: Added -Wall,extra,-pedantic, fixed warnings and peeves.

This commit is contained in:
2025-01-10 18:27:10 -04:00
parent ce2d47e6b9
commit 876526364b
10 changed files with 38 additions and 23 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ std::ostream& operator<<(
return os;
}
const std::string DeviceManager::printDeviceSpecs(void)
const std::string DeviceManager::stringifyDeviceSpecs(void)
{
std::ostringstream oss;
+3 -2
View File
@@ -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)
+2 -2
View File
@@ -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;
+2 -2
View File
@@ -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
View File
@@ -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();
}