Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756689AbXF1ERR (ORCPT ); Thu, 28 Jun 2007 00:17:17 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751178AbXF1ERG (ORCPT ); Thu, 28 Jun 2007 00:17:06 -0400 Received: from terminus.zytor.com ([192.83.249.54]:55601 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751113AbXF1ERF (ORCPT ); Thu, 28 Jun 2007 00:17:05 -0400 Message-ID: <468332D3.4040707@zytor.com> Date: Thu, 28 Jun 2007 00:02:27 -0400 From: "H. Peter Anvin" User-Agent: Thunderbird 2.0.0.4 (X11/20070615) MIME-Version: 1.0 To: Kyle Moffett CC: Adrian Bunk , David Woodhouse , Joerg Schilling , david@lang.hm, LKML Kernel Subject: Re: Linux Kernel include files References: <467afc63.OnsqEXOk5zqMYzym%Joerg.Schilling@fokus.fraunhofer.de> <467b0bf2.Xfs7T8Ys4nY9ZNLW%Joerg.Schilling@fokus.fraunhofer.de> <1182483527.10524.31.camel@shinybook.infradead.org> <20070622150038.GN23017@stusta.de> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1603 Lines: 40 Kyle Moffett wrote: > > Gah, this particular topic and a few other similar header-compatibility > ones show up once a month on LKML; I should probably just make a patch > to fix all the types.h files and be done with it. The proper solution > is this: > > # if __STDC_VERSION__ >= 19901L > typedef signed long long __s64; > typedef unsigned long long __u64; > # elif defined(__GNUC__) > __extension__ typedef signed long long __s64; > __extension__ typedef unsigned long long __u64; > # else > # error "Your compiler doesn't support long long (IOW: It sucks). > Please get a new one" > # endif > > That way if you have any kind of vaguely-long-long-compatible compiler > then it will work, and otherwise you'll get a nice useful error > message. It also makes sure that GCC doesn't spew warnings/errors when > in c89-pedantic mode. The "__extension__" keyword is designed for use > in implementation header files which want to use GCC-isms unconditionally. > __extension__ should be macroized if so. However, since something that doesn't have "long long" won't be able to compile those headers, there is absolutely no reason to not simply use it -- you get an error message on that line, which is good enough. There is definitely no reason to use a test like the one above, which is wrong for several supportable compilers. -hpa - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/