On 08/23/2010 10:27 AM, Paul Eggert wrote:
On 08/23/10 09:14, Eric Blake wrote:
So does clang define __GNUC__?  That's a lie, if it does not support the
same extensions as gcc.

Yes, and this lie causes a lot of problems in practice:
clang does not support many extensions that GCC does support.
The usual workaround is to replace "defined __GNUC__" with
"defined __GNUC__&&  ! defined __clang__", but this sort of
thing is obviously not The Autoconf Way.  It is better, in
general, to avoid the use of __GNUC__ entirely.  In this
particular case, where the __GNUC__ is gratuitous, I'd remove
the __GNUC__ (while also replacing the -1 with 0 as Eric suggests).

But that particular __GNUC__ use was _not_ gratuitous. That piece of code uses non-standard C, so we wanted to limit compilation to exactly two compilers: AIX, to expose the compiler bug; and gcc, where we know that the extension is supported, to make sure we don't introduce a future regression that could have been detected by gcc (and in case the AIX compiler is ever fixed). Now we have to deal with clang also compiling the same bit of code.

--
Eric Blake   ebl...@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Reply via email to