This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 1/2] Add __clang_has_extension to sys/cdefs.h.
- From: Paul Eggert <eggert at cs dot ucla dot edu>
- To: Florian Weimer <fweimer at redhat dot com>, Zack Weinberg <zackw at panix dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>
- Date: Tue, 26 Apr 2016 08:13:43 -0700
- Subject: Re: [PATCH 1/2] Add __clang_has_extension to sys/cdefs.h.
- Authentication-results: sourceware.org; auth=none
- References: <cover dot 1461444595 dot git dot zackw at panix dot com> <7d28608ab5396836526b235526e0b757236cfc85 dot 1461444595 dot git dot zackw at panix dot com> <571DC5D1 dot 5070209 at redhat dot com> <CAKCAbMjuZmKOMVBpPBHK06i5oherVeRhm4xswLrFAK3u-dsKkA at mail dot gmail dot com> <571F71A7 dot 9070207 at redhat dot com>
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.