From patchwork Sat Jul 18 20:37:47 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramsay Jones X-Patchwork-Id: 36207 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 n6IL9qsY006441 for ; Sat, 18 Jul 2009 21:09:52 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753670AbZGRVJt (ORCPT ); Sat, 18 Jul 2009 17:09:49 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753674AbZGRVJt (ORCPT ); Sat, 18 Jul 2009 17:09:49 -0400 Received: from anchor-post-3.mail.demon.net ([195.173.77.134]:41060 "EHLO anchor-post-3.mail.demon.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753670AbZGRVJs (ORCPT ); Sat, 18 Jul 2009 17:09:48 -0400 Received: from ramsay1.demon.co.uk ([193.237.126.196]) by anchor-post-3.mail.demon.net with esmtp (Exim 4.69) id 1MSHAC-0005Mf-mg; Sat, 18 Jul 2009 21:09:48 +0000 Message-ID: <4A62329B.9040107@ramsay1.demon.co.uk> Date: Sat, 18 Jul 2009 21:37:47 +0100 From: Ramsay Jones User-Agent: Thunderbird 1.5.0.2 (Windows/20060308) MIME-Version: 1.0 To: Christopher Li CC: Sparse Mailing-list Subject: [PATCH 1/5] Fix an "'__sentinel__' attribute directive ignored" warning Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org This attribute was introduced in gcc 3.5. In order to avoid such warnings, add a gcc version check when defining the SENTINEL_ATTR macro. (This warning message, in particular, was issued by a gcc 3.4.4 compiler). Signed-off-by: Ramsay Jones --- Hi Chris, I had some, somewhat old, patches kicking around in my sparse repo which may be useful; so I'm sending them along for your consideration. For this patch, an alternative solution (which I haven't tried) would be to add -Wno-attributes to CFLAGS. ATB, Ramsay Jones lib.h | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/lib.h b/lib.h index b22fa93..919b5b1 100644 --- a/lib.h +++ b/lib.h @@ -70,7 +70,11 @@ struct token *expect(struct token *, int, const char *); #ifdef __GNUC__ #define FORMAT_ATTR(pos) __attribute__ ((__format__ (__printf__, pos, pos+1))) #define NORETURN_ATTR __attribute__ ((__noreturn__)) -#define SENTINEL_ATTR __attribute__ ((__sentinel__)) +#if ((__GNUC__ * 100 + __GNUC__MINOR__) >= 305) /* gcc version >= 3.5 */ +# define SENTINEL_ATTR __attribute__ ((__sentinel__)) +#else +# define SENTINEL_ATTR +#endif #else #define FORMAT_ATTR(pos) #define NORETURN_ATTR