aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorAlex Samuel <samuel@codesourcery.com>1999-09-21 18:09:54 +0000
committerAlex Samuel <samuel@gcc.gnu.org>1999-09-21 18:09:54 +0000
commit5c7261ab87ea3e94b51b40cee621ebf6b665e952 (patch)
tree89263391f64cf9aef62e2594ccd56036bca0f0f5 /gcc/tree.c
parent3e3f78a69b9d2bf4608d5b04b907a9a13099971b (diff)
downloadgcc-5c7261ab87ea3e94b51b40cee621ebf6b665e952.zip
gcc-5c7261ab87ea3e94b51b40cee621ebf6b665e952.tar.gz
gcc-5c7261ab87ea3e94b51b40cee621ebf6b665e952.tar.bz2
Replace string const "<built-in>" with dynamic allocation.
* 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. From-SVN: r29552
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 752595c4..81942ce 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -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>")
tree global_trees[TI_MAX];
@@ -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. */