> 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 the
> "-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.  The
> documentation doesn't seem to show an annotation that could be
> used for that
> case, but it seems like something that would have come up before...

I encountered a problem very much similar to this when checking some
code that made extensive use of this macro:

#define newstr(s)\
        strcpy(malloc(strlen(s) + 1), s)

every time it used that macro is raised a "-boundswrite" warning
since it thought the src buffer could get overflowed. The solution
is to add a control comment into the macro itself:

#define newstr(s)\
        /*@-boundswrite@*/ strcpy(malloc(strlen(s) + 1), s) /*@=boundswrite@*/

so Splint's preprocessor will put this in, and that will suppress
the warning


Reply via email to