Menu

Suppressions and plist files

2021-08-03
2021-08-16
  • Tofik Sonono

    Tofik Sonono - 2021-08-03

    Hi,

    I'm running cppcheck with a compile_commands file, a couple of suppressions and plist output (for usage with ericsson codechecker). The problem I'm experiencing is that plist entries are generated for the findings that are suppressed, even though that the suppressed findings are not displayed in the cli output. Am I missing something, or is this expected behavior / bug?

    cppcheck -i$(pwd)/external --project=build/compile_commands.json --enable=all plist-output=./reports --suppress=objectIndex --addon=misra.py --suppress=unusedFunction --suppress=misra-c2012-15.5 --suppress=unmatchedSuppression
    

    Best regards,
    Tofik

     

    Last edit: Tofik Sonono 2021-08-04
  • Daniel Marjamäki

    Sorry for delayed reply. I do not think it is by intention. Sounds like a bug.

     
  • Daniel Marjamäki

    hmm.. I fail to reproduce. What cppcheck version do you have.

    I tried this in cppcheck repo:

    ./cppcheck --project=build/compile_commands.json --enable=style --suppress=missingOverride --plist-output=1 --file-filter="*tinyxml*"
    

    If I remove the --suppress=missingOverride then the plist file contains lots of those warnings.

    Is it misra warnings that are not suppressed or the "core" cppcheck warnings also?

     
  • Tofik Sonono

    Tofik Sonono - 2021-08-08

    Hi again, thanks for the reply. I'm using cppcheck 2.5 from Fedora dnf repos. In my case, it's actually both the misra and core warnings which I have suppressed that still show up in the plist files.

     
  • Daniel Marjamäki

    Not sure what to ask. It would help with some reduced example that reproduces the problem..
    can you reproduce if you check a single file.. and can the file be reduced somehow.

     
  • Tofik Sonono

    Tofik Sonono - 2021-08-14

    Yes sorry, I was short on time. I did some more investigating and it seems like the suppressed errors that I'm getting are actually from the directories I've ignored. As you can see on the command I ran from my initial post, it includes -i$(pwd)/external. However, I'm still getting errors from my external directories. I figured this was due to using ignore (-i) option combined with --project which then in turn will make cppcheck not respect the paths you want to ignore. But now I'm noticing that all my errors which are of the suppressed type, are also from the external directories. It seems like cppcheck is in fact suppressing some of my false positives, but not on the path that I want to ignore.

    To summurize:
    - This might be a bug or not, but the -i option does not seem to ignore paths when combining with a compile_commands.json project (I tried both with and without pwd in the ignore path)
    - Supressed errors are showing up for the "ignored" paths but not on the paths which are not ignored (in conjunction with a compile_commands.json project file)

     

    Last edit: Tofik Sonono 2021-08-14
    • Daniel Marjamäki

      The behavior has changed a little bit.

      Output with cppcheck-2.4:

      danielm@debian:~/cppcheck$ ../.cppcheck/cppcheck-2.4 --project=build/compile_commands.json
      Checking /home/danielm/cppcheck/externals/tinyxml2/tinyxml2.cpp ...
      Checking /home/danielm/cppcheck/externals/tinyxml2/tinyxml2.cpp: FILESDIR="/usr/local/share/Cppcheck";_GLIBCXX_DEBUG=1;__cplusplus=201103L...
      1/71 files checked 1% done
      
      ../.cppcheck/cppcheck-2.4 --project=build/compile_commands.json -i$(pwd)/external
      Checking /home/danielm/cppcheck/lib/analyzerinfo.cpp ...
      Checking /home/danielm/cppcheck/lib/analyzerinfo.cpp: FILESDIR="/usr/local/share/Cppcheck";_GLIBCXX_DEBUG=1;__cplusplus=201103L...
      1/68 files checked 1% done
      

      Output with cppcheck-2.5:

      danielm@debian:~/cppcheck$ ../.cppcheck/cppcheck-2.5 --project=build/compile_commands.json
      Checking externals/tinyxml2/tinyxml2.cpp ...
      Checking externals/tinyxml2/tinyxml2.cpp: FILESDIR="/usr/local/share/Cppcheck";_GLIBCXX_DEBUG=1;__cplusplus=201103L...
      1/71 files checked 1% done
      
      danielm@debian:~/cppcheck$ ../.cppcheck/cppcheck-2.5 --project=build/compile_commands.json -iexternals
      Checking lib/analyzerinfo.cpp ...
      Checking lib/analyzerinfo.cpp: FILESDIR="/usr/local/share/Cppcheck";_GLIBCXX_DEBUG=1;__cplusplus=201103L...
      1/68 files checked 1% done
      

      With cppcheck-2.5 you should ignore the relative path.

       
  • Tofik Sonono

    Tofik Sonono - 2021-08-16

    Thanks for your that, that did indeed remove all the errors from the ignored paths, and no more suppressed errors appear as well. Everything seems to work now.

    I did however notice that suppression do still appear when running cppcheck in multithreaded mode, e.g when I run the command I posted in my initial post in multithreaded (without pwd and adding -j12 or -j2) will still generate suppressed errors (not in ignored paths). Just wanted to bring that to light.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.