]> andersk Git - splint.git/blobdiff - src/macrocache.c
Removed /*bee:...*/ comments.
[splint.git] / src / macrocache.c
index 2db8944e3476a4e099944e854c539039dd36178b..881b0940288f4fce3f21f54bb1df1073f90a1a96 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
 */
 /*
 ** macrocache.c
@@ -29,7 +29,7 @@
 **
 */
 
-# include "lclintMacros.nf"
+# include "splintMacros.nf"
 # include "llbasic.h"
 # include "llmain.h"
 
@@ -43,7 +43,7 @@
 ** Temporary file used for processing macros.
 */
 
-static /*@null@*/ FILE *s_macFile = NULL;
+static /*:open:*/ /*@null@*/ FILE *s_macFile = NULL;
 
 /*
 ** mcDisable is set to TRUE when a macro is being processed, so
@@ -97,7 +97,7 @@ macrocache_free (macrocache s)
 
   for (i = 0; i < s->entries; i++)
     {
-      mce_free (s->contents[i]);
+       mce_free (s->contents[i]);
     }
 
   sfree (s->contents);
@@ -115,7 +115,7 @@ macrocache_grow (macrocache s)
 
   for (i = 0; i < s->entries; i++)
     {
-      s->contents[i] = oldcontents[i];
+       s->contents[i] = oldcontents[i];
     }
 
   sfree (oldcontents);
@@ -136,7 +136,7 @@ macrocache_addGenEntry (macrocache s, /*@only@*/ fileloc fl,
 
   if ((i = macrocache_exists (s, fl)) != DNE)
     {
-      if (cstring_equal (def, s->contents[i]->def))
+        if (cstring_equal (def, s->contents[i]->def))
        {
          fileloc_free (fl);
          cstring_free (def);
@@ -153,7 +153,7 @@ macrocache_addGenEntry (macrocache s, /*@only@*/ fileloc fl,
          */
          
          cstring_free (s->contents[i]->def);
-         s->contents[i]->def = def;
+           s->contents[i]->def = def;
 
          fileloc_free (fl);
          return;
@@ -165,7 +165,7 @@ macrocache_addGenEntry (macrocache s, /*@only@*/ fileloc fl,
   }
 
   s->nspace--;
-  s->contents[s->entries] = mce_create (fl, def, sup);
+    s->contents[s->entries] = mce_create (fl, def, sup);
   s->entries++;
 }
 
@@ -179,6 +179,7 @@ macrocache_addEntry (macrocache s, /*@only@*/ fileloc fl, /*@only@*/ cstring def
 void
 macrocache_addComment (macrocache s, /*@only@*/ fileloc fl, /*@only@*/ cstring def)
 {
+  DPRINTF (("Macrocache add comment: %s / %s", fileloc_unparse (fl), def));
   macrocache_addGenEntry (s, fl, def, TRUE);
 }
 
@@ -189,7 +190,7 @@ macrocache_exists (macrocache s, fileloc fl)
 
   for (i = 0; i < s->entries; i++)
     {
-      if (fileloc_equal (s->contents[i]->fl, fl))
+        if (fileloc_equal (s->contents[i]->fl, fl))
        return (i);
     }
 
@@ -204,7 +205,7 @@ macrocache_unparse (macrocache m)
 
   for (i = 0; i < m->entries; i++)
     {
-      fileloc fl = m->contents[i]->fl;
+        fileloc fl = m->contents[i]->fl;
       cstring def = m->contents[i]->def;
       bool defined = m->contents[i]->defined;
       
@@ -235,8 +236,8 @@ static void pushString (/*@only@*/ cstring s)
       cstring fname;
       mtid = fileTable_addMacrosFile (context_fileTable ());
       
-      fname = fileName (mtid);
-      s_macFile = fopen (cstring_toCharsSafe (fname), "wb+");
+      fname = fileTable_fileName (mtid);
+      s_macFile = fileTable_createMacrosFile (context_fileTable (), fname); /* , "wb+"); ? **/
       
       if (s_macFile == NULL)
        {
@@ -276,9 +277,9 @@ static void pushString (/*@only@*/ cstring s)
 static void
 macrocache_processMacro (macrocache m, int i)
 {
-  fileloc fl = m->contents[i]->fl;
+    fileloc fl = m->contents[i]->fl;
    
-  m->contents[i]->defined = TRUE;
+    m->contents[i]->defined = TRUE;
 
   if (!fileId_equal (currentFile (), fileloc_fileId (fl)))
     {
@@ -313,11 +314,15 @@ macrocache_processMacro (macrocache m, int i)
 
       if (context_inSuppressRegion () && !insup)
        {
-         llerrorlit (FLG_SYNTAX, "Macro ends in ignore region");
+         voptgenerror
+           (FLG_SYNTAX, 
+            message ("Macro ends in ignore region: %s", m->contents[i]->def),
+            fl);
        }
     }
   
   incLine ();  
+  context_exitAllClauses ();
   context_exitMacroCache ();
 }
 
@@ -334,7 +339,7 @@ extern void macrocache_processUndefinedElements (macrocache m)
     {
       for (i = 0; i < m->entries; i++) 
        {
-         if (m->contents[i]->defined)
+           if (m->contents[i]->defined)
            {
              ;
            }
@@ -348,12 +353,10 @@ extern void macrocache_processUndefinedElements (macrocache m)
                }
              else
                {
-                 if (context_getFlag (FLG_SHOWSCAN))
+                 if (!fileloc_isLib (fl))
                    {
-                     if (!fileloc_isLib (fl))
-                       {
-                         lldiagmsg (message ("< checking macros %s >", fileloc_filename (fl)));
-                       }
+                     displayScan (message ("checking macros %q",
+                                           fileloc_outputFilename (fl)));
                    }
                  
                  lastfl = fl;
@@ -377,7 +380,7 @@ extern /*@observer@*/ fileloc macrocache_processFileElements (macrocache m, cstr
 
   for (i = 0; i < m->entries; i++) 
     {
-      if (m->contents[i]->defined)
+        if (m->contents[i]->defined)
        {
          ;
        }
@@ -402,7 +405,7 @@ void macrocache_finalize (void)
 {
   if (s_macFile != NULL)
     {
-      check (fclose (s_macFile) == 0);
+      check (fileTable_closeFile (context_fileTable (), s_macFile));
       s_macFile = NULL;
     }
 }
This page took 0.114828 seconds and 4 git commands to generate.