Skip to content

Commit 1f16e72

Browse files
committed
Removed --debug-fp. The reduce tool should be used instead.
1 parent 932f6ea commit 1f16e72

5 files changed

Lines changed: 3 additions & 80 deletions

File tree

cli/cmdlineparser.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,6 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[])
132132
else if (std::strcmp(argv[i], "--debug-warnings") == 0)
133133
_settings->debugwarnings = true;
134134

135-
// Print out code that triggers false positive
136-
else if (std::strcmp(argv[i], "--debug-fp") == 0)
137-
_settings->debugFalsePositive = true;
138-
139135
// dump cppcheck data
140136
else if (std::strcmp(argv[i], "--dump") == 0)
141137
_settings->dump = true;

lib/cppcheck.cpp

Lines changed: 3 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -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-
13888
unsigned 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()) {

lib/cppcheck.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,6 @@ class CPPCHECKLIB CppCheck : ErrorLogger {
177177
*/
178178
virtual void reportOut(const std::string &outmsg);
179179

180-
/**
181-
* @brief Check given code. If error is found, return true
182-
* and print out source of the file. Try to reduce the code
183-
* while still showing the error.
184-
*/
185-
bool findError(std::string code, const char FileName[]);
186-
187180
/**
188181
* @brief Replace "from" strings with "to" strings in "code"
189182
* and return it.

lib/settings.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ Settings::Settings()
2828
debug(false),
2929
debugnormal(false),
3030
debugwarnings(false),
31-
debugFalsePositive(false),
3231
dump(false),
3332
exceptionHandling(false),
3433
inconclusive(false),

lib/settings.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ class CPPCHECKLIB Settings {
6464
/** @brief Is --debug-warnings given? */
6565
bool debugwarnings;
6666

67-
/** @brief Is --debug-fp given? */
68-
bool debugFalsePositive;
69-
7067
/** @brief Is --dump given? */
7168
bool dump;
7269

0 commit comments

Comments
 (0)