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

<locale>: Hide some non-Standard functions of locale::id #5067

Merged
merged 4 commits into from
Nov 8, 2024

Conversation

frederick-vs-ja
Copy link
Contributor

The non-Standard constructor and conversion function are likely to change the behavior of overload resolution, so perhaps they should be eliminated. But they're currently appearing in the DLL interface and thus can't be removed until vNext.

This PR attempts to make them only exist when building the STL. The newly added Standard default constructor and _Get_index function are templates to avoid alternating DLL interface. (I'm still unsure whether this is sufficient or necessary.)

@frederick-vs-ja frederick-vs-ja requested a review from a team as a code owner November 6, 2024 03:54
@frederick-vs-ja frederick-vs-ja changed the title <xlocale>: Hide some non-Standard functions from locale::id <xlocale>: Hide some non-Standard functions of locale::id Nov 6, 2024
The non-Standard constructor and conversion function are likely to
change the behavior of overload resolution, so perhaps they should
be eliminated. But they're currently appearing in the DLL interface and
thus can't be removed until vNext.

This PR attempts to make them only exist when building the STL. The
newly added Standard default constructor and `_Get_index` function are
templates to avoid alternating DLL interface.
(unsure whether this is sufficient or necessary)
@frederick-vs-ja frederick-vs-ja changed the title <xlocale>: Hide some non-Standard functions of locale::id <locale>: Hide some non-Standard functions of locale::id Nov 6, 2024
@StephanTLavavej StephanTLavavej added the enhancement Something can be improved label Nov 7, 2024
@StephanTLavavej StephanTLavavej self-assigned this Nov 7, 2024
@StephanTLavavej
Copy link
Member

StephanTLavavej commented Nov 7, 2024

The newly added Standard default constructor and _Get_index function are templates to avoid alternating DLL interface. (I'm still unsure whether this is sufficient or necessary.)

When a class is separately compiled, as class _CRTIMP2_PURE_IMPORT id is, then any ordinary member functions will be separately compiled and dllexported.

As always, you can check by running dumpbin /exports on the DLL and comparing before-and-after.

Edit: This change is special because of the default argument (review comment incoming).

stl/src/wlocale.cpp Outdated Show resolved Hide resolved
tests/std/tests/Dev09_056375_locale_cleanup/test.cpp Outdated Show resolved Hide resolved
stl/inc/xlocale Outdated Show resolved Hide resolved
@StephanTLavavej
Copy link
Member

Thanks! 🐈 I pushed a commit to fix bincompat, plus a couple of minor commits. This is moderately risky but I'm willing to roll the dice.

@StephanTLavavej StephanTLavavej removed their assignment Nov 7, 2024
@StephanTLavavej StephanTLavavej self-assigned this Nov 7, 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 25dc2b7 into microsoft:main Nov 8, 2024
39 checks passed
@StephanTLavavej
Copy link
Member

Looks like we avoided rolling snake eyes!

⛔ 🐍 🎲 🎲

@frederick-vs-ja frederick-vs-ja deleted the locale-id-no-nonstd branch November 8, 2024 17:41
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.

2 participants