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:

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.

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

-----Original Message-----
From: David Evans [mailto:[EMAIL PROTECTED]]
Sent: Friday 10 May 2002 1:49 PM
To: Taed Wynnell
Cc: Splint Mailing List (E-mail)
Subject: Re: Suppressing ifempty with an annotation?

Did you define __asm with a macro?

Without any macro definitions, splint doesn't report any warnings for that
code.  It does if you don't have the { ... } though, perhaps that is what
you mean.

Without them, the __asm is cut, and splint does report the ifempty
warning.  You can use -ifempty on the command line or as a control comment
like this:

  if (debuggerRunning)
    /*@-ifempty@*/ __asm { int 3 }; /*@=ifempty@*/

--- Dave

On Fri, 10 May 2002, Taed Wynnell wrote:

> I just started using Split this morning to try it out on my Windows device
> driver.  Whew!  Lots and lots of "errors", so I'm just concentrating on
> "-weak" ones...
> I have a macro that I use a lot that looks something like:
>       if (debuggerRunning) {
>               __asm { int 3 };
>       }
> Of course, I don't expect Splint to do anything with the assembly, but I
> then get the "empty if statement" warning all over the place.  I'd like to
> just fix that warning in the macro, rather than suppress it altogether.
> documentation doesn't seem to show an annotation that could be used for
> case, but it seems like something that would have come up before...
> Is there an undocumented annotation for this?  Is there another way of
> avoiding the warning without suppressing the warning for all the code?
> Thanks!

Reply via email to