diff options
author | Andreas Holzammer <andreas.holzammer@kdab.com> | 2016-02-10 13:05:26 +0100 |
---|---|---|
committer | Andreas Holzammer <andreas.holzammer@kdab.com> | 2016-02-11 12:54:06 +0000 |
commit | 7e85e7ced7079d620ae73f8664a68530992c6af1 (patch) | |
tree | cbf9665ac00132838a57afeeae976aa877b9a7af /src/corelib/global/qcompilerdetection.h | |
parent | 9e8c84aa14ee26c04ab04ff28f0bab22e04887d6 (diff) |
Add initial clang-cl support to Qt
This adds the functionality to build Qt with clang under Windows against
the Microsoft Visual Studio 2015 runtime.
In order to replicate this, a Clang 3.8 build with Visual Studio 2015
Update 1 is needed.
Adds compiler detection to Qt to distinguish correctly the clang compiler
and Windows with Visual Studio.
Clang has some built-in numeric functions, there is no need to use the
Microsoft versions, which also conflict here.
Task-number: QTBUG-50804
Change-Id: Ia4b267a298310ac7d73edf473b12792991249d8a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Diffstat (limited to 'src/corelib/global/qcompilerdetection.h')
-rw-r--r-- | src/corelib/global/qcompilerdetection.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index e655aace32..7575fe06b2 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -83,6 +83,9 @@ # endif #elif defined(_MSC_VER) +# ifdef __clang__ +# define Q_CC_CLANG ((__clang_major__ * 100) + __clang_minor__) +# endif # define Q_CC_MSVC (_MSC_VER) # define Q_CC_MSVC_NET # define Q_OUTOFLINE_TEMPLATE inline @@ -97,7 +100,9 @@ # define Q_UNREACHABLE_IMPL() __assume(0) # define Q_NORETURN __declspec(noreturn) # define Q_DECL_DEPRECATED __declspec(deprecated) -# define Q_DECL_DEPRECATED_X(text) __declspec(deprecated(text)) +# ifndef Q_CC_CLANG +# define Q_DECL_DEPRECATED_X(text) __declspec(deprecated(text)) +# endif # define Q_DECL_EXPORT __declspec(dllexport) # define Q_DECL_IMPORT __declspec(dllimport) /* Intel C++ disguising as Visual C++: the `using' keyword avoids warnings */ @@ -1177,7 +1182,7 @@ # define QT_WARNING_DISABLE_MSVC(number) # define QT_WARNING_DISABLE_CLANG(text) # define QT_WARNING_DISABLE_GCC(text) -#elif defined(Q_CC_MSVC) && _MSC_VER >= 1500 +#elif defined(Q_CC_MSVC) && _MSC_VER >= 1500 && !defined(Q_CC_CLANG) # undef QT_DO_PRAGMA /* not needed */ # define QT_WARNING_PUSH __pragma(warning(push)) # define QT_WARNING_POP __pragma(warning(pop)) |