]> andersk Git - splint.git/blobdiff - src/sRefSet.c
noexpand always false.
[splint.git] / src / sRefSet.c
index 2bc16c9eedd3903baff3614a8111507ec88a164e..796d176463cb63bb6f3d894991dac9b249e4802d 100644 (file)
@@ -1,6 +1,6 @@
 /*
-** 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
@@ -17,9 +17,9 @@
 ** 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
@@ -29,7 +29,7 @@
 ** where T has T_equal (or change this) and T_unparse
 */
 
-# include "lclintMacros.nf"
+# include "splintMacros.nf"
 # include "basic.h"
 
 sRefSet
@@ -60,7 +60,7 @@ sRefSet_single (/*@exposed@*/ sRef sr)
   s->elements = (sRef *) dmalloc (sizeof (*s->elements) * sRefSetBASESIZE);
   s->elements[0] = sr;
 
-    return (s);
+  return (s);
 }
 
 static void
@@ -100,13 +100,13 @@ sRefSet_insert (sRefSet s, /*@exposed@*/ sRef el)
 
       llassert (s->elements != NULL);
       s->elements[s->entries] = el;
-
-            s->entries++;
+      s->entries++;
     }
   else
     {
-          }
-
+      ;
+    }
+  
   return s;
 }
 
@@ -130,7 +130,7 @@ sRefSet_clearStatics (sRefSet s)
   if (sRefSet_isDefined (s))
     {
       int i;
-
+      
       for (i = 0; i < s->entries; i++)
        {
          sRef current = s->elements[i];
@@ -194,7 +194,7 @@ sRefSet_choose (sRefSet s)
   return (s->elements[0]);
 }
 
-sRef
+/*@exposed@*/ sRef
 sRefSet_mergeIntoOne (sRefSet s)
 {
   sRef res;
@@ -211,10 +211,10 @@ sRefSet_mergeIntoOne (sRefSet s)
     {
       sRef tmp;
 
-            tmp = sRef_makeConj (res, s->elements[i]);
-            res = tmp;
+      tmp = sRef_makeConj (res, s->elements[i]);
+      res = tmp;
     }
-
+  
   return res;
 }
 
@@ -282,7 +282,7 @@ sRefSet_union (/*@returned@*/ sRefSet s1, sRefSet s2)
 
   if (sRefSet_isEmpty (s1))
     {
-      s1 = sRefSet_copy (s1, s2);
+      s1 = sRefSet_copyInto (s1, s2);
     }
   else
     {
@@ -308,7 +308,8 @@ sRefSet_unionExcept (/*@returned@*/ sRefSet s1, sRefSet s2, sRef ex)
     {
       if (sRef_same (el, ex))
        {
-               }
+         ;
+       }
       else
        {
          s1 = sRefSet_insert (s1, el);
@@ -421,8 +422,7 @@ sRefSet_levelPrune (sRefSet s, int lexlevel)
 ** s1 <- s2
 */
 
-sRefSet
-  sRefSet_copy (/*@returned@*/ sRefSet s1, /*@exposed@*/ sRefSet s2)
+sRefSet sRefSet_copyInto (/*@returned@*/ sRefSet s1, /*@exposed@*/ sRefSet s2)
 {
   int origentries;
   
@@ -582,6 +582,12 @@ sRefSet_hasRealElement (sRefSet s)
   return FALSE;
 }
 
+bool
+sRefSet_containsSameObject (sRefSet s, sRef el)
+{
+  return (sRefSet_isElementCompare (sRef_sameObject, s, el));
+}
+
 bool
 sRefSet_isSameMember (sRefSet s, sRef el)
 {
@@ -776,6 +782,31 @@ sRefSet_unparseDebug (sRefSet s)
   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)
 {
@@ -790,7 +821,7 @@ sRefSet_fixSrefs (sRefSet s)
          if (sRef_isLocalVar (current))
            {
              s->elements[i] = uentry_getSref (sRef_getUentry (current));
-                   }
+           }
        }
     }
 }
@@ -800,7 +831,8 @@ sRefSet_free (/*@only@*/ sRefSet s)
 {
   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);
@@ -839,13 +871,12 @@ sRefSet sRefSet_addIndirection (sRefSet 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;
@@ -858,14 +889,13 @@ sRefSet sRefSet_accessField (sRefSet s, /*@observer@*/ cstring f)
   /*
   ** 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))))
        {
@@ -996,3 +1026,12 @@ sRefSet_dump (sRefSet sl)
   return st;
 }
 
+void
+sRefSet_markImmutable (sRefSet s)
+{
+  sRefSet_allElements (s, el)
+    {
+      sRef_markImmutable (el);
+    } end_sRefSet_allElements;
+}
+
This page took 0.041029 seconds and 4 git commands to generate.