define QT_NO_EXCEPTIONS reliably when using Clang
Clang's definition of the __EXCEPTIONS macro is inconsistent across platforms. When compiling for Darwin, Clang 3.6 and newer will set the token when exceptions are enabled in either C++ or ObjC. This change adds the reliable check described in the Clang 3.6 release notes to ensure that QT_NO_EXCEPTIONS is defined when required. The check requires the use of the Clang-specific __has_feature() syntax for which a new proxy macro QT_HAS_FEATURE(x) is added in qcompilerdetection.h Task-number: QTBUG-61034 Change-Id: Ie7b482dfa1a4a5b700a6b97562c26b626be1fc04 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
b7d76e533c
commit
6e97d091e4
@ -1246,6 +1246,11 @@
|
||||
#else
|
||||
# define QT_HAS_INCLUDE_NEXT(x) 0
|
||||
#endif
|
||||
#ifdef __has_feature
|
||||
# define QT_HAS_FEATURE(x) __has_feature(x)
|
||||
#else
|
||||
# define QT_HAS_FEATURE(x) 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Warning/diagnostic handling
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user