From: Wolfgang (Blub) Bumiller Date: Sun, 11 Nov 2012 13:17:48 +0000 (+0100) Subject: properly in all situations where an array is part of a function's return type X-Git-Tag: 0.1~19^2~35 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9324a96f779bfe0bef8529fbc008453da87b9813;p=xonotic%2Fgmqcc.git properly in all situations where an array is part of a function's return type --- diff --git a/parser.c b/parser.c index fbc0967..ad5ec47 100644 --- a/parser.c +++ b/parser.c @@ -2354,7 +2354,8 @@ static ast_value *parse_typename(parser_t *parser, ast_value **storebase) lex_ctx ctx; const char *name = NULL; - bool isfield = false; + bool isfield = false; + bool wasarray = false; ctx = parser_ctx(parser); @@ -2420,6 +2421,7 @@ static ast_value *parse_typename(parser_t *parser, ast_value **storebase) /* now this may be an array */ if (parser->tok == '[') { + wasarray = true; var = parse_arraysize(parser, var); if (!var) return NULL; @@ -2436,6 +2438,8 @@ static ast_value *parse_typename(parser_t *parser, ast_value **storebase) /* now there may be function parens again */ if (parser->tok == '(' && opts_standard == COMPILER_QCC) parseerror(parser, "C-style function syntax is not allowed in -std=qcc"); + if (parser->tok == '(' && wasarray) + parseerror(parser, "arrays as part of a return type is not supported"); while (parser->tok == '(') { var = parse_parameter_list(parser, var); if (!var) { @@ -2512,7 +2516,7 @@ static bool parse_variable(parser_t *parser, ast_block *localblock, bool nofield } } if (parser->tok == '(' && wasarray) { - parseerror(parser, "functions cannot return arrays"); + parseerror(parser, "arrays as part of a return type is not supported"); /* we'll still parse the type completely for now */ } /* for functions returning functions */