]> andersk Git - splint.git/blobdiff - src/exprChecks.c
EXtensive code clean up. Almost passes LCLint.
[splint.git] / src / exprChecks.c
index 07765e239176a6f1cd379c25ada8a1cf4be3cb16..72be47c0fa520eebd45d6d003ffe6fdf9cb0315d 100644 (file)
@@ -884,6 +884,7 @@ void exprNode_checkFunctionBody (exprNode body)
            }
        }
 
+      /* drl added call*/
       exprNode_checkFunction (context_getHeader (), body);
       
       if (!checkret)
@@ -894,13 +895,16 @@ void exprNode_checkFunctionBody (exprNode body)
 }
 /*drl modified */
 
+extern constraintList implicitFcnConstraints;
+
 void exprNode_checkFunction (/*@unused@*/ uentry ue, /*@only@*/ exprNode body)
 {
   constraintList c, t;
+ constraintList c2, fix;
 
+ //  return;
 
-  //  return;
-  
+ //  context_setFlag(FLG_ORCONSTRAINT, TRUE);
   exprNode_generateConstraints (body);
   
   c =   uentry_getFcnPreconditions (ue);
@@ -911,14 +915,27 @@ void exprNode_checkFunction (/*@unused@*/ uentry ue, /*@only@*/ exprNode body)
   
    if (c)
      {
-       llassert (c);
+
        DPRINTF ( (message ("Function preconditions are %s \n\n\n\n\n", constraintList_printDetailed (c) ) ) );
        
        t = reflectChanges (body->requiresConstraints, constraintList_copy (c) );
        body->requiresConstraints = constraintList_copy (t);
+
+       c2  =  constraintList_copy (c);
+       fix =  constraintList_makeFixedArrayConstraints (body->uses);
+       c2  =  reflectChanges (c2, constraintList_copy(fix) );
+       if ( context_getFlag (FLG_ORCONSTRAINT) )
+        {
+          t = reflectChangesOr (body->requiresConstraints, constraintList_copy (c2) );
+        }
+       else
+        {
+          t = reflectChanges (body->requiresConstraints, constraintList_copy (c2) );
+        }
+       body->requiresConstraints = constraintList_copy (t);
        
-       DPRINTF ( (message ("The body has the required cosntraints: %s", constraintList_printDetailed (t) ) ) );
-   t = constraintList_mergeEnsures (c, body->ensuresConstraints);
+       DPRINTF ( (message ("The body has the required constraints: %s", constraintList_printDetailed (t) ) ) );
+       t = constraintList_mergeEnsures (c, body->ensuresConstraints);
 
    body->ensuresConstraints = constraintList_copy (t);
    
@@ -934,6 +951,14 @@ void exprNode_checkFunction (/*@unused@*/ uentry ue, /*@only@*/ exprNode body)
        DPRINTF((message ("The Function %s has no preconditions", uentry_unparse(ue) ) ) );
      }
 
+   if ( implicitFcnConstraints)
+     {
+          if (context_getFlag (FLG_IMPLICTCONSTRAINT) )
+             {
+               body->requiresConstraints = reflectChanges (body->requiresConstraints, constraintList_copy (implicitFcnConstraints) );
+             }
+     }
+   
    constraintList_printError(body->requiresConstraints, g_currentloc);
    constraintList_printError(body->ensuresConstraints, g_currentloc);
    
This page took 0.030226 seconds and 4 git commands to generate.