From 165daa88c1e5a768cce18c10bf570fe22a741411 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Thu, 9 Nov 2023 13:11:35 +0100 Subject: [PATCH] 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 (cherry picked from commit 52b6258ec846cc53ebdb1c8167edd30db39c7891) (cherry picked from commit 24ca6bd117648e28d8b966d97c0a76036cf57345) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit 2723b03120e066e56ac94fc578ca4dea2f271ea3) (cherry picked from commit 521e059cdddd4a67babc49921ddd9969724c0fb9) --- src/corelib/global/qcompilerdetection.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index f374c531e56..07964bbed74 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -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