]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
Prevent aliasing functions through forward declared prototypes. This closes #125
authorDale Weiler <killfieldengine@gmail.com>
Thu, 17 Oct 2013 03:37:39 +0000 (23:37 -0400)
committerDale Weiler <killfieldengine@gmail.com>
Thu, 17 Oct 2013 03:37:39 +0000 (23:37 -0400)
parser.c

index 3db28b39d99320f2027913338dc2bf9c54027538..e5231666e3a735c1a12897b258c01e6b35f7f2f5 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -5088,6 +5088,13 @@ static bool parse_variable(parser_t *parser, ast_block *localblock, bool nofield
             var->expression.flags & AST_FLAG_ALIAS)
             var->desc = vstring;
 
+        if (parser_find_global(parser, var->name) && var->expression.flags & AST_FLAG_ALIAS) {
+            parseerror(parser, "function aliases cannot be forward declared");
+            retval = false;
+            goto cleanup;
+        }
+
+
         /* Part 1:
          * check for validity: (end_sys_..., multiple-definitions, prototypes, ...)
          * Also: if there was a prototype, `var` will be deleted and set to `proto` which