From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1767618AbXCIXF4 (ORCPT ); Fri, 9 Mar 2007 18:05:56 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1767619AbXCIXF4 (ORCPT ); Fri, 9 Mar 2007 18:05:56 -0500 Received: from rgminet01.oracle.com ([148.87.113.118]:47275 "EHLO rgminet01.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1767618AbXCIXFz (ORCPT ); Fri, 9 Mar 2007 18:05:55 -0500 Date: Fri, 9 Mar 2007 15:02:57 -0800 From: Randy Dunlap To: Rusty Russell Cc: lkml - Kernel Mailing List , Linus Torvalds , Andrew Morton Subject: Re: [PATCH] Use more gcc extensions in the Linux headers Message-Id: <20070309150257.d3b51589.randy.dunlap@oracle.com> In-Reply-To: <1173481052.32234.137.camel@localhost.localdomain> References: <1173419792.32234.131.camel@localhost.localdomain> <1173481052.32234.137.camel@localhost.localdomain> Organization: Oracle Linux Eng. X-Mailer: Sylpheed 2.3.1 (GTK+ 2.8.10; x86_64-unknown-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Whitelist: TRUE X-Whitelist: TRUE X-Brightmail-Tracker: AAAAAQAAAAI= Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 10 Mar 2007 09:57:32 +1100 Rusty Russell wrote: > On Fri, 2007-03-09 at 16:56 +1100, Rusty Russell wrote: > > __builtin_types_compatible_p() has been around since gcc 2.95, and we > > don't use it anywhere. This patch quietly fixes that. Bah. Just because gcc has a "feature" doesn't mean we should use it (in this form). > OK, many people complained that it needed a comment. Good point! > == > Add comment to ARRAY_SIZE macro. > > Signed-off-by: Rusty Russell > > diff -r 933e410f204f include/linux/kernel.h > --- a/include/linux/kernel.h Sat Mar 10 09:55:31 2007 +1100 > +++ b/include/linux/kernel.h Sat Mar 10 09:55:53 2007 +1100 > @@ -35,6 +35,7 @@ extern const char linux_proc_banner[]; > #define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1) > #define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask)) > > +/* GCC is awesome. */ > #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) \ > + sizeof(typeof(int[1 - 2*!!__builtin_types_compatible_p(typeof(arr), \ > typeof(&arr[0]))]))*0) --- ~Randy *** Remember to use Documentation/SubmitChecklist when testing your code ***