From b51ae88b68504905ef8339809b65e262d35bee6c Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Sat, 16 Mar 2024 19:17:43 -0700 Subject: [PATCH 1/2] Fix DevCom-10610863. --- stl/inc/yvals.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/stl/inc/yvals.h b/stl/inc/yvals.h index 9428b35aaeb..779a8e3c996 100644 --- a/stl/inc/yvals.h +++ b/stl/inc/yvals.h @@ -172,8 +172,10 @@ _STL_DISABLE_CLANG_WARNINGS #ifndef _STL_CRT_SECURE_INVALID_PARAMETER #ifdef _STL_CALL_ABORT_INSTEAD_OF_INVALID_PARAMETER #define _STL_CRT_SECURE_INVALID_PARAMETER(expr) _CSTD abort() -#elif defined(_DEBUG) // avoid emitting unused long strings for function names; see GH-1956 -#define _STL_CRT_SECURE_INVALID_PARAMETER(expr) ::_invalid_parameter(_CRT_WIDE(#expr), L"", __FILEW__, __LINE__, 0) +#elif defined(_DEBUG) // Avoid emitting unused long strings for function names; see GH-1956. +// static_cast(__LINE__) avoids warning C4365 (signed/unsigned mismatch) with the /ZI compiler option. +#define _STL_CRT_SECURE_INVALID_PARAMETER(expr) \ + ::_invalid_parameter(_CRT_WIDE(#expr), L"", __FILEW__, static_cast(__LINE__), 0) #else // ^^^ defined(_DEBUG) / !defined(_DEBUG) vvv #define _STL_CRT_SECURE_INVALID_PARAMETER(expr) _CRT_SECURE_INVALID_PARAMETER(expr) #endif // ^^^ !defined(_DEBUG) ^^^ From 6e9cae9294ed0a6f3ca183f56f99d6d5f1caa34d Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Sat, 16 Mar 2024 19:18:21 -0700 Subject: [PATCH 2/2] _invoke_watson() always ignores its parameters. C:\Program Files (x86)\Windows Kits\10\Source\10.0.22621.0\ucrt\misc\invalid_parameter.cpp This was the only other potential occurrence of signed/unsigned mismatch warnings involving __LINE__. --- stl/inc/yvals.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/stl/inc/yvals.h b/stl/inc/yvals.h index 779a8e3c996..d2201390f57 100644 --- a/stl/inc/yvals.h +++ b/stl/inc/yvals.h @@ -467,11 +467,7 @@ class _CRTIMP2_PURE_IMPORT _EmptyLockit { // empty lock class used for bin compa } \ } -#ifdef _DEBUG -#define _RAISE(x) _invoke_watson(_CRT_WIDE(#x), __FUNCTIONW__, __FILEW__, __LINE__, 0) -#else #define _RAISE(x) _invoke_watson(nullptr, nullptr, nullptr, 0, 0) -#endif #define _RERAISE #define _THROW(...) (__VA_ARGS__)._Raise()