]> andersk Git - splint.git/blobdiff - src/idDecl.c
Fixed /*@i@*/ warning in splintme
[splint.git] / src / idDecl.c
index ebfc81a1c0e6009557fb8d19dea7359feea50433..4c0429c0dca2aacda4d7b86b934107b69646adb2 100644 (file)
@@ -1,6 +1,6 @@
 /*
 ** Splint - annotation-assisted static program checker
-** Copyright (C) 1994-2002 University of Virginia,
+** 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 information on splint: info@splint.org
+** To report a bug: splint-bug@splint.org
 ** For more information: http://www.splint.org
 */
 /*
 ** idDecl.c
 */
 
-# include "lclintMacros.nf"
+# include "splintMacros.nf"
 # include "basic.h"
 
 /*@only@*/ idDecl
@@ -175,6 +175,7 @@ idDecl_replaceCtype (/*@returned@*/ idDecl d, ctype c)
 {
   llassert (idDecl_isDefined (d));
 
+  DPRINTF (("Replace type: %s / %s", idDecl_unparse (d), ctype_unparse (c)));
   qtype_setType (d->typ, c);
   return d;
 }
@@ -223,10 +224,48 @@ idDecl_expectFunction (/*@returned@*/ idDecl d)
   return d;
 }
 
+/*
+** evans 2002-02-09: This is a bit of a kludge, but we 
+** need it to fix declarations like int (*p)[];
+*/
+
+void
+idDecl_notExpectingFunction (/*@returned@*/ idDecl d)
+{
+  if (idDecl_isDefined (d)) 
+    {
+      ctype ct = qtype_getType (d->typ);
+
+      if (ctype_isExpFcn (ct))
+       {
+         qtype_setType (d->typ, ctype_dontExpectFunction (ct));
+       }
+    }
+}
+
 void
 idDecl_addClauses (idDecl d, functionClauseList clauses)
 {
   llassert (idDecl_isDefined (d));
-  llassert (functionClauseList_isUndefined (d->clauses));
-  d->clauses = clauses;
+
+  /*
+    DRL comment out llassert:
+    
+    This breaks on sometypes of functionPointers.
+    I.e.
+    void (*signal (int sig ) @requires g >= 0 @ ) (int) @requires g >= 0 @ ;
+
+    llassert (functionClauseList_isUndefined (d->clauses));
+
+  */
+
+  if (functionClauseList_isUndefined (d->clauses) )
+    {
+      d->clauses = clauses;
+    }
+  else
+    {
+      functionClauseList_free(d->clauses);
+      d->clauses = clauses;
+    }
 }
This page took 0.038449 seconds and 4 git commands to generate.