X-Git-Url: http://andersk.mit.edu/gitweb/splint.git/blobdiff_plain/155af98de2d41917730964947d990b7fb70ddc01..312c981596ce6202de7686f2d4c46aec1bae3939:/src/exprChecks.c?ds=sidebyside diff --git a/src/exprChecks.c b/src/exprChecks.c index 75ce7f3..4b3b81d 100644 --- a/src/exprChecks.c +++ b/src/exprChecks.c @@ -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"));