News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Code::Blocks and lint

Started by Lazybones, January 07, 2008, 10:10:21 AM

Previous topic - Next topic

Lazybones

Hi there.

I have to integrate lint in our build process, preferably as own target because we have to invoke lint for each source file to check for possible errors before building it.

Is it possible to integrate lint as a "pseudo-compiler", which I then invoke in an own target? The problem is, that the linking step must not be done, because only the source files should be checked and then the process should be stopped. So, is it possible to define a new compiler (either in CB source and recompile CB, or directly in CB's compiler settings) and leave the linker command empty?

Any help is appreciated!
Thanks
Sven

MortenMacFly

Quote from: Lazybones on January 07, 2008, 10:10:21 AM
Is it possible to integrate lint as a "pseudo-compiler", which I then invoke in an own target?
I had done similar recently. I solved it by actually making a copy of the GCC compiler and exchanging the executables with batch files that call lint (or any other preprocessor you like) before and throw an error if that fails. If it succeeds they just call the compiler with the usual command line. But you probably need to write a tiny app that extracts the file from the compiler command line.
Then I created a target (pre-compiler) that uses only the files I want to check and this "pre-compiler". This works very well and C::B will stop compiling if the batch file returns an error (as it thinks the compiler has thrown the error).

Another way is to use scripting and integrate lint into the pre-build process. You can use the per-file variables for each compilation step if you like.

Another possibility is to write a plugin that does that accordingly - this should actually be very easy and could possibly be a scipted plugin.

You see - plenty of possibilities - just choose one. ;-)

With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

Bonanza

Hi Morten,

It sounds very interesting what you did with the batch jobs.

Are there any possibility that you could share then?

Regards Flemming

tilmannreh

Well, I know that this is a really OLD thread, but...

I would like to integrate LINT (current version is 9.00L) for usage in Code::Blocks (16.0.1).
Any concrete advices, tips, or a recipe how to do that?
(I don't like reinventing the wheel...)

Thanks,
Tilmann

oBFusCATed

Probably check the valgrind plugin or something similar.
How is lint given the files to parse?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

tilmannreh

Quote from: oBFusCATed on November 17, 2016, 09:25:14 PM
Probably check the valgrind plugin or something similar.
How is lint given the files to parse?

LINT is invoked with a small batch file that provides some configuration information and a list of files to be parsed to the LINT executable. The output of LINT can be directed to a file, which I currently use to look at the results.

The configuration files contain information about the global definitions of the compiler and the project, as well as some parameters for the output format.

I was hoping that someone already used CB with LINT so I could avoid reinventing the wheel... Basically, it's about how to invoke LINT from CB (probably as another target, as mentioned earlier), how to configure LINT to provide a useful output format, and how to configure CB to parse this output correctly.

oBFusCATed

Can it work on a single file?
You can probably try to setup a compiler that calls lint.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

tilmannreh

Quote from: oBFusCATed on November 18, 2016, 07:45:31 PM
Can it work on a single file?
You can probably try to setup a compiler that calls lint.

Yes, it also works on single files, and yes, most probably setting up LINT as a compiler is the way to go (see the second post in this thread).

I was just asking if someone already did this and would perhaps share the detail information so I don't need to reinvent the wheel (and repeat all the mistakes).

oBFusCATed

Then we wait for Morten to come back and answer you.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

tilmannreh

Quote from: oBFusCATed on November 19, 2016, 01:44:39 PM
Then we wait for Morten to come back and answer you.

Do you have any idea when that might be?

oBFusCATed

No, but he is probably busy with something else in his real life. :)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

tilmannreh

Hello again,

I just wonder if Morten is still alive...
It's been almost a year now, and I also got no response to my personal message. :-(

Tilmann