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.

Pick-to: 6.5 6.2 5.15
Fixes: QTBUG-118993
Change-Id: I2c3b69d46d13f6fcccf0ffce186b984b7758f287
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 52b6258ec846cc53ebdb1c8167edd30db39c7891)
This commit is contained in:
Mårten Nordheim 2023-11-09 13:11:35 +01:00
parent ef2a6ba74f
commit 24ca6bd117

View File

@ -76,8 +76,10 @@
# define Q_UNREACHABLE_IMPL() __assume(0)
# 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
#elif defined(__BORLANDC__) || defined(__TURBOC__)
# define Q_CC_BOR