0

want to suppress all error checks in some file. My command line command is

cppcheck --enable=all -j 4 --output-file=out.txt --project=solution.sln --suppress=*:file.cpp

But I got errors from file.cpp in my output file. I used to have quite similar(as far as I recall) command line before and it suppress all checks in the file, but ,u some reason now it doesn't work now. Is my command line wrong?

I know can use suppression file, but I prefer command line parameter and also want to figure out what am I doing wrong.

Name
  • 37
  • 4
  • need to supply a relative path for file.cpp? If the errors in your output file have a relative path to file.cpp, use that same path in the `--suppress` argument. – yano Jul 12 '21 at 21:34

1 Answers1

0

The suppression needs to match the file path as shown in the result.

If you specify a relative folder/file to check that is straight forward and you can just use the structure from your current folder. But if you are checking with --project or an absolute path you need to specify -rp (as in "root path") to tell Cppcheck where to base the file paths from. In your case just adding -rp=. should fix the issue - at least it will change the paths in the result from absolute ones to relative ones which are the ones you have to use in your suppression.

Firewave
  • 336
  • 2
  • 11