From 1021d4e462da1089b50bcc023efdc0134d12fcac Mon Sep 17 00:00:00 2001 From: Teddy Date: Mon, 7 Apr 2014 05:52:04 +0800 Subject: ... --- TODO.rst | 9 ++++++++- semantics.c | 6 +++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/TODO.rst b/TODO.rst index d5451eb..06b0311 100644 --- a/TODO.rst +++ b/TODO.rst @@ -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); -- cgit v1.2.3