OSDN Git Service

* cppinit.c (cpp_cleanup): Free include dir chains.
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 17 Aug 2000 18:01:43 +0000 (18:01 +0000)
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 17 Aug 2000 18:01:43 +0000 (18:01 +0000)
* cpplib.c (do_undef): Let _cpp_free_definition make the node void.
(do_unassert): Free the assert with _cpp_free_definition.
* cppmacro.c (_cpp_free_definition): Free memory allocated for
assertions.  Make the node a T_VOID node.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35765 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/cppinit.c
gcc/cpplib.c
gcc/cppmacro.c

index 072c5ac..9b8739b 100644 (file)
@@ -1,5 +1,13 @@
 2000-08-17  Neil Booth  <NeilB@earthling.net>
 
+       * cppinit.c (cpp_cleanup): Free include dir chains.
+       * cpplib.c (do_undef): Let _cpp_free_definition make the node void.
+       (do_unassert): Free the assert with _cpp_free_definition.
+       * cppmacro.c (_cpp_free_definition): Free memory allocated for
+       assertions.  Make the node a T_VOID node.
+
+2000-08-17  Neil Booth  <NeilB@earthling.net>
+
        * cppinit.c (path_include, append_include_chain):
        Remove 2nd parameter (struct cpp_pending *).
        (path_include, initialize_standard_includes, cpp_handle_option):
index 0cb90ab..e91f1be 100644 (file)
@@ -467,6 +467,8 @@ void
 cpp_cleanup (pfile)
      cpp_reader *pfile;
 {
+  struct file_name_list *dir, *next;
+
   while (CPP_BUFFER (pfile) != NULL)
     cpp_pop_buffer (pfile);
 
@@ -480,6 +482,13 @@ cpp_cleanup (pfile)
   _cpp_cleanup_includes (pfile);
   _cpp_cleanup_stacks (pfile);
   _cpp_cleanup_macros (pfile);
+
+  for (dir = CPP_OPTION (pfile, quote_include); dir; dir = next)
+    {
+      next = dir->next;
+      free (dir->name);
+      free (dir);
+    }
 }
 
 
index 9daee3e..bc50452 100644 (file)
@@ -298,7 +298,6 @@ do_undef (pfile)
        cpp_warning (pfile, "undefining \"%s\"", node->name);
 
       _cpp_free_definition (node);
-      node->type = T_VOID;
     }
 }
 
@@ -1369,14 +1368,7 @@ do_unassert (pfile)
                node->type = T_VOID;
            }
          else
-           {
-             for (temp = node->value.answers; temp; temp = next)
-               {
-                 next = temp->next;
-                 FREE_ANSWER (temp);
-               }
-             node->type = T_VOID;
-           }
+           _cpp_free_definition (node);
        }
 
       if (answer)
index ade67d7..3c9ffb9 100644 (file)
@@ -404,6 +404,18 @@ _cpp_free_definition (h)
 {
   if (h->type == T_MACRO)
     free ((PTR) h->value.expansion);
+  else if (h->type == T_ASSERTION)
+    {
+      struct answer *temp, *next;
+
+      for (temp = h->value.answers; temp; temp = next)
+       {
+         next = temp->next;
+         FREE_ANSWER (temp);
+       }
+    }
+
+  h->type = T_VOID;
   h->value.expansion = NULL;
 }