aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1996-02-13 17:47:16 -0500
committerRichard Kenner <kenner@gcc.gnu.org>1996-02-13 17:47:16 -0500
commite3b776dcc4fba456909e92a9d087befa5c163051 (patch)
tree7a222bd1e7189390d17479346eb6133effeda0fa /gcc
parentf6135b207a02f8daa8653e4b0a91ed5156041494 (diff)
downloadgcc-e3b776dcc4fba456909e92a9d087befa5c163051.zip
gcc-e3b776dcc4fba456909e92a9d087befa5c163051.tar.gz
gcc-e3b776dcc4fba456909e92a9d087befa5c163051.tar.bz2
(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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-decl.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index d7ca9d0..f28b026 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 ();
}