From patchwork Thu Jun 18 16:44:54 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Torvalds X-Patchwork-Id: 31182 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 n5IGixeI009407 for ; Thu, 18 Jun 2009 16:44:59 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751668AbZFRQoz (ORCPT ); Thu, 18 Jun 2009 12:44:55 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751629AbZFRQoz (ORCPT ); Thu, 18 Jun 2009 12:44:55 -0400 Received: from smtp1.linux-foundation.org ([140.211.169.13]:49686 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751376AbZFRQoz (ORCPT ); Thu, 18 Jun 2009 12:44:55 -0400 Received: from imap1.linux-foundation.org (imap1.linux-foundation.org [140.211.169.55]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id n5IGitdp007237 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 18 Jun 2009 09:44:56 -0700 Received: from localhost (localhost [127.0.0.1]) by imap1.linux-foundation.org (8.13.5.20060308/8.13.5/Debian-3ubuntu1.1) with ESMTP id n5IGismv026711; Thu, 18 Jun 2009 09:44:54 -0700 Date: Thu, 18 Jun 2009 09:44:54 -0700 (PDT) From: Linus Torvalds X-X-Sender: torvalds@localhost.localdomain To: Christopher Li , linux-sparse@vger.kernel.org Subject: Allow array declarators to have 'restrict' in them Message-ID: User-Agent: Alpine 2.01 (LFD 1184 2008-12-16) MIME-Version: 1.0 X-Spam-Status: No, hits=-3.472 required=5 tests=AWL,BAYES_00 X-Spam-Checker-Version: SpamAssassin 3.2.4-osdl_revision__1.47__ X-MIMEDefang-Filter: lf$Revision: 1.188 $ X-Scanned-By: MIMEDefang 2.63 on 140.211.169.13 Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org Otherwise sparse is very unhappy about the current glibc header files (aio.h, netdb.h. regex.h and spawn.h at a minimum). It's a hack, and not a proper parsing with saving the information. It just ignores any "restrict" keyword at the start of an abstract array declaration, but it's better than what we have now. Signed-off-by: Linus Torvalds --- ident-list.h | 1 + parse.c | 2 ++ 2 files changed, 3 insertions(+), 0 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/ident-list.h b/ident-list.h index 29ddeca..0ee81bc 100644 --- a/ident-list.h +++ b/ident-list.h @@ -83,6 +83,7 @@ IDENT(stdcall); IDENT(__stdcall__); IDENT(fastcall); IDENT(__fastcall__); IDENT(dllimport); IDENT(__dllimport__); IDENT(dllexport); IDENT(__dllexport__); +IDENT(restrict); IDENT(__restrict); /* Preprocessor idents. Direct use of __IDENT avoids mentioning the keyword * itself by name, preventing these tokens from expanding when compiling diff --git a/parse.c b/parse.c index fbeebb0..df696e5 100644 --- a/parse.c +++ b/parse.c @@ -1431,6 +1431,8 @@ static struct token *abstract_array_declarator(struct token *token, struct symbo { struct expression *expr = NULL; + if (match_idents(token, &restrict_ident, &__restrict_ident, NULL)) + token = token->next; token = parse_expression(token, &expr); sym->array_size = expr; return token;