Menu

3rd party include file warning suppression suppresses my code warnings too

thomas
2020-03-17
2020-03-25
  • thomas

    thomas - 2020-03-17

    I want to suppress error/warnings from a 3rd party library header. It seems like this is possible to do from what I have read online. I do so using the following in my project file:

    <suppressions>
    <suppression filename="*\include\ThirdParty\*">uninitMemberVar</suppression>
    </suppressions>

    I run this using:

    "c:\Program Files\Cppcheck\cppcheck.exe" --enable=all --std=c++03 --project=MyProj.cppcheck myFile.cpp

    This works in suppressing the uninitMemberVar warning in my 3rd party header file. However it supresses the same warning in my code as well.

    myFile.cpp

    include "myFile.h"

    ...

    myFile.h

    include "ThirdParty/header.h"

    ...

    Without the suppression above, I get:

    ...\ThirdParty\header.h:705:5: warning: Member variable 'XXX' is not initialized in the constructor. [uninitMemberVar]

    myFile.h:184:5: warning: Member variable 'YYY' is not initialized in the constructor. [uninitMemberVar]

    With the suppression, I expect to get the second warning but not the first. However I get neither.

    Is this expected? Am I doing something wrong?

     
  • thomas

    thomas - 2020-03-24

    This is still an issue for me. Anyone have any idea why suppression specified to third party header file also applies to my code file.

     
  • Robert Lind

    Robert Lind - 2020-03-25

    I had the same issue with suppressions in projectfiles. I've ended up writing some scripts to parse the suppression out of the .cppcheck file and into a seperate suppression.xml. In the gui the .cppcheck file with suppressions seem to work fine

     

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.