[hackers] [scc] [cc1] Allow declaration of global array variables || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Tue, 9 Aug 2016 16:04:17 +0200 (CEST)

commit 7cf23450ad628012dfb66d72f1796955d1b34d71
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Tue Aug 9 16:01:57 2016 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Tue Aug 9 16:03:58 2016 +0200

    [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.

diff --git a/cc1/decl.c b/cc1/decl.c
index 20df8fd..8ecb40d 100644
--- a/cc1/decl.c
+++ b/cc1/decl.c
_AT_@ -732,7 +732,7 @@ identifier(struct decl *dcl)
         /* 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);
         }
 
Received on Tue Aug 09 2016 - 16:04:17 CEST

This archive was generated by hypermail 2.3.0 : Tue Aug 09 2016 - 16:12:22 CEST