scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit c7315dfa1117bafcb193d4fbd9cdaa27d08e932d
parent a31573bf6a292f30bd578285aff5da9652931579
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Thu, 31 Oct 2013 21:13:19 +0100

Fix struct field declaration

struct fields cannot have storage or qualifiers specifiers, and
it causes they can be defined without explicit type.

Diffstat:
Mdecl.c | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/decl.c b/decl.c @@ -220,12 +220,15 @@ specifier(register struct ctype *tp, if (!tp->defined) { if (!store->defined && !qlf->defined && - curctx != CTX_OUTER ) { + curctx != CTX_OUTER && + nested_tags == 0) { return false; } warn(options.implicit, "type defaults to 'int' in declaration"); } + if (nested_tags > 0 && (qlf->defined || store->defined)) + error("type qualifer or store specifier in field declaration"); if (!tp->c_signed && !tp->c_unsigned) { switch (tp->type) { case CHAR: