diff --git a/lib/settings.cpp b/lib/settings.cpp index 5e4baf2b9..e141b1b14 100644 --- a/lib/settings.cpp +++ b/lib/settings.cpp @@ -24,7 +24,6 @@ #include Settings::Settings() - : inconclusive(false) { _debug = false; _checkCodingStyle = false; @@ -38,46 +37,7 @@ Settings::Settings() _showtime = 0; // TODO: use enum _append = ""; _terminate = false; -} - -Settings::Settings(const Settings &s) - : inconclusive(s.inconclusive) -{ - *this = s; -} - -// Constructor used in unit testing.. -Settings::Settings(bool all) - : inconclusive(all) -{ - Settings s; - *this = s; // This assigns all members except "inconclusive" -} - -const Settings &Settings::operator=(const Settings & s) -{ - if (&s == this) - return *this; - - _debug = s._debug; - _checkCodingStyle = s._checkCodingStyle; - _errorsOnly = s._errorsOnly; - _inlineSuppressions = s._inlineSuppressions; - _verbose = s._verbose; - _force = s._force; - _xml = s._xml; - _jobs = s._jobs; - _exitCode = s._exitCode; - _showtime = s._showtime; - _append = s._append; - _terminate = s._terminate; - _outputFormat = s._outputFormat; - return *this; -} - -Settings::~Settings() -{ - + inconclusive = false; } diff --git a/lib/settings.h b/lib/settings.h index 710173602..bd784e1c4 100644 --- a/lib/settings.h +++ b/lib/settings.h @@ -16,8 +16,8 @@ * along with this program. If not, see . */ -#ifndef SETTINGS_H -#define SETTINGS_H +#ifndef settingsH +#define settingsH #include #include @@ -49,25 +49,14 @@ private: /** @brief terminate checking */ bool _terminate; - Settings(bool all); - public: Settings(); - Settings(const Settings &s); - const Settings &operator=(const Settings &s); - virtual ~Settings(); - - /** @brief Return test settings where inconclusive is true */ - static Settings testSettings() - { - return Settings(true); - } /** @brief Is --debug given? */ bool _debug; /** @brief Inconclusive checks - for debugging of Cppcheck */ - const bool inconclusive; + bool inconclusive; /** @brief Is --style given? */ bool _checkCodingStyle; diff --git a/test/testbufferoverrun.cpp b/test/testbufferoverrun.cpp index 34a60d435..5efc7b887 100644 --- a/test/testbufferoverrun.cpp +++ b/test/testbufferoverrun.cpp @@ -53,7 +53,8 @@ private: errout.str(""); // Check for buffer overruns.. - Settings settings(showAll ? Settings::testSettings() : Settings()); + Settings settings; + settings.inconclusive = showAll; settings._checkCodingStyle = true; CheckBufferOverrun checkBufferOverrun(&tokenizer, &settings, this); checkBufferOverrun.bufferOverrun(); diff --git a/test/testclass.cpp b/test/testclass.cpp index 692736589..61c3d7ac8 100644 --- a/test/testclass.cpp +++ b/test/testclass.cpp @@ -417,7 +417,8 @@ private: errout.str(""); // Check.. - Settings settings(Settings::testSettings()); + Settings settings; + settings.inconclusive = true; settings._checkCodingStyle = true; CheckClass checkClass(&tokenizer, &settings, this); checkClass.operatorEqToSelf(); @@ -1391,7 +1392,8 @@ private: errout.str(""); // Check.. - Settings settings(Settings::testSettings()); + Settings settings; + settings.inconclusive = true; CheckClass checkClass(&tokenizer, &settings, this); checkClass.constructors(); } @@ -2106,7 +2108,7 @@ private: errout.str(""); // Check.. - Settings settings(Settings::testSettings()); + Settings settings; settings._checkCodingStyle = true; CheckClass checkClass(&tokenizer, &settings, this); checkClass.thisSubtraction(); diff --git a/test/testconstructors.cpp b/test/testconstructors.cpp index 9ab050df3..706f9268f 100644 --- a/test/testconstructors.cpp +++ b/test/testconstructors.cpp @@ -46,7 +46,8 @@ private: errout.str(""); // Check class constructors.. - Settings settings(showAll ? Settings::testSettings() : Settings()); + Settings settings; + settings.inconclusive = showAll; settings._checkCodingStyle = true; CheckClass checkClass(&tokenizer, &settings, this); checkClass.constructors(); diff --git a/test/testdangerousfunctions.cpp b/test/testdangerousfunctions.cpp index 7456d5f57..d9d344ba6 100644 --- a/test/testdangerousfunctions.cpp +++ b/test/testdangerousfunctions.cpp @@ -53,7 +53,8 @@ private: errout.str(""); // Check for dangerous functions.. - Settings settings(Settings::testSettings()); + Settings settings; + settings.inconclusive = true; CheckDangerousFunctions checkDangerousFunctions(&tokenizer, &settings, this); checkDangerousFunctions.dangerousFunctions(); } diff --git a/test/testdivision.cpp b/test/testdivision.cpp index 1ba7b6911..a6fe278af 100644 --- a/test/testdivision.cpp +++ b/test/testdivision.cpp @@ -46,7 +46,8 @@ private: // Clear the error buffer.. errout.str(""); - Settings settings(all ? Settings::testSettings() : Settings()); + Settings settings; + settings.inconclusive = all; settings._checkCodingStyle = style; // Check for unsigned divisions.. diff --git a/test/testincompletestatement.cpp b/test/testincompletestatement.cpp index 27ef43b05..5421bb5a9 100644 --- a/test/testincompletestatement.cpp +++ b/test/testincompletestatement.cpp @@ -47,9 +47,8 @@ private: // Clear the error buffer.. errout.str(""); - Settings settings(Settings::testSettings()); - - // Check for unused variables.. + // Check for incomplete statements.. + Settings settings; CheckOther checkOther(&tokenizer, &settings, this); checkOther.checkIncompleteStatement(); } diff --git a/test/testmemleak.cpp b/test/testmemleak.cpp index 9870907a6..650badbbe 100644 --- a/test/testmemleak.cpp +++ b/test/testmemleak.cpp @@ -212,8 +212,8 @@ private: errout.str(""); // Check for memory leaks.. - Settings settings(showAll ? Settings::testSettings() : Settings()); - settings._debug = true; + Settings settings; + settings.inconclusive = showAll; tokenizer.fillFunctionList(); CheckMemoryLeakInFunction checkMemoryLeak(&tokenizer, &settings, this); checkMemoryLeak.check(); @@ -600,7 +600,8 @@ private: } } - Settings settings(all ? Settings::testSettings() : Settings()); + Settings settings; + settings.inconclusive = all; CheckMemoryLeakInFunction checkMemoryLeak(&tokenizer, &settings, NULL); all = false; checkMemoryLeak.simplifycode(tokens, all); @@ -2141,8 +2142,8 @@ private: errout.str(""); // Check for memory leaks.. - Settings settings(Settings::testSettings()); - settings._debug = true; + Settings settings; + settings.inconclusive = true; { std::istringstream istr(_autoDealloc); @@ -2712,8 +2713,8 @@ private: errout.str(""); // Check for memory leaks.. - Settings settings(showAll ? Settings::testSettings() : Settings()); - settings._debug = true; + Settings settings; + settings.inconclusive = true; tokenizer.fillFunctionList(); CheckMemoryLeakInClass checkMemoryLeak(&tokenizer, &settings, this); checkMemoryLeak.check(); diff --git a/test/testpreprocessor.cpp b/test/testpreprocessor.cpp index 2543e9db2..f481aec80 100644 --- a/test/testpreprocessor.cpp +++ b/test/testpreprocessor.cpp @@ -1060,8 +1060,8 @@ private: std::istringstream istr(filedata); std::map actual; Settings settings; - settings._verbose = true; settings._debug = true; + settings._verbose = true; Preprocessor preprocessor(&settings, this); preprocessor.preprocess(istr, actual, "file.c"); diff --git a/test/testsimplifytokens.cpp b/test/testsimplifytokens.cpp index 2a3b83ff0..f61f95919 100644 --- a/test/testsimplifytokens.cpp +++ b/test/testsimplifytokens.cpp @@ -3488,7 +3488,8 @@ private: void checkSimplifyTypedef(const char code[]) { // Tokenize.. - Settings settings(Settings::testSettings()); + Settings settings; + settings.inconclusive = true; settings._checkCodingStyle = true; Tokenizer tokenizer(&settings, this); std::istringstream istr(code); @@ -4255,7 +4256,8 @@ private: void checkSimplifyEnum(const char code[]) { // Tokenize.. - Settings settings(Settings::testSettings()); + Settings settings; + settings.inconclusive = true; settings._checkCodingStyle = true; Tokenizer tokenizer(&settings, this); std::istringstream istr(code); diff --git a/test/teststl.cpp b/test/teststl.cpp index ece91cfa9..07100b8f0 100644 --- a/test/teststl.cpp +++ b/test/teststl.cpp @@ -92,7 +92,8 @@ private: errout.str(""); // Check.. - Settings settings(Settings::testSettings()); + Settings settings; + settings.inconclusive = true; settings._checkCodingStyle = true; CheckStl checkStl; checkStl.runSimplifiedChecks(&tokenizer, &settings, this); diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index b7c941e44..bb7d631b0 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -3114,7 +3114,8 @@ private: void checkSimplifyInitVar(const char code[], bool simplify = false) { // Tokenize.. - Settings settings(Settings::testSettings()); + Settings settings; + settings.inconclusive = true; settings._checkCodingStyle = true; Tokenizer tokenizer(&settings, this); std::istringstream istr(code);