summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qcompilerdetection.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/global/qcompilerdetection.h')
-rw-r--r--src/corelib/global/qcompilerdetection.h35
1 files changed, 20 insertions, 15 deletions
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index 5f60e32af5..d1d5373146 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -656,14 +656,6 @@
/* General C++ features */
# define Q_COMPILER_RESTRICTED_VLA
# define Q_COMPILER_THREADSAFE_STATICS
-# if !__has_feature(cxx_exceptions)
-# ifndef QT_NO_EXCEPTIONS
-# define QT_NO_EXCEPTIONS
-# endif
-# endif
-# if !__has_feature(cxx_rtti)
-# define QT_NO_RTTI
-# endif
# if __has_feature(attribute_deprecated_with_message)
# define Q_DECL_DEPRECATED_X(text) __attribute__ ((__deprecated__(text)))
# endif
@@ -1042,7 +1034,8 @@
// critical definitions. (Reported as Intel Issue ID 6000117277)
# define __USE_CONSTEXPR 1
# define __USE_NOEXCEPT 1
-# elif defined(Q_CC_MSVC) && (defined(Q_CC_CLANG) || defined(Q_CC_INTEL))
+# endif
+# if defined(Q_CC_MSVC) && defined(Q_CC_CLANG)
// Clang and the Intel compiler support more C++ features than the Microsoft compiler
// so make sure we don't enable them if the MS headers aren't properly adapted.
# ifndef _HAS_CONSTEXPR
@@ -1069,12 +1062,6 @@
# ifndef _HAS_VARIADIC_TEMPLATES
# undef Q_COMPILER_VARIADIC_TEMPLATES
# endif
-# elif defined(_LIBCPP_VERSION)
-// libc++ uses __has_feature(cxx_atomic), so disable the feature if the compiler
-// doesn't support it. That's required for the Intel compiler 14.x or earlier on OS X, for example.
-# if !__has_feature(cxx_atomic)
-# undef Q_COMPILER_ATOMICS
-# endif
# endif
# if defined(Q_COMPILER_THREADSAFE_STATICS) && defined(Q_OS_MAC)
// Apple's low-level implementation of the C++ support library
@@ -1354,6 +1341,24 @@
Q_ASSUME_IMPL(valueOfExpression);\
} while (0)
+#if QT_HAS_CPP_ATTRIBUTE(fallthrough)
+# define Q_FALLTHROUGH() [[fallthrough]]
+#elif defined(__cplusplus)
+/* Clang can not parse namespaced attributes in C mode, but defines __has_cpp_attribute */
+# if QT_HAS_CPP_ATTRIBUTE(clang::fallthrough)
+# define Q_FALLTHROUGH() [[clang::fallthrough]]
+# elif QT_HAS_CPP_ATTRIBUTE(gnu::fallthrough)
+# define Q_FALLTHROUGH() [[gnu::fallthrough]]
+# endif
+#endif
+#ifndef Q_FALLTHROUGH
+# if defined(Q_CC_GNU) && Q_CC_GNU >= 700
+# define Q_FALLTHROUGH() __attribute__((fallthrough))
+# else
+# define Q_FALLTHROUGH() (void)0
+#endif
+#endif
+
/*
Sanitize compiler feature availability