KEMBAR78
Use `_STL_REPORT_ERROR` in headers by AlexGuteniev · Pull Request #5560 · microsoft/STL · GitHub
Skip to content

Conversation

@AlexGuteniev
Copy link
Contributor

@AlexGuteniev AlexGuteniev commented May 31, 2025

Resolves #5529.

terminate() still calls abort(). All other places use _STL_REPORT_ERROR.

Headers only. Keep abort() in separately compiled code to avoid losing a customization point.

🚨 Drops abort() from <utility> without any replacement🚨! Core headers should not call any functions.

@AlexGuteniev AlexGuteniev requested a review from a team as a code owner May 31, 2025 12:31
@github-project-automation github-project-automation bot moved this to Initial Review in STL Code Reviews May 31, 2025
AlexGuteniev and others added 2 commits May 31, 2025 17:54
Co-authored-by: Fulgen301 <Fulgen301@users.noreply.github.com>
@StephanTLavavej StephanTLavavej added the enhancement Something can be improved label Jun 1, 2025
@StephanTLavavej StephanTLavavej self-assigned this Jun 1, 2025
@AlexGuteniev
Copy link
Contributor Author

Maybe it worth using _STL_REPORT_ERROR instead of _MSVC_STL_DOOM_FUNCTION here, just to be consistent?

@StephanTLavavej StephanTLavavej moved this from Ready To Merge to Final Review in STL Code Reviews Jun 11, 2025
@StephanTLavavej StephanTLavavej self-assigned this Jun 11, 2025
@StephanTLavavej StephanTLavavej changed the title Use _MSVC_STL_DOOM_FUNCTION in headers Use _STL_REPORT_ERROR in headers Jun 11, 2025
@StephanTLavavej
Copy link
Member

Thanks, updated PR title and description. The difference is significant, not cosmetic:

STL/stl/inc/yvals.h

Lines 260 to 262 in 7841cf8

#define _STL_REPORT_ERROR(mesg) \
_RPTF0(_CRT_ASSERT, mesg); \
_MSVC_STL_DOOM_FUNCTION(mesg)

The UCRT's _RPTF0 is what pops up the nice assertion dialog in debug mode (or prints to stderr etc. if redirected). Without it, _MSVC_STL_DOOM_FUNCTION is just a __fastfail that makes the process vanish. I should have noticed this earlier - thanks for catching it.

@StephanTLavavej StephanTLavavej removed their assignment Jun 11, 2025
@StephanTLavavej StephanTLavavej moved this from Final Review to Ready To Merge in STL Code Reviews Jun 11, 2025
@StephanTLavavej StephanTLavavej moved this from Ready To Merge to Merging in STL Code Reviews Jun 11, 2025
@StephanTLavavej
Copy link
Member

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej merged commit e2115ba into microsoft:main Jun 14, 2025
48 checks passed
@github-project-automation github-project-automation bot moved this from Merging to Done in STL Code Reviews Jun 14, 2025
@StephanTLavavej
Copy link
Member

Thanks for making this consistent, and easier to follow precedent in the future! 😻 🎉 🥳

@AlexGuteniev AlexGuteniev deleted the fail-faster-harder-better branch June 14, 2025 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Something can be improved

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Call __fastfail instead of abort() in more places

3 participants