ref: cf5c3a1d54e206326de7e2a7b9e12f6c179e866e
parent: 5e00eb6985f2f280a7f4edc260bd0f6d0760faec
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Fri Jul 5 05:01:53 EDT 2013
Move type default warning to the correct place spec() was filling the type field in ctype structure, so was impossible other part of the code could emit some message due to this issue.
--- a/decl.c
+++ b/decl.c
@@ -121,8 +121,11 @@
}
}
default:
- if (tp && !tp->type && sign)
- tp->type = INT;
+ if (!tp || tp->type)
+ return tp;
+ warning_error(options.implicit,
+ "type defaults to 'int' in declaration");
+ tp->type = INT;
return tp;
}
}
@@ -192,11 +195,6 @@
declarator(tp);
tp = decl_type(base);
- if (!tp->type) {
- warning_error(options.implicit,
- "type defaults to 'int' in declaration of '%s'",
- yytext);
- }
(cursym->ctype = tp)->refcnt++;
sp = nodesym(cursym);
if (tp->type == FTN && yytoken == '{') {
--
⑨