/*
-** LCLint - annotation-assisted static program checker
-** Copyright (C) 1994-2000 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
*/
/*
** sRefSet.c
** where T has T_equal (or change this) and T_unparse
*/
-# include "lclintMacros.nf"
+# include "splintMacros.nf"
# include "basic.h"
sRefSet
s->elements = (sRef *) dmalloc (sizeof (*s->elements) * sRefSetBASESIZE);
s->elements[0] = sr;
- return (s);
+ return (s);
}
static void
llassert (s->elements != NULL);
s->elements[s->entries] = el;
-
- s->entries++;
+ s->entries++;
}
else
{
- }
-
+ ;
+ }
+
return s;
}
if (sRefSet_isDefined (s))
{
int i;
-
+
for (i = 0; i < s->entries; i++)
{
sRef current = s->elements[i];
return (s->elements[0]);
}
-sRef
+/*@exposed@*/ sRef
sRefSet_mergeIntoOne (sRefSet s)
{
sRef res;
{
sRef tmp;
- tmp = sRef_makeConj (res, s->elements[i]);
- res = tmp;
+ tmp = sRef_makeConj (res, s->elements[i]);
+ res = tmp;
}
-
+
return res;
}
if (sRefSet_isEmpty (s1))
{
- s1 = sRefSet_copy (s1, s2);
+ s1 = sRefSet_copyInto (s1, s2);
}
else
{
{
if (sRef_same (el, ex))
{
- }
+ ;
+ }
else
{
s1 = sRefSet_insert (s1, el);
** s1 <- s2
*/
-sRefSet
- sRefSet_copy (/*@returned@*/ sRefSet s1, /*@exposed@*/ sRefSet s2)
+sRefSet sRefSet_copyInto (/*@returned@*/ sRefSet s1, /*@exposed@*/ sRefSet s2)
{
int origentries;
return FALSE;
}
+bool
+sRefSet_containsSameObject (sRefSet s, sRef el)
+{
+ return (sRefSet_isElementCompare (sRef_sameObject, s, el));
+}
+
bool
sRefSet_isSameMember (sRefSet s, sRef el)
{
return st;
}
+cstring
+sRefSet_unparseFull (sRefSet s)
+{
+ int i;
+ cstring st = cstring_makeLiteral ("{");
+
+ if (sRefSet_isDefined (s))
+ {
+ for (i = 0; i < sRefSet_size (s); i++)
+ {
+ if (i == 0)
+ {
+ st = message ("%q %q", st, sRef_unparseFull (s->elements[i]));
+ }
+ else
+ {
+ st = message ("%q, %q", st, sRef_unparseFull (s->elements[i]));
+ }
+ }
+ }
+
+ st = message ("%q }", st);
+ return st;
+}
+
void
sRefSet_fixSrefs (sRefSet s)
{
if (sRef_isLocalVar (current))
{
s->elements[i] = uentry_getSref (sRef_getUentry (current));
- }
+ }
}
}
}
{
if (!sRefSet_isUndefined (s))
{
- llassertprint (s->entries < 1000, ("sRefSet free size: %d", s->entries));
+ /* evans 2003-10-20: increase size sanity limit from 1000 */
+ llassertprint (s->entries < 99999, ("sRefSet free size: %d", s->entries));
sfree (s->elements);
sfree (s);
sRefSet_allElements (s, el)
{
ctype ct = ctype_realType (sRef_getType (el));
-
+
if ((ctype_isArrayPtr (ct)))
{
sRef a = sRef_constructPointer (el);
-
t = sRefSet_insert (t, a);
}
} end_sRefSet_allElements;
/*
** returns a NEW sRefSet containing references to all sRef's in s
*/
-
+
sRefSet t = sRefSet_new ();
-
sRefSet_allElements (s, el)
{
ctype ct = ctype_realType (sRef_getType (el));
-
+
if ((ctype_isStruct (ct) || ctype_isUnion (ct))
&& (!uentry_isUndefined (uentryList_lookupField (ctype_getFields (ct), f))))
{
return st;
}
+void
+sRefSet_markImmutable (sRefSet s)
+{
+ sRefSet_allElements (s, el)
+ {
+ sRef_markImmutable (el);
+ } end_sRefSet_allElements;
+}
+