Skip to content

MISRA checking without an analysis of library headers

If you look in the MISRA author files:
  • au-misra1.lnt
  • au-misra2.lnt
  • au-misra3.lnt
  • au-misra-cpp.lnt
... you will find that they explicitly enable message output for library headers.  For example, in au-misra3.lnt, you'll see this entry for rule 4.9:
/**** Dir 4.9 (Adv) ************/

    +e9026               /* function-like macro defined */
    -append(9026,[MISRA 2012 Directive 4.9, advisory])
Here, the relevant option is +elib(9026): it requests output of message 9026 against function-like macro definions that appear inside library headers.

This is explicitly set because the Motor Industry Software Reliability Association (MISRA) standards generally assume that developers have control over the content of the Standard Library implementation and system library implementation for the target system (which, in the automotive industry, is common), and therefore require developers to analyze and correct the content of their libraries where necessary.

If your arrangement differs (for example, if it is not your intention to compile your own version of the Standard & system libraries), then you can explicitly disable message output for library code.  One way to do this is to use the -wlib() option to toggle the warning level and thus "wipe" the message suppression state for library regions; this must be done after the reference to the MISRA author file.  Example:
au-misra3.lnt // enables Elective Notes for library code
-wlib(4)      // raises the warning level 
-wlib(1)      // lowers the warning level (and disables messages)
Note also the options that control whether Lint regards a header as a "library" header; see chapter 6 ("Libraries") in the Lint manual.

Feedback and Knowledge Base