Skip to content

Commit 8897850

Browse files
_STL_VERIFY shouldn't emit long strings for function names (#2054)
Co-authored-by: Stephan T. Lavavej <[email protected]>
1 parent 7adf490 commit 8897850

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

stl/inc/yvals.h

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,18 @@ _STL_DISABLE_CLANG_WARNINGS
164164
#error _ITERATOR_DEBUG_LEVEL != 0 must imply _CONTAINER_DEBUG_LEVEL == 1.
165165
#endif // _ITERATOR_DEBUG_LEVEL != 0 && _CONTAINER_DEBUG_LEVEL == 0
166166

167-
#define _STL_REPORT_ERROR(mesg) \
168-
do { \
169-
_RPTF0(_CRT_ASSERT, mesg); \
170-
_CRT_SECURE_INVALID_PARAMETER(mesg); \
167+
#ifndef _STL_CRT_SECURE_INVALID_PARAMETER
168+
#ifdef _DEBUG // avoid emitting unused long strings for function names; see GH-1956
169+
#define _STL_CRT_SECURE_INVALID_PARAMETER(expr) ::_invalid_parameter(_CRT_WIDE(#expr), L"", __FILEW__, __LINE__, 0)
170+
#else // _DEBUG
171+
#define _STL_CRT_SECURE_INVALID_PARAMETER(expr) _CRT_SECURE_INVALID_PARAMETER(expr)
172+
#endif // _DEBUG
173+
#endif // _STL_CRT_SECURE_INVALID_PARAMETER
174+
175+
#define _STL_REPORT_ERROR(mesg) \
176+
do { \
177+
_RPTF0(_CRT_ASSERT, mesg); \
178+
_STL_CRT_SECURE_INVALID_PARAMETER(mesg); \
171179
} while (false)
172180

173181
#ifdef __clang__

0 commit comments

Comments
 (0)