From e3b776dcc4fba456909e92a9d087befa5c163051 Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Tue, 13 Feb 1996 17:47:16 -0500 Subject: [PATCH] (finish_decl): TREE_ASM_WRITTEN says if duplicate_decls modified declaration to... (finish_decl): TREE_ASM_WRITTEN says if duplicate_decls modified declaration to match an outside file scope declaration. From-SVN: r11264 --- gcc/c-decl.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/gcc/c-decl.c b/gcc/c-decl.c index d7ca9d02c8d..f28b026f0e0 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -3734,10 +3734,11 @@ 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. */ - /* We must use DECL_CONTEXT instead of current_binding_level, - because a duplicate_decls call could have changed the binding - level of this decl. */ - (DECL_INITIAL (decl) != 0 || DECL_CONTEXT (decl) != 0) + /* 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)) : /* An automatic variable with an incomplete type is an error. */ @@ -3779,7 +3780,9 @@ finish_decl (decl, init, asmspec_tree) end_temporary_allocation (); /* This is a no-op in c-lang.c or something real in objc-actions.c. */ maybe_objc_check_decl (decl); - rest_of_decl_compilation (decl, asmspec, DECL_CONTEXT (decl) == 0, + rest_of_decl_compilation (decl, asmspec, + (DECL_CONTEXT (decl) == 0 + || TREE_ASM_WRITTEN (decl)), 0); pop_obstacks (); } -- 2.30.2