This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fixes for a small number of compiler warnings


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]