mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2024-11-30 15:41:12 +00:00
Fix 'declaration does not declare anything' regression i.e this closes #132.
This commit is contained in:
parent
97217b55d1
commit
02a1d9f4a1
1 changed files with 10 additions and 11 deletions
21
parser.c
21
parser.c
|
@ -4841,8 +4841,14 @@ static ast_value *parse_typename(parser_t *parser, ast_value **storebase, ast_va
|
|||
}
|
||||
|
||||
/* there may be a name now */
|
||||
if (parser->tok == TOKEN_IDENT) {
|
||||
if (parser->tok == TOKEN_IDENT || parser->tok == TOKEN_KEYWORD) {
|
||||
if (!strcmp(parser_tokval(parser), "break"))
|
||||
(void)!parsewarning(parser, WARN_BREAKDEF, "break definition ignored (suggest removing it)");
|
||||
else if (parser->tok == TOKEN_KEYWORD)
|
||||
goto leave;
|
||||
|
||||
name = util_strdup(parser_tokval(parser));
|
||||
|
||||
/* parse on */
|
||||
if (!parser_next(parser)) {
|
||||
ast_delete(var);
|
||||
|
@ -4852,6 +4858,7 @@ static ast_value *parse_typename(parser_t *parser, ast_value **storebase, ast_va
|
|||
}
|
||||
}
|
||||
|
||||
leave:
|
||||
/* now this may be an array */
|
||||
if (parser->tok == '[') {
|
||||
wasarray = true;
|
||||
|
@ -5571,16 +5578,8 @@ skipvar:
|
|||
|
||||
if (parser->tok != '{' || var->expression.vtype != TYPE_FUNCTION) {
|
||||
if (parser->tok != '=') {
|
||||
if (!strcmp(parser_tokval(parser), "break")) {
|
||||
if (!parser_next(parser)) {
|
||||
parseerror(parser, "error parsing break definition");
|
||||
break;
|
||||
}
|
||||
(void)!parsewarning(parser, WARN_BREAKDEF, "break definition ignored (suggest removing it)");
|
||||
} else {
|
||||
parseerror(parser, "missing semicolon or initializer, got: `%s`", parser_tokval(parser));
|
||||
break;
|
||||
}
|
||||
parseerror(parser, "missing semicolon or initializer, got: `%s`", parser_tokval(parser));
|
||||
break;
|
||||
}
|
||||
|
||||
if (!parser_next(parser)) {
|
||||
|
|
Loading…
Reference in a new issue