mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2024-11-24 04:41:25 +00:00
fixed: -frelaxed-switch check was in the wrong position
This commit is contained in:
parent
353b1f945f
commit
b59401db1b
1 changed files with 8 additions and 9 deletions
17
parser.c
17
parser.c
|
@ -2107,15 +2107,6 @@ static bool parse_switch(parser_t *parser, ast_block *block, ast_expression **ou
|
||||||
if (!operand)
|
if (!operand)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!OPTS_FLAG(RELAXED_SWITCH)) {
|
|
||||||
opval = (ast_value*)operand;
|
|
||||||
if (!ast_istype(operand, ast_value) || !opval->constant) {
|
|
||||||
parseerror(parser, "case on non-constant values need to be explicitly enabled via -frelaxed-switch");
|
|
||||||
ast_unref(operand);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switchnode = ast_switch_new(ctx, operand);
|
switchnode = ast_switch_new(ctx, operand);
|
||||||
|
|
||||||
/* closing paren */
|
/* closing paren */
|
||||||
|
@ -2159,6 +2150,14 @@ static bool parse_switch(parser_t *parser, ast_block *block, ast_expression **ou
|
||||||
parseerror(parser, "expected expression for case");
|
parseerror(parser, "expected expression for case");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (!OPTS_FLAG(RELAXED_SWITCH)) {
|
||||||
|
opval = (ast_value*)swcase.value;
|
||||||
|
if (!ast_istype(swcase.value, ast_value) || !opval->constant) {
|
||||||
|
parseerror(parser, "case on non-constant values need to be explicitly enabled via -frelaxed-switch");
|
||||||
|
ast_unref(operand);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (!strcmp(parser_tokval(parser), "default")) {
|
else if (!strcmp(parser_tokval(parser), "default")) {
|
||||||
swcase.value = NULL;
|
swcase.value = NULL;
|
||||||
|
|
Loading…
Reference in a new issue