svn commit: r249995 - head/include

Ed Schouten ed at FreeBSD.org
Sat Apr 27 21:18:35 UTC 2013


Author: ed
Date: Sat Apr 27 21:18:34 2013
New Revision: 249995
URL: http://svnweb.freebsd.org/changeset/base/249995

Log:
  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.

Modified:
  head/include/tgmath.h

Modified: head/include/tgmath.h
==============================================================================
--- head/include/tgmath.h	Sat Apr 27 20:24:30 2013	(r249994)
+++ head/include/tgmath.h	Sat Apr 27 21:18:34 2013	(r249995)
@@ -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,				\


More information about the svn-src-all mailing list