]> andersk Git - splint.git/blobdiff - src/stateClause.c
Fixed all /*@i...@*/ tags (except 1).
[splint.git] / src / stateClause.c
index a68d3882c2ed0d61df0d1c07836755a82dca58f4..cf2faf03251e90d60e5ee09e21283570743614a8 100644 (file)
@@ -1,6 +1,6 @@
 /*
-** LCLint - annotation-assisted static program checker
-** Copyright (C) 1994-2001 University of Virginia,
+** Splint - annotation-assisted static program checker
+** Copyright (C) 1994-2003 University of Virginia,
 **         Massachusetts Institute of Technology
 **
 ** This program is free software; you can redistribute it and/or modify it
 ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 ** MA 02111-1307, USA.
 **
-** For information on lclint: lclint-request@cs.virginia.edu
-** To report a bug: lclint-bug@cs.virginia.edu
-** For more information: http://lclint.cs.virginia.edu
+** For information on splint: info@splint.org
+** To report a bug: splint-bug@splint.org
+** For more information: http://www.splint.org
 */
 /*
 ** stateClause.c
 */
 
-# include "lclintMacros.nf"
+# include "splintMacros.nf"
 # include "basic.h"
 # include "cgrammar.h"
 # include "cgrammar_tokens.h"
@@ -43,6 +43,25 @@ stateClause_createRaw (stateConstraint st, stateClauseKind sk, /*@only@*/ sRefSe
   return ret;
 }
 
+/*drl added 3/7/2003*/
+bool stateClause_hasEmptyReferences (stateClause s)
+{
+  if (sRefSet_isUndefined(s->refs) )
+    return TRUE;
+    else
+    return FALSE;
+}
+
+bool stateClause_isMetaState (stateClause s)
+{
+
+  if (qual_isMetaState (s->squal) )
+    return TRUE;
+  else
+    return FALSE;
+}
+/*end drl added*/
+
 stateClause 
 stateClause_create (lltok tok, qual q, sRefSet s) 
 {
@@ -98,6 +117,11 @@ bool stateClause_isEnsures (stateClause cl)
   return (cl->state == TK_AFTER);
 }
 
+bool stateClause_isQual (stateClause cl)
+{
+  return (cl->kind == SP_QUAL);
+}
+
 bool stateClause_isMemoryAllocation (stateClause cl)
 {
   switch (cl->kind)
@@ -122,6 +146,11 @@ bool stateClause_isMemoryAllocation (stateClause cl)
 /*
 ** An error is reported if the test is NOT true.
 */
+\r
+# ifdef WIN32\r
+/* Microsoft doesn't believe in higher order functions... */\r
+# pragma warning( disable : 4550 )\r
+# endif  \r
 
 sRefTest stateClause_getPreTestFunction (stateClause cl)
 {
@@ -247,9 +276,9 @@ sRefMod stateClause_getEntryFunction (stateClause cl)
        case SP_USES:
          return sRef_setDefinedComplete;
        case SP_ALLOCATES:
-         return NULL;
+         return sRef_setUndefined; /* evans 2002-01-01 */
        case SP_DEFINES:
-         return NULL;
+         return sRef_setUndefined; /* evans 2002-01-01 */
        case SP_SETS:
          return sRef_setAllocatedComplete;
        case SP_RELEASES:
@@ -287,7 +316,7 @@ sRefMod stateClause_getEntryFunction (stateClause cl)
       return NULL;
     }
 
-  BADBRANCH;
+  BADBRANCHNULL;
 }
 
 sRefMod stateClause_getEffectFunction (stateClause cl)
@@ -337,7 +366,7 @@ sRefMod stateClause_getEffectFunction (stateClause cl)
       return NULL;
     }
 
-  BADBRANCH;
+  BADBRANCHNULL;
 }
 
 sRefMod stateClause_getReturnEffectFunction (stateClause cl)
@@ -369,7 +398,7 @@ sRefMod stateClause_getReturnEffectFunction (stateClause cl)
       return NULL;
     }
 
-  BADBRANCH;
+  BADBRANCHNULL;
 }
 
 static flagcode stateClause_qualErrorCode (stateClause cl)
@@ -392,6 +421,8 @@ static flagcode stateClause_qualErrorCode (stateClause cl)
   } else {
     BADBRANCH;
   }
+
+  BADBRANCHRET (INVALID_FLAG);
 }
 
 flagcode stateClause_preErrorCode (stateClause cl)
@@ -405,7 +436,7 @@ flagcode stateClause_preErrorCode (stateClause cl)
     case SP_ALLOCATES: /*@fallthrough@*/ 
     case SP_DEFINES:
     case SP_SETS:
-      return FLG_MUSTFREE;
+      return FLG_MUSTFREEONLY;
     case SP_RELEASES:
       return FLG_USEDEF;
     case SP_GLOBAL:
@@ -413,7 +444,7 @@ flagcode stateClause_preErrorCode (stateClause cl)
       return stateClause_qualErrorCode (cl);
     }
 
-  BADBRANCH;
+  BADBRANCHRET (INVALID_FLAG);
 }
 
 static /*@observer@*/ cstring stateClause_qualErrorString (stateClause cl, sRef sr)
@@ -446,7 +477,7 @@ static /*@observer@*/ cstring stateClause_qualErrorString (stateClause cl, sRef
     BADBRANCH;
   }
   
-  BADBRANCH;
+  BADBRANCHRET (cstring_undefined);
 }
 
 cstring stateClause_preErrorString (stateClause cl, sRef sr)
@@ -505,14 +536,14 @@ flagcode stateClause_postErrorCode (stateClause cl)
     case SP_SETS:     
       return FLG_COMPDEF;
     case SP_RELEASES:
-      return FLG_MUSTFREE;
+      return FLG_MUSTFREEONLY;
     case SP_GLOBAL:
       BADBRANCH;
     case SP_QUAL:
       return stateClause_qualErrorCode (cl);
     }
 
-  BADBRANCH;
+  BADBRANCHRET (INVALID_FLAG);
 }
 
 cstring stateClause_postErrorString (stateClause cl, sRef sr)
@@ -671,6 +702,8 @@ stateClause stateClause_createPlain (lltok tok, sRefSet s)
       sRefSet_free (s);
       BADBRANCH;
     }
+
+  BADBRANCHRET (stateClause_createUses (sRefSet_undefined));
 }
 
 stateClause stateClause_createAllocates (sRefSet s)
@@ -726,7 +759,7 @@ static sRefModVal stateClause_getStateFunction (stateClause cl)
     }
   else if (qual_isAliasQual (sq))
     {
-      return (sRefModVal) sRef_setAliasKind; /*@i23 complete? @*/
+      return (sRefModVal) sRef_setAliasKind; 
     }
   else
     {
@@ -734,6 +767,7 @@ static sRefModVal stateClause_getStateFunction (stateClause cl)
       BADBRANCH;
     }
   /*@=enumint@*/
+  BADBRANCHRET (NULL);
 }
 
 int stateClause_getStateParameter (stateClause cl)
@@ -743,9 +777,12 @@ int stateClause_getStateParameter (stateClause cl)
   llassert (cl->kind == SP_QUAL || cl->kind == SP_GLOBAL);
 
   sq = cl->squal;
-
-  /*@+relaxtypes@*/ /*@i523 this is wrong, remove the enumint@*/
-  /*@+enumint@*/
+  
+  /*@+enumint@*/ 
+  /*
+  ** Since this can be many different types of state kinds, we need to allow all
+  ** enum's to be returned as int.
+  */
 
   if (qual_isNotNull (sq))
     {
@@ -792,6 +829,7 @@ int stateClause_getStateParameter (stateClause cl)
 
   /*@=enumint@*/
   /*@=relaxtypes@*/
+  BADBRANCHRET (0);
 }
 
 sRefModVal stateClause_getEnsuresFunction (stateClause cl)
This page took 0.115248 seconds and 4 git commands to generate.