Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mitigate non-conformance of extensions of non-reserved names by the push_macro/pop_macro mechanism #4285

Merged

Conversation

frederick-vs-ja
Copy link
Contributor

@frederick-vs-ja frederick-vs-ja commented Dec 24, 2023

Towards #2206. The posted example should compile with the changes landed when pre-standard hash containers are disabled.

  • Not sure how to test stdext, because <__msvc_all_public_headers.hpp> is currently including non-Standard <hash_map> & <hash_set>.
  • <arm64_neon.h> (which is surprisingly heavy), <ppltasks.h>, and UCRT stuffs are not handled currently.

Some extensions may become conforming with deprecation warnings enabled, others are not yet because they're visible via SFINAE.

@frederick-vs-ja frederick-vs-ja requested a review from a team as a code owner December 24, 2023 04:04
stl/inc/exception Outdated Show resolved Hide resolved
stl/inc/iterator Outdated Show resolved Hide resolved
stl/inc/yvals_core.h Outdated Show resolved Hide resolved
Comment on lines 34 to 42

// TRANSITION, terminate_function and unexpected_function are defined for source compatibility.
#pragma push_macro("terminate_function")
#pragma push_macro("unexpected_function")
#undef terminate_function
#undef unexpected_function
#include <vcruntime_exception.h>
#pragma pop_macro("unexpected_function")
#pragma pop_macro("terminate_function")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems fragile against other inclusions of public VCRuntime headers. I suggest you remove all changes regarding terminate_function and unexpected_function, I've opened MSVC-PR-519139 to change eh.h directly.

@CaseyCarter CaseyCarter added the bug Something isn't working label Jan 4, 2024
- Avoid touching `terminate_function` and `unexpected_function`.
- Remove the `// TRANSITION, vNext` comments.
- Simplify comments for `stdext`
@StephanTLavavej StephanTLavavej self-assigned this Jan 10, 2024
@StephanTLavavej StephanTLavavej removed their assignment Jan 11, 2024
@StephanTLavavej
Copy link
Member

Thanks! I pushed a conflict-free merge with main and fixed 3 comments.

I would not be eager to add dozens/hundreds/thousands of such lines to defend against names in arm64_neon.h/ppltasks/UCRT headers, but defending "our own" extensions is a very limited and reasonable thing to do.

@StephanTLavavej StephanTLavavej self-assigned this Jan 11, 2024
@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 a17bdaa into microsoft:main Jan 11, 2024
35 checks passed
@StephanTLavavej
Copy link
Member

Thanks for defending the STL against technically conformant macroization! 🛡️ 🎯 🎉

@frederick-vs-ja frederick-vs-ja deleted the push-pop-nonreserved-names branch January 11, 2024 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants