aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index e5e1ee2..f7075b1 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -2766,7 +2766,6 @@ start_decl (tree declarator, tree declspecs, int initialized, tree attributes)
if (initialized)
{
- DECL_EXTERNAL (decl) = 0;
if (current_scope == file_scope)
TREE_STATIC (decl) = 1;
@@ -2833,6 +2832,9 @@ start_decl (tree declarator, tree declspecs, int initialized, tree attributes)
TEM may equal DECL or it may be a previous decl of the same name. */
tem = pushdecl (decl);
+ if (initialized)
+ DECL_EXTERNAL (tem) = 0;
+
return tem;
}
@@ -4599,7 +4601,10 @@ grokdeclarator (tree declarator, tree declspecs,
if (inlinep)
pedwarn ("%Jvariable '%D' declared `inline'", decl, decl);
- DECL_EXTERNAL (decl) = extern_ref;
+ /* At file scope, an initialized extern declaration may follow
+ a static declaration. In that case, DECL_EXTERNAL will be
+ reset later in start_decl. */
+ DECL_EXTERNAL (decl) = !!(specbits & (1 << (int) RID_EXTERN));
/* At file scope, the presence of a `static' or `register' storage
class specifier, or the absence of all storage class specifiers