Menu

Suppression does not work

2025-02-17
2025-02-25
  • Mikael Heden

    Mikael Heden - 2025-02-17

    Hi,

    I have a suppression-list file and it is working fine. However, sometimes the suppression doesn't kick in for some reason.

    Here is an example:

    Snip from xml output file:

            <error id="misra-c2012-5.6" severity="style" msg="A typedef name shall be a unique identifier" verbose="A typedef name shall be a unique identifier">
                <location file="lib\src\Misc\Typedef.c" line="44" column="5"/>
            </error>
            <error id="misra-c2012-5.6" severity="style" msg="A typedef name shall be a unique identifier" verbose="A typedef name shall be a unique identifier">
                <location file="lib\src\Misc\Typedef.c" line="43" column="5"/>
            </error>
            <error id="misra-c2012-5.6" severity="style" msg="A typedef name shall be a unique identifier" verbose="A typedef name shall be a unique identifier">
                <location file="lib\src\Misc\Typedef.c" line="57" column="5"/>
            </error>
            <error id="misra-c2012-5.6" severity="style" msg="A typedef name shall be a unique identifier" verbose="A typedef name shall be a unique identifier">
                <location file="lib\src\Misc\Typedef.c" line="50" column="5"/>
            </error>
    

    Add suppression to the misra-suppression.txt file:

    misra-c2012-5.6:lib/src/Misc/Typedef.c
    

    The violations from the xml output disappeared (as expected) but I get this error instead:

            <error id="unmatchedSuppression" severity="information" msg="Unmatched suppression: misra-c2012-5.6" verbose="Unmatched suppression: misra-c2012-5.6">
                <location file="lib\src\Misc\Typedef.c" line="0" column="0"/>
            </error>
    

    Here is the commandline:

        -$(Q)$(CPPCHECK) \
            --project=$< \
            --check-level=exhaustive \
            -j $(NUMBER_OF_PROCESSORS) \
            --output-file=$@ \
            --cppcheck-build-dir=$(OUT)/cppcheck \
            --addon=lib/tools/cppcheck-misra.json \
            --addon-python=%PYTHON% \
            --std=c99 \
            $(CPPCHECK_EXTRA_ARGS) \
            --enable=all \
            --suppress=unusedFunction \
            --suppressions-list=misra-suppressions.txt \
            --checkers-report=$(OUT)/cppcheck-checkers.txt \
            -q \
            --xml
    

    cppcheck 2.16

    Does anyone have any ideas on why this occur?

     

    Last edit: Mikael Heden 2025-02-17
  • Oliver Stöneberg

    unmatchedSuppression is currently broken in many ways. I will take a look after https://github.com/danmar/cppcheck/pull/5647 has been merged.

     
    👍
    1
  • Oliver Stöneberg

    Will be a bit longer until I look into this issue. I am currently focused on finally dogfooding unmatched suppressions.

     

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.