From 003bb9dfb41791a84c496d43f69438b0daadfc05 Mon Sep 17 00:00:00 2001 From: Dale Weiler Date: Wed, 16 Oct 2013 23:37:39 -0400 Subject: [PATCH] Prevent aliasing functions through forward declared prototypes. This closes #125 --- parser.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/parser.c b/parser.c index 3db28b3..e523166 100644 --- 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