On Tue, 12 Feb 2002, Raimar Falke wrote:

> $ cat test.c
> int g(int *a, int *b)
> {
>     if(a) return 1;
>     if(!b) return 2;
>     if(a && b) {
>         if(a[0]) return 4;
>         if(!b[0]) return 5;
>     }
>     return 0;
> }
> $ splint test.c
> splint test.c
> Splint 3.0.1.6 --- 11 Feb 2002
>
> test.c: (in function g)
> test.c:5:8: Operands of && are non-boolean (int *): a && b
>   The operand of a boolean operator is not a boolean. Use +ptrnegate to allow !
>   to be used on pointers. (Use -boolops to inhibit warning)
> test.c:6:5: Test expression for if not boolean, type int: a[0]
>   Test expression type is not boolean or int. (Use -predboolint to inhibit
>   warning)
> test.c:7:6: Operand of ! is non-boolean (int): !b[0]
>
> Finished checking --- 3 code warnings
>
> I want that the first warning disappears. So I type
> $ splint +ptrnegate test.c
> and get the same warning and an extra"Warning: setting +ptrnegate
> redundant with current value". If I use "-boolops" I loose the warning
> from line 7.

The warning on line 5 is because of the use of && with non-boolean.  Use
-boolops to inhibit that warning (as suggested by the hint).  This also
inhibits the warning on line 7.  There is no way to inhibit one without
inhibiting the other globally.  (You can use a local control comment to
inhibit one of the warnings directly.)

There should probably be a separate flag for this, but there isn't
currently.

--- Dave

>
> So in short: I don't want to write the "[!=]= NULL" for pointer tests
> but want all the rest. Any ideas?
>
>       Raimar
>
> --
>  email: [EMAIL PROTECTED]
>   reality.sys corrupt. Reboot Universe? (y,n,q)
>
>

Reply via email to