aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTeddy <ted.sybil@gmail.com>2014-04-07 05:52:04 +0800
committerTeddy <ted.sybil@gmail.com>2014-04-07 05:52:04 +0800
commit1021d4e462da1089b50bcc023efdc0134d12fcac (patch)
treeb45720175f8bf2b09df435dd8de8c9244cd1b79c
parent8ab5aab4ee0e27092dc588e196b1437614687964 (diff)
...
-rw-r--r--TODO.rst9
-rw-r--r--semantics.c6
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);