[PATCH 1/2] Add __clang_has_extension to sys/cdefs.h.

Paul Eggert eggert@cs.ucla.edu
Tue Apr 26 15:13:00 GMT 2016


On 04/26/2016 06:48 AM, Florian Weimer wrote:
>
> This will confuse application that checks for the presence of 
> __has_extension.

Yes. As an example of this sort of thing, GNU Emacs does this:

    #ifndef __has_attribute
    # define __has_attribute(a) __has_attribute_##a
    # define __has_attribute_alloc_size (4 < __GNUC__ + (3 <= 
__GNUC_MINOR__))
    # define __has_attribute_cleanup (3 < __GNUC__ + (4 <= __GNUC_MINOR__))
    ...

and this would stop working if Glibc sys/cdefs.h defined 
__has_attribute(x) to be 0 when compiling with GCC. This specific 
example is about __has_attribute and not __has_extension, but the same 
idea applies to __has_extension.



More information about the Libc-alpha mailing list