aboutsummaryrefslogtreecommitdiffstats
path: root/include/tgmath.h
diff options
context:
space:
mode:
authorEd Schouten <ed@FreeBSD.org>2013-04-27 21:18:34 +0000
committerEd Schouten <ed@FreeBSD.org>2013-04-27 21:18:34 +0000
commit5a1d14ca781b085924714ce4ed9bcce6cfa89398 (patch)
treeba7b6ae7ac7f7b9fb817b26a6b33f2531f530d4e /include/tgmath.h
parentd9e22925e0cd52fc6b4e3fedf05367b3c6d401a1 (diff)
downloadsrc-5a1d14ca781b085924714ce4ed9bcce6cfa89398.tar.gz
src-5a1d14ca781b085924714ce4ed9bcce6cfa89398.zip
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.
Notes
Notes: svn path=/head/; revision=249995
Diffstat (limited to 'include/tgmath.h')
-rw-r--r--include/tgmath.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/tgmath.h b/include/tgmath.h
index 9302302658fb..7f4de6f3fa6e 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, \