diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-01-04 14:33:06 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-01-08 04:52:43 +0000 |
commit | b096c53d593a313a6372bffb35f45cdc0e1ffd21 (patch) | |
tree | 31b9eb39439c6fb0055c167b1105489728ae6bbf | |
parent | 78f234d5dd7face13dd88fd777fa27497590b34d (diff) |
QtCore: Raise minimum supported MSVC version to 2015
Remove code for older versions and streamline #ifdefs.
Task-number: QTBUG-51673
Change-Id: I211703189ff12f827d94914093369736b6e65d4a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r-- | src/corelib/global/qcompilerdetection.h | 68 | ||||
-rw-r--r-- | src/corelib/global/qglobal.cpp | 12 | ||||
-rw-r--r-- | src/corelib/global/qglobal.h | 6 | ||||
-rw-r--r-- | src/corelib/global/qlibraryinfo.cpp | 10 | ||||
-rw-r--r-- | src/corelib/global/qnumeric_p.h | 4 | ||||
-rw-r--r-- | src/corelib/io/qurlidna.cpp | 5 | ||||
-rw-r--r-- | src/corelib/tools/qalgorithms.h | 2 | ||||
-rw-r--r-- | src/corelib/tools/qbytearray.cpp | 4 | ||||
-rw-r--r-- | src/corelib/tools/qbytearraymatcher.h | 5 | ||||
-rw-r--r-- | src/corelib/tools/qchar.cpp | 2 | ||||
-rw-r--r-- | src/corelib/tools/qdatetime.cpp | 4 | ||||
-rw-r--r-- | src/corelib/tools/qhash.h | 2 | ||||
-rw-r--r-- | src/corelib/tools/qstring.h | 2 | ||||
-rw-r--r-- | src/corelib/tools/qstringview.cpp | 3 |
14 files changed, 23 insertions, 106 deletions
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 885cb96c1a..f3f3139d1a 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -89,9 +89,6 @@ # define Q_CC_MSVC (_MSC_VER) # define Q_CC_MSVC_NET # define Q_OUTOFLINE_TEMPLATE inline -# if _MSC_VER < 1600 -# define Q_NO_TEMPLATE_FRIENDS -# endif # define Q_COMPILER_MANGLES_RETURN_TYPE # define Q_FUNC_INFO __FUNCSIG__ # define Q_ALIGNOF(type) __alignof(type) @@ -105,12 +102,8 @@ # endif # define Q_DECL_EXPORT __declspec(dllexport) # define Q_DECL_IMPORT __declspec(dllimport) -# if _MSC_VER >= 1800 -# define QT_MAKE_UNCHECKED_ARRAY_ITERATOR(x) stdext::make_unchecked_array_iterator(x) -# endif -# if _MSC_VER >= 1500 -# define QT_MAKE_CHECKED_ARRAY_ITERATOR(x, N) stdext::make_checked_array_iterator(x, size_t(N)) -# endif +# define QT_MAKE_UNCHECKED_ARRAY_ITERATOR(x) stdext::make_unchecked_array_iterator(x) // Since _MSC_VER >= 1800 +# define QT_MAKE_CHECKED_ARRAY_ITERATOR(x, N) stdext::make_checked_array_iterator(x, size_t(N)) // Since _MSC_VER >= 1500 /* Intel C++ disguising as Visual C++: the `using' keyword avoids warnings */ # if defined(__INTEL_COMPILER) # define Q_DECL_VARIABLE_DEPRECATED @@ -564,7 +557,7 @@ */ #ifdef __cplusplus -# if __cplusplus < 201103L && !(defined(Q_CC_MSVC) && Q_CC_MSVC >= 1800) +# if __cplusplus < 201103L && !defined(Q_CC_MSVC) # error Qt requires a C++11 compiler and yours does not seem to be that. # endif #endif @@ -636,22 +629,6 @@ # define Q_COMPILER_THREAD_LOCAL # define Q_COMPILER_UDL # endif -# ifdef _MSC_VER -# if _MSC_VER == 1700 -// <initializer_list> is missing with MSVC 2012 (it's present in 2010, 2013 and up) -# undef Q_COMPILER_INITIALIZER_LISTS -# endif -# if _MSC_VER < 1900 -// ICC disables unicode string support when compatibility mode with MSVC 2013 or lower is active -# undef Q_COMPILER_UNICODE_STRINGS -// Even though ICC knows about ref-qualified members, MSVC 2013 or lower doesn't, so -// certain member functions (like QString::toUpper) may be missing from the DLLs. -# undef Q_COMPILER_REF_QUALIFIERS -// Disable constexpr unless the MS headers have constexpr in all the right places too -// (like std::numeric_limits<T>::max()) -# undef Q_COMPILER_CONSTEXPR -# endif -# endif # elif defined(__STDC_VERSION__) && __STDC_VERSION__ > 199901L s // C11 features supported. Only tested with ICC 17 and up. # define Q_COMPILER_STATIC_ASSERT @@ -932,11 +909,9 @@ #if defined(Q_CC_MSVC) # if defined(__cplusplus) -# if _MSC_VER >= 1400 /* C++11 features supported in VC8 = VC2005: */ # define Q_COMPILER_VARIADIC_MACROS -# ifndef __cplusplus_cli /* 2005 supports the override and final contextual keywords, in the same positions as the C++11 variants, but 'final' is called 'sealed' instead: @@ -945,12 +920,7 @@ "virtual" keyword to be present too, so don't define for that. So don't define Q_COMPILER_EXPLICIT_OVERRIDES (since it's not the same as the C++11 version), but define the Q_DECL_* flags - accordingly: */ -# define Q_DECL_OVERRIDE override -# define Q_DECL_FINAL sealed -# endif -# endif -# if _MSC_VER >= 1600 + accordingly. */ /* C++11 features supported in VC10 = VC2010: */ # define Q_COMPILER_AUTO_FUNCTION # define Q_COMPILER_AUTO_TYPE @@ -960,57 +930,31 @@ # define Q_COMPILER_NULLPTR # define Q_COMPILER_RVALUE_REFS # define Q_COMPILER_STATIC_ASSERT -// MSVC's library has std::initializer_list, but the compiler does not support the braces initialization -//# define Q_COMPILER_INITIALIZER_LISTS -//# define Q_COMPILER_UNIFORM_INIT -# endif -# if _MSC_VER >= 1700 /* C++11 features supported in VC11 = VC2012: */ -# undef Q_DECL_OVERRIDE /* undo 2005/2008 settings... */ -# undef Q_DECL_FINAL /* undo 2005/2008 settings... */ # define Q_COMPILER_EXPLICIT_OVERRIDES /* ...and use std C++11 now */ # define Q_COMPILER_CLASS_ENUM # define Q_COMPILER_ATOMICS -# endif /* VC 11 */ -# if _MSC_VER >= 1800 /* C++11 features in VC12 = VC2013 */ -/* Implemented, but can't be used on move special members */ -/* # define Q_COMPILER_DEFAULT_MEMBERS */ # define Q_COMPILER_DELETE_MEMBERS # define Q_COMPILER_DELEGATING_CONSTRUCTORS # define Q_COMPILER_EXPLICIT_CONVERSIONS # define Q_COMPILER_NONSTATIC_MEMBER_INIT -// implemented, but nested initialization fails (eg tst_qvector): http://connect.microsoft.com/VisualStudio/feedback/details/800364/initializer-list-calls-object-destructor-twice -// #define Q_COMPILER_INITIALIZER_LISTS -// implemented in principle, but has a bug that makes it unusable: http://connect.microsoft.com/VisualStudio/feedback/details/802058/c-11-unified-initialization-fails-with-c-style-arrays -// #define Q_COMPILER_UNIFORM_INIT # define Q_COMPILER_RAW_STRINGS # define Q_COMPILER_TEMPLATE_ALIAS # define Q_COMPILER_VARIADIC_TEMPLATES -# endif /* VC 12 */ -# 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 +# define Q_COMPILER_INITIALIZER_LISTS // VC 12 SP 2 RC /* C++11 features in VC14 = VC2015 */ # define Q_COMPILER_DEFAULT_MEMBERS # 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 -// Broken, see QTBUG-47224 and https://connect.microsoft.com/VisualStudio/feedback/details/1549785 -//# 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 # if _MSC_FULL_VER >= 190023419 # define Q_COMPILER_ATTRIBUTES // Almost working, see https://connect.microsoft.com/VisualStudio/feedback/details/2011648 @@ -1315,7 +1259,7 @@ # define QT_WARNING_DISABLE_CLANG(text) # define QT_WARNING_DISABLE_GCC(text) # define QT_WARNING_DISABLE_DEPRECATED QT_WARNING_DISABLE_INTEL(1478 1786) -#elif defined(Q_CC_MSVC) && _MSC_VER >= 1500 && !defined(Q_CC_CLANG) +#elif defined(Q_CC_MSVC) && !defined(Q_CC_CLANG) # undef QT_DO_PRAGMA /* not needed */ # define QT_WARNING_PUSH __pragma(warning(push)) # define QT_WARNING_POP __pragma(warning(pop)) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index a8fa7654ba..d37ccc9253 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -3249,7 +3249,7 @@ static QBasicMutex environmentMutex; QByteArray qgetenv(const char *varName) { QMutexLocker locker(&environmentMutex); -#if defined(_MSC_VER) && _MSC_VER >= 1400 +#ifdef Q_CC_MSVC size_t requiredSize = 0; QByteArray buffer; getenv_s(&requiredSize, 0, 0, varName); @@ -3364,7 +3364,7 @@ QString qEnvironmentVariable(const char *varName) bool qEnvironmentVariableIsEmpty(const char *varName) Q_DECL_NOEXCEPT { QMutexLocker locker(&environmentMutex); -#if defined(_MSC_VER) && _MSC_VER >= 1400 +#ifdef Q_CC_MSVC // we provide a buffer that can only hold the empty string, so // when the env.var isn't empty, we'll get an ERANGE error (buffer // too small): @@ -3405,7 +3405,7 @@ int qEnvironmentVariableIntValue(const char *varName, bool *ok) Q_DECL_NOEXCEPT (std::numeric_limits<uint>::digits + NumBinaryDigitsPerOctalDigit - 1) / NumBinaryDigitsPerOctalDigit; QMutexLocker locker(&environmentMutex); -#if defined(_MSC_VER) && _MSC_VER >= 1400 +#ifdef Q_CC_MSVC // we provide a buffer that can hold any int value: char buffer[MaxDigitsForOctalInt + 2]; // +1 for NUL +1 for optional '-' size_t dummy; @@ -3452,7 +3452,7 @@ int qEnvironmentVariableIntValue(const char *varName, bool *ok) Q_DECL_NOEXCEPT bool qEnvironmentVariableIsSet(const char *varName) Q_DECL_NOEXCEPT { QMutexLocker locker(&environmentMutex); -#if defined(_MSC_VER) && _MSC_VER >= 1400 +#ifdef Q_CC_MSVC size_t requiredSize = 0; (void)getenv_s(&requiredSize, 0, 0, varName); return requiredSize != 0; @@ -3482,7 +3482,7 @@ bool qEnvironmentVariableIsSet(const char *varName) Q_DECL_NOEXCEPT bool qputenv(const char *varName, const QByteArray& value) { QMutexLocker locker(&environmentMutex); -#if defined(_MSC_VER) && _MSC_VER >= 1400 +#if defined(Q_CC_MSVC) return _putenv_s(varName, value.constData()) == 0; #elif (defined(_POSIX_VERSION) && (_POSIX_VERSION-0) >= 200112L) || defined(Q_OS_HAIKU) // POSIX.1-2001 has setenv @@ -3513,7 +3513,7 @@ bool qputenv(const char *varName, const QByteArray& value) bool qunsetenv(const char *varName) { QMutexLocker locker(&environmentMutex); -#if defined(_MSC_VER) && _MSC_VER >= 1400 +#if defined(Q_CC_MSVC) return _putenv_s(varName, "") == 0; #elif (defined(_POSIX_VERSION) && (_POSIX_VERSION-0) >= 200112L) || defined(Q_OS_BSD4) || defined(Q_OS_HAIKU) // POSIX.1-2001, BSD and Haiku have unsetenv diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 7873ab2b43..224288a1d4 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -927,13 +927,7 @@ QT_WARNING_DISABLE_MSVC(4514) /* unreferenced inline function has been removed * QT_WARNING_DISABLE_MSVC(4800) /* 'type' : forcing value to bool 'true' or 'false' (performance warning) */ QT_WARNING_DISABLE_MSVC(4097) /* typedef-name 'identifier1' used as synonym for class-name 'identifier2' */ QT_WARNING_DISABLE_MSVC(4706) /* assignment within conditional expression */ -# if _MSC_VER <= 1310 // MSVC 2003 -QT_WARNING_DISABLE_MSVC(4786) /* 'identifier' : identifier was truncated to 'number' characters in the debug information */ -# endif QT_WARNING_DISABLE_MSVC(4355) /* 'this' : used in base member initializer list */ -# if _MSC_VER < 1800 // MSVC 2013 -QT_WARNING_DISABLE_MSVC(4231) /* nonstandard extension used : 'identifier' before template explicit instantiation */ -# endif QT_WARNING_DISABLE_MSVC(4710) /* function not inlined */ QT_WARNING_DISABLE_MSVC(4530) /* C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc */ # elif defined(Q_CC_BOR) diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index b4ba0b5b2e..422d08f32c 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -318,15 +318,7 @@ QLibraryInfo::buildDate() #elif defined(Q_CC_GNU) # define COMPILER_STRING "GCC " __VERSION__ #elif defined(Q_CC_MSVC) -# if _MSC_VER < 1600 -# define COMPILER_STRING "MSVC 2008" -# elif _MSC_VER < 1700 -# define COMPILER_STRING "MSVC 2010" -# elif _MSC_VER < 1800 -# define COMPILER_STRING "MSVC 2012" -# elif _MSC_VER < 1900 -# define COMPILER_STRING "MSVC 2013" -# elif _MSC_VER < 1910 +# if _MSC_VER < 1910 # define COMPILER_STRING "MSVC 2015" # elif _MSC_VER < 2000 # define COMPILER_STRING "MSVC 2017" diff --git a/src/corelib/global/qnumeric_p.h b/src/corelib/global/qnumeric_p.h index dd249f8cc8..a352e39ef0 100644 --- a/src/corelib/global/qnumeric_p.h +++ b/src/corelib/global/qnumeric_p.h @@ -220,7 +220,7 @@ template <> inline bool mul_overflow(unsigned long long v1, unsigned long long v # define HAVE_MUL64_OVERFLOW #endif -#if ((defined(Q_CC_MSVC) && _MSC_VER >= 1800) || defined(Q_CC_INTEL)) && defined(Q_PROCESSOR_X86) && !QT_HAS_BUILTIN(__builtin_uadd_overflow) +#if (defined(Q_CC_MSVC) || defined(Q_CC_INTEL)) && defined(Q_PROCESSOR_X86) && !QT_HAS_BUILTIN(__builtin_uadd_overflow) template <> inline bool add_overflow(unsigned v1, unsigned v2, unsigned *r) { return _addcarry_u32(0, v1, v2, r); } # ifdef Q_CC_MSVC // longs are 32-bit @@ -228,7 +228,7 @@ template <> inline bool add_overflow(unsigned long v1, unsigned long v2, unsigne { return _addcarry_u32(0, v1, v2, reinterpret_cast<unsigned *>(r)); } # endif #endif -#if ((defined(Q_CC_MSVC) && _MSC_VER >= 1800) || defined(Q_CC_INTEL)) && defined(Q_PROCESSOR_X86_64) && !QT_HAS_BUILTIN(__builtin_uadd_overflow) +#if (defined(Q_CC_MSVC) || defined(Q_CC_INTEL)) && defined(Q_PROCESSOR_X86_64) && !QT_HAS_BUILTIN(__builtin_uadd_overflow) template <> inline bool add_overflow(quint64 v1, quint64 v2, quint64 *r) { return _addcarry_u64(0, v1, v2, reinterpret_cast<unsigned __int64 *>(r)); } # ifndef Q_CC_MSVC // longs are 64-bit diff --git a/src/corelib/io/qurlidna.cpp b/src/corelib/io/qurlidna.cpp index 226bc8ba28..2f8bd91f6e 100644 --- a/src/corelib/io/qurlidna.cpp +++ b/src/corelib/io/qurlidna.cpp @@ -60,11 +60,6 @@ struct NameprepCaseFoldingEntry { ushort mapping[4]; }; -#if defined(Q_CC_MSVC) && _MSC_VER < 1600 -inline bool operator<(const NameprepCaseFoldingEntry &one, const NameprepCaseFoldingEntry &other) -{ return one.uc < other.uc; } -#endif - inline bool operator<(uint one, const NameprepCaseFoldingEntry &other) { return one < other.uc; } diff --git a/src/corelib/tools/qalgorithms.h b/src/corelib/tools/qalgorithms.h index c0f7709fec..1a03bfaac4 100644 --- a/src/corelib/tools/qalgorithms.h +++ b/src/corelib/tools/qalgorithms.h @@ -42,7 +42,7 @@ #include <QtCore/qglobal.h> -#if defined(Q_CC_MSVC) && _MSC_VER > 1500 +#ifdef Q_CC_MSVC #include <intrin.h> #endif diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index 9b648adb06..adfa939cc6 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -268,7 +268,7 @@ char *qstrcpy(char *dst, const char *src) { if (!src) return 0; -#if defined(_MSC_VER) && _MSC_VER >= 1400 +#ifdef Q_CC_MSVC const int len = int(strlen(src)); // This is actually not secure!!! It will be fixed // properly in a later release! @@ -304,7 +304,7 @@ char *qstrncpy(char *dst, const char *src, uint len) if (!src || !dst) return 0; if (len > 0) { -#if defined(_MSC_VER) && _MSC_VER >= 1400 +#ifdef Q_CC_MSVC strncpy_s(dst, len, src, len - 1); #else strncpy(dst, src, len); diff --git a/src/corelib/tools/qbytearraymatcher.h b/src/corelib/tools/qbytearraymatcher.h index c1c0c3a660..dafaea9c12 100644 --- a/src/corelib/tools/qbytearraymatcher.h +++ b/src/corelib/tools/qbytearraymatcher.h @@ -134,9 +134,6 @@ private: } }; -QT_WARNING_PUSH -QT_WARNING_DISABLE_MSVC(4351) // MSVC 2013: "new behavior: elements of array ... will be default initialized" - // remove once we drop MSVC 2013 support template <uint N> class QStaticByteArrayMatcher : QStaticByteArrayMatcherBase { @@ -158,8 +155,6 @@ public: QByteArray pattern() const { return QByteArray(m_pattern, int(N - 1)); } }; -QT_WARNING_POP - template <uint N> Q_DECL_RELAXED_CONSTEXPR QStaticByteArrayMatcher<N> qMakeStaticByteArrayMatcher(const char (&pattern)[N]) Q_DECL_NOTHROW { return QStaticByteArrayMatcher<N>(pattern); } diff --git a/src/corelib/tools/qchar.cpp b/src/corelib/tools/qchar.cpp index 31ea84a74e..94de69f075 100644 --- a/src/corelib/tools/qchar.cpp +++ b/src/corelib/tools/qchar.cpp @@ -624,8 +624,6 @@ QT_BEGIN_NAMESPACE \since 5.10 Constructs a QChar corresponding to the UTF-16 character \a ch. - - \note This constructor is not available on MSVC 2013. */ /*! diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 050f37dcd2..fccf1c4afa 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -2216,7 +2216,7 @@ static int qt_timezone() static QString qt_tzname(QDateTimePrivate::DaylightStatus daylightStatus) { int isDst = (daylightStatus == QDateTimePrivate::DaylightTime) ? 1 : 0; -#if defined(_MSC_VER) && _MSC_VER >= 1400 +#if defined(Q_CC_MSVC) size_t s = 0; char name[512]; if (_get_tzname(&s, name, 512, isDst)) @@ -2346,7 +2346,7 @@ static bool qt_localtime(qint64 msecsSinceEpoch, QDate *localDate, QTime *localT res = localtime_r(&secsSinceEpoch, &local); if (res) valid = true; -#elif defined(_MSC_VER) && _MSC_VER >= 1400 +#elif defined(Q_CC_MSVC) if (!_localtime64_s(&local, &secsSinceEpoch)) valid = true; #else diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index e7ce4b658f..ce663ce2ca 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -969,7 +969,7 @@ Q_OUTOFLINE_TEMPLATE bool QHash<Key, T>::operator==(const QHash &other) const // // ### Qt 6: if C++14 library support is a mandated minimum, remove the ifdef for MSVC. if (!std::is_permutation(it, thisEqualRangeEnd, otherEqualRange.first -#if defined(Q_CC_MSVC) && _MSC_VER >= 1900 +#ifdef Q_CC_MSVC , otherEqualRange.second #endif )) { diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index af1513442a..808f388c89 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -1367,7 +1367,7 @@ inline std::wstring QString::toStdWString() const std::wstring str; str.resize(length()); -#if defined(_MSC_VER) && _MSC_VER >= 1400 +#ifdef Q_CC_MSVC // VS2005 crashes if the string is empty if (!length()) return str; diff --git a/src/corelib/tools/qstringview.cpp b/src/corelib/tools/qstringview.cpp index 9cefcd4531..0e3246c72c 100644 --- a/src/corelib/tools/qstringview.cpp +++ b/src/corelib/tools/qstringview.cpp @@ -371,8 +371,7 @@ QT_BEGIN_NAMESPACE Returns a const pointer to the first character in the string. - \c{storage_type} is \c{char16_t}, except on MSVC 2013 (which lacks \c char16_t support), - where it is \c{wchar_t} instead. + \c{storage_type} is \c{char16_t}. \note The character array represented by the return value is \e not null-terminated. |