ref: 5e00eb6985f2f280a7f4edc260bd0f6d0760faec
parent: d571d1e0f46cacbc2867bd25779b745f0744fb2b
author: Roberto E. Vargas Caballero <[email protected]>
date: Fri Jul 5 04:59:52 EDT 2013
Rewrite typedef handling in spec This new version is clear (and more efficient) than the previous one.
--- a/decl.c
+++ b/decl.c
@@ -108,17 +108,17 @@
case STRUCT: /* TODO */
case UNION: /* TODO */
case ENUM: /* TODO */
- case IDEN: {
- struct symbol *sym = find(yytext, NS_TYPEDEF);
+ case IDEN:
+ if (!tp || !tp->type) {
+ struct symbol *sym;
+ unsigned char tok = ahead();
- if (sym && (!tp || !tp->type)) {
- register unsigned char tok = ahead();
-
- if (tok != ';' && tok != ',') {
+ sym = (yyval.sym->ns == NS_TYPEDEF) ?
+ yyval.sym : find(yytext, NS_TYPEDEF);
+ if (sym && tok != ';' && tok != ',') {
(tp = sym->ctype)->refcnt++;
next();
}
- }
}
default:
if (tp && !tp->type && sign)