OSDN Git Service

Replace string const "<built-in>" with dynamic allocation.
authorsamuel <samuel@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 21 Sep 1999 18:09:54 +0000 (18:09 +0000)
committersamuel <samuel@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 21 Sep 1999 18:09:54 +0000 (18:09 +0000)
* tree.c (built_in_filename): New variable.
(BUILT_IN_FILENAME): New macro.
(init_tree_codes): Allocate built_in_filename.
(make_node): Use built_in_filename instead of string constant.

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

gcc/ChangeLog
gcc/tree.c

index ece5f0d..0eb093a 100644 (file)
@@ -1,3 +1,10 @@
+Tue Sep 21 11:04:34 1999  Alex Samuel  <samuel@codesourcery.com>
+
+       * tree.c (built_in_filename): New variable.
+       (BUILT_IN_FILENAME): New macro.
+       (init_tree_codes): Allocate built_in_filename.
+       (make_node): Use built_in_filename instead of string constant.
+
 Tue Sep 21 14:13:27 1999  Nick Clifton  <nickc@cygnus.com>
 
        * configure.in: Add fr30 target.
index 752595c..81942ce 100644 (file)
@@ -278,6 +278,13 @@ static void fix_sizetype PROTO ((tree));
 /* If non-null, a language specific helper for unsave_expr_now. */
 
 void (*lang_unsave_expr_now) PROTO((tree));
+
+/* The string used as a placeholder instead of a source file name for
+   built-in tree nodes.  The variable, which is dynamically allocated,
+   should be used; the macro is only used to initialize it.  */
+
+static char *built_in_filename;
+#define BUILT_IN_FILENAME ("<built-in>")
 \f
 tree global_trees[TI_MAX];
 \f
@@ -867,7 +874,9 @@ resume_momentary (yes)
 void
 init_tree_codes ()
 {
-  
+  built_in_filename = 
+    ggc_alloc_string (BUILT_IN_FILENAME, sizeof (BUILT_IN_FILENAME));
+  ggc_add_string_root (&built_in_filename, 1);
 }
 
 /* Return a newly allocated node of code CODE.
@@ -1044,7 +1053,8 @@ make_node (code)
       DECL_IN_SYSTEM_HEADER (t)
        = in_system_header && (obstack == &permanent_obstack);
       DECL_SOURCE_LINE (t) = lineno;
-      DECL_SOURCE_FILE (t) = (input_filename) ? input_filename : "<built-in>";
+      DECL_SOURCE_FILE (t) = 
+       (input_filename) ? input_filename : built_in_filename;
       DECL_UID (t) = next_decl_uid++;
       /* Note that we have not yet computed the alias set for this
         declaration.  */