Menu

Ignore Header Files code for external libraries

2025-02-22
2025-02-24
  • Sven Wienand

    Sven Wienand - 2025-02-22

    Hallo,

    is there any way to "ignore" specific header files by a path without causing "missingInclude" Error or the "misra-c2012-17.3" implicit function call Error?

    The problem is that we build embedded software and there is access to the HAL Layer Libraries source code but we want to take it "As Is" and don't want to check this code (because we don't want to change it) with cppcheck or Misra. But even if we don't check the c files explicitly by including the header files we introduce external source code and some inline functions which sadly already have many cppcheck errors.

    So the current approach is that we have a folder where the code which we control is placed. Lets say it is "project/src" and HAL code from the processor supplier is located out of this folder lets say in "project/hal".

    now we run cppcheck on project/src and misra.py also on project/src, without specifing -I project/hal

    As cppcheck can not find the include file we get "missingInclude", i got around that with duck tape by saying please use "<somehalfile.h>" if you include a external library function and i ignore all missingIncludeSystem errors globally. This i can justify as the code needs to compile anyway and if there where missing includes it wouldn't build.</somehalfile.h>

    But then Misra complains about the implicit function call as it couldn't map the function called to a function prototype.

    I think the problem might be rather general and more people would have similar problems of not wanting to check other peoples code (especially if it is a Processor HAL Layer), so maybe there is already a solution which i overlooked?

     
  • Oliver Stöneberg

    I think this might be covered by https://trac.cppcheck.net/ticket/12359.

     
    • Sven Wienand

      Sven Wienand - 2025-02-24

      thanks yes that would be the solution. If it propagates to the mista checks too, which might not be the case or is dependent on implementation.

       

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.