Skip to content

Conversation

@CaseyCarter
Copy link
Contributor

@CaseyCarter CaseyCarter commented Oct 19, 2023

Functions declared extern "C" are implicitly noexcept(true) when compiling with /EHc, and implicitly noexcept(false) when compiling without. To ensure consistency regardless of the compiler's command line options, all extern "C" functions should have explicit noexcept-specifiers.

This change excludes (with explanatory comment) the redeclarations of locale.h functions in xlocinfo to avoid clashing with the primary declarations in the UCRT.

Drive-by:

  • In mutex.cpp, indicate that _Thrd_abort is exported for ABI only; there are no callers outside this file.
  • In winapisupp.cpp, the dynamic initializer initialize_pointers never throws exceptions and should therefore be noexcept.
  • In vector_algorithms.cpp, the APIs are noexcept so the helpers must be as well. Add annotations to make that contractual obligation explicit.

Excludes (with explanatory comment) the redeclarations of `locale.h` functions in `xlocinfo` to avoid clashing with the primary declarations.

Drive-by in `mutex.cpp`: Indicate that `_Thrd_abort` is exported for ABI only; there are no callers outside this file.
@CaseyCarter CaseyCarter added the enhancement Something can be improved label Oct 19, 2023
@CaseyCarter CaseyCarter requested a review from a team as a code owner October 19, 2023 05:34
@StephanTLavavej StephanTLavavej self-assigned this Oct 19, 2023
@StephanTLavavej StephanTLavavej removed their assignment Oct 19, 2023
@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 0b9ec10 into microsoft:main Oct 25, 2023
@StephanTLavavej
Copy link
Member

Thanks for this big consistency improvement! 🎉 ✅ 😻

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

None yet

Development

Successfully merging this pull request may close these issues.

2 participants