JB Enterprises - Johan BezemInterim Management & Consulting |
|
|
JB Enterprises - BlogUsing PC Lint in eclipse – no plug-ins requiredI've been tinkering with Eclipse to see if I can make PC Lint run from inside Eclipse. Of course, running Lint as an external tool is always an option, but I couldn't get Eclipse to recognize the Lint warnings and display them in the 'Problems' tab. From my testing and what I could find on the Internet, it seems that the output of so-configured external tools is not run by the error parsers installed. What I found on the Internet suggested that I have to use a special error parser, configure it, and then it would run. Now, I have nothing against using extra tools if that's the way to achieve what I want, but if I can do without, I consider that a better solution, since every tool used is another tool to learn how to use. And delivering configurations to my customers, it's not my business model to make myself indispensable, on the contrary. So, after experimenting some more, I have found a way to use PC Lint with Eclipse (I used Ganymede for testing) without resorting to additional tools or plug-ins. Be aware, I'm not an Eclipse expert in any sense, so there may be many more and possibly better ways to achieve this. I'd be happy to get some comments with further tips. The key is to add a new 'build target' for running PC Lint:
Be aware that these indications all assume some kind of a general build or make environment, so the names themselves do not indicate the possibility for running a single program. If you use a Makefile concept for running Lint, you may use that as well, and 'clean' might even make sense.
And that's it. OK; one final thing remains. We now need to coerce Lint into providing warnings in a format similar to the GNU C/C++ compiler. This can be achieved by some Lint options in your option file. I use: // Output options: One line, file info always; Use full path names -hF1 +ffn // Normally my format is defined as follows: //-"format=%(\q%f\q %l %C%) %t %n: %m" // For eclipse-usage, the GCC error format is necessary, // since we have only the default eclipse error parser available. -"format=%(%f:%l:%C:%) %t %n: %m" // And also for eclipse, the reference locations provided by // Lint, put into square brackets "[Reference: File: ... Line: ...]" // are not correctly handled, therefore we switch them off. // Enable warning 831 if you are interested. -frl // Do not break lines -width(0) // And make sure no foreign includes change the format +flm If you want to know more than my comments are telling you, check the Lint manual for details. Now, don't get me wrong: I will not switch from my trusted SlickEdit to Eclipse. But, as a consultant, I cannot always pick and choose. And running Lint from Eclipse, having a way to jump from warning to warning, definitely beats manual navigation. Happy Linting! August 18th, 2009
www.bezem.de:
© 1999 – 2024 by Johan Bezem, all rights reserved. |