From ddda49e128008fef3ff1dab28c9e0ed7d8f5bcf0 Mon Sep 17 00:00:00 2001 From: mid-kid Date: Tue, 15 Feb 2022 08:22:00 +0100 Subject: [PATCH] Fix building with musl libc https://bugs.gentoo.org/829158 https://bugs.gentoo.org/833306 --- dispatch/source.h | 2 +- os/generic_unix_base.h | 8 ++++++++ src/shims/getprogname.h | 2 +- tests/dispatch_test.c | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/dispatch/source.h b/dispatch/source.h index b54862ea8..fa960d3c2 100644 --- a/dispatch/source.h +++ b/dispatch/source.h @@ -32,7 +32,7 @@ #endif #if !defined(_WIN32) -#include +#include #endif DISPATCH_ASSUME_NONNULL_BEGIN diff --git a/os/generic_unix_base.h b/os/generic_unix_base.h index aaf6f8504..a83132243 100644 --- a/os/generic_unix_base.h +++ b/os/generic_unix_base.h @@ -25,6 +25,14 @@ #if __has_include() #include +#else +#if defined(__cplusplus) +#define __BEGIN_DECLS extern "C" { +#define __END_DECLS } +#else +#define __BEGIN_DECLS +#define __END_DECLS +#endif #endif #ifndef API_AVAILABLE diff --git a/src/shims/getprogname.h b/src/shims/getprogname.h index a768eedd1..07ad2c0e4 100644 --- a/src/shims/getprogname.h +++ b/src/shims/getprogname.h @@ -37,7 +37,7 @@ const char *getprogname(void); static inline char * getprogname(void) { -# if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME +# if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME || defined(__linux__) return program_invocation_short_name; # elif defined(__ANDROID__) return __progname; diff --git a/tests/dispatch_test.c b/tests/dispatch_test.c index d84a7b228..53e07ea69 100644 --- a/tests/dispatch_test.c +++ b/tests/dispatch_test.c @@ -34,7 +34,7 @@ #define HAS_SYS_EVENT_H 1 #include #else -#include +#include #endif #elif defined(_WIN32) #include