]> andersk Git - splint.git/blobdiff - src/constraintGeneration.c
Fixes after removing -unrecogcomments flag for make splintme.
[splint.git] / src / constraintGeneration.c
index c08063d3ce058c39864a8ee5c57167983410d798..7595c148bf101026231119a55e0c96ebcecfa43f 100644 (file)
@@ -1,6 +1,6 @@
 /*
 ** Splint - annotation-assisted static program checker
-** Copyright (C) 1994-2002 University of Virginia,
+** Copyright (C) 1994-2003 University of Virginia,
 **         Massachusetts Institute of Technology
 **
 ** This program is free software; you can redistribute it and/or modify it
 # include "exprChecks.h"
 # include "exprNodeSList.h"
 
-/*@access exprNode@*/ /* NO! Don't do this recklessly! */
-/*@-nullderef@*/ /* DRL needs to fix this code! */
-/*@-nullpass@*/ /* DRL needs to fix this code! */
-/*@-temptrans@*/ /* DRL needs to fix this code! */
+/*drl We need to access the internal representation of exprNode
+  because these functions walk down the parse tree and need a richer
+information than is accessible through the exprNode interface.*/
+  
+/*@access exprNode@*/
 
-static /*@truewhennull@*/ bool exprNode_handleError (/*@temp@*/ exprNode p_e);
+static /*@nullwhentrue@*/ bool exprNode_handleError (/*@temp@*/ exprNode p_e);
 
 static void exprNode_stmt (/*@temp@*/ /*@temp@*/ exprNode p_e);
 static void  exprNode_multiStatement (/*@temp@*/ exprNode p_e);
@@ -94,7 +95,7 @@ static bool exprNode_isUnhandled (/*@temp@*/ /*@observer@*/ exprNode e)
   return FALSE;
 }
 
-bool exprNode_handleError (exprNode e)
+/*@nullwhentrue@*/ bool exprNode_handleError (exprNode e) 
 {
   if (exprNode_isError (e) || exprNode_isUnhandled (e))
     {
@@ -145,7 +146,7 @@ bool /*@alt void@*/ exprNode_generateConstraints (/*@temp@*/ exprNode e)
     constraintList_free(c);
   }    
 
-  DPRINTF ((message ("e->requiresConstraints %s", constraintList_printDetailed (e->requiresConstraints))));
+  DPRINTF ((message ("e->requiresConstraints %s", constraintList_unparseDetailed (e->requiresConstraints))));
   return FALSE;
 }
 
@@ -251,8 +252,8 @@ static void exprNode_stmt (/*@temp@*/ exprNode e)
   e->ensuresConstraints  = exprNode_traversEnsuresConstraints(snode);
 
   DPRINTF ((message ("smtlist constraints are: pre: %s \n and \t post %s\n",
-                     constraintList_print(e->requiresConstraints),
-                     constraintList_print(e->ensuresConstraints))));
+                     constraintList_unparse(e->requiresConstraints),
+                     constraintList_unparse(e->ensuresConstraints))));
 
   return; 
 }
@@ -292,8 +293,8 @@ static void exprNode_stmtList  (/*@dependent@*/ exprNode e)
   exprNode_mergeResolve (e, stmt1, stmt2);
   
   DPRINTF ((message ("smtlist constraints are: pre: %s \n and \t post %s\n",
-                     constraintList_print(e->requiresConstraints),
-                     constraintList_print(e->ensuresConstraints))));
+                     constraintList_unparse(e->requiresConstraints),
+                     constraintList_unparse(e->ensuresConstraints))));
   return;
 }
 
