Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 05 Jul 2011 12:38:32 +0200
From:      Matthias Andree <matthias.andree@gmx.de>
To:        freebsd-hackers@freebsd.org
Subject:   Re: [PATCH] __FreeBSD_cc_version in <sys/cdefs.h>
Message-ID:  <4E12E9A8.1090900@gmx.de>
In-Reply-To: <4E12E358.80002@FreeBSD.org>
References:  <CAOfDtXMHdVm%2B7DFr=ZV4x_5uQ=q%2B2A0cFxvZsUgGzqWEwURhYg@mail.gmail.com> <4E12E358.80002@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Am 05.07.2011 12:11, schrieb Dimitry Andric:
> On 2011-07-04 18:30, Robert Millan wrote:
>> This patch fixes a (harmless) warning when<sys/cdefs.h>  is parsed by
>> upstream version of GCC.
>>
>> -#if __FreeBSD_cc_version >= 300001 && defined(__GNUC__) &&
>> !defined(__INTEL_COMPILER)
>> +#if defined(__FreeBSD_cc_version) && __FreeBSD_cc_version >= 300001
>> && defined(__GNUC__) && !defined(__INTEL_COMPILER)
> 
> As far as I can see, this code only gives warnings when compiled with
> gcc 4.5 or higher, and when using the -Wundef flag.  Isn't it easier to
> just remove the -Wundef flag here?
> 
> Additionally, it looks like the C standard is a bit vague about whether
> the preprocessor uses short-circuited boolean evaluation (although gcc's
> manual says it does), so I'm not sure whether this patch solves the
> problem properly either.

The CPP #if argument is a /constant-expression/, according to K&R's The
C Programming language 2nd ed., so it shall short-circuit.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4E12E9A8.1090900>