From patchwork Sat Feb 14 12:25:25 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 7234 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n1ECPCL6004075 for ; Sat, 14 Feb 2009 12:25:27 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751389AbZBNMZ1 (ORCPT ); Sat, 14 Feb 2009 07:25:27 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751526AbZBNMZ1 (ORCPT ); Sat, 14 Feb 2009 07:25:27 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:37433 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751389AbZBNMZ0 (ORCPT ); Sat, 14 Feb 2009 07:25:26 -0500 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.69 #1 (Red Hat Linux)) id 1LYJaH-0001nA-Kl for linux-sparse@vger.kernel.org; Sat, 14 Feb 2009 12:25:25 +0000 To: linux-sparse@vger.kernel.org Subject: [PATCH 3/7] More nested declarator fixes Message-Id: From: Al Viro Date: Sat, 14 Feb 2009 12:25:25 +0000 Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org no nested declarators after [...] or (parameters) Signed-off-by: Al Viro --- parse.c | 2 ++ validation/nested-declarator.c | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 0 deletions(-) diff --git a/parse.c b/parse.c index 86e26aa..1678d80 100644 --- a/parse.c +++ b/parse.c @@ -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; diff --git a/validation/nested-declarator.c b/validation/nested-declarator.c index 24ed833..1e69823 100644 --- a/validation/nested-declarator.c +++ b/validation/nested-declarator.c @@ -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: */