Subject: Re: [Boost-build] Using PC-Lint
From: John Dillan (demised_at_[hidden])
Date: 2008-11-27 00:26:46
Thanks for the tips Jurko! I know it's a pretty delayed response, but I
only just got a chance to start implementing the rules to make this work.
I managed to get the notfile method working, but the project is big enough
that I really need better dependency checking so that it only checks the
modified files again.
Ideally, I would like to be able to do:
lint myLintCheck : mySourceA.cpp mySourceB.cpp ;
exe myApplication : myLintCheck : ;
So like you suggested, 'lint' would have to return the source files. Here
is what I have so far:
import generators ;
import type ;
import print ;
import path ;
type.register LINT : lo ;
generators.register-composing lint.lint : CPP : LINT ;
c:\tools\pc-lint\lint-nt.exe -i"c:\tools\pc-lint" std_vs80.lnt
env-vc8.lnt ProjectSettings.lnt "$(>)"
rule lint ( targets + : sources * : properties * )
for local file in $(sources)
lint-action $(targets) : $(file) ;
return $(sources) ;
The primary problem with it so far is that the only target it tries to
create is 'myLintCheck.lo'. Also, because no target files are generated,
it re-does the lint-action on every build regardless of success or
failure. Is my approach here even remotely correct? What would I need to
change to get this working?
Thanks for any help you can offer on this!
On Tue, 26 Aug 2008 05:02:01 -0700, Jurko GospodnetiÄ
> Hi John.
>> I've been trying to setup a system for running pc-lint on my source
>> files, but I'm having a hard time figuring out the right way to setup a
>> rule to do so.
>> Basically, I want a rule that depends on the input *.lnt file along
>> with all the source files, so that if any of those changes, it runs it
>> again. My main 'exe' rule will also have the 'lint' rule as a
>> dependency so that if pc-lint fails it won't even bother compiling the
>> application. Can someone just point me in the right direction to get
>> this working? I thought using the 'notfile' rule as a basis would make
>> sense since it doesn't actually output any files, but is that not the
>> right approach?
> So you have source files (i.e. not built by the build system):
> and you want to build from them:
> a.exe <-- a1.cpp a2.cpp
> a-lint <-- a.lnt a1.cpp a2.cpp
> where a-lint would simply run some sort of a test action that can
> either fail or succeed and not generate any new files.
> Well if that are all the requirements then I think notfile would suit
> you just fine and your action can simply return 0 if it 'succeeds' or
> any other value if it 'fails'.
> If your test action generates some files that your would like Boost
> Build to know about (e.g. to remove them when doing a clean) then you
> would need to modify your approach by using either a custom target (or a
> custom generator but I do not see your target as a typed one at the
> moment) or either the make or the generate rule.
> Another, perhaps too smart for its own good, idea would be to prepare
> a new typed target for a-link which actually builds all of its sources
> and runs the test rule but also returns all of its sources except the
> .lnt file as its output virtual-targets. That would allow you to do
> something like this:
> a-lint <-- a.lnt a1.cpp a2.cpp
> a.exe <-- a-lint
> and the exe target would be built from the original sources that get
> 'linted' in the process. I would not go this way without getting the
> notfile solution working first.
> Hope this helps.
> Best regards,
> Jurko GospodnetiÄ
> Unsubscribe & other changes:
Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk