commit 46eaaf7b32ddb0e7ce17c03db45d6c6ef98bc0f0
parent 5a21c182dcb8e58fb9df08628299c81871dd02e9
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Wed, 30 Oct 2013 07:51:30 +0100
Remove the NS_TYPEDEF namespace
Typedef are usual symbols, and they use the NS_IDEN namespace,
so NS_TYPEDEF namespace was an error and complicated the code.
This new version is more standard comptlaint.
Diffstat:
2 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/decl.c b/decl.c
@@ -193,13 +193,11 @@ specifier(void)
next();
return structdcl(tp);
case IDEN:
- /* TODO: remove NS_TYPEDEF */
- if (tp && tp->c_typedef && !tp->type)
- goto check_type;
if (!tp || !tp->type) {
- struct symbol *sym = lookup(yytext, NS_TYPEDEF);
+ register struct symbol *sym;
- if (sym->ctype) {
+ sym = lookup(yytext, NS_IDEN);
+ if (sym->ctype && sym->ctype->c_typedef) {
tp = ctype(tp, TYPEDEF);
tp->base = sym->ctype;
break;
@@ -297,7 +295,7 @@ listdcl(struct ctype *base)
struct node *np;
register struct ctype *tp;
- declarator(base, base->c_typedef ? NS_TYPEDEF : NS_IDEN);
+ declarator(base, NS_IDEN);
tp = cursym->ctype = decl_type(base);
if ((tp->type == STRUCT || tp->type == UNION) && tp->forward)
error("declaration of variable with incomplete type");
diff --git a/symbol.h b/symbol.h
@@ -14,7 +14,6 @@ enum {
NS_IDEN,
NS_KEYWORD,
NS_LABEL,
- NS_TYPEDEF,
NS_STRUCT
};