ref: b0ffc63f8087baa7e5c77911b7b6fb14c49ec306
parent: 113870ab619a3ca19dd9e524c43c9a347f5e3895
author: Roberto E. Vargas Caballero <[email protected]>
date: Thu Jul 10 09:39:02 EDT 2014
Handle extern in external symbols
--- a/cc1/decl.c
+++ b/cc1/decl.c
@@ -240,6 +240,7 @@
error("invalid type specification");
}
+/* TODO: check storage class and correctness of the initializator */
static struct node *
initializer(register Type *tp)
{
@@ -443,13 +444,15 @@
do {
sym = declarator(base, ID_EXPECTED);
tp = sym->type;
- if (!(sclass & STATIC))
+ sym->s.isstatic = 1;
+
+ if (sclass != STATIC)
sym->s.isglobal = 1;
+ else if (sclass != EXTERN)
+ sym->s.isdefined = 1;
+
if (BTYPE(tp) != FTN) {
- sym->s.isstatic = 1;
- if (sclass & EXTERN)
- ; /* TODO: handle extern */
- else if (accept('='))
+ if (accept('='))
initializer(tp);
emitdcl(sym);
} else if (yytoken == '{') {