diff options
author | Jason Merrill <jason@redhat.com> | 2000-08-27 21:44:28 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2000-08-27 21:44:28 -0400 |
commit | edb4c415dc1288c0137de8fa0cbb8a36376223c3 (patch) | |
tree | 61fc1ad13675eb3e6b0c792709c98b4f16062357 /gcc | |
parent | 94dfccd136eece4162a4c78bcc14b3fa61767c0e (diff) | |
download | gcc-edb4c415dc1288c0137de8fa0cbb8a36376223c3.zip gcc-edb4c415dc1288c0137de8fa0cbb8a36376223c3.tar.gz gcc-edb4c415dc1288c0137de8fa0cbb8a36376223c3.tar.bz2 |
c-decl.c (duplicate_decls): Don't set TREE_STATIC or clear DECL_EXTERNAL on a local extern.
* c-decl.c (duplicate_decls): Don't set TREE_STATIC or clear
DECL_EXTERNAL on a local extern. Don't set DECL_IGNORED_P or
TREE_ASM_WRITTEN, either.
(finish_decl): Adjust.
From-SVN: r36012
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/c-decl.c | 32 |
2 files changed, 19 insertions, 20 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fba2d7d..14ade14 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2000-08-27 Jason Merrill <jason@redhat.com> + + * c-decl.c (duplicate_decls): Don't set TREE_STATIC or clear + DECL_EXTERNAL on a local extern. Don't set DECL_IGNORED_P or + TREE_ASM_WRITTEN, either. + (finish_decl): Adjust. + 2000-08-28 Philipp Thomas <pthomas@suse.de> * ABOUT-GCC-NLS: Remove gettext patches from Paul Eggert as diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 2e336f4..5404a4f 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -1947,8 +1947,14 @@ duplicate_decls (newdecl, olddecl, different_binding_level) } if (DECL_EXTERNAL (newdecl)) { - TREE_STATIC (newdecl) = TREE_STATIC (olddecl); - DECL_EXTERNAL (newdecl) = DECL_EXTERNAL (olddecl); + if (! different_binding_level) + { + /* Don't mess with these flags on local externs; they remain + external even if there's a declaration at file scope which + isn't. */ + TREE_STATIC (newdecl) = TREE_STATIC (olddecl); + DECL_EXTERNAL (newdecl) = DECL_EXTERNAL (olddecl); + } /* An extern decl does not override previous storage class. */ TREE_PUBLIC (newdecl) = TREE_PUBLIC (olddecl); if (! DECL_EXTERNAL (newdecl)) @@ -2007,19 +2013,7 @@ duplicate_decls (newdecl, olddecl, different_binding_level) } } if (different_binding_level) - { - /* Don't output a duplicate symbol or debugging information for this - declaration. - - Do not set TREE_ASM_WRITTEN for a FUNCTION_DECL since we may actually - just have two declarations without a definition. VAR_DECLs may need - the same treatment, I'm not sure. */ - if (TREE_CODE (newdecl) == FUNCTION_DECL) - DECL_IGNORED_P (newdecl) = 1; - else - TREE_ASM_WRITTEN (newdecl) = DECL_IGNORED_P (newdecl) = 1; - return 0; - } + return 0; /* Copy most of the decl-specific fields of NEWDECL into OLDDECL. But preserve OLDDECL's DECL_UID. */ @@ -2370,7 +2364,8 @@ pushdecl (x) DECL_ARGUMENTS (x) = DECL_ARGUMENTS (oldglobal); DECL_RESULT (x) = DECL_RESULT (oldglobal); TREE_ASM_WRITTEN (x) = TREE_ASM_WRITTEN (oldglobal); - DECL_ABSTRACT_ORIGIN (x) = DECL_ORIGIN (oldglobal); + DECL_ABSTRACT_ORIGIN (x) + = DECL_ABSTRACT_ORIGIN (oldglobal); } /* Inner extern decl is built-in if global one is. */ if (DECL_BUILT_IN (oldglobal)) @@ -3648,11 +3643,8 @@ finish_decl (decl, init, asmspec_tree) Also if it is not file scope. Otherwise, let it through, but if it is not `extern' then it may cause an error message later. */ - /* A duplicate_decls call could have changed an extern - declaration into a file scope one. This can be detected - by TREE_ASM_WRITTEN being set. */ (DECL_INITIAL (decl) != 0 - || (DECL_CONTEXT (decl) != 0 && ! TREE_ASM_WRITTEN (decl))) + || DECL_CONTEXT (decl) != 0) : /* An automatic variable with an incomplete type is an error. */ |