[PATCH] Fixes for a small number of compiler warnings
Ed Maste
emaste@freebsd.org
Wed Apr 1 19:46:00 GMT 2015
On 1 April 2015 at 14:43, Ed Schouten <ed@nuxi.nl> wrote:
> 2015-04-01 17:16 GMT+02:00 H.J. Lu <hjl.tools@gmail.com>:
>> +#if defined(__GNUC__) && GCC_VERSION < 4006
>
> So the issue with this expression is that this also evaluates to true
> when using Clang. Clang also defines __GNUC__ as it implements most
> GNU-specific constructs. It has to define this to make existing code
> out there work.
>
> This makes the code work for me:
>
> #if defined(__GNUC__) && GCC_VERSION < 4006 && !defined(__clang__)
FWIW ICC also defines __GNUC__.
Clang does not define GCC_VERSION, so that might be another way to approach it.
The GCC version macros Clang defines are:
#define __GNUC_MINOR__ 2
#define __GNUC_PATCHLEVEL__ 1
#define __GNUC_STDC_INLINE__ 1
#define __GNUC__ 4
More information about the Binutils
mailing list