From: Wolfgang (Blub) Bumiller Date: Sun, 25 Nov 2012 19:25:39 +0000 (+0100) Subject: more on CV_CONST/CV_VAR, initializers to check 'constant' not just 'hasvalue' X-Git-Tag: 0.1.9~242 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1b72cb264a0cf180e0b491cc4a7f77b14beca525;p=xonotic%2Fgmqcc.git more on CV_CONST/CV_VAR, initializers to check 'constant' not just 'hasvalue' --- diff --git a/parser.c b/parser.c index 2b944ca..6e440cd 100644 --- a/parser.c +++ b/parser.c @@ -3505,7 +3505,7 @@ static bool parse_variable(parser_t *parser, ast_block *localblock, bool nofield } } - if (is_const_var > 0) + if (is_const_var == CV_CONST) var->constant = true; /* Part 1: @@ -3856,12 +3856,12 @@ skipvar: if (!localblock) { cval = (ast_value*)cexp; - if (!ast_istype(cval, ast_value) || !cval->hasvalue) + if (!ast_istype(cval, ast_value) || !cval->hasvalue || !cval->constant) parseerror(parser, "cannot initialize a global constant variable with a non-constant expression"); else { if (opts_standard != COMPILER_GMQCC && !OPTS_FLAG(INITIALIZED_NONCONSTANTS) && - is_const_var >= 0) + is_const_var != CV_VAR) { var->constant = true; }