ref: a31573bf6a292f30bd578285aff5da9652931579
parent: e288e44926d1cb8f0f7c3b837466698007a95c5d
author: Roberto E. Vargas Caballero <[email protected]>
date: Thu Oct 31 17:02:07 EDT 2013
Simplify the type checking in specifier Doesn't matter if the type is int by default or if it hasn't storage or qualifier. The important is the default type.
--- a/decl.c
+++ b/decl.c
@@ -217,19 +217,14 @@
}
/* it is not a type name */
default:
- check_type:
- /* TODO: simplify this checks */
- if (!tp->defined && !store->defined && !qlf->defined) {
- /* TODO: Allow no type in structs and union */
- if (curctx != CTX_OUTER || yytoken != IDEN)
+ if (!tp->defined) {
+ if (!store->defined &&
+ !qlf->defined &&
+ curctx != CTX_OUTER ) {
return false;
- store->c_auto = false;
+ }
warn(options.implicit,
- "data definition has no type or storage class");
- } else if (!tp->defined) {
- warn(options.implicit,
- "type defaults to 'int' in declaration");
- tp = ctype(tp, INT);
+ "type defaults to 'int' in declaration");
}
if (!tp->c_signed && !tp->c_unsigned) {
switch (tp->type) {
--- a/types.c
+++ b/types.c
@@ -31,8 +31,11 @@
struct storage *
initstore(register struct storage *store)
{
+ extern unsigned char curctx;
memset(store, 0, sizeof(*store));
- store->c_auto = 1;
+
+ if (curctx != CTX_OUTER)
+ store->c_auto = 1;
return store;
}