diff options
Diffstat (limited to 'src/corelib/global/qcompilerdetection.h')
-rw-r--r-- | src/corelib/global/qcompilerdetection.h | 104 |
1 files changed, 87 insertions, 17 deletions
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 5f8ca5c7cc..db5f6f3bb1 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Copyright (C) 2012 Intel Corporation +** Copyright (C) 2014 Intel Corporation ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -75,7 +75,6 @@ # if defined(__SC__) && __SC__ < 0x750 # error "Compiler not supported" # endif -# define Q_NO_USING_KEYWORD #elif defined(_MSC_VER) # define Q_CC_MSVC (_MSC_VER) @@ -113,7 +112,6 @@ # if __BORLANDC__ < 0x502 # error "Compiler not supported" # endif -# define Q_NO_USING_KEYWORD #elif defined(__WATCOMC__) # define Q_CC_WAT @@ -278,7 +276,6 @@ # error "Compiler not supported" # endif /* Spurious (?) error messages observed on Compaq C++ V6.5-014. */ -# define Q_NO_USING_KEYWORD /* Apply to all versions prior to Compaq C++ V6.0-000 - observed on DEC C++ V5.5-004. */ # if __DECCXX_VER < 60060000 @@ -323,7 +320,6 @@ compiler is using its own set of rules. Forget it. */ # elif defined(__KCC) # define Q_CC_KAI -# define Q_NO_USING_KEYWORD /* Using the `using' keyword avoids Intel C++ for Linux warnings */ # elif defined(__INTEL_COMPILER) @@ -346,23 +342,19 @@ # if !defined(__SCO_VERSION__) || (__SCO_VERSION__ < 302200010) # define Q_OUTOFLINE_TEMPLATE inline # endif -# define Q_NO_USING_KEYWORD /* ### check "using" status */ /* Never tested! */ # elif defined(CENTERLINE_CLPP) || defined(OBJECTCENTER) # define Q_CC_OC -# define Q_NO_USING_KEYWORD /* CDS++ defines __EDG__ although this is not documented in the Reliant documentation. It also follows conventions like _BOOL and this documented */ # elif defined(sinix) # define Q_CC_CDS -# define Q_NO_USING_KEYWORD /* The MIPSpro compiler defines __EDG */ # elif defined(__sgi) # define Q_CC_MIPS -# define Q_NO_USING_KEYWORD /* ### check "using" status */ # define Q_NO_TEMPLATE_FRIENDS # if defined(_COMPILER_VERSION) && (_COMPILER_VERSION >= 740) # define Q_OUTOFLINE_TEMPLATE inline @@ -404,9 +396,6 @@ # if !defined(_BOOL) # error "Compiler not supported" # endif -# if defined(__SUNPRO_CC_COMPAT) && (__SUNPRO_CC_COMPAT <= 4) -# define Q_NO_USING_KEYWORD -# endif # define Q_C_CALLBACKS /* 4.2 compiler or older */ # else @@ -445,7 +434,6 @@ # else # error "Compiler not supported" # endif -# define Q_NO_USING_KEYWORD /* ### check "using" status */ #else # error "Qt has not been tested with this compiler - see http://www.qt-project.org/" @@ -511,7 +499,7 @@ // at least since 13.1, but I can't test further back # define Q_COMPILER_BINARY_LITERALS # endif -# if __cplusplus >= 201103L +# if __cplusplus >= 201103L || defined(__INTEL_CXX11_MODE__) # if __INTEL_COMPILER >= 1200 # define Q_COMPILER_AUTO_TYPE # define Q_COMPILER_CLASS_ENUM @@ -529,7 +517,9 @@ # define Q_COMPILER_AUTO_FUNCTION # define Q_COMPILER_NULLPTR # define Q_COMPILER_TEMPLATE_ALIAS -# define Q_COMPILER_UNICODE_STRINGS +# ifndef _CHAR16T // MSVC headers +# define Q_COMPILER_UNICODE_STRINGS +# endif # define Q_COMPILER_VARIADIC_TEMPLATES # endif # if __INTEL_COMPILER >= 1300 @@ -874,7 +864,24 @@ # if _MSC_FULL_VER >= 180030324 // VC 12 SP 2 RC # define Q_COMPILER_INITIALIZER_LISTS # endif /* VC 12 SP 2 RC */ - +# if _MSC_VER >= 1900 + /* C++11 features in VC14 = VC2015 */ +# define Q_COMPILER_ALIGNAS +# define Q_COMPILER_ALIGNOF +// Partial support, insufficient for Qt +//# define Q_COMPILER_CONSTEXPR +# define Q_COMPILER_INHERITING_CONSTRUCTORS +# define Q_COMPILER_NOEXCEPT +# define Q_COMPILER_RANGE_FOR +# define Q_COMPILER_REF_QUALIFIERS +# define Q_COMPILER_THREAD_LOCAL +# define Q_COMPILER_THREADSAFE_STATICS +# define Q_COMPILER_UDL +# define Q_COMPILER_UNICODE_STRINGS +// Uniform initialization is not working yet -- build errors with QUuid +//# define Q_COMPILER_UNIFORM_INIT +# define Q_COMPILER_UNRESTRICTED_UNIONS +# endif # endif /* __cplusplus */ #endif /* Q_CC_MSVC */ @@ -944,12 +951,21 @@ # define Q_COMPILER_DEFAULT_DELETE_MEMBERS #endif -#ifdef Q_COMPILER_CONSTEXPR +#if defined(__cpp_constexpr) && __cpp_constexpr-0 >= 201304 +# define Q_DECL_CONSTEXPR constexpr +# define Q_DECL_RELAXED_CONSTEXPR constexpr +# define Q_CONSTEXPR constexpr +# define Q_RELAXED_CONSTEXPR constexpr +#elif defined Q_COMPILER_CONSTEXPR # define Q_DECL_CONSTEXPR constexpr +# define Q_DECL_RELAXED_CONSTEXPR # define Q_CONSTEXPR constexpr +# define Q_RELAXED_CONSTEXPR const #else # define Q_DECL_CONSTEXPR +# define Q_DECL_RELAXED_CONSTEXPR # define Q_CONSTEXPR const +# define Q_RELAXED_CONSTEXPR const #endif #ifdef Q_COMPILER_EXPLICIT_OVERRIDES @@ -1052,6 +1068,60 @@ #endif /* + * Warning/diagnostic handling + */ + +#define QT_DO_PRAGMA(text) _Pragma(#text) +#if defined(Q_CC_INTEL) && defined(Q_CC_MSVC) +/* icl.exe: Intel compiler on Windows */ +# undef QT_DO_PRAGMA /* not needed */ +# define QT_WARNING_PUSH __pragma(warning(push)) +# define QT_WARNING_POP __pragma(warning(pop)) +# define QT_WARNING_DISABLE_MSVC(number) +# define QT_WARNING_DISABLE_INTEL(number) __pragma(warning(disable: number)) +# define QT_WARNING_DISABLE_CLANG(text) +# define QT_WARNING_DISABLE_GCC(text) +#elif defined(Q_CC_INTEL) +/* icc: Intel compiler on Linux or OS X */ +# define QT_WARNING_PUSH QT_DO_PRAGMA(warning(push)) +# define QT_WARNING_POP QT_DO_PRAGMA(warning(pop)) +# define QT_WARNING_DISABLE_INTEL(number) QT_DO_PRAGMA(warning(disable: number)) +# 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 +# undef QT_DO_PRAGMA /* not needed */ +# define QT_WARNING_PUSH __pragma(warning(push)) +# define QT_WARNING_POP __pragma(warning(pop)) +# define QT_WARNING_DISABLE_MSVC(number) __pragma(warning(disable: number)) +# define QT_WARNING_DISABLE_INTEL(number) +# define QT_WARNING_DISABLE_CLANG(text) +# define QT_WARNING_DISABLE_GCC(text) +#elif defined(Q_CC_CLANG) +# define QT_WARNING_PUSH QT_DO_PRAGMA(clang diagnostic push) +# define QT_WARNING_POP QT_DO_PRAGMA(clang diagnostic pop) +# define QT_WARNING_DISABLE_CLANG(text) QT_DO_PRAGMA(clang diagnostic ignored text) +# define QT_WARNING_DISABLE_GCC(text) QT_DO_PRAGMA(GCC diagnostic ignored text) // GCC directives work in Clang too +# define QT_WARNING_DISABLE_INTEL(number) +# define QT_WARNING_DISABLE_MSVC(number) +#elif defined(Q_CC_GNU) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 405) +# define QT_WARNING_PUSH QT_DO_PRAGMA(GCC diagnostic push) +# define QT_WARNING_POP QT_DO_PRAGMA(GCC diagnostic pop) +# define QT_WARNING_DISABLE_GCC(text) QT_DO_PRAGMA(GCC diagnostic ignored text) +# define QT_WARNING_DISABLE_CLANG(text) +# define QT_WARNING_DISABLE_INTEL(number) +# define QT_WARNING_DISABLE_MSVC(number) +#else // All other compilers, GCC < 4.6 and MSVC < 2008 +# define QT_WARNING_DISABLE_GCC(text) +# define QT_WARNING_PUSH +# define QT_WARNING_POP +# define QT_WARNING_DISABLE_INTEL(number) +# define QT_WARNING_DISABLE_MSVC(number) +# define QT_WARNING_DISABLE_CLANG(text) +# define QT_WARNING_DISABLE_GCC(text) +#endif + +/* Proper for-scoping in MIPSpro CC */ #ifndef QT_NO_KEYWORDS |