-
Notifications
You must be signed in to change notification settings - Fork 461
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 support for Musl libc #798
base: main
Are you sure you want to change the base?
Conversation
Since Musl is sufficiently different from Glibc (see https://wiki.musl-libc.org/functional-differences-from-glibc.html), it requires additional checks for available headers.
@swift-ci test |
Co-authored-by: Saleem Abdulrasool <[email protected]>
@swift-ci test |
@swift-ci test windows |
@@ -25,7 +25,7 @@ | |||
#endif | |||
#include <sys/param.h> | |||
|
|||
#if __has_include(<sys/cdefs.h>) | |||
#if __has_include(<sys/cdefs.h>) && (defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__GLIBC__)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see why we're making this particular change. Musl (at least the copy I'm looking at) doesn't have <sys/cdefs.h>
, so wouldn't have tried to include it anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Alpine /usr/include/sys/cdefs.h
is present and it contains #warning usage of non-standard #include <sys/cdefs.h> is deprecated
, which fails due to our usage of -Werror
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. I wonder if we can work out why we're including <sys/cdefs.h>
and just not do that anywhere.
tests/dispatch_test.c
Outdated
@@ -33,6 +33,8 @@ | |||
#if __has_include(<sys/event.h>) | |||
#define HAS_SYS_EVENT_H 1 | |||
#include <sys/event.h> | |||
#elif __has_include(<poll.h>) | |||
#include <poll.h> | |||
#else | |||
#include <sys/poll.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a platform with <sys/poll.h>
that doesn't also have <poll.h>
? Could we just have <poll.h>
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure, I'm a bit afraid to touch this, as this repo may have support for OpenBSD, FreeBSD etc, but we don't have CI set up for those to verify those don't break.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those aren't officially supported platforms; I wouldn't worry too much about breaking them anyway, but in this particular case both OpenBSD and FreeBSD document poll
as being in <poll.h>
.
@swift-ci test |
@swift-ci test windows |
@swift-ci test |
@swift-ci test windows |
Since Musl is sufficiently different from Glibc (see https://wiki.musl-libc.org/functional-differences-from-glibc.html), it requires additional checks for available headers.