diff options
author | Richard Stallman <rms@gnu.org> | 1992-05-17 20:16:20 +0000 |
---|---|---|
committer | Richard Stallman <rms@gnu.org> | 1992-05-17 20:16:20 +0000 |
commit | 6dbf678a01473cf184ebb37e1cdd24ec2e86b99c (patch) | |
tree | e48e6434c00824ccb974e781dbbad22faca05cab | |
parent | 64309441e0685d95ea54f896d9eb91332afcac10 (diff) | |
download | gcc-6dbf678a01473cf184ebb37e1cdd24ec2e86b99c.zip gcc-6dbf678a01473cf184ebb37e1cdd24ec2e86b99c.tar.gz gcc-6dbf678a01473cf184ebb37e1cdd24ec2e86b99c.tar.bz2 |
*** empty log message ***
From-SVN: r1002
-rw-r--r-- | gcc/c-lex.c | 12 | ||||
-rw-r--r-- | gcc/toplev.c | 20 |
2 files changed, 25 insertions, 7 deletions
diff --git a/gcc/c-lex.c b/gcc/c-lex.c index e8759bc..7258157 100644 --- a/gcc/c-lex.c +++ b/gcc/c-lex.c @@ -1069,6 +1069,18 @@ yylex () if (lastiddecl != 0 && TREE_CODE (lastiddecl) == TYPE_DECL) value = TYPENAME; + /* A user-invisible read-only initialized variable + should be replaced by its value. + We handle only strings since that's the only case used in C. */ + else if (lastiddecl != 0 && TREE_CODE (lastiddecl) == VAR_DECL + && DECL_IGNORED_P (lastiddecl) + && TREE_READONLY (lastiddecl) + && DECL_INITIAL (lastiddecl) != 0 + && TREE_CODE (DECL_INITIAL (lastiddecl)) == STRING_CST) + { + yylval.ttype = DECL_INITIAL (lastiddecl); + value = STRING; + } else if (doing_objc_thang) { tree objc_interface_decl = lookup_interface (yylval.ttype); diff --git a/gcc/toplev.c b/gcc/toplev.c index 46fdcbc..248f407 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1906,13 +1906,19 @@ rest_of_decl_compilation (decl, asmspec, top_level, at_end) TIMEVAR (varconst_time, { make_decl_rtl (decl, asmspec, top_level); - /* Don't output anything - when a tentative file-scope definition is seen. - But at end of compilation, do output code for them. */ - if (! (! at_end && top_level - && (DECL_INITIAL (decl) == 0 - || DECL_INITIAL (decl) == error_mark_node))) - assemble_variable (decl, top_level, at_end); + /* For a user-invisible decl that should be replaced + by its value when used, don't output anything. */ + if (! (TREE_CODE (decl) == VAR_DECL + && DECL_IGNORED_P (decl) && TREE_READONLY (decl) + && DECL_INITIAL (decl) != 0)) + /* Don't output anything + when a tentative file-scope definition is seen. + But at end of compilation, do output code for them. */ + if (! (! at_end && top_level + && (DECL_INITIAL (decl) == 0 + || DECL_INITIAL (decl) == error_mark_node + || DECL_IGNORED_P (decl)))) + assemble_variable (decl, top_level, at_end); }); else if (TREE_REGDECL (decl) && asmspec != 0) { |