More nested declarator fixes
PATCH 3/7 More nested declarator fixes
no nested declarators after [...] or (parameters)
Signed-off-by Al Viro <[email protected]>
--- parse.c | 2 ++ validation/nested-declarator.c | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 0 deletions(-)
parse.c +2 -0
@@ -1295,6 +1295,7 @@ static struct token *direct_declarator(struct token *token, struct symbol *decl, token =parameter_type_list (next, sym, p); token =expect (token,')' ,"in function declarator" ); sym->endpos = token->pos; + dont_nest =1 ;continue ; }if (token->special =='[' ) {
@@ -1303,6 +1304,7 @@ static struct token *direct_declarator(struct token *token, struct symbol *decl, token =expect (token,']' ,"in abstract_array_declarator" ); array->endpos = token->pos; ctype = &array->ctype; + dont_nest =1 ;continue ; }break ;
validation/nested-declarator.c +16 -0
@@ -6,6 +6,22 @@ static void g(int x)T = x;f (T ); } +static void h (void ) +{ + static int [2](T)[3]; +} +static int [2](*p)[3]; +int i(void (void)(*f)); +int j(int [2](*));/* * check-name: nested declarator vs. parameters +* check-error-start: +nested-declarator.c:11:22: warning: missing identifier in declaration +nested-declarator.c:13:16: error: Expected ) in function declarator +nested-declarator.c:13:16: error: got * +nested-declarator.c:14:19: error: Expected ) in function declarator +nested-declarator.c:14:19: error: got * +nested-declarator.c:15:15: error: Expected ) in function declarator +nested-declarator.c:15:15: error: got * +* check-error-end: */
Signature · 1 line
1.5.6.6