scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit b0ffc63f8087baa7e5c77911b7b6fb14c49ec306
parent 113870ab619a3ca19dd9e524c43c9a347f5e3895
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Thu, 10 Jul 2014 13:39:02 +0200

Handle extern in external symbols

Diffstat:
Mcc1/decl.c | 13++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/cc1/decl.c b/cc1/decl.c @@ -240,6 +240,7 @@ invalid_type: error("invalid type specification"); } +/* TODO: check storage class and correctness of the initializator */ static struct node * initializer(register Type *tp) { @@ -443,13 +444,15 @@ extdecl(void) 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 == '{') {