This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] float128: Extend __MATH_TG for float128 support
On Wed, 17 May 2017, Gabriel F. T. Gomes wrote:
> Should I also add a clang-specific test, since Clang also defines __GNUC__?
> Something like the following in sys/cdefs.h:
>
> /* Support for generic selection (ISO C11) is available in GCC since
> version 4.9. Previous versions do not provide generic selection,
> even though they might set __STDC_VERSION__ to 201112L, when in
> -std=c11 mode. Thus, we must check for !defined __GNUC__ when
> testing __STDC_VERSION__ for generic selection support.
> On the other hand, Clang also defines __GNUC__, so a clang-specific
> check is required to enable the use of generic selection. */
> #if __GNUC_PREREQ (4, 9) \
> || __glibc_clang_has_extension (c_generic_selections) \
> || (!defined __GNUC__ && defined __STDC_VERSION__ \
> && __STDC_VERSION__ >= 201112L)
> # define __HAVE_GENERIC_SELECTION 1
> #else
> # define __HAVE_GENERIC_SELECTION 0
> #endif
>
> And is __HAVE_GENERIC_SELECTION a good name for a macro in sys/cdefs.h?
That seems reasonable.
Presumably if you want to support clang versions with __float128 support
on powerpc64le you'll have similar tests in your bits/floatn.h.
--
Joseph S. Myers
joseph@codesourcery.com