scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit 3eb074604d8c04734b97de4ef489f2a94431c5a8
parent e6ef99231498cfcd683a5132b7de6f266e50444d
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Tue, 19 Jan 2016 07:27:19 +0100

Allow declaration of arrays without size

Such arrays have incomplete type, but if they are initialized
them the type is completed with the information taken from the
initializer.

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

diff --git a/cc1/decl.c b/cc1/decl.c @@ -728,8 +728,11 @@ identifier(struct decl *dcl) return sym; /* TODO: Add warning about ANSI limits */ - if (!tp->defined && sclass != EXTERN && sclass != TYPEDEF) + if (!tp->defined && + sclass != EXTERN && sclass != TYPEDEF && + !(tp->op == ARY && yytoken == '=')) { errorp("declared variable '%s' of incomplete type", name); + } if (tp->op != FTN) { sym = install(NS_IDEN, sym);