Enable improved <tgmath.h> for Clang even when not using C11.

By using __has_extension(c_generic_selections), we can explicitly test
whether we're dealing with a version of Clang that supports _Generic().
That way we can use the improved <tgmath.h> code, even when not using
-std=c11. This massively reduces the compilation time when invoking
these functions.
This commit is contained in:
Ed Schouten 2013-04-27 21:18:34 +00:00
parent d9e22925e0
commit 5a1d14ca78

View File

@ -60,7 +60,8 @@
* compilers use an inefficient yet reliable version.
*/
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \
__has_extension(c_generic_selections)
#define __tg_generic(x, cfnl, cfn, cfnf, fnl, fn, fnf) \
_Generic(x, \
long double _Complex: cfnl, \