Fix 'declaration does not declare anything' regression i.e this closes #132.

This commit is contained in:
Dale Weiler 2013-10-17 05:06:09 -04:00
parent 97217b55d1
commit 02a1d9f4a1

View file

@ -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,17 +5578,9 @@ 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;
}
}
if (!parser_next(parser)) {
parseerror(parser, "error parsing initializer");