According to the Splint 3.1.1 manual:

  Use the -booltype <name> flag to select the type name is used to
  represent Boolean values.  There is no default Boolean type,
  although bool is used by convention.  The names TRUE and FALSE are
  assumed to represent true and false Boolean values.  To change the
  names of true and false, use -booltrue and -boolfalse.  (The Splint
  distribution includes an implementation of bool, in lib/bool.h.
  However, it isn't necessary to use this implementation to get the
  benefits of Boolean checking.)

I have the following piece of code:

      1 #define FALSE 0
      2 #define TRUE 1
      3
      4 typedef int bool_t;
      5
      6 int main(void)
      7 {
      8   bool_t boolean1 = FALSE;
      9   bool_t boolean2 = TRUE;
     10
     11   if (!boolean1)
     12     boolean1 = TRUE;
     13
     14   if (boolean2)
     15     boolean2 = FALSE;
     16
     17   return(0);
     18 }

When I run splint 3.1.1 against it, I get:

  % splint -booltype bool_t -booltrue TRUE booltest.c
  Splint 3.1.1 --- 20 May 2003

  booltest.c: (in function main)
  booltest.c:9:22: Variable boolean2 initialized to type int, expects bool_t: 1
    To make bool and int types equivalent, use +boolint.
  booltest.c:12:5: Assignment of int to bool_t: boolean1 = 1
  Finished checking --- 2 code warnings

The result is the same withouth the -booltrue argument.  However, 
if TRUE is defined to (!FALSE), then it works fine.  It would 
seem not to matter what -booltrue and -boolfalse are set to.

Am I doing something wrong, or is there a bug here?  My desire
would be that TRUE could be defined as either "1" or "(!FALSE)".

Thanks.

-Jay

_______________________________________________
splint-discuss mailing list
[EMAIL PROTECTED]
http://www.splint.org/mailman/listinfo/splint-discuss

Reply via email to