From 43f6b44f389409af5b6162d831fe7c5c79f2ccb3 Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Fri, 12 Sep 2008 12:33:42 +0000 Subject: [PATCH] Only assume it is a k&r-declaration, if the unknown identifier in the parameter list is followed by a , or ). This leads to better error messages. [r21896] --- parser.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/parser.c b/parser.c index 98ae3f3..ad03d04 100644 --- a/parser.c +++ b/parser.c @@ -3602,9 +3602,10 @@ static declaration_t *parse_parameters(function_type_t *type) add_anchor_token(')'); int saved_comma_state = save_and_reset_anchor_state(','); - if (token.type == T_IDENTIFIER) { - symbol_t *symbol = token.v.symbol; - if (!is_typedef_symbol(symbol)) { + if (token.type == T_IDENTIFIER && + !is_typedef_symbol(token.v.symbol)) { + token_type_t la1_type = look_ahead(1)->type; + if (la1_type == ',' || la1_type == ')') { type->kr_style_parameters = true; declarations = parse_identifier_list(); goto parameters_finished; -- 2.20.1