From 07537070fe773762f63bf32bb9f7d63662740971 Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Thu, 5 Jan 2023 16:32:20 +0000 Subject: [PATCH 1/3] config, os: add support for Musl libc According to Musl's FAQ, `__BEGIN_DECLS` and `__END_DECLS` macros come from Glibc private headers. Because of that, we need to define them manually in case those aren't defined. --- os/generic_win_base.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/os/generic_win_base.h b/os/generic_win_base.h index afc5f4265..b4f36a666 100644 --- a/os/generic_win_base.h +++ b/os/generic_win_base.h @@ -25,14 +25,6 @@ typedef int mode_t; typedef void pthread_attr_t; -#if defined(__cplusplus) -#define __BEGIN_DECLS extern "C" { -#define __END_DECLS } -#else -#define __BEGIN_DECLS -#define __END_DECLS -#endif - #ifndef API_AVAILABLE #define API_AVAILABLE(...) #endif From 65626f86da063a904b181c3d2ddda3519d384d25 Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Thu, 12 Jan 2023 15:50:12 +0000 Subject: [PATCH 2/3] source.h: fix signal.h include --- dispatch/source.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From ca40df076283f426088021d12c06acfec77631fb Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Wed, 18 Jan 2023 10:07:39 +0000 Subject: [PATCH 3/3] os: create `generic_base.h` for `_DECLS` macros --- os/CMakeLists.txt | 3 ++- os/generic_base.h | 34 ++++++++++++++++++++++++++++++++++ os/generic_unix_base.h | 2 ++ os/generic_win_base.h | 2 ++ 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 os/generic_base.h diff --git a/os/CMakeLists.txt b/os/CMakeLists.txt index 282af25f7..cccf97ba6 100644 --- a/os/CMakeLists.txt +++ b/os/CMakeLists.txt @@ -3,9 +3,10 @@ # voucher_private.h are included in the source tarball install(FILES - object.h + generic_base.h generic_unix_base.h generic_win_base.h + object.h DESTINATION "${INSTALL_OS_HEADERS_DIR}") diff --git a/os/generic_base.h b/os/generic_base.h new file mode 100644 index 000000000..e85257843 --- /dev/null +++ b/os/generic_base.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2011-2014 Apple Inc. All rights reserved. + * + * @APPLE_APACHE_LICENSE_HEADER_START@ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @APPLE_APACHE_LICENSE_HEADER_END@ + */ + +#ifndef __OS_GENERIC_BASE__ +#define __OS_GENERIC_BASE__ + +#if !defined(__BEGIN_DECLS) && !defined(__END_DECLS) +#if defined(__cplusplus) +#define __BEGIN_DECLS extern "C" { +#define __END_DECLS } +#else +#define __BEGIN_DECLS +#define __END_DECLS +#endif +#endif + +#endif /* __OS_GENERIC_BASE__ */ diff --git a/os/generic_unix_base.h b/os/generic_unix_base.h index aaf6f8504..b77d2adaa 100644 --- a/os/generic_unix_base.h +++ b/os/generic_unix_base.h @@ -13,6 +13,8 @@ #ifndef __OS_GENERIC_UNIX_BASE__ #define __OS_GENERIC_UNIX_BASE__ +#include + #if __has_include() #include #endif diff --git a/os/generic_win_base.h b/os/generic_win_base.h index b4f36a666..af2c602ec 100644 --- a/os/generic_win_base.h +++ b/os/generic_win_base.h @@ -13,6 +13,8 @@ #ifndef __OS_GENERIC_WIN_BASE__ #define __OS_GENERIC_WIN_BASE__ +#include + // Unices provide `roundup` via sys/param.h #define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) // Unices provide `MAX` via sys/param.h