]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
turn the message about global variable double-declaration into a warning instead...
authorWolfgang (Blub) Bumiller <blub@speed.at>
Fri, 23 Nov 2012 21:30:35 +0000 (22:30 +0100)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Fri, 23 Nov 2012 21:30:35 +0000 (22:30 +0100)
parser.c

index 7d91aaaf7e1a79ca3720df812f2f1f29627160b3..41a87302a1721382a592ec084832cc9c3842099c 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -3380,10 +3380,20 @@ static bool parse_variable(parser_t *parser, ast_block *localblock, bool nofield
                 {
                     /* other globals */
                     if (old) {
-                        parseerror(parser, "global `%s` already declared here: %s:%i",
-                                   var->name, ast_ctx(old).file, ast_ctx(old).line);
-                        retval = false;
-                        goto cleanup;
+                        if (opts_standard == COMPILER_GMQCC) {
+                            parseerror(parser, "global `%s` already declared here: %s:%i",
+                                       var->name, ast_ctx(old).file, ast_ctx(old).line);
+                            retval = false;
+                            goto cleanup;
+                        } else {
+                            if (parsewarning(parser, WARN_DOUBLE_DECLARATION,
+                                             "global `%s` already declared here: %s:%i",
+                                             var->name, ast_ctx(old).file, ast_ctx(old).line))
+                            {
+                                retval = false;
+                                goto cleanup;
+                            }
+                        }
                     }
                     if (opts_standard == COMPILER_QCC &&
                         (old = parser_find_field(parser, var->name)))