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

Explicitly import locale modules #771

Merged
merged 1 commit into from
Sep 14, 2024

Conversation

ian-twilightcoder
Copy link
Contributor

The Darwin module is slowly being split up, and as it gets further along, it will stop importing some of the split-out modules like the one for locale.h that provides newlocale() and other locale API. However, there's a wrinkle that on platforms with xlocale, it's xlocale.h that provides most of the POSIX locale.h functions and not locale.h, so prefer the xlocale module when available.

The Darwin module is slowly being split up, and as it gets further along, it will stop importing some of the split-out modules like the one for locale.h that provides newlocale() and other locale API. However, there's a wrinkle that on platforms with xlocale, it's xlocale.h that provides most of the POSIX locale.h functions and not locale.h, so prefer the xlocale module when available.
@Lukasa
Copy link
Collaborator

Lukasa commented Sep 14, 2024

@swift-server-bot add to allowlist

Copy link
Collaborator

@Lukasa Lukasa left a comment

Choose a reason for hiding this comment

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

Thanks @ian-twilightcoder, much appreciated.

@Lukasa Lukasa merged commit 6df8e1c into swift-server:main Sep 14, 2024
6 of 7 checks passed
@Lukasa Lukasa added the semver/patch For PRs that when merged will only cause a bump of the patch version, ie. 1.0.x -> 1.0.(x+1) label Sep 16, 2024
@al45tair
Copy link
Contributor

This has broken AHC on the Static SDK for Linux and also I believe on Android? (@finagolfin?), because the file in question was using more than just <locale.h>; it's also using timegm(), errno and EOVERFLOW.

al45tair added a commit to al45tair/async-http-client that referenced this pull request Sep 30, 2024
On modularised platforms, swift-server#771 broke things because it changed from
importing `Musl` or `Glibc` to importing just `locale_h`.  The latter
understandably doesn't define `errno` or `EOVERFLOW`, so we get a
build failure.

Fixes swift-server#773.
Lukasa pushed a commit that referenced this pull request Sep 30, 2024
On modularised platforms, #771 broke things because it changed from
importing `Musl` or `Glibc` to importing just `locale_h`. The latter
understandably doesn't define `errno` or `EOVERFLOW`, so we get a build
failure.

Fixes #773.
@finagolfin
Copy link

also I believe on Android?

No, I have never built this repo. I was speaking generally of the many other Swift repos where I had to start adding new import Android statements since July, like SwiftPM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/patch For PRs that when merged will only cause a bump of the patch version, ie. 1.0.x -> 1.0.(x+1)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants