Suppressions; Fixed problem with cppcheck build dir is used
This commit is contained in:
parent
118ad67645
commit
7dbca470f7
|
@ -1401,6 +1401,8 @@ void CppCheck::reportErr(const ErrorMessage &msg)
|
|||
if (std::find(mErrorList.begin(), mErrorList.end(), errmsg) != mErrorList.end())
|
||||
return;
|
||||
|
||||
mAnalyzerInformation.reportErr(msg, mSettings.verbose);
|
||||
|
||||
const Suppressions::ErrorMessage errorMessage = msg.toSuppressionsErrorMessage();
|
||||
|
||||
if (mUseGlobalSuppressions) {
|
||||
|
@ -1422,7 +1424,6 @@ void CppCheck::reportErr(const ErrorMessage &msg)
|
|||
mErrorList.push_back(errmsg);
|
||||
|
||||
mErrorLogger.reportErr(msg);
|
||||
mAnalyzerInformation.reportErr(msg, mSettings.verbose);
|
||||
if (!mSettings.plistOutput.empty() && plistFile.is_open()) {
|
||||
plistFile << ErrorLogger::plistData(msg);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
int main() {
|
||||
// cppcheck-suppress unreadVariable
|
||||
int i = 0;
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
import json
|
||||
import os
|
||||
import tempfile
|
||||
from testutils import cppcheck
|
||||
|
||||
def create_unused_function_compile_commands():
|
||||
|
@ -56,3 +57,18 @@ def test_compile_commands_unused_function_suppression():
|
|||
ret, stdout, stderr = cppcheck(['--enable=all', '--inline-suppr', '--error-exitcode=1', '--project=./proj-inline-suppress-unusedFunction/compile_commands.json'])
|
||||
assert ret == 0, stdout
|
||||
assert 'unusedFunction' not in stderr
|
||||
|
||||
|
||||
def test_build_dir():
|
||||
with tempfile.TemporaryDirectory() as tempdir:
|
||||
args = f'--cppcheck-build-dir={tempdir} --enable=all --inline-suppr proj-inline-suppress/4.c'.split()
|
||||
|
||||
ret, stdout, stderr = cppcheck(args)
|
||||
assert ret == 0, stdout
|
||||
assert len(stderr) == 0
|
||||
|
||||
ret, stdout, stderr = cppcheck(args)
|
||||
assert ret == 0, stdout
|
||||
assert len(stderr) == 0
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue