diff --git a/cli/cmdlineparser.cpp b/cli/cmdlineparser.cpp index e0b59d0ac..83501ef97 100644 --- a/cli/cmdlineparser.cpp +++ b/cli/cmdlineparser.cpp @@ -132,10 +132,6 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) else if (std::strcmp(argv[i], "--debug-warnings") == 0) _settings->debugwarnings = true; - // Print out code that triggers false positive - else if (std::strcmp(argv[i], "--debug-fp") == 0) - _settings->debugFalsePositive = true; - // dump cppcheck data else if (std::strcmp(argv[i], "--dump") == 0) _settings->dump = true; diff --git a/lib/cppcheck.cpp b/lib/cppcheck.cpp index d6f2e4f5c..84d38b494 100644 --- a/lib/cppcheck.cpp +++ b/lib/cppcheck.cpp @@ -85,56 +85,6 @@ void CppCheck::replaceAll(std::string& code, const std::string &from, const std: } } -bool CppCheck::findError(std::string code, const char FileName[]) -{ - std::set checksums; - // First make sure that error occurs with the original code - bool internalErrorFound(false); - checkFile(code, FileName, checksums, internalErrorFound); - if (_errorList.empty()) { - // Error does not occur with this code - return false; - } - - const std::string previousCode = code; - std::string error = _errorList.front(); - for (;;) { - - // Try to remove included files from the source - const std::size_t found = previousCode.rfind("\n#endfile"); - if (found == std::string::npos) { - // No modifications can be done to the code - } else { - // Modify code and re-check it to see if error - // is still there. - code = previousCode.substr(found+9); - _errorList.clear(); - checksums.clear(); - checkFile(code, FileName, checksums, internalErrorFound); - } - - if (_errorList.empty()) { - // Latest code didn't fail anymore. Fall back - // to previous code - code = previousCode; - } else { - error = _errorList.front(); - } - - // Add '\n' so that "\n#file" on first line would be found - code = "// " + error + "\n" + code; - replaceAll(code, "\n#file", "\n// #file"); - replaceAll(code, "\n#endfile", "\n// #endfile"); - - // We have reduced the code as much as we can. Print out - // the code and quit. - _errorLogger.reportOut(code); - break; - } - - return true; -} - unsigned int CppCheck::processFile(const std::string& filename, std::istream& fileStream) { exitcode = 0; @@ -231,15 +181,9 @@ unsigned int CppCheck::processFile(const std::string& filename, std::istream& fi codeWithoutCfg += _settings.append(); - if (_settings.debugFalsePositive) { - if (findError(codeWithoutCfg, filename.c_str())) { - return exitcode; - } - } else { - if (!checkFile(codeWithoutCfg, filename.c_str(), checksums, internalErrorFound)) { - if (_settings.isEnabled("information") && (_settings.debug || _settings._verbose)) - purgedConfigurationMessage(filename, cfg); - } + if (!checkFile(codeWithoutCfg, filename.c_str(), checksums, internalErrorFound)) { + if (_settings.isEnabled("information") && (_settings.debug || _settings._verbose)) + purgedConfigurationMessage(filename, cfg); } } } catch (const std::runtime_error &e) { @@ -582,12 +526,6 @@ void CppCheck::reportErr(const ErrorLogger::ErrorMessage &msg) if (std::find(_errorList.begin(), _errorList.end(), errmsg) != _errorList.end()) return; - if (_settings.debugFalsePositive) { - // Don't print out error - _errorList.push_back(errmsg); - return; - } - std::string file; unsigned int line(0); if (!msg._callStack.empty()) { diff --git a/lib/cppcheck.h b/lib/cppcheck.h index 375f856cb..6cebeac7f 100644 --- a/lib/cppcheck.h +++ b/lib/cppcheck.h @@ -177,13 +177,6 @@ private: */ virtual void reportOut(const std::string &outmsg); - /** - * @brief Check given code. If error is found, return true - * and print out source of the file. Try to reduce the code - * while still showing the error. - */ - bool findError(std::string code, const char FileName[]); - /** * @brief Replace "from" strings with "to" strings in "code" * and return it. diff --git a/lib/settings.cpp b/lib/settings.cpp index e2c711288..000cb3767 100644 --- a/lib/settings.cpp +++ b/lib/settings.cpp @@ -28,7 +28,6 @@ Settings::Settings() debug(false), debugnormal(false), debugwarnings(false), - debugFalsePositive(false), dump(false), exceptionHandling(false), inconclusive(false), diff --git a/lib/settings.h b/lib/settings.h index 9ef59efd4..9d82bbef5 100644 --- a/lib/settings.h +++ b/lib/settings.h @@ -64,9 +64,6 @@ public: /** @brief Is --debug-warnings given? */ bool debugwarnings; - /** @brief Is --debug-fp given? */ - bool debugFalsePositive; - /** @brief Is --dump given? */ bool dump;