@@ -85,56 +85,6 @@ void CppCheck::replaceAll(std::string& code, const std::string &from, const std:
8585 }
8686}
8787
88- bool CppCheck::findError (std::string code, const char FileName[])
89- {
90- std::set<unsigned long long > checksums;
91- // First make sure that error occurs with the original code
92- bool internalErrorFound (false );
93- checkFile (code, FileName, checksums, internalErrorFound);
94- if (_errorList.empty ()) {
95- // Error does not occur with this code
96- return false ;
97- }
98-
99- const std::string previousCode = code;
100- std::string error = _errorList.front ();
101- for (;;) {
102-
103- // Try to remove included files from the source
104- const std::size_t found = previousCode.rfind (" \n #endfile" );
105- if (found == std::string::npos) {
106- // No modifications can be done to the code
107- } else {
108- // Modify code and re-check it to see if error
109- // is still there.
110- code = previousCode.substr (found+9 );
111- _errorList.clear ();
112- checksums.clear ();
113- checkFile (code, FileName, checksums, internalErrorFound);
114- }
115-
116- if (_errorList.empty ()) {
117- // Latest code didn't fail anymore. Fall back
118- // to previous code
119- code = previousCode;
120- } else {
121- error = _errorList.front ();
122- }
123-
124- // Add '\n' so that "\n#file" on first line would be found
125- code = " // " + error + " \n " + code;
126- replaceAll (code, " \n #file" , " \n // #file" );
127- replaceAll (code, " \n #endfile" , " \n // #endfile" );
128-
129- // We have reduced the code as much as we can. Print out
130- // the code and quit.
131- _errorLogger.reportOut (code);
132- break ;
133- }
134-
135- return true ;
136- }
137-
13888unsigned int CppCheck::processFile (const std::string& filename, std::istream& fileStream)
13989{
14090 exitcode = 0 ;
@@ -231,15 +181,9 @@ unsigned int CppCheck::processFile(const std::string& filename, std::istream& fi
231181
232182 codeWithoutCfg += _settings.append ();
233183
234- if (_settings.debugFalsePositive ) {
235- if (findError (codeWithoutCfg, filename.c_str ())) {
236- return exitcode;
237- }
238- } else {
239- if (!checkFile (codeWithoutCfg, filename.c_str (), checksums, internalErrorFound)) {
240- if (_settings.isEnabled (" information" ) && (_settings.debug || _settings._verbose ))
241- purgedConfigurationMessage (filename, cfg);
242- }
184+ if (!checkFile (codeWithoutCfg, filename.c_str (), checksums, internalErrorFound)) {
185+ if (_settings.isEnabled (" information" ) && (_settings.debug || _settings._verbose ))
186+ purgedConfigurationMessage (filename, cfg);
243187 }
244188 }
245189 } catch (const std::runtime_error &e) {
@@ -582,12 +526,6 @@ void CppCheck::reportErr(const ErrorLogger::ErrorMessage &msg)
582526 if (std::find (_errorList.begin (), _errorList.end (), errmsg) != _errorList.end ())
583527 return ;
584528
585- if (_settings.debugFalsePositive ) {
586- // Don't print out error
587- _errorList.push_back (errmsg);
588- return ;
589- }
590-
591529 std::string file;
592530 unsigned int line (0 );
593531 if (!msg._callStack .empty ()) {
0 commit comments