ref: 5772e7b120d9b0221c4dc2b723c44ed7d6fc9801
parent: d1ad7cfaec448eca408a0226f6b956cdddeee34c
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Tue Aug 9 12:01:57 EDT 2016
[cc1] Allow declaration of global array variables It is desirable to declare global array variables with an incomplete type, because in this case we are not defining them and we can have later a definition.
--- a/cc1/decl.c
+++ b/cc1/decl.c
@@ -732,7 +732,7 @@
/* TODO: Add warning about ANSI limits */
if (!(tp->prop & TDEFINED) &&
sclass != EXTERN && sclass != TYPEDEF &&
- !(tp->op == ARY && yytoken == '=')) {
+ (tp->op != ARY || yytoken != '=' && curctx != GLOBALCTX)) {
errorp("declared variable '%s' of incomplete type", name);
}