Skip to content

Fix compat between libc++ and emscripten's xlocale.h #23414

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

Merged
merged 1 commit into from
Jan 15, 2025

Conversation

sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Jan 15, 2025

libc++ was assuming that musl doesn't have xlocale.h which is true, but emscripten adds xlocale.h for compatibility (I'm not sure we really need to, but we do).

Fixes: #23413

@@ -25,8 +27,6 @@
# include <__locale_dir/locale_base_api/fuchsia.h>
#elif defined(__wasi__) || defined(_LIBCPP_HAS_MUSL_LIBC)
# include <__locale_dir/locale_base_api/musl.h>
#elif defined(__APPLE__) || defined(__FreeBSD__)
# include <xlocale.h>
Copy link
Member

Choose a reason for hiding this comment

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

Would adding emscripten here be less of a diff, so less churn in the next libc++ update? Or must the change be on top?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's not possible because we would already have hit the _LIBCPP_HAS_MUSL_LIBC case above. Our case needs to come first.

libc++ was assuming that musl doesn't have `xlocale.h` which is true,
but emscripten adds xlocale.h for compatibility (I'm not sure we really
need to, but we do).

Fixes: emscripten-core#23413
@sbc100 sbc100 merged commit 4c14f1f into emscripten-core:main Jan 15, 2025
29 checks passed
@sbc100 sbc100 deleted the xlocale branch January 15, 2025 22:19
aheejin added a commit to aheejin/emscripten that referenced this pull request May 16, 2025
Before, the code was like
https://github.com/emscripten-core/emscripten/blob/dc1abd514b1bade135a01a4453a9ff6def0793b6/system/lib/libcxx/include/__locale_dir/locale_base_api.h#L12-L30

But now they are divided into two parts, one using the new API and the
other using old. See "Locale API reimplementation" above.
https://github.com/llvm/llvm-project/blob/ec28b8f9cc7f2ac187d8a617a6d08d5e56f9120e/libcxx/include/__locale_dir/locale_base_api.h#L116-L138

This adds Emscripten in the beginning of the "old" API list. (This has
to be the beginning; see emscripten-core#23414)
aheejin added a commit to aheejin/emscripten that referenced this pull request May 16, 2025
Before, the code was like
https://github.com/emscripten-core/emscripten/blob/dc1abd514b1bade135a01a4453a9ff6def0793b6/system/lib/libcxx/include/__locale_dir/locale_base_api.h#L12-L30

But now they are divided into two parts, one using the new API and the
other using old. See "Locale API reimplementation" above.
https://github.com/llvm/llvm-project/blob/ec28b8f9cc7f2ac187d8a617a6d08d5e56f9120e/libcxx/include/__locale_dir/locale_base_api.h#L116-L138

This adds Emscripten in the beginning of the "old" API list. (This has
to be the beginning; see emscripten-core#23414)
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.

error: cannot add 'abi_tag' attribute in a redeclaration
3 participants