Menu

Fails to suppress the syntaxError

Kamalpreet
2018-09-14
2018-09-17
  • Kamalpreet

    Kamalpreet - 2018-09-14

    Hi,
    I am trying to suppress the syntaxErrors in my files as they are C++/CL files and often syntaxError is reported for CL code.

    I used following argument to suppress syntaxError for entire code base but it is not suppressing all the syntaxErrors: tried all suppressions txt, command line and inline but no luck
    Inline :
    cppcheck src\folder --xml --force --inline-suppr 2>resultslocal11.xml
    In file:
    // cppcheck-suppress syntaxError

    Command Line:
    cppcheck src\folder --xml --force --suppress=syntaxError 2>resultslocal02.xml

    Results:
    It successfully suppresses the errors with following description:
    <error msg="syntax error" verbose="syntax error" id="syntaxError" severity="error"></error>

    but still throws the following syntaxErrors as bugs:

    <error msg="The code contains unhandled character(s) (character code=208). Neither unicode nor extended ascii is supported." verbose="The code contains unhandled character(s) (character code=208). Neither unicode nor extended ascii is supported." id="syntaxError" severity="error"></error>

     
  • versat

    versat - 2018-09-14

    What exactly do you mean with CL?
    Can you post a minimal example where you see this behaviour?

     
  • Kamalpreet

    Kamalpreet - 2018-09-15

    Sorry that was typo, I meant C++/CLI File/
    Also we figured out the issue atleast with the character that is causing this error. But main issue is why its not suppressing the error even though we have set up that rule.

    Attaching a sample file.

     
  • versat

    versat - 2018-09-17

    I can reproduce that the supression does not work in Cppcheck V1.84.
    With the latest development code (git head) it seems to be fixed:

    $ ./cppcheck --template=gcc sample.cpp
    Checking sample.cpp ...
    sample.cpp:3:0: warning: The code contains unhandled character(s) (character code=208). Neither unicode nor extended ascii is supported. [syntaxError]
    СWorkOffsetBase::СWorkOffsetBase(
    ^
    
    $ ./cppcheck  --suppress=syntaxError --template=gcc sample.cpp
    Checking sample.cpp ...
    

    Fixing this ticket could have fixed your issue too:
    https://trac.cppcheck.net/ticket/7792

    So with Cppcheck V1.85 (not yet released) the supression of syntaxError should work correctly for you.

     
  • Kamalpreet

    Kamalpreet - 2018-09-17

    Thanks for the fix, will wait for the new version !!

     

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.