This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

pc-lint: issues with uvision4

Hi,

I just start learning to use pc-lint. During configuring the pc-lint in Keil uVision4 IDE, I met some small issues and figured out the workaround myself.

For these issues I feel like they should be improved by Keil in the future uVision IDE versions. But I am not sure if or not I should give the feedbacks directly to Keil technical supports, so I post it in the forum.

Btw, I am using:
- PC-lint v9.00h
- Keil uVision 4.00a

(I am using C166 toolchain, but i guess it should be the same for the other toolchains because it is uVision related.)

(I am also aware that my Keil uVision is a bit old. Maybe the issues I am mentioning below are already fixed. But I cannot find anywhere a release information of the uVision IDE itself.)

---------------------

Keil does provide instructions about how to configure pc-lint with uVision. It is in the Help file and online manual: www.keil.com/.../uv4_ut_running_pc_lint.htm

At beginning I followed the instructions, but then I met some issues:

(1) incorrect file names

For some wrap-up messages reported by pc-lint, the Keil uses a temporary file name like:
C:\Docume~1\user_account\Locals~1\Temp\Uv3__14.lnt instead of the correct file name.
This is even showed in the official Help file, see the 2nd picture of the link i give above.

Double click the line will not open the file but saying the file doesn't exist.

I feel like Keil will first run pc-lint and dump all messages into this temp file, and then copy them back to Keil IDE "Build Output" window after reorganize them. The temp file is deleted at the end, so it doesn't exist anymore.

The reason of the issue is probably because the wrap-up message reported by pc-lint doesn't have a file name at the beginning. So Keil failed to analyze it out.

A solution I found is to modify the pc-lint message presentation options.

Keil says we should use:

-hsb_3 // 3 lines output, column below
-format="*** LINT: %(%f(%l) %)%t %n: %m" // Change message output format
-width(0,10) // Don't break lines

In fact, according to pc-lint's user manual Chapter 5.6.1, the -h option has many other flags:
-h[s/S][F][f][a][b][r]...[I]N

Turning on "F" (or "f") will force to provide file names always with the messages.
So if changing the line "-hsb_3" to "-hsFb_3" it will correct those nonexisting Temp\Uv3__14.lnt files in Keil. But on the other hand, when doing this, sometimes the global wrap-up file names are showed twice. So it seems Keil should improve its way of reading pc-lint's output messages.

(2) Keil doesn't clear Build Output window before lint

When compiling or building a project, Keil will clear the Build Output window before start. But when doing pc-lint, the window is not cleared.

This is annoying to me cuz pc-lint is normally giving lots of messages, without clearing the Build Output window make it worse. Of course we can clear the window manually, but still it takes some extra clicks.

(3) There is no shortcut for pc-lint

So if starting the pc-lint from keyboard, it will be <ALT>+T+A for all files. There is not a single button for lint all source files.

----------------------

At the end I realize another alternative method, which I feel is much better to use pc-lint with Keil IDE this way, that we can use the pc-lint as a user program before building a project.

This is configured in the Target Options -> User (tab).
Also described here: http://www.keil.com/support/man/docs/uv4/uv4_dg_user.htm

Simply make a pc_lint.bat file and put it as a user program before building the project. In this way:
- All pc-lint output will be rediected to Build Output window as its original look, Keil won't modify it.
- The Build Output window is auto cleared everytime before build a project.
- A button (F7) can be used to start.
- And we are free to setup PC-lint message presentation as we want. I use this settings:

-hSrb^3 // 3-line style, "^" as indicator below the source line
-width(0,0) // no line break
-format=%(%f(%l,%C)\s%)%t\s%n:\s%m

Some notes about settings:
1. S or s flag is not needed cuz Keil does not allow empty line anyway, but in other programs like cmd, with empty line looks better
2. When setup pc-lint via Tools->Setup PC-Lint, indicator "_" is a must cuz that is how Keil finds out the column number. Keil inserts column number automatically after the line number
3. "*** LINT: xxxx" format is not needed if using pc-lint as a user program. (In the official method under Tools menu, this chars seem to help Keil to locate the pc-lint messages. Without this format it won't show anything on Keil Build Output window)
4. In the method I suggested, when double click the line, the source file is also open/located automatically.

So, these are some experiences of mine about configuring pc-lint with Keil uVision4. Comments are welcome.

Regards,
Xiang

0