0

When I run PC-Lint on my code on IAR Workbench it conflicts with a code snippet present in library header file yvals.h which I am including below and then PC-Lint stops working.

/* IAR compiler version check */
#if (__IAR_SYSTEMS_ICC__ < 9) || (__IAR_SYSTEMS_ICC__ > 9)
  #error "DLib compiled with wrong (version of IAR) compiler"
#endif

The version of IAR compiler that I am using is co-iar.lnt. I chose this compiler version from PC-Lint config file.

Blue
  • 820
  • 4
  • 17
Utkarsh
  • 31
  • 5

1 Answers1

0

The IAR compiler internally defines various preprocessor symbols (like __IAR_SYTEMS_ICC) which are not known by PC-Lint in your setup. Fortunately you can instruct the IAR compiler to generate a file with all theses symbols using the command line option --predef_macros iar_symbols.h. You can add this option in any Embedded Workbench project under Project > Options > Compiler > Extra Options. Once you compile your project the file iar_symbols.h is generated. Afterwards you can remove the --predef_macros option from your project again.

Now you need to instruct PC-Lint to read the generated file by adding the option -header(iar_symbols.h) to your PC-Lint command line. This should resolve your issue.

Note that the list of pre-defined symbols depends on the compiler version used. If you use different IAR compiler versions for different projects you should generate one iar_symbols.h header for each compiler version.

Blue
  • 820
  • 4
  • 17