@@ -308,23 +309,23 @@ static exprNode doIf (/*@returned@*/  exprNode e, /*@dependent@*/ exprNode test,
   llassert (exprNode_isDefined (body));
 
   
-      DPRINTF((message ("ensures constraints for %s are %s", exprNode_unparse(e), constraintList_printDetailed(e->ensuresConstraints))));
+      DPRINTF((message ("ensures constraints for %s are %s", exprNode_unparse(e), constraintList_unparseDetailed(e->ensuresConstraints))));
 
-      DPRINTF((message ("Requires constraints for %s are %s", exprNode_unparse(e), constraintList_printDetailed(e->ensuresConstraints))));
+      DPRINTF((message ("Requires constraints for %s are %s", exprNode_unparse(e), constraintList_unparseDetailed(e->ensuresConstraints))));
       
-      DPRINTF((message ("trueEnsures constraints for %s are %s", exprNode_unparse(e), constraintList_printDetailed(e->trueEnsuresConstraints))));
+      DPRINTF((message ("trueEnsures constraints for %s are %s", exprNode_unparse(e), constraintList_unparseDetailed(e->trueEnsuresConstraints))));
 
-      DPRINTF((message ("falseEnsures constraints for %s are %s", exprNode_unparse(e), constraintList_printDetailed(e->falseEnsuresConstraints))));
+      DPRINTF((message ("falseEnsures constraints for %s are %s", exprNode_unparse(e), constraintList_unparseDetailed(e->falseEnsuresConstraints))));
 
 
 
-      DPRINTF((message ("ensures constraints for %s are %s", exprNode_unparse(test), constraintList_printDetailed(test->ensuresConstraints))));
+      DPRINTF((message ("ensures constraints for %s are %s", exprNode_unparse(test), constraintList_unparseDetailed(test->ensuresConstraints))));
 
-      DPRINTF((message ("Requires constraints for %s are %s", exprNode_unparse(test), constraintList_printDetailed(test->ensuresConstraints))));
+      DPRINTF((message ("Requires constraints for %s are %s", exprNode_unparse(test), constraintList_unparseDetailed(test->ensuresConstraints))));
       
-      DPRINTF((message ("trueEnsures constraints for %s are %s", exprNode_unparse(test), constraintList_printDetailed(test->trueEnsuresConstraints))));
+      DPRINTF((message ("trueEnsures constraints for %s are %s", exprNode_unparse(test), constraintList_unparseDetailed(test->trueEnsuresConstraints))));
 
-      DPRINTF((message ("falseEnsures constraints for %s are %s", exprNode_unparse(test), constraintList_printDetailed(test->falseEnsuresConstraints))));
+      DPRINTF((message ("falseEnsures constraints for %s are %s", exprNode_unparse(test), constraintList_unparseDetailed(test->falseEnsuresConstraints))));
 
 
 
@@ -343,9 +344,9 @@ static exprNode doIf (/*@returned@*/  exprNode e, /*@dependent@*/ exprNode test,
 
   test->trueEnsuresConstraints = constraintList_substituteFreeTarget(test->trueEnsuresConstraints, test->ensuresConstraints);
   
-  DPRINTF ((message ("doIf: test ensures %s ", constraintList_print(test->ensuresConstraints))));
+  DPRINTF ((message ("doIf: test ensures %s ", constraintList_unparse(test->ensuresConstraints))));
     
-  DPRINTF ((message ("doIf: test true ensures %s ", constraintList_print(test->trueEnsuresConstraints))));
+  DPRINTF ((message ("doIf: test true ensures %s ", constraintList_unparse(test->trueEnsuresConstraints))));
   
   constraintList_free(e->requiresConstraints);
 
@@ -370,7 +371,7 @@ static exprNode doIf (/*@returned@*/  exprNode e, /*@dependent@*/ exprNode test,
                                                        test->falseEnsuresConstraints);
     }
   
-  DPRINTF ((message ("doIf: if requiers %s ", constraintList_print(e->requiresConstraints))));
+  DPRINTF ((message ("doIf: if requiers %s ", constraintList_unparse(e->requiresConstraints))));
   
   return e;
 }
@@ -433,8 +434,8 @@ static exprNode doIfElse (/*@returned@*/ exprNode e, /*@dependent@*/ exprNode p,
   constraintList_free(cons);
   constraintList_free(c1);
   
-  DPRINTF ((message ("doIfElse: if requires %q ", constraintList_print(e->requiresConstraints))));
-  DPRINTF ((message ("doIfElse: if ensures %q ", constraintList_print(e->ensuresConstraints))));
+  DPRINTF ((message ("doIfElse: if requires %q ", constraintList_unparse(e->requiresConstraints))));
+  DPRINTF ((message ("doIfElse: if ensures %q ", constraintList_unparse(e->ensuresConstraints))));
   
   return e;
 }
@@ -461,7 +462,7 @@ static exprNode doWhile (/*@returned@*/ exprNode e, /*@dependent@*/ exprNode tes
          size = sRef_getArraySize(el);
          DPRINTF((message("%s is a fixed array with size %d",
                            sRef_unparse(el), (int)size)));
-         con = constraint_makeSRefSetBufferSize (el, (size - 1));
+         con = constraint_makeSRefSetBufferSize (el, size_toLong (size - 1));
          ret = constraintList_add(ret, con);
        }
       else
@@ -488,7 +489,7 @@ static exprNode doWhile (/*@returned@*/ exprNode e, /*@dependent@*/ exprNode tes
   end_sRefSet_elements ;
   
   DPRINTF((message("constraintList_makeFixedArrayConstraints returning %s",
-                   constraintList_print(ret))));
+                   constraintList_unparse(ret))));
   return ret;
 }
 
@@ -640,7 +641,7 @@ exprNode_doGenerateConstraintSwitch
                  DPRINTF((message("returning from exprNode_doGenerateConstraintSwitch: (switch %s) %s currentRequires:"
                                    "%s currentEnsures:%s",
                                    exprNode_unparse(switchExpr), exprNode_unparse(body),
-                                   constraintList_print(*currentRequires), constraintList_print(*currentEnsures)
+                                   constraintList_unparse(*currentRequires), constraintList_unparse(*currentEnsures)
                                   )));
                  /*@-onlytrans@*/
                  return;
@@ -678,26 +679,21 @@ exprNode_doGenerateConstraintSwitch
          *savedRequires = constraintList_mergeRequiresFreeFirst (*savedRequires, *currentRequires);
        }
       
-      con = constraint_makeEnsureEqual (switchExpr, exprData_getSingle
-                                       (stmt->edata), exprNode_getfileloc(stmt));
-
+      con = constraint_makeEnsureEqual (switchExpr, exprData_getSingle (stmt->edata), exprNode_loc (stmt));
 
-      constraintList_free(*currentEnsures);
+      constraintList_free (*currentEnsures);
       *currentEnsures = constraintList_makeNew();
       *currentEnsures = constraintList_add(*currentEnsures, con);
 
       constraintList_free(*currentRequires);
       *currentRequires = constraintList_makeNew();
-      DPRINTF((message("exprNode_doGenerateConstraintSwitch: (switch %s) %s savedRequires:"
-                       "%s savedEnsures:%s",
-                       exprNode_unparse(switchExpr), exprNode_unparse(body),
-                       constraintList_print(*savedRequires), constraintList_print(*savedEnsures)
-                       )));
-
+      DPRINTF (("exprNode_doGenerateConstraintSwitch: (switch %s) %s savedRequires:"
+               "%s savedEnsures:%s",
+               exprNode_unparse(switchExpr), exprNode_unparse(body),
+               constraintList_unparse(*savedRequires), constraintList_unparse(*savedEnsures)
+               ));
     }
-
-  else if (exprNode_isCaseMarker(stmt))
-    /* prior case has no break. */
+  else if (exprNode_isCaseMarker(stmt)) /* prior case has no break. */
     {
       /* 
         We don't do anything to the sved constraints because the case hasn't ended
@@ -707,38 +703,28 @@ exprNode_doGenerateConstraintSwitch
       
       constraintList temp;
       constraint con;
-
       constraintList ensuresTemp;
 
-      DPRINTF ((message("Got case marker with no prior break")));
-
-      con = constraint_makeEnsureEqual (switchExpr, exprData_getSingle
-                                       (stmt->edata), exprNode_getfileloc(stmt));
-
-      ensuresTemp = constraintList_makeNew();
-
+      con = constraint_makeEnsureEqual (switchExpr, exprData_getSingle (stmt->edata), exprNode_loc (stmt));
+      
+      ensuresTemp = constraintList_makeNew ();
       ensuresTemp = constraintList_add (ensuresTemp, con);
 
-      if (exprNode_isError(stmtList))
+      if (exprNode_isError (stmtList))
        {
-         constraintList_free(*currentEnsures);
-
-         *currentEnsures = constraintList_copy(ensuresTemp);
-         constraintList_free(ensuresTemp);
-
+         constraintList_free (*currentEnsures);
+         *currentEnsures = constraintList_copy (ensuresTemp);
+         constraintList_free (ensuresTemp);
        }
       else
        {
-         
          temp = constraintList_logicalOr (*currentEnsures, ensuresTemp);
-         
-         constraintList_free(*currentEnsures);
-         constraintList_free(ensuresTemp);
-
+         constraintList_free (*currentEnsures);
+         constraintList_free (ensuresTemp);
          *currentEnsures = temp;
        }
-      constraintList_free(*currentRequires);
-      
+
+      constraintList_free (*currentRequires);
       *currentRequires = constraintList_makeNew();
     }
   else
@@ -750,11 +736,12 @@ exprNode_doGenerateConstraintSwitch
       BADEXIT;
     }
 
-  DPRINTF((message("returning from exprNode_doGenerateConstraintSwitch: (switch %s) %s currentRequires:"
-                   "%s currentEnsures:%s",
-                   exprNode_unparse(switchExpr), exprNode_unparse(body),
-                   constraintList_print(*currentRequires), constraintList_print(*currentEnsures)
-                  )));
+  DPRINTF (("returning from exprNode_doGenerateConstraintSwitch: (switch %s) %s currentRequires:"
+           "%s currentEnsures:%s",
+           exprNode_unparse(switchExpr), exprNode_unparse(body),
+           constraintList_unparse(*currentRequires), constraintList_unparse(*currentEnsures)
+           ));
+
   /*@-onlytrans@*/ 
   return;
   /*@=onlytrans@*/ 
@@ -779,22 +766,21 @@ static void exprNode_generateConstraintSwitch (/*@notnull@*/ exprNode switchStmt
       return;
     }
 
-  /*@i22*/
   DPRINTF((message("")));
   
   if (body->kind == XPR_BLOCK)
     body = exprData_getSingle(body->edata);
 
-  /*
+  
   constraintsRequires = constraintList_undefined;
   constraintsEnsures = constraintList_undefined;
 
   lastRequires = constraintList_makeNew();
   lastEnsures = constraintList_makeNew();
-  */
+  
 
   /*@-mustfree@*/ 
-  /*@i6534 - evans 2002-01-01: spurious warnings for these becuase of stack allocated storage */
+  /* evans 2002-01-01: spurious warnings for these becuase of stack allocated storage */
   exprNode_doGenerateConstraintSwitch (switchExpr, body, &lastRequires, 
                                       &lastEnsures, &constraintsRequires, &constraintsEnsures);
   /*@=mustfree@*/
@@ -824,8 +810,8 @@ static void exprNode_generateConstraintSwitch (/*@notnull@*/ exprNode switchStmt
   constraintList_free (lastEnsures);
 
   DPRINTF(((message(" exprNode_generateConstraintSwitch returning requires: %s and ensures %s",
-                    constraintList_print(switchStmt->requiresConstraints),
-                    constraintList_print(switchStmt->ensuresConstraints)
+                    constraintList_unparse(switchStmt->requiresConstraints),
+                    constraintList_unparse(switchStmt->ensuresConstraints)
                    )
            )));
 }
@@ -952,14 +938,31 @@ void exprNode_multiStatement (/*@dependent@*/ exprNode e)
       p->trueEnsuresConstraints =  exprNode_traversTrueEnsuresConstraints(p);
       constraintList_free(temp);
 
+
+
+      DPRINTF((message("p->trueEnsuresConstraints before substitue %s", constraintList_unparse(p->trueEnsuresConstraints)  )
+              ));
+
+            /*drl 10/10/2002 this is a bit of a hack but the reason why we do this is so that any function post conditions or similar things get applied correctly to each branch.  e.g. in strlen(s) < 5 we want the trueEnsures to be maxRead(s) < 5*/
+
+      p->trueEnsuresConstraints = constraintList_substituteFreeTarget (p->trueEnsuresConstraints,
+                                                                      p->ensuresConstraints);
+      
+      DPRINTF(( message ("p->trueEnsuresConstraints after substitue %s", constraintList_unparse(p->trueEnsuresConstraints) )
+               ));
+      
       temp = p->falseEnsuresConstraints;
       p->falseEnsuresConstraints =  exprNode_traversFalseEnsuresConstraints(p);
       constraintList_free(temp);
 
+      /*See comment on trueEnsures*/
+      p->falseEnsuresConstraints = constraintList_substituteFreeTarget (p->falseEnsuresConstraints,
+                                                                      p->ensuresConstraints);
+      
       e = doIfElse (e, p, trueBranch, falseBranch);
       DPRINTF(("Done IFELSE"));
       break;
+      
     case XPR_DOWHILE:
 
       e2 = (exprData_getPairB (data));
@@ -969,18 +972,30 @@ void exprNode_multiStatement (/*@dependent@*/ exprNode e)
       exprNode_generateConstraints (e2);
       exprNode_generateConstraints (e1);
       e = exprNode_copyConstraints (e, e2);
-      DPRINTF ((message ("e = %s  ", constraintList_print(e->requiresConstraints))));
+      DPRINTF ((message ("e = %s  ", constraintList_unparse(e->requiresConstraints))));
       
       break;
       
     case XPR_BLOCK:
-      exprNode_generateConstraints (exprData_getSingle (data));
-      
-      constraintList_free(e->requiresConstraints);
-      e->requiresConstraints = constraintList_copy ((exprData_getSingle (data))->requiresConstraints);
-      
-      constraintList_free(e->ensuresConstraints);
-      e->ensuresConstraints = constraintList_copy ((exprData_getSingle (data))->ensuresConstraints);
+      {
+       exprNode tempExpr;
+
+       tempExpr = exprData_getSingle (data);
+
+       exprNode_generateConstraints (tempExpr);
+
+       if (exprNode_isDefined(tempExpr) )
+         {
+           constraintList_free(e->requiresConstraints);
+           e->requiresConstraints = constraintList_copy (tempExpr->requiresConstraints);
+           constraintList_free(e->ensuresConstraints);
+           e->ensuresConstraints = constraintList_copy (tempExpr->ensuresConstraints);
+         }
+       else
+         {
+           llassert(FALSE);
+         }
+      }
       break;
 
     case XPR_SWITCH:
@@ -1004,17 +1019,17 @@ static bool lltok_isBoolean_Op (lltok tok)
     I don't want to violate the abstraction
     maybe this should go in lltok.c */
   
-  if (lltok_isEq_Op (tok))
+  if (lltok_isEqOp (tok))
        {
          return TRUE;
        }
-      if (lltok_isAnd_Op (tok))
+      if (lltok_isAndOp (tok))
 
        {
 
          return TRUE;            
        }
-   if (lltok_isOr_Op (tok))
+   if (lltok_isOrOp (tok))
        {
          return TRUE;          
        }
@@ -1050,17 +1065,28 @@ static void exprNode_booleanTraverse (/*@dependent@*/ exprNode e, /*@unused@*/ b
   exprData data;
   lltok tok;
   constraintList tempList, temp;
+
+  if (exprNode_isUndefined(e) )
+    {
+      llassert (exprNode_isDefined(e) );
+      return;
+    }
+  
   data = e->edata;
   
   tok = exprData_getOpTok (data);
   t1 = exprData_getOpA (data);
   t2 = exprData_getOpB (data);
+
+  /* drl 3/2/2003 we know this because of the type of expression*/
+  llassert( exprNode_isDefined(t1) &&   exprNode_isDefined(t2) );
+  
   
   tempList = constraintList_undefined;
   
   /* arithmetic tests */
   
-  if (lltok_isEq_Op (tok))
+  if (lltok_isEqOp (tok))
     {
       cons =  constraint_makeEnsureEqual (t1, t2, sequencePoint);
       e->trueEnsuresConstraints = constraintList_add(e->trueEnsuresConstraints, cons);
@@ -1103,7 +1129,7 @@ static void exprNode_booleanTraverse (/*@dependent@*/ exprNode e, /*@unused@*/ b
   
   /* Logical operations */
   
-  if (lltok_isAnd_Op (tok))
+  if (lltok_isAndOp (tok))
     {
       /* true ensures  */
       tempList = constraintList_copy (t1->trueEnsuresConstraints);
@@ -1120,7 +1146,7 @@ static void exprNode_booleanTraverse (/*@dependent@*/ exprNode e, /*@unused@*/ b
       /* evans - was constraintList_addList - memory leak detected by splint */
       e->falseEnsuresConstraints = constraintList_addListFree (e->falseEnsuresConstraints, tempList);
     }
-  else if (lltok_isOr_Op (tok))
+  else if (lltok_isOrOp (tok))
     {
       /* false ensures */
       tempList = constraintList_copy (t1->falseEnsuresConstraints);
@@ -1144,7 +1170,7 @@ static void exprNode_booleanTraverse (/*@dependent@*/ exprNode e, /*@unused@*/ b
     } 
 }
 
-void exprNode_exprTraverse (exprNode e, bool definatelv, bool definaterv,  /*@observer@*/ /*@temp@*/ fileloc sequencePoint)
+void exprNode_exprTraverse (/*@dependent@*/ exprNode e, bool definatelv, bool definaterv,  /*@observer@*/ /*@temp@*/ fileloc sequencePoint)
 {
   exprNode t1, t2, fcn;
   lltok tok;
@@ -1210,7 +1236,6 @@ void exprNode_exprTraverse (exprNode e, bool definatelv, bool definaterv,  /*@ob
       exprNode_exprTraverse (exprData_getPairA (data), FALSE, TRUE, sequencePoint);
       exprNode_exprTraverse (exprData_getPairB (data), FALSE, TRUE, sequencePoint);
       
-      /*@i325 Should check which is array/index. */
       break;
       
     case XPR_PARENS: 
@@ -1292,7 +1317,7 @@ void exprNode_exprTraverse (exprNode e, bool definatelv, bool definaterv,  /*@ob
 
       break;
     case XPR_SIZEOFT:
-      /*@i43 drl possible problem : warning make sure the case can be ignored.. */
+      /*drl 4-11-03 I think this is the same as the next case...*/
       
       break;
       
@@ -1310,6 +1335,8 @@ void exprNode_exprTraverse (exprNode e, bool definatelv, bool definaterv,  /*@ob
       exprNode_exprTraverse (fcn, definatelv, definaterv, sequencePoint);
       DPRINTF ((message ("Got call that %s (%s) ",  exprNode_unparse(fcn),   exprNodeList_unparse (exprData_getArgs (data)))));
 
+      llassert( exprNode_isDefined(fcn) );
+               
       fcn->requiresConstraints = constraintList_addListFree (fcn->requiresConstraints,
                                                 checkCall (fcn, exprData_getArgs (data) ));      
 
@@ -1349,17 +1376,23 @@ void exprNode_exprTraverse (exprNode e, bool definatelv, bool definaterv,  /*@ob
       
     case XPR_PREOP: 
       t1 = exprData_getUopNode(data);
+
+      
+      /* drl 3/2/2003 we know this because of the type of expression*/
+      llassert( exprNode_isDefined(t1) );
+  
+      
       tok = (exprData_getUopTok (data));
       exprNode_exprTraverse (t1, definatelv, definaterv, sequencePoint);
       /*handle * pointer access */
-      if (lltok_isInc_Op (tok))
+      if (lltok_isIncOp (tok))
        {
          DPRINTF(("doing ++(var)"));
          t1 = exprData_getUopNode (data);
          cons = constraint_makeMaxSetSideEffectPostIncrement (t1, sequencePoint);
          e->ensuresConstraints = constraintList_add (e->ensuresConstraints, cons);
        }
-      else if (lltok_isDec_Op (tok))
+      else if (lltok_isDecOp (tok))
        {
          DPRINTF(("doing --(var)"));
          t1 = exprData_getUopNode (data);
@@ -1378,7 +1411,7 @@ void exprNode_exprTraverse (exprNode e, bool definatelv, bool definaterv,  /*@ob
            }
              e->requiresConstraints = constraintList_add(e->requiresConstraints, cons);
        }
-      else if (lltok_isNot_Op (tok))
+      else if (lltok_isNotOp (tok))
        /* ! expr */
        {
          constraintList_free(e->trueEnsuresConstraints);
@@ -1415,14 +1448,14 @@ void exprNode_exprTraverse (exprNode e, bool definatelv, bool definaterv,  /*@ob
       exprNode_exprTraverse (exprData_getUopNode (data), TRUE, 
                             definaterv, sequencePoint);
       
-      if (lltok_isInc_Op (exprData_getUopTok (data)))
+      if (lltok_isIncOp (exprData_getUopTok (data)))
        {
          DPRINTF(("doing ++"));
          t1 = exprData_getUopNode (data);
          cons = constraint_makeMaxSetSideEffectPostIncrement (t1, sequencePoint);
          e->ensuresConstraints = constraintList_add (e->ensuresConstraints, cons);
        }
-       if (lltok_isDec_Op (exprData_getUopTok (data)))
+       if (lltok_isDecOp (exprData_getUopTok (data)))
        {
          DPRINTF(("doing --"));
          t1 = exprData_getUopNode (data);
@@ -1545,13 +1578,13 @@ void exprNode_exprTraverse (exprNode e, bool definatelv, bool definaterv,  /*@ob
 
   e->requiresConstraints = constraintList_removeSurpressed(e->requiresConstraints);
   
-  DPRINTF((message ("ensures constraints for %s are %s", exprNode_unparse(e), constraintList_printDetailed(e->ensuresConstraints))));
+  DPRINTF((message ("ensures constraints for %s are %s", exprNode_unparse(e), constraintList_unparseDetailed(e->ensuresConstraints))));
 
-  DPRINTF((message ("Requires constraints for %s are %s", exprNode_unparse(e), constraintList_printDetailed(e->ensuresConstraints))));
+  DPRINTF((message ("Requires constraints for %s are %s", exprNode_unparse(e), constraintList_unparseDetailed(e->ensuresConstraints))));
   
-  DPRINTF((message ("trueEnsures constraints for %s are %s", exprNode_unparse(e), constraintList_printDetailed(e->trueEnsuresConstraints))));
+  DPRINTF((message ("trueEnsures constraints for %s are %s", exprNode_unparse(e), constraintList_unparseDetailed(e->trueEnsuresConstraints))));
 
-  DPRINTF((message ("falseEnsures constraints for %s are %s", exprNode_unparse(e), constraintList_printDetailed(e->falseEnsuresConstraints))));
+  DPRINTF((message ("falseEnsures constraints for %s are %s", exprNode_unparse(e), constraintList_unparseDetailed(e->falseEnsuresConstraints))));
 
   return;
 }
@@ -1645,7 +1678,6 @@ constraintList exprNode_traversTrueEnsuresConstraints (exprNode e)
       ret = constraintList_addListFree (ret,
                                     exprNode_traversTrueEnsuresConstraints
                                    (exprData_getFcn (data)));
-      /*@i11*/  /* exprNodeList_unparse (exprData_getArgs (data)); */
       break;
       
     case XPR_RETURN:
@@ -1778,7 +1810,6 @@ constraintList exprNode_traversFalseEnsuresConstraints (exprNode e)
       ret = constraintList_addListFree (ret,
                                     exprNode_traversFalseEnsuresConstraints
                                    (exprData_getFcn (data)));
-      /*@i11*/ /* exprNodeList_unparse (exprData_getArgs (data)); */
       break;
       
     case XPR_RETURN:
@@ -1914,7 +1945,6 @@ constraintList exprNode_traversFalseEnsuresConstraints (exprNode e)
       ret = constraintList_addListFree (ret,
                                     exprNode_traversRequiresConstraints
                                    (exprData_getFcn (data)));
-      /*@i11*/ /* exprNodeList_unparse (exprData_getArgs (data)); */
       break;
       
     case XPR_RETURN:
@@ -1988,7 +2018,7 @@ constraintList exprNode_traversFalseEnsuresConstraints (exprNode e)
   DPRINTF ((message ("exprnode_traversEnsuresConstraints call for %s with "
                     "constraintList of %s",
                     exprNode_unparse (e),
-                    constraintList_print(e->ensuresConstraints)
+                    constraintList_unparse(e->ensuresConstraints)
                     )
            ));
   
@@ -2057,7 +2087,6 @@ constraintList exprNode_traversFalseEnsuresConstraints (exprNode e)
       ret = constraintList_addListFree (ret,
                                        exprNode_traversEnsuresConstraints
                                        (exprData_getFcn (data)));
-      /*@i11*/ /* exprNodeList_unparse (exprData_getArgs (data)); */
       break;
     case XPR_RETURN:
       ret = constraintList_addListFree (ret,
@@ -2097,7 +2126,7 @@ constraintList exprNode_traversFalseEnsuresConstraints (exprNode e)
   DPRINTF((message ("exprnode_traversEnsuresConstraints call for %s with "
                    "constraintList of  is returning %s",
                    exprNode_unparse (e),
-                   constraintList_print(ret))));
+                   constraintList_unparse(ret))));
   
   return ret;
 }
@@ -2106,6 +2135,9 @@ constraintList exprNode_traversFalseEnsuresConstraints (exprNode e)
 void checkArgumentList (/*@out@*/ exprNode temp, exprNodeList arglist,
                        fileloc sequencePoint)
 {
+  
+  llassert(temp != NULL );
+  
   temp->requiresConstraints = constraintList_makeNew();
   temp->ensuresConstraints = constraintList_makeNew();
   temp->trueEnsuresConstraints = constraintList_makeNew();
@@ -2114,6 +2146,9 @@ void checkArgumentList (/*@out@*/ exprNode temp, exprNodeList arglist,
   exprNodeList_elements (arglist, el)
     {
       constraintList temp2;
+
+      llassert(exprNode_isDefined(el) );
+
       exprNode_exprTraverse (el, FALSE, FALSE, sequencePoint);
       temp2 = el->requiresConstraints;
       el->requiresConstraints = exprNode_traversRequiresConstraints(el);
@@ -2187,13 +2222,13 @@ we'll include it in a production release when its stable...
          invars = getInvariants(ct);
 
 
-         TPRINTF((message ("findStructs has invariants %s ", constraintList_print (invars))
+         TPRINTF((message ("findStructs has invariants %s ", constraintList_unparse (invars))
                   ));
          
          invars = constraintList_doSRefFixStructConstraint(invars, exprNode_getSref(expr), ct);
 
          
-         TPRINTF((message ("findStructs finded invariants to be %s ", constraintList_print (invars))
+         TPRINTF((message ("findStructs finded invariants to be %s ", constraintList_unparse (invars))
                   ));
        }
     }
@@ -2224,8 +2259,45 @@ constraintList checkCall (/*@dependent@*/ exprNode fcn, exprNodeList arglist)
       if (constraintList_isUndefined(preconditions))
        preconditions = constraintList_makeNew();
     }
+  
+  if (context_getFlag (FLG_IMPLICTCONSTRAINT) )
+    {
+
+      /*
+      uentryList_elements (arglist, el)
+       {
+         sRef s;
+         TPRINTF((message("setImplictfcnConstraints doing: %s", uentry_unparse(el) ) ));
+         
+         s = uentry_getSref(el);
+         if (sRef_isReference (s) )
+           {
+             TPRINTF((message ("%s is a pointer", sRef_unparse(s) ) ));
+           }
+         else
+           {
+             TPRINTF((message ("%s is NOT a pointer", sRef_unparse(s) ) ));
+           }
+         //drl 4/26/01
+         //chagned this from MaxSet(s) == 0 to MaxSet(s) >= 0 
+         c = constraint_makeSRefWriteSafeInt (s, 0);
+         
+         implicitFcnConstraints = constraintList_add(implicitFcnConstraints , c);
+         
+         //drl 10/23/2002 added support for out
+         if (!uentry_isOut(el) )
+           {
+             c = constraint_makeSRefReadSafeInt (s, 0);
+             implicitFcnConstraints = constraintList_add(implicitFcnConstraints , c);
+           }
+        
+         
+       }
+      */
+    }
+  
   DPRINTF ((message("Done checkCall\n")));
-  DPRINTF ((message("Returning list %q ", constraintList_printDetailed(preconditions))));
+  DPRINTF ((message("Returning list %q ", constraintList_unparseDetailed(preconditions))));
 
   /*
     drl we're going to comment this out for now
@@ -2245,7 +2317,6 @@ constraintList checkCall (/*@dependent@*/ exprNode fcn, exprNodeList arglist)
   I'm a bit nervous about modifying the exprNode
   but this is the easy way to do this
   If I have time I'd like to cause the exprNode to get created correctly in the first place */
-/*@i223*/
 void exprNode_findValue(exprNode e)
 {
   exprData data;
@@ -2253,6 +2324,8 @@ void exprNode_findValue(exprNode e)
   exprNode t1, t2;
   lltok tok;
 
+  llassert(exprNode_isDefined(e) );
   data = e->edata;
   
   if (exprNode_hasValue(e))
This page took 0.061279 seconds and 4 git commands to generate.