summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2013-04-27 21:18:34 +0000
committered <ed@FreeBSD.org>2013-04-27 21:18:34 +0000
commit122d06c54099c05d307b2dc49493a716cbc4f225 (patch)
treeba7b6ae7ac7f7b9fb817b26a6b33f2531f530d4e /include
parent7b9fef1391980ba73dcc1c4ea9b36dcb7f6f7794 (diff)
downloadFreeBSD-src-122d06c54099c05d307b2dc49493a716cbc4f225.zip
FreeBSD-src-122d06c54099c05d307b2dc49493a716cbc4f225.tar.gz
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.
Diffstat (limited to 'include')
-rw-r--r--include/tgmath.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/tgmath.h b/include/tgmath.h
index 9302302..7f4de6f 100644
--- a/include/tgmath.h
+++ b/include/tgmath.h
@@ -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, \
OpenPOWER on IntegriCloud