You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This repairs collate<unsigned short> by adding two missing unsigned short specializations for _LStrcoll and _LStrxfrm when we're building the STL. Fixes#5236.
There are similar specializations for a few functions in <xlocale>. I guess _LStrcoll and _LStrxfrm were missed because they are located in a different header.
Since collate is the only user of these functions, I also moved them from <xlocinfo> to <locale> just above collate.
As for why this also fixes collate<wchar_t> = collate<unsigned short> under non-native wchar_t when linking to the DLL, this is because the the locale facets are constructed in the DLL here:
const locale* ptrloc) { // setup wide part of a new locale
ADDFAC(_Tu1, cat, ptrimp, ptrloc);
ADDFAC(_Tu2, cat, ptrimp, ptrloc);
ADDFAC(_Tu3, cat, ptrimp, ptrloc);
ADDFAC(_Tu4, cat, ptrimp, ptrloc);
ADDFAC(_Tu5, cat, ptrimp, ptrloc);
ADDFAC(_Tu6, cat, ptrimp, ptrloc);
ADDFAC(_Tu7, cat, ptrimp, ptrloc);
ADDFAC(_Tu8, cat, ptrimp, ptrloc);
ADDFAC(_Tu9, cat, ptrimp, ptrloc);
ADDFAC(_Tu10, cat, ptrimp, ptrloc);
ADDFAC(_Tu11, cat, ptrimp, ptrloc);
ADDFAC(_Tu12, cat, ptrimp, ptrloc);
ADDFAC(_Tu13, cat, ptrimp, ptrloc);
}
Thus, collate's virtual functions originate from the DLL as well. These virtual functions call _LStrcoll and _LStrxfrm, but the specializations for unsigned short were missing since the DLL is built with native wchar_t.
In the new test, we have to skip collate::transform() tests when there is IDL mismatch between TU and linked DLL.
Thanks! I updated the product code's preprocessor logic, pushed significant changes to the test, and updated the PR description accordingly - please meow if I messed something up.
The general principle that we now follow (although our legacy codebase didn't) is that while /Zc:wchar_t- should work (fake wchar_t), normal users of /Zc:wchar_t (real wchar_t) should not experience unsigned short as anything special. Only the STL's separately compiled code has to worry about real and fake wchar_t simultaneously.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This repairs
collate<unsigned short>
by adding two missingunsigned short
specializations for_LStrcoll
and_LStrxfrm
when we're building the STL. Fixes #5236.There are similar specializations for a few functions in
<xlocale>
. I guess_LStrcoll
and_LStrxfrm
were missed because they are located in a different header.Since
collate
is the only user of these functions, I also moved them from<xlocinfo>
to<locale>
just abovecollate
.As for why this also fixes
collate<wchar_t>
=collate<unsigned short>
under non-nativewchar_t
when linking to the DLL, this is because the the locale facets are constructed in the DLL here:STL/stl/src/wlocale.cpp
Lines 58 to 88 in f2a2933
Thus,
collate
's virtual functions originate from the DLL as well. These virtual functions call_LStrcoll
and_LStrxfrm
, but the specializations forunsigned short
were missing since the DLL is built with nativewchar_t
.In the new test, we have to skip
collate::transform()
tests when there is IDL mismatch between TU and linked DLL.