Author Topic: Code::Blocks and lint  (Read 5004 times)

Offline Lazybones

  • Multiple posting newcomer
  • *
  • Posts: 14
Code::Blocks and lint
« on: January 07, 2008, 10:10:21 am »
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

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9425
Re: Code::Blocks and lint
« Reply #1 on: January 07, 2008, 11:07:53 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: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline Bonanza

  • Multiple posting newcomer
  • *
  • Posts: 34
  • Engineer
Re: Code::Blocks and lint
« Reply #2 on: August 22, 2008, 11:46:52 pm »
Hi Morten,

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

Are there any possibility that you could share then?

Regards Flemming

Offline tilmannreh

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Code::Blocks and lint
« Reply #3 on: November 17, 2016, 04:19:00 pm »
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

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10356
Re: Code::Blocks and lint
« Reply #4 on: November 17, 2016, 09:25:14 pm »
Probably check the valgrind plugin or something similar.
How is lint given the files to parse?
<debugger plugin maintainer>
(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!]

Offline tilmannreh

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Code::Blocks and lint
« Reply #5 on: November 18, 2016, 07:57:15 am »
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.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10356
Re: Code::Blocks and lint
« Reply #6 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.
<debugger plugin maintainer>
(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!]

Offline tilmannreh

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Code::Blocks and lint
« Reply #7 on: November 19, 2016, 09:55:51 am »
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).

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10356
Re: Code::Blocks and lint
« Reply #8 on: November 19, 2016, 01:44:39 pm »
Then we wait for Morten to come back and answer you.
<debugger plugin maintainer>
(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!]

Offline tilmannreh

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Code::Blocks and lint
« Reply #9 on: November 29, 2016, 09:09:22 am »
Then we wait for Morten to come back and answer you.

Do you have any idea when that might be?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10356
Re: Code::Blocks and lint
« Reply #10 on: November 29, 2016, 08:31:50 pm »
No, but he is probably busy with something else in his real life. :)
<debugger plugin maintainer>
(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!]

Offline tilmannreh

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Code::Blocks and lint
« Reply #11 on: October 20, 2017, 08:03:34 am »
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