Search code examples
clintiarpc-lint

IAR EWARM PC-LINT Inhibiting messages from a header included with the -header option


I am using IAR EWARM 7.4

I have followed the instructions here: http://www.safetycritical.info/library/static/pc-lint/ewb-pclint-v2.pdf

I have created a header full of compiler definitions using the --predef_macros compiler option

--predef_macros C:\lint\lnt\iar-ewarm-predefined_macros_for_PC-lint.h

In iar-co-arm-v6.lnt I've added the following:

//
//    EWARM extended defines
//
-header(C:/lint/lnt/iar-ewarm-predefined_macros_for_PC-lint.h)

Lint it gryping about a ton of MISRA violations from within that file.

Edit: I tried adding the line

+libh(C:/lint/lnt/iar-ewarm-predefined_macros_for_PC-lint.h)

This cuts down on many of many of the MISRA violations, but I am still getting a few, e.g:

#define __CODE_MEMORY_LIST1__() __CODE_MEM_HELPER1__(__code, 0)
        ^
"LINT: C:\lint\lnt\iar-ewarm-predefined_macros_for_PC-lint.h (150, 9) Note 9026: Function-like macro, '__CODE_MEMORY_LIST1__', defined [MISRA 2012 
Directive 4.9, advisory]"

#define __CODE_MEMORY_LIST2__(_P1) __CODE_MEM_HELPER2__(__code, 0, _P1)
        ^
"LINT: C:\lint\lnt\iar-ewarm-predefined_macros_for_PC-lint.h (151, 9) Note 9026: Function-like macro, '__CODE_MEMORY_LIST2__', defined [MISRA 2012 
Directive 4.9, advisory]"

Solution

  • All of these messages were being explicitly turned on using the +elib() argument in the au-misra3.lnt file. That is why they were not being enabled by default.

    Also, it did not work when I used -elib() to suppress them because when I included the au-misra3.lnt file they were reenabled.

    So the answer is, include the au-misra3.lnt file and then manually suppress all of the messages I don't care to see about library files because that's more transparent then modifying the file that ships with lint or supplying my own file for MISRA.