aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJim Wilson <wilson@gcc.gnu.org>1994-11-28 15:03:16 -0800
committerJim Wilson <wilson@gcc.gnu.org>1994-11-28 15:03:16 -0800
commit15317f8925397dd1fa38293d98464c34b8915207 (patch)
treec7f84cb7fb58b5b8722bca33b954106dca9bebe3 /gcc
parentad6267596c510660a93889a53319e9f051cab39a (diff)
downloadgcc-15317f8925397dd1fa38293d98464c34b8915207.zip
gcc-15317f8925397dd1fa38293d98464c34b8915207.tar.gz
gcc-15317f8925397dd1fa38293d98464c34b8915207.tar.bz2
(finish_decl): Use DECL_CONTEXT instead of
current_binding_level to identify file-scope variables. From-SVN: r8565
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-decl.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 427ff3a..0f47777 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -3586,8 +3586,10 @@ 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. */
- (DECL_INITIAL (decl) != 0
- || current_binding_level != global_binding_level)
+ /* 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)
:
/* An automatic variable with an incomplete type
is an error. */
@@ -3629,8 +3631,7 @@ 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,
- current_binding_level == global_binding_level,
+ rest_of_decl_compilation (decl, asmspec, DECL_CONTEXT (decl) == 0,
0);
pop_obstacks ();
}
@@ -3638,11 +3639,10 @@ finish_decl (decl, init, asmspec_tree)
{
/* 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,
- current_binding_level == global_binding_level,
+ rest_of_decl_compilation (decl, asmspec, DECL_CONTEXT (decl) == 0,
0);
}
- if (current_binding_level != global_binding_level)
+ if (DECL_CONTEXT (decl) != 0)
{
/* Recompute the RTL of a local array now
if it used to be an incomplete type. */
@@ -3666,8 +3666,7 @@ finish_decl (decl, init, asmspec_tree)
{
/* 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, NULL_PTR,
- current_binding_level == global_binding_level,
+ rest_of_decl_compilation (decl, NULL_PTR, DECL_CONTEXT (decl) == 0,
0);
}