/*
-** LCLint - annotation-assisted static program checker
-** Copyright (C) 1994-2001 University of Virginia,
+** Splint - annotation-assisted static program checker
+** Copyright (C) 1994-2003 University of Virginia,
** Massachusetts Institute of Technology
**
** This program is free software; you can redistribute it and/or modify it
** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
** MA 02111-1307, USA.
**
-** For information on lclint: lclint-request@cs.virginia.edu
-** To report a bug: lclint-bug@cs.virginia.edu
-** For more information: http://lclint.cs.virginia.edu
+** For information on splint: info@splint.org
+** To report a bug: splint-bug@splint.org
+** For more information: http://www.splint.org
*/
/*
** functionConstraint.c
*/
-# include "lclintMacros.nf"
+# include "splintMacros.nf"
# include "basic.h"
-# include "mtincludes.h"
-static /*@only@*/ /*@notnull@*/ /*@special@*/ functionConstraint /*@i32 need special? @*/
+static /*@only@*/ /*@notnull@*/ /*@special@*/ functionConstraint
functionConstraint_alloc (functionConstraintKind kind) /*@defines result->kind@*/
{
functionConstraint res = (functionConstraint) dmalloc (sizeof (*res));
}
}
-extern constraintList functionConstraint_getBufferConstraint (functionConstraint node)
+extern constraintList functionConstraint_getBufferConstraints (functionConstraint node)
{
- llassert (functionConstraint_isDefined (node));
-
- if (node->kind == FCT_CONJUNCT)
+ if (functionConstraint_isDefined (node))
{
- if (functionConstraint_hasBufferConstraint (node->constraint.conjunct.op1))
+ if (node->kind == FCT_CONJUNCT)
{
- return functionConstraint_getBufferConstraint (node->constraint.conjunct.op1);
+ /* make sure this is safe*/
+ return constraintList_addListFree (functionConstraint_getBufferConstraints (node->constraint.conjunct.op1),
+ functionConstraint_getBufferConstraints (node->constraint.conjunct.op2));
}
else
{
- llassert (functionConstraint_hasBufferConstraint (node->constraint.conjunct.op2));
- return functionConstraint_getBufferConstraint (node->constraint.conjunct.op2);
+ if (node->kind == FCT_BUFFER)
+ {
+ return constraintList_copy (node->constraint.buffer);
+ }
+ else
+ {
+ return constraintList_undefined;
+ }
}
}
-
- llassert (node->kind == FCT_BUFFER);
- return node->constraint.buffer;
+ else
+ {
+ return constraintList_undefined;
+ }
}
-extern metaStateConstraint functionConstraint_getMetaStateConstraint (functionConstraint node)
+extern metaStateConstraintList functionConstraint_getMetaStateConstraints (functionConstraint node)
{
- llassert (functionConstraint_isDefined (node));
-
- if (node->kind == FCT_CONJUNCT)
+ if (functionConstraint_isDefined (node))
{
- if (functionConstraint_hasMetaStateConstraint (node->constraint.conjunct.op1))
+ if (node->kind == FCT_CONJUNCT)
{
- return functionConstraint_getMetaStateConstraint (node->constraint.conjunct.op1);
+ return metaStateConstraintList_append
+ (functionConstraint_getMetaStateConstraints (node->constraint.conjunct.op1),
+ functionConstraint_getMetaStateConstraints (node->constraint.conjunct.op2));
}
else
{
- llassert (functionConstraint_hasMetaStateConstraint (node->constraint.conjunct.op2));
- return functionConstraint_getMetaStateConstraint (node->constraint.conjunct.op2);
+ if (node->kind == FCT_METASTATE)
+ {
+ return metaStateConstraintList_single (node->constraint.metastate);
+ }
+ else
+ {
+ return metaStateConstraintList_undefined;
+ }
}
}
-
- llassert (node->kind == FCT_METASTATE);
- return node->constraint.metastate;
+ else
+ {
+ return metaStateConstraintList_undefined;
+ }
}
extern bool functionConstraint_hasBufferConstraint (functionConstraint node)
{
return functionConstraint_undefined;
}
+
+ BADBRANCHRET (functionConstraint_undefined);
}
extern void functionConstraint_free (/*@only@*/ functionConstraint node)
case FCT_CONJUNCT:
functionConstraint_free (node->constraint.conjunct.op1);
functionConstraint_free (node->constraint.conjunct.op2);
- BADDEFAULT;
+ break;
+ BADDEFAULT;
}
sfree (node);
}
}
+/*drl modified */
+void functionConstraint_addBufferConstraints (functionConstraint node, constraintList clist)
+{
+ constraintList temp;
-
-
-
-
-
-
-
+ temp = constraintList_copy (clist);
+
+ if (functionConstraint_isDefined (node))
+ {
+ if (node->kind == FCT_CONJUNCT)
+ {
+ functionConstraint_addBufferConstraints (node->constraint.conjunct.op1, constraintList_copy(temp) );
+ functionConstraint_addBufferConstraints (node->constraint.conjunct.op2,temp);
+ }
+ else
+ {
+ if (node->kind == FCT_BUFFER)
+ {
+ node->constraint.buffer = constraintList_addListFree(node->constraint.buffer, temp);
+ }
+ else
+ {
+ constraintList_free (temp);
+ return;
+ }
+ }
+ }
+ else
+ {
+ constraintList_free (temp);
+ return;
+ }
+}