# include "exprChecks.h"
# include "exprNodeSList.h"
-/*@i33*/
-
-/*@access exprNode@*/ /* !!! NO! Don't do this recklessly! */
-/*@-nullderef@*/ /* !!! DRL needs to fix this code! */
-/*@-nullstate@*/ /* !!! DRL needs to fix this code! */
-/*@-temptrans@*/ /* !!! DRL needs to fix this code! */
static /*@only@*/ cstring constraint_printDetailedPostCondition (/*@observer@*/ /*@temp@*/ constraint p_c);
void constraint_overWrite (constraint c1, constraint c2)
{
- llassert (constraint_isDefined (c1));
+ llassert (constraint_isDefined (c1) && constraint_isDefined (c2));
llassert (c1 != c2);
return ret;
}
+/*@access exprNode@*/
+
constraint constraint_addGeneratingExpr (/*@returned@*/ constraint c, /*@exposed@*/ exprNode e)
{
-
+
+ llassert (constraint_isDefined (c) );
+
if (c->generatingExpr == NULL)
{
c->generatingExpr = e;
}
return c;
}
+/*@noaccess exprNode@*/
constraint constraint_origAddGeneratingExpr (/*@returned@*/ constraint c, exprNode e)
{
-
+ llassert (constraint_isDefined (c) );
+
if (c->orig != constraint_undefined)
{
c->orig = constraint_addGeneratingExpr (c->orig, e);
constraint constraint_setFcnPre (/*@returned@*/ constraint c)
{
+ llassert (constraint_isDefined (c) );
+
if (c->orig != constraint_undefined)
{
c->orig->fcnPre = TRUE;
fileloc constraint_getFileloc (constraint c)
{
+
+ llassert (constraint_isDefined (c) );
+
if (exprNode_isDefined (c->generatingExpr))
return (fileloc_copy (exprNode_getfileloc (c->generatingExpr)));
-
+
return (constraintExpr_getFileloc (c->lexpr));
-
+
}
static bool checkForMaxSet (constraint c)
{
+
+ llassert (constraint_isDefined (c) );
+
if (constraintExpr_hasMaxSet (c->lexpr) || constraintExpr_hasMaxSet (c->expr))
return TRUE;
bool constraint_hasMaxSet (constraint c)
{
+
+ llassert (constraint_isDefined (c) );
+
if (checkForMaxSet (c))
return TRUE;
{
constraint ret;
- ret = constraint_makeReadSafeExprNode (t1, t2);
+ ret = constraint_makeReadSafeExprNode (t1, t2);
+ llassert (constraint_isDefined (ret) );
+
ret->lexpr = constraintExpr_setFileloc (ret->lexpr, sequencePoint);
ret->post = TRUE;
}
-exprNode exprNode_copyConstraints (/*@returned@*/ exprNode dst, exprNode src)
-{
- constraintList_free (dst->ensuresConstraints);
- constraintList_free (dst->requiresConstraints);
- constraintList_free (dst->trueEnsuresConstraints);
- constraintList_free (dst->falseEnsuresConstraints);
-
- dst->ensuresConstraints = constraintList_copy (src->ensuresConstraints);
- dst->requiresConstraints = constraintList_copy (src->requiresConstraints);
- dst->trueEnsuresConstraints = constraintList_copy (src->trueEnsuresConstraints);
- dst->falseEnsuresConstraints = constraintList_copy (src->falseEnsuresConstraints);
- return dst;
-}
/* Makes the constraint e = e + f */
constraint constraint_makeAddAssign (exprNode e, exprNode f, fileloc sequencePoint)
bool isLikely;
+
+ llassert (constraint_isDefined (c) );
+
/*drl 11/26/2001 avoid printing tautological constraints */
if (constraint_isAlwaysTrue (c))
{
cstring genExpr;
cstring st = cstring_undefined;
+
+ llassert (constraint_isDefined (c) );
+
+
st = constraint_print(c);
if (c->orig != constraint_undefined)
{
cstring st = cstring_undefined;
cstring genExpr;
-
+
+
+ llassert (constraint_isDefined (c) );
+
st = message ("Unsatisfied ensures constraint condition:\nSplint is unable to verify the constraint %q", constraint_printDeep (c));
genExpr = exprNode_unparse (c->generatingExpr);
cstring temp = cstring_undefined;
cstring genExpr;
bool isLikely;
-
+
+ llassert (constraint_isDefined (c) );
+
if (!c->post)
{
st = message ("Unable to resolve constraint:\n%q", constraint_printDeep (c));
constraint temp;
ret = cstring_undefined;
+
+ llassert (constraint_isDefined (c) );
+
temp = c;
ret = cstring_concatFree (ret, constraint_print (temp));
/*@only@*/ constraint constraint_doSRefFixBaseParam (/*@returned@*/ /*@only@*/ constraint precondition,
exprNodeList arglist)
{
+
+ llassert (constraint_isDefined (precondition) );
+
precondition->lexpr = constraintExpr_doSRefFixBaseParam (precondition->lexpr,
arglist);
precondition->expr = constraintExpr_doSRefFixBaseParam (precondition->expr,
constraint constraint_doFixResult (constraint postcondition, /*@dependent@*/ exprNode fcnCall)
{
postcondition = constraint_copy (postcondition);
+
+ llassert (constraint_isDefined (postcondition) );
+
+
postcondition->lexpr = constraintExpr_doFixResult (postcondition->lexpr, fcnCall);
postcondition->expr = constraintExpr_doFixResult (postcondition->expr, fcnCall);
{
precondition = constraint_copy (precondition);
+
+ llassert (constraint_isDefined (precondition) );
+
precondition->lexpr = constraintExpr_doSRefFixConstraintParam (precondition->lexpr, arglist);
precondition->expr = constraintExpr_doSRefFixConstraintParam (precondition->expr, arglist);
{
DPRINTF ((message ("Doing constraint_preserverOrig for %q ", constraint_printDetailed (c))));
-
+
+ llassert (constraint_isDefined (c) );
+
if (c->orig == constraint_undefined)
c->orig = constraint_copy (c);
/* avoid infinite loop */
c->orig = NULL;
c->orig = constraint_copy (c);
+ /*drl 03/2/2003 if c != NULL then the copy of c will != null*/
+ llassert (constraint_isDefined (c->orig) );
+
if (c->orig->orig == NULL)
{
c->orig->orig = temp;
constraint constraint_togglePost (/*@returned@*/ constraint c)
{
+ llassert (constraint_isDefined (c) );
+
c->post = !c->post;
return c;
}
constraint constraint_togglePostOrig (/*@returned@*/ constraint c)
{
+ llassert (constraint_isDefined (c) );
+
if (c->orig != NULL)
c->orig = constraint_togglePost (c->orig);
return c;
bool constraint_hasOrig ( /*@observer@*/ /*@temp@*/ constraint c)
{
- if (c->orig == NULL)
+
+ llassert (constraint_isDefined (c) );
+
+ if (c->orig == NULL)
return FALSE;
else
return TRUE;
s = fgets (os, MAX_DUMP_LINE_LENGTH, f);
- /*@i33*/ /*this should probably be wrappered...*/
+ if (! mstring_isDefined(s) )
+ {
+ llfatalbug(message("Library file is corrupted") );
+ }
fcnPre = (bool) reader_getInt (&s);
advanceField (&s);
s = fgets (os, MAX_DUMP_LINE_LENGTH, f);
+ if (! mstring_isDefined(s) )
+ {
+ llfatalbug(message("Library file is corrupted") );
+ }
+
reader_checkChar (&s, 'l');
lexpr = constraintExpr_undump (f);
s = fgets (os, MAX_DUMP_LINE_LENGTH, f);
reader_checkChar (&s, 'r');
+
+ if (! mstring_isDefined(s) )
+ {
+ llfatalbug(message("Library file is corrupted") );
+ }
+
expr = constraintExpr_undump (f);
c = constraint_makeNew ();
constraintExpr lexpr;
constraintExpr expr;
-
+ llassert (constraint_isDefined (c) );
+
fcnPre = c->fcnPre;
post = c->post;
ar = c->ar;
static int constraint_getDepth (/*@observer@*/ /*@temp@*/ constraint c)
{
int l , r;
-
+
+ llassert (constraint_isDefined (c) );
+
l = constraintExpr_getDepth (c->lexpr);
r = constraintExpr_getDepth (c->expr);
bool constraint_isConstantOnly (constraint c)
{
bool l, r;
-
+
+ llassert (constraint_isDefined (c) );
+
l = constraintExpr_isConstantOnly(c->lexpr);
r = constraintExpr_isConstantOnly(c->expr);