Menu

Cppcheck not reporting error when many preprocessor configs present

Krishna
2021-11-15
2021-11-27
  • Krishna

    Krishna - 2021-11-15

    We are using cppcheck 2.4.1v. We have a header file in that there are many configurations(#ifdef) based on compiler specific flags(GNUC for GCC toolchain and ICCARM for IAR toolchain).
    We are passing these compiler(GNUC or ICCARM) defines using --library option.
    What we are seeing is one of the source file with IAR flag, errors are not reporting whereas for GCC it is reporting. But when we use --force option we are able to see those errors with IAR as well.
    I'm not sure what --force does, it is becase of the levels?
    We don't want to use --force as project contains many source files and it will increase execution time, hence we want to know what --force option is doing to expose these errors?

    FYI, We are using --project=compile_commands.json and invoking it using command line. compile_commands.json is similar for both GCC & IAR except toolchain.

     

    Last edit: Krishna 2021-11-22
  • Daniel Marjamäki

    What build system do you use? I wonder if you would see better results when using --project.

     
  • Krishna

    Krishna - 2021-11-15

    Hi Daniel,

    We already using --project with compile database file.

    Thanks

     
  • Krishna

    Krishna - 2021-11-19

    Hi @danielmarjamaki,
    Any further suggestions is very helpful.

    Thanks.

     
  • Daniel Marjamäki

    It would be interesting to see some faked/obfuscated code. But I guess it's not possible.

    I would assume that the compile database only contains the defines for GCC not for IAR? Therefore Cppcheck does not find the IAR bugs.

    Then somehow it would be good if you could import the IAR build with --project also. Do you use IAR workbench? Then if we solve this ticket it would help you: https://trac.cppcheck.net/ticket/10428
    I can't promise that it will be fixed anytime soon unfortunately.

     
    • Krishna

      Krishna - 2021-11-22

      Hi @danielmarjamaki,
      We are not using with IAR workbench.
      Updated question, please go through and respond.

      Thanks.

       

      Last edit: Krishna 2021-11-26
      • Daniel Marjamäki

        sorry.. I think it's very hard to help without seeing any code etc whatsoever.

         

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.