]> andersk Git - splint.git/blobdiff - src/exprChecks.c
Fixed line numbering when multi-line macro parameters are used.
[splint.git] / src / exprChecks.c
index 75ce7f386d68a1a0b9ac61ac172fc91b88280264..4b3b81db593fbb0c26172eaef5f59be0a014b157 100644 (file)
@@ -52,11 +52,36 @@ static void checkSafeReturnExpr (/*@notnull@*/ exprNode p_e);
 **
 */
 
+static int inCompoundStatementExpression = 0;
+
+void
+exprChecks_inCompoundStatementExpression (void)
+{
+  inCompoundStatementExpression++;
+}
+
+void
+exprChecks_leaveCompoundStatementExpression (void)
+{
+  inCompoundStatementExpression--;
+  llassert (inCompoundStatementExpression >= 0);
+}
+
 void
-exprNode_checkStatement (exprNode e)
+exprChecks_checkStatementEffect (exprNode e)
 {
   bool hasError = FALSE;
 
+  if (inCompoundStatementExpression > 0)
+    {
+      /*
+      ** Okay to have effectless statments in compound statement expression (should check
+      ** it is the last statement, but we don't for now).
+      */
+
+      return;
+    }
+
   if (!exprNode_isError (e))
     {
       exprKind ek = e->kind;
@@ -913,17 +938,14 @@ void exprNode_checkFunctionBody (exprNode body)
 /*drl modified */
 
 
-void exprNode_checkFunction (/*@unused@*/ uentry ue, /*@only@*/ exprNode fcnBody)
+void exprNode_checkFunction (/*@unused@*/ uentry ue, /*@only@*/ exprNode body)
 {
   constraintList c, t, post;
   constraintList c2, fix;
   constraintList implicitFcnConstraints;
-
-  /*@owned@*/ exprNode body;
-
   context_enterInnerContext ();
 
-  body = fcnBody;
+  llassert (exprNode_isDefined (body));
 
   /*
     if we're not going to be printing any errors for buffer overflows
@@ -948,7 +970,8 @@ void exprNode_checkFunction (/*@unused@*/ uentry ue, /*@only@*/ exprNode fcnBody
        }
     }
   
-  exprNode_generateConstraints (body);
+  exprNode_generateConstraints (body); /* evans 2002-03-02: this should not be declared to take a
+                                         dependent... fix it! */
   
   c =   uentry_getFcnPreconditions (ue);
   DPRINTF(("function constraints\n"));
This page took 0.034715 seconds and 4 git commands to generate.