>> I'm working on the ADM project which will be delivered into ON in the
>> future.  I'm trying to get my code "lint clean" but am having some
>> troubles with a few constructs.  Is this page on lint directives
>> valid for ON? http://docs.sun.com/app/docs/doc/819-5265/bjaih?a=view

Yes.

>> I've been trying to fix the "constant in conditional" error.  Per the
>> above web site the NOTE(CONSTCOND) syntax is the preferred syntax,
>> and /* CONSTCOND */ is the old method.  I have a file where:
>>
>>     NOTE(CONSTCOND) while (1) {
>>
>> Gives and error, yet
>>
>>     /* CONSTCOND */
>>     while (1) {
>>
>> works fine.

Did you include the directive

        #include <note.h>

in this file, as directed in the second paragraph of the documentation 
you referenced?

>> I have other code using marcos with the 'do {xxxx } while (0)' syntax
>> and I can't get ANY form of the CONSTCOND to work. I'm even getting
>> errors when I use the macros in /usr/include/sys/queue.h.

This is kind of ugly, but the following really DOES work:

> #include <note.h>
> #define MYMACRO do { ; NOTE(CONSTCOND) } while (0)
> 
> void main(void) {
>       MYMACRO;
> }

If you're doing this in a macro, then you MUST use the NOTE(CONSTCOND) 
notation, instead of the /* CONSTCOND */ comment, because the 
preprocessor will strip the comment when it expands the macro.

> There's not much we can do about <sys/queue.h> unless you want to
> fix upstream (in whichever *BSD we found it) and then sync up.

I agree.

>> I'm doing 'make lint' from my $SRC/cmd/hsm directory.  The Makefile
>> there includes the top level Makefile.master, which has a bunch of
>> lint flags defined.
>>
>> My lint version is:
>> /ws/onnv-tools/SUNWspro/SS12/bin/lint -V
>> lint: Sun C 5.9 SunOS_i386 Patch 124868-07 2008/10/07
>>
>> Any suggestions are greatly appreciated.

See above.  What James suggests below is probably also acceptable, but 
is a blanket exception, rather than the preferred per-usage notation.

> What I ended up doing for fwflash was to add
> 
> -erroff=E_CONSTANT_CONDITION
> 
> to $SRC/cmd/fwflash/Makefile.com's LINTFLAGS definition.
> 
> It's ugly and annoying, but it works and was acceptable
> to my RTI advocate :-) 

Hm; wonder who that could have been?

--Mark

Reply via email to