On Fri, 10 May 2002, Taed Wynnell wrote:

> Quick summary:  I think this is a Splint bug...
>
> > Did you define __asm with a macro?
>
> No, the assembly is there when I compile with my compiler, and I was very
> careful to use all the same "-D" definitions.
>
> I just did a "strings -a" on splint.exe and found the following:
>       __asm
>       _asm
>       __asm__
>
> So, I would hypothesize that:
>       -- Splint understands the __asm.
>       -- Splint removes it during the preprocessor step or somesuch.
>       -- Splint then finds an empty code block in a later step and
> produces the warning.
>
> I then went to the source and found the following in LEX.YY.C:
>       else if (cstring_equalLit (id, "__attribute__")
>                || cstring_equalLit (id, "__asm__")
>                || cstring_equalLit (id, "_asm")
>                || cstring_equalLit (id, "__asm")
>                || cstring_equalLit (id, "__declspec"))
> Although I couldn't follow it well enough to determine what it was really
> doing with the line (namely, was it deleting it).
>
> So, it seems that this actually is a Splint bug.

Its correct that the __asm syntax extension goes to nothing, and this
leads to to the ifempty warning if you don't have the { }'s.  (I'm
confused why they were there in your example, though.  Did you get the
warning for that example, or add the braces for clarity in your message?)
I'd argue, that it is dangerous to assume that __asm { ... } is treated as
an expression by all compilers, though, and it would seem much wiser to
use the { __asm { ... } } in your if branch in this case.  If there were
another empty macro there, would you expect to get the ifempty warning or
not?

>
> By the way, it would be REALLY useful if Split supported "-E" (dump
> preprocessor output) or something along those lines...
>

Try +keep

--- Dave

Reply via email to