diff options
author | Alex Samuel <samuel@codesourcery.com> | 1999-09-21 18:14:26 +0000 |
---|---|---|
committer | Alex Samuel <samuel@gcc.gnu.org> | 1999-09-21 18:14:26 +0000 |
commit | f3cdb9c694c0384e5cb59af694afc3ce01cc688d (patch) | |
tree | ed9bf6e0492df78ea611e210027f85260d62fbb4 | |
parent | 5c7261ab87ea3e94b51b40cee621ebf6b665e952 (diff) | |
download | gcc-f3cdb9c694c0384e5cb59af694afc3ce01cc688d.zip gcc-f3cdb9c694c0384e5cb59af694afc3ce01cc688d.tar.gz gcc-f3cdb9c694c0384e5cb59af694afc3ce01cc688d.tar.bz2 |
Replace string const "<internal>" with dynamic allocation.
* lex.c (internal_filename): New variable.
(INTERNAL_FILENAME): New macro.
(init_parse): Allocate internal_filename and mark as root. Use it
instead of a string constant.
From-SVN: r29553
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/lex.c | 11 |
2 files changed, 17 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2feaf83..2fc11ec 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +1999-09-21 Alex Samuel <samuel@codesourcery.com> + + * lex.c (internal_filename): New variable. + (INTERNAL_FILENAME): New macro. + (init_parse): Allocate internal_filename and mark as root. Use it + instead of a string constant. + 1999-09-21 Nathan Sidwell <nathan@acm.org> Reimplement dynamic cast and catch matching. diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index e714dff..af78b7f 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -213,6 +213,11 @@ struct impl_files static struct impl_files *impl_file_chain; +/* The string used to represent the filename of internally generated + tree nodes. The variable, which is dynamically allocated, should + be used; the macro is only used to initialize it. */ +static char *internal_filename; +#define INTERNAL_FILENAME ("<internal>") /* Return something to represent absolute declarators containing a *. TARGET is the absolute declarator that the * contains. @@ -720,10 +725,13 @@ init_parse (filename) gcc_obstack_init (&inline_text_obstack); inline_text_firstobj = (char *) obstack_alloc (&inline_text_obstack, 0); + internal_filename = ggc_alloc_string (INTERNAL_FILENAME, + sizeof (INTERNAL_FILENAME)); + /* Start it at 0, because check_newline is called at the very beginning and will increment it to 1. */ lineno = 0; - input_filename = "<internal>"; + input_filename = internal_filename; current_function_decl = NULL; maxtoken = 40; @@ -915,6 +923,7 @@ init_parse (filename) ggc_add_tree_root (ansi_opname, LAST_CPLUS_TREE_CODE); ggc_add_tree_root (ansi_assopname, LAST_CPLUS_TREE_CODE); + ggc_add_string_root (&internal_filename, 1); ggc_add_tree_root (ridpointers, RID_MAX); ggc_add_tree_root (&defarg_fns, 1); ggc_add_tree_root (&defarg_parm, 1); |