Fix compilation with MSVC 17.8

stdext is deprecated, slated for removal.

The macros were used to work around a compiler warning generated
when using the 3-arg overload of certain STL algorithms even when
the 4-arg version (added in C++14) was not available.

These deprecation warnings seem to have been discontinued as of
  MSVC++ 14.15 _MSC_VER == 1915 (Visual Studio 2017 version 15.8)
so making the macros no-ops from VS 2022 17.8 onward is not expected
to trigger these warnings again.

Fixes: QTBUG-118993
Change-Id: I2c3b69d46d13f6fcccf0ffce186b984b7758f287
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 52b6258ec846cc53ebdb1c8167edd30db39c7891)
(cherry picked from commit 24ca6bd117648e28d8b966d97c0a76036cf57345)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 2723b03120e066e56ac94fc578ca4dea2f271ea3)
(cherry picked from commit 521e059cdddd4a67babc49921ddd9969724c0fb9)
This commit is contained in:
Mårten Nordheim 2023-11-09 13:11:35 +01:00 committed by Qt Cherry-pick Bot
parent 63a58e0720
commit 165daa88c1

View File

@ -110,8 +110,10 @@
# endif
# define Q_DECL_EXPORT __declspec(dllexport)
# define Q_DECL_IMPORT __declspec(dllimport)
# 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
# if _MSC_VER < 1938 // stdext is deprecated since VS 2022 17.8
# 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
# endif
/* Intel C++ disguising as Visual C++: the `using' keyword avoids warnings */
# if defined(__INTEL_COMPILER)
# undef Q_CC_MSVC_ONLY