How to suppress specific cases of syntaxError with CppCheck

932 views Asked by At

I'm running CppCheck over some files containing CLI code. As the CLI portions of the file make use of '^)' characters, I'm trying to suppress the "false positive" syntaxError generated by CppCheck due to those characters.

Rather than using inline suppression commands, I have decided to create an XML suppression file to achieve my purpose.

Here is a snippet of the suppression file.

<?xml version="1.0"?> 
<suppressions>
    <suppress>
        <id>syntaxError</id> 
        <fileName>src/file1.c</fileName>
        <symbolName>^)</symbolName>
    </suppress>
        ...
</suppressions>

This is based off example shown by the CppCheck manual

<?xml version="1.0"?> 
<suppressions>
    <suppress>
       <id>uninitvar</id> 
       <fileName>src/file1.c</fileName>         
<      <lineNumber>10</lineNumber>      
       <symbolName>var</symbolName>
    </suppress>
</suppressions>

As you can see, I am trying to use the symbolName field to specify that all syntaxError due to ^) should be suppressed.

However, my suppression currently does not suppress any syntaxErrors.

0

There are 0 answers