clang: Use __has_feature() to detect C++11 features.

This commit is contained in:
Felix Geyer 2012-07-01 20:24:43 +02:00
parent ee3bc89a54
commit 6ce53b142d

View File

@ -25,13 +25,21 @@
#include <QtCore/QtGlobal> #include <QtCore/QtGlobal>
#ifdef Q_CC_CLANG #ifdef Q_CC_CLANG
# if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L # if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
# if ((__clang_major__ * 100) + __clang_minor__) >= 209 /* since clang 2.9 */ /* Detect C++ features using __has_feature(), see http://clang.llvm.org/docs/LanguageExtensions.html#cxx11 */
# if __has_feature(cxx_strong_enums)
# define COMPILER_CLASS_ENUM
# endif
# if __has_feature(cxx_constexpr)
# define COMPILER_CONSTEXPR
# endif
# if __has_feature(cxx_decltype) /* && __has_feature(cxx_decltype_incomplete_return_types) */
# define COMPILER_DECLTYPE # define COMPILER_DECLTYPE
# endif # endif
# if ((__clang_major__ * 100) + __clang_minor__) >= 300 /* since clang 3.0 */ # if __has_feature(cxx_override_control)
# define COMPILER_CLASS_ENUM
# define COMPILER_EXPLICIT_OVERRIDES # define COMPILER_EXPLICIT_OVERRIDES
# endif
# if __has_feature(cxx_nullptr)
# define COMPILER_NULLPTR # define COMPILER_NULLPTR
# endif # endif
# endif # endif