Opened 4 weeks ago

Closed 4 weeks ago

#14936 closed defect (fixed)

Suppressions in project file do not work in combination with --suppress arguments

Reported by: davidramnero Owned by: noone
Priority: Normal Milestone: 2.22
Component: Other Version:
Keywords: Cc:

Description

If you have a .cppcheck project file with suppressions specified these seem to be ignored if you call cppcheck with --suppress="warningType" arguments in your command.

Change History (3)

comment:1 by ludviggunne, 4 weeks ago

I can't reproduce this.

tmp/project.cppcheck:

<?xml version="1.0" encoding="UTF-8"?>
<project version="1">
    <root name="."/>
    <suppressions>
        <suppression fileName="main.c">uninitvar</suppression>
    </suppressions>
    <paths>
        <dir name="."/>
    </paths>
</project>

tmp/main.c:

[[maybe_unused]]
int f()
{
        int x;
        return x;
}

No warnings with this command:

$ ./cppcheck --suppress=ctunullpointerOutOfMemory --project=tmp/project.cppcheck

comment:2 by ludviggunne, 4 weeks ago

Adding the same suppression twice produces an error, but that error is never handled in importCppcheckGuiProject (there's a TODO). It seems like it would be useful to add additional suppressions on the command line though, maybe we should allow it in conjunction with project files?

comment:3 by ludviggunne, 4 weeks ago

Milestone: 2.22
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.