0

I've got a question towards PC-Lint and its configuration file. At that file, I start with the following:

// --- Rules --------------------------------------------------------------------------------------

// warning policy
au-misra3.lnt                    // (MISRA C 2012 (TM) - 6/12/14)
au-misra-cpp-alt.lnt             // (MISRA C++ 2008 using 9000 level messages - 6/12/14)

The project is mixed-up with .c and .cpp files. How can I tell PC-Lint only to use the C-Policy on C-Files and the CPP-Policy on CPP-Files?

Thanks in advance!

Pierre Begon
  • 166
  • 13

2 Answers2

1

That is an interesting question. If you are doing unit checks (option -u) you can of course set up your build environment to use different option files for different source files. But otherwise I think this should work:

-save
au-misra3.lnt
[list of C files]
-restore

au-misra-cpp-alt.lnt
[list of C++ files]
Lars Ljung
  • 375
  • 2
  • 6
  • As easy as to this. See other comment for further infos. This solution lacks the effort for large blown up project. However, it works. – Pierre Begon Apr 08 '15 at 13:49
0

Another idea is to use -header(lintoptions.h) to include your lint options. The include file could be something like this:

//lint -restore_at_end
#ifdef __cplusplus
//lint -indirect(au-misra-cpp-alt.lnt)
#else
//lint -indirect(au-misra3.lnt)
#endif

Let us know if any of this works.

Lars Ljung
  • 375
  • 2
  • 6
  • For me, this option is not working. As I have integrated this into the Jenkins Plugin, I am not sure whether my settings are correct. Nevertheless an approach I will investigate later. – Pierre Begon Apr 08 '15 at 13:48