cp-tree.h (permanent_p): New function.
authorMark Mitchell <mark@codesourcery.com>
Sun, 16 May 1999 19:31:51 +0000 (19:31 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Sun, 16 May 1999 19:31:51 +0000 (19:31 +0000)
* cp-tree.h (permanent_p): New function.
* init.c (build_new_1): Use mapcar, not copy_node, to copy a
possibly complex tree node.
* tree.c (mapcar): Adjust comments, and follow coding standards in
conditional.
(permanent_p): New function.

From-SVN: r26951

gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/init.c
gcc/cp/tree.c

index ceb0df70f6c350f2049ea3c907a4e2d5f3d6ea21..2a16a395bc48970589413849c58b3f8f46072901 100644 (file)
@@ -1,3 +1,12 @@
+1999-05-16  Mark Mitchell  <mark@codesourcery.com>
+
+       * cp-tree.h (permanent_p): New function.
+       * init.c (build_new_1): Use mapcar, not copy_node, to copy a
+       possibly complex tree node.
+       * tree.c (mapcar): Adjust comments, and follow coding standards in
+       conditional.
+       (permanent_p): New function.
+
 1999-05-13  Per Bothner  <bothner@cygnus.com>
 
        * class.c (push_lang_context):  Turn off DECL_IGNORED_P for
index 955bf0a0e97ee6576a40e444a9602c7c59dc0f77..7c517c0dbdc4d960153fa040927c3645449cd373 100644 (file)
@@ -3357,6 +3357,7 @@ extern char *lang_printable_name          PROTO((tree, int));
 extern tree build_exception_variant            PROTO((tree, tree));
 extern tree copy_template_template_parm                PROTO((tree));
 extern tree copy_to_permanent                  PROTO((tree));
+extern tree permanent_p                         PROTO((tree));
 extern void print_lang_statistics              PROTO((void));
 extern void __eprintf
        PROTO((const char *, const char *, unsigned, const char *));
index 39736ce9199623652ac577be0bf744fd85e84f92..7fb203007dea9bc2ee6a41272339b376fac3e902 100644 (file)
@@ -2430,7 +2430,7 @@ build_new_1 (exp)
            }
 
          /* Copy size to the saveable obstack.  */
-         size = copy_node (size);
+         size = mapcar (size, permanent_p);
 
          cleanup = build_op_delete_call (dcode, alloc_node, size, flags, fn);
 
index 9012810d051d5cc3d3a600267a4bf80638e21faa..bf16fe2a0c5ccc53c51f50a4ddaa8b66c66c2f9f 100644 (file)
@@ -1724,10 +1724,8 @@ no_linkage_check (t)
 }
 
 
-/* Subroutine of copy_to_permanent
-
-   Assuming T is a node build bottom-up, make it all exist on
-   permanent obstack, if it is not permanent already.  */
+/* Make copies of all the nodes below T.  If FUNC is non-NULL, call it
+   for each node.  */
 
 tree
 mapcar (t, func)
@@ -1739,8 +1737,12 @@ mapcar (t, func)
   if (t == NULL_TREE)
     return t;
 
-  if (tmp = func (t), tmp != NULL_TREE)
-    return tmp;
+  if (func) 
+    {
+      tmp = func (t);
+      if (tmp)
+       return tmp;
+    }
 
   switch (TREE_CODE (t))
     {
@@ -1984,6 +1986,16 @@ mapcar (t, func)
   return NULL_TREE;
 }
 
+/* Returns T if T is allocated on the permanent obstack, NULL_TREE
+   otherwise.  */
+
+tree
+permanent_p (t)
+     tree t;
+{
+  return TREE_PERMANENT (t) ? t : NULL_TREE;
+}
+
 static tree
 perm_manip (t)
      tree t;