From 24ca6bd117648e28d8b966d97c0a76036cf57345 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. Pick-to: 6.5 6.2 5.15 Fixes: QTBUG-118993 Change-Id: I2c3b69d46d13f6fcccf0ffce186b984b7758f287 Reviewed-by: Marc Mutz (cherry picked from commit 52b6258ec846cc53ebdb1c8167edd30db39c7891) --- 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 a2c0b035973..8b6288c13da 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -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