scc

Simple C99 Compiler
Log | Files | Refs | README | LICENSE

commit 8bcf160b21f60b00bf753905687b61b69a117577
parent 60593515d461f8665b59f7c51eca7556fff69256
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Thu, 10 Jul 2014 13:55:26 +0200

Set isdefined bit in local declarations

All the local definitions are definitions, excepts if they are
labelled as extern.

Diffstat:
cc1/decl.c | 33++++++++++++++++++---------------
1 file changed, 18 insertions(+), 15 deletions(-)

diff --git a/cc1/decl.c b/cc1/decl.c @@ -400,21 +400,24 @@ decl(void) int8_t sclass; tp = specifier(&sclass); - if (yytoken != ';') { - do { - sym = declarator(tp, ID_EXPECTED); - switch (sclass) { - case REGISTER: sym->s.isregister = 1; break; - case STATIC: sym->s.isstatic = 1; break; - case EXTERN: /* TODO: */; break; - case TYPEDEF: /* TODO: */;break; - case AUTO: default: sym->s.isauto = 1; - } - if (accept('=')) - initializer(sym); - emitdcl(sym); - } while (accept(',')); - } + if (accept(';')) + return; + + do { + sym = declarator(tp, ID_EXPECTED); + sym->s.isdefined = 1; + switch (sclass) { + case REGISTER: sym->s.isregister = 1; break; + case STATIC: sym->s.isstatic = 1; break; + case EXTERN: sym->s.isdefined = 0; break; + case TYPEDEF: /* TODO: */;break; + case AUTO: default: sym->s.isauto = 1; + } + if (accept('=')) + initializer(sym); + emitdcl(sym); + } while (accept(',')); + expect(';'); }