summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@digia.com>2014-11-04 18:12:46 +0100
committerThiago Macieira <thiago.macieira@intel.com>2014-11-05 07:30:32 +0100
commit85a71381145528d446416d2744734384dbe739b4 (patch)
tree29f3434273cc4173b4c73fc7d22c7983a1e2f06a
parentdce13e4b7b0d6cf04879fc3b1f2a241579296e73 (diff)
Define Q_CC_CLANG to be the version of upstream Clang that's in use
We map the Apple Clang versions to upstream, so that we have one define to compare against. Fixes build break on iOS due to qbasicatomic.h not defining QT_BASIC_ATOMIC_HAS_CONSTRUCTORS on Apple Clang versions, which is needed after 1e9db9f5e18123f2e686c10b Change-Id: I17493c0187c20abc5d22e71944d62bfd16afbad2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r--src/corelib/global/qcompilerdetection.h25
-rw-r--r--src/corelib/thread/qbasicatomic.h10
-rw-r--r--src/corelib/tools/qsimd_p.h2
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp2
4 files changed, 27 insertions, 12 deletions
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index 949617fa7c..de8a53ea06 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -152,7 +152,26 @@
# endif
# elif defined(__clang__)
/* Clang also masquerades as GCC */
-# define Q_CC_CLANG
+# if defined(__apple_build_version__)
+# /* http://en.wikipedia.org/wiki/Xcode#Toolchain_Versions */
+# if __apple_build_version__ >= 600051
+# define Q_CC_CLANG 305
+# elif __apple_build_version__ >= 503038
+# define Q_CC_CLANG 304
+# elif __apple_build_version__ >= 500275
+# define Q_CC_CLANG 303
+# elif __apple_build_version__ >= 425024
+# define Q_CC_CLANG 302
+# elif __apple_build_version__ >= 318045
+# define Q_CC_CLANG 301
+# elif __apple_build_version__ >= 211101
+# define Q_CC_CLANG 300
+# else
+# error "Unknown Apple Clang version"
+# endif
+# else
+# define Q_CC_CLANG ((__clang_major__ * 100) + __clang_minor__)
+# endif
# define Q_ASSUME_IMPL(expr) if (expr){} else __builtin_unreachable()
# define Q_UNREACHABLE_IMPL() __builtin_unreachable()
# if !defined(__has_extension)
@@ -566,7 +585,7 @@
# endif
// Variadic macros are supported for gnu++98, c++11, c99 ... since 2.9
-# if ((__clang_major__ * 100) + __clang_minor__) >= 209
+# if Q_CC_CLANG >= 209
# if !defined(__STRICT_ANSI__) || defined(__GXX_EXPERIMENTAL_CXX0X__) \
|| (defined(__cplusplus) && (__cplusplus >= 201103L)) \
|| (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
@@ -668,7 +687,7 @@
# define Q_COMPILER_VARIADIC_TEMPLATES
# endif
/* Features that have no __has_feature() check */
-# if ((__clang_major__ * 100) + __clang_minor__) >= 209 /* since clang 2.9 */
+# if Q_CC_CLANG >= 209 /* since clang 2.9 */
# define Q_COMPILER_EXTERN_TEMPLATES
# endif
# endif
diff --git a/src/corelib/thread/qbasicatomic.h b/src/corelib/thread/qbasicatomic.h
index 09500e92d7..be293f58e3 100644
--- a/src/corelib/thread/qbasicatomic.h
+++ b/src/corelib/thread/qbasicatomic.h
@@ -84,13 +84,9 @@ QT_END_NAMESPACE
// New atomics
#if defined(Q_COMPILER_CONSTEXPR) && defined(Q_COMPILER_DEFAULT_MEMBERS) && defined(Q_COMPILER_DELETE_MEMBERS)
-# if defined(Q_CC_CLANG) && ((((__clang_major__ * 100) + __clang_minor__) < 303) \
- || defined(__apple_build_version__) \
- )
- /* Do not define QT_BASIC_ATOMIC_HAS_CONSTRUCTORS for "stock" clang before version 3.3.
- Apple's version has different (higher!) version numbers, so disable it for all of them for now.
- (The only way to distinguish between them seems to be a check for __apple_build_version__ .)
-
+# if defined(Q_CC_CLANG) && Q_CC_CLANG < 303
+ /*
+ Do not define QT_BASIC_ATOMIC_HAS_CONSTRUCTORS for Clang before version 3.3.
For details about the bug: see http://llvm.org/bugs/show_bug.cgi?id=12670
*/
# else
diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h
index 434819aa61..3241e09b08 100644
--- a/src/corelib/tools/qsimd_p.h
+++ b/src/corelib/tools/qsimd_p.h
@@ -219,7 +219,7 @@
// other x86 intrinsics
#if defined(Q_PROCESSOR_X86) && ((defined(Q_CC_GNU) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 404)) \
- || (defined(Q_CC_CLANG) && (__clang_major__ * 100 + __clang_minor__ >= 208)) \
+ || (defined(Q_CC_CLANG) && (Q_CC_CLANG >= 208)) \
|| defined(Q_CC_INTEL))
# define QT_COMPILER_SUPPORTS_X86INTRIN
# ifdef Q_CC_INTEL
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index 13e786cd20..edb6488eaa 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -1564,7 +1564,7 @@ public slots:
void doAnotherThing(bool a = (1 < 3), bool b = (1 > 4)) { Q_UNUSED(a); Q_UNUSED(b); }
-#if defined(Q_MOC_RUN) || (defined(Q_COMPILER_AUTO_TYPE) && !(defined(Q_CC_CLANG) && (__clang_major__ * 100) + __clang_minor__) < 304)
+#if defined(Q_MOC_RUN) || (defined(Q_COMPILER_AUTO_TYPE) && !(defined(Q_CC_CLANG) && Q_CC_CLANG < 304))
// There is no Q_COMPILER_>> but if compiler support auto, it should also support >>
void performSomething(QVector<QList<QString>> e = QVector<QList<QString>>(8 < 1),
QHash<int, QVector<QString>> h = QHash<int, QVector<QString>>())