PC-Lint v9.00i plugin for CodeWarrior S12(X) V5.1/ 5.9.0

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PC-Lint v9.00i plugin for CodeWarrior S12(X) V5.1/ 5.9.0

2,740 Views
ianlovatt
Contributor III

Dear all,

 

I'm trying to get the PC-lint plugin up and running for the above IDE (refers to itself as V5.1 in the start menu but under help-> about shows V5.9.0).

 

I have followed the instructions to setup lint and have run its demos sucessfully. I've created a new project in codewarrior with lint support and configured it according to the instructions in env-mw.lnt. Lint seems to have trouble picking up the warning supressions embedded in comment in hidef.h. See attached image of the output.

 

Lint is working as it finds genuine problems when i lint one of my own projects in addition to these warnings.

 

How do i configure Lint and/or the plugin so that it correctly ignores problems within the codewarrior library files?

 

Cheers,

ian

Labels (1)
Tags (1)
0 Kudos
4 Replies

959 Views
theo
NXP Employee
NXP Employee

Hello ian,

PC-lint is actually reporting different errors/warnings than those already suppressed in hidef.h (e.g. #95 - which is highlighted in the caption). The ones that are handled in hidef.h, via PC-lint specific comments, are not, in fact, reported. Take, for instance, message #961 (line 51 in file hidef.h). If you modify the lint comment used to suppress this message (simply insert a white space between '/*' and 'lint' so that PC-lint no longer recognizes the comment), you will notice that you also get message #961 on the next PC-lint run.

 

Error #95 is not handled in hidef.h because it is associated with a general exception to a MISRA rule (an exception which applies across the whole library, not just hidef.h). As such, the inhibition option for this error was specified in a PC-lint configuration file, rather than directly within the header file source code.

For details on error inhibition options, refer to section 5.2 in the PC-lint manual (Error Inhibition Options).

 

The PC-lint configuration files that were used for linting the HC(S)12 libraries are available in folder lib\hc12c\misra2004_lnt  in the CW layout:

- compiler-specific config file (co-cwhc12.lnt)

- general exceptions config file (lib-exceptions.lnt)

- project-specific config files, one per library project (e.g. config-c_mb_ieee_3232.lnt).

Error #95, for instance, is suppressed in file lib-exceptions.lnt:

/* inhibit PC-Lint error #95 (all occurences of this error across the library refer to object-like macros) */
-e95                       

The list of exceptions to MISRA rules across the HC(S)12 libraries is documented in Help\PDF\MISRA_2004_HC12_XGATE_lib__exceptions.pdf in the CW layout.

 

In order to suppress the PC-lint messages you are currently getting on the library code included in your project, you may either:

- use PC-lint comments to handle the message within the code

- put the error inhibition option in a configuration file (the name of which you must specify in the 'Additional Options' field of the 'PC-lint Options' panel).

Note that if you inhibit the error/warning in a configuration file, the message will be suppressed for the whole project - including your own source code. So, depending on the message, you may want to avoid that.

 

Regards,

theo

 

0 Kudos

960 Views
ianlovatt
Contributor III

I noticed that the errors were different too and was about to come back and apologises for the silly question when I noticed your reply.

Thanks for all the information. I tried using the .lnt files (co-mwhc12.lnt and lib-exceptions.lnt) in the misra folder in combination with the co-mwe_base.lnt that's in {Compiler}\Lint\lnt\CodeWarrior and have now got a clean project working. That means I now have 3 versions of co-mwhc12.lnt!:

One that came with Lint (looks oldest)

one from {Compiler}\Lint\lnt\CodeWarrior (very similar to Lint version but looks newer)

one from {Compiler}\lib\hc12c\misra2004_lnt (quite different to the other two and doesn’t reference co-mwe_base.lnt so I added that in)

 

There’s also two versions of co-mwe_base.lnt – one from Lint and one from from {Compiler}\Lint\lnt\CodeWarrior

 

Is there any other documentation from Freescale on configuring and using Lint via the plugin? It’s been a lot of trial and error and I’m surprised the correct set of files isn’t available that don’t need modifying before use. I’ve gone through the PC-lint manual but it doesn’t get too involved in IDE/editior integration.

We’re having to pay to upgrade our licence to pro so that we can use this plugin but it feels like I have to wire up the plug myself and then go and look for the missing pieces. Perhaps if you’re already an expert user of lint then you can second guess what it needs from the plugin settings but for us this is the first time we’ve used it.

As you suggest I think I will try to move away from using lib-exceptions so that lint will still find those errors in our source.

 

Cheers,

Ian

0 Kudos

960 Views
theo
NXP Employee
NXP Employee

You are right that the architecture-specific lnt file in {CWDIR}\Lint\lnt\CodeWarrior (i.e. co-mwhc12.lnt) is different from the architecture-specific file in {CWDIR}\lib\hc12c\misra2004_lnt (i.e. co-cwhc12.lnt). The reason we see this is because the latter was used for linting the HC(S)12 libraries and, therefore, it also contains inhibition options that only make sense for the library, e.g.:

/*
 * the following functions exhibit variable return modes
 * (that is, they may equally-usefully be called for a value
 * as called just for their effects); accordingly we inhibit
 * Warning 534 for these functions
 */
-esym(534,close,creat,fclose,fprintf,fputc)
A project that you create on your own will be linked against the library. It will not include library source code, except for hidef.h and, of course, the startup file.

As for the architecture-specific file that comes with PC-lint, well, you can ignore that one altogether.

 

Now, regarding the other question (on the so-called 'base' file), you are right to be confused. I did not mention this previously: the MISRA configuration file that was used when linting the libraries (along with the exception files in {CWDIR}\lib\hc12c\misra2004_lnt) is au-misra2.lnt (the MISRA-C:2004 configuration file that comes with PC-lint). I just did not go into all the details regarding the library - only mentioned the library-linting process in order to explain why some errors were suppressed in hidef.h and some were not.

 

In order to check your own code, you should use the target-specific file in {CWDIR}\Lint\lnt\CodeWarrior (co-mwhc12.lnt) along with the appropriate MISRA configuration file that is available with PC-lint, depending on what your goal is (for example, if you wish to check your code for compliance with MISRA-C:2004, you may use au-misra2.lnt). Refer to the PC-lint manual for information on the configuration files that it includes. Whatever lint messages you are getting that originate from hidef.h and/or the startup code, you should suppress them locally, in the respective file. For details on how to integrate PC-lint, refer to readme.txt in {CWDIR}\Lint\lnt\CodeWarrior. 

 

I hope this helps.

0 Kudos

960 Views
theo
NXP Employee
NXP Employee

One correction: of course you will also need to include lib header files (other than hidef.h) in your source code, but these header files do not generally contain any error suppresion comments.

0 Kudos