diff options
-rw-r--r-- | TODO.rst | 9 | ||||
-rw-r--r-- | semantics.c | 6 |
2 files changed, 11 insertions, 4 deletions
@@ -9,7 +9,14 @@ TODO - Fix: - check global definition when semantic analysis finishes - - local function declaration is not in a local scope + - local function declaration is not in a local scope (external linkage issue) + - incomplete type issues + - function **definition** requires complete return type + - array requires complete elem type + - struct or union requires complete fields ( ``struct A;`` vs. ``struct A a;`` ?) + - pointer may allow incomplete type + - calculate type memory footprint when complete type is required + - function type parameter - Not Implemented: diff --git a/semantics.c b/semantics.c index 39ca0c1..2a3cfeb 100644 --- a/semantics.c +++ b/semantics.c @@ -579,7 +579,7 @@ CTable_t semantics_fields(CNode *p, CScope_t scope) { CVar_t semantics_decl(CNode *p, CScope_t scope) { CHECK_TYPE(p, DECL); - CNode *init = p->chd->next; + CNode *declr = p->chd->next; CType_t type = semantics_type_spec(p->chd, scope); CVar_t res = NULL; int useful = 0; @@ -589,10 +589,10 @@ CVar_t semantics_decl(CNode *p, CScope_t scope) { cscope_push_type(scope, type); useful = 1; } - if (init->chd->type != NOP) + if (declr->chd->type != NOP) { CNode *p; - for (p = init->chd; p; p = p->next) + for (p = declr->chd; p; p = p->next) { /* TODO: initializer checking */ CVar_t var = semantics_declr(p->chd, type, scope, 0); |