summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/global/qcompilerdetection.h10
-rw-r--r--src/corelib/global/qglobal.h7
2 files changed, 16 insertions, 1 deletions
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index c8f1280e21..038ad03cb0 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -1155,6 +1155,16 @@
#endif
/*
+ * a useful extension from Clang
+ * http://clang.llvm.org/docs/LanguageExtensions.html#feature-checking-macros
+ */
+#ifdef __has_feature
+# define QT_HAS_FEATURE(x) __has_feature(x)
+#else
+# define QT_HAS_FEATURE(x) 0
+#endif
+
+/*
* Warning/diagnostic handling
*/
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index a7183cb983..4528005177 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -631,7 +631,12 @@ inline void qt_noop(void) {}
*/
#if !defined(QT_NO_EXCEPTIONS)
-# if defined(QT_BOOTSTRAPPED) || (defined(Q_CC_GNU) && !defined (__EXCEPTIONS) && !defined(Q_MOC_RUN))
+# if !defined(Q_MOC_RUN)
+# if (defined(Q_CC_CLANG) && !defined(Q_CC_INTEL) && !QT_HAS_FEATURE(cxx_exceptions)) || \
+ (defined(Q_CC_GNU) && !defined(__EXCEPTIONS))
+# define QT_NO_EXCEPTIONS
+# endif
+# elif defined(QT_BOOTSTRAPPED)
# define QT_NO_EXCEPTIONS
# endif
#endif