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

add mingw64 to mingw-w64-cppwinrt #20477

Merged
merged 1 commit into from
Apr 1, 2024
Merged

add mingw64 to mingw-w64-cppwinrt #20477

merged 1 commit into from
Apr 1, 2024

Conversation

ReenigneArcher
Copy link
Contributor

replacement for #20003

@psyke83
Copy link

psyke83 commented Mar 29, 2024

I think I can help shed some light on the situation. In Sunshine and the regex-issue testcase we are setting the locale to .utf-8, but some debugging reveals that MINGW64 fails to set it correctly, leaving it as the default (C).

Results using my fork of: https://github.com/FrogTheFrog/regex-issue

MINGW64:

setlocale info: C
Before regex
After regex. Took 0ms

UCRT64:

setlocale info: English_Ireland.utf8
Before regex
After regex. Took 194383ms

So, @MehdiChinoune was probably correct in stating that the issue is likely to be present in MINGW64, but we're not seeing the issue simply because setlocale was not having an effect. I tried to hardcode the locale as English_Ireland.utf8, it still returns as C when built against the MINGW64 runtime, so I'm not sure what's happening.

It seems that std::regex works OK with the UCRT64 runtime if the locale is unset/set to the default C. Maybe this PR is not necessary, unless there are other major issues aside from locale?

psyke83 referenced this pull request in FrogTheFrog/regex-issue Mar 29, 2024
@FrogTheFrog
Copy link

I think I can help shed some light on the situation. In Sunshine and the regex-issue testcase we are setting the locale to .utf-8, but some debugging reveals that MINGW64 fails to set it correctly, leaving it as the default (C).

Results using my fork of: https://github.com/FrogTheFrog/regex-issue

MINGW64:

setlocale info: C
Before regex
After regex. Took 0ms

UCRT64:

setlocale info: English_Ireland.utf8
Before regex
After regex. Took 194383ms

So, @MehdiChinoune was probably correct in stating that the issue is likely to be present in MINGW64, but we're not seeing the issue simply because setlocale was not having an effect. I tried to hardcode the locale as English_Ireland.utf8, it still returns as C when built against the MINGW64 runtime, so I'm not sure what's happening.

It seems that std::regex works OK with the UCRT64 runtime if the locale is unset/set to the default C. Maybe this PR is not necessary, unless there are other major issues aside from locale?

Can confirm this. You either have to explicitly set it to C or leave it unset (as C++ sets it to C anyway). Setting it to default locale "" (empty string) would still produce the regex bug if the Windows locale is set to UTF-8 system-wide.

@lazka lazka merged commit 64263cb into msys2:master Apr 1, 2024
8 checks passed
@ReenigneArcher ReenigneArcher deleted the patch-1 branch April 2, 2024 00:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants