Skip to content

Commit 6ca0868

Browse files
committed
[CF] OpenBSD doesn't have the xlocale header.
OpenBSD is one of the platforms that doesn't have xlocale.h, so ensure that the header is not used and the relevant macros are exposed. While we are here, change the sense of the conditionals in CFInternal.h to be a little more clear and consistent.
1 parent e6e0046 commit 6ca0868

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

CoreFoundation/Base.subproj/CFInternal.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ CF_EXTERN_C_BEGIN
9797

9898
#if TARGET_OS_MAC || TARGET_OS_LINUX || TARGET_OS_BSD
9999

100-
#if !TARGET_OS_CYGWIN && !defined(__linux__)
100+
#if TARGET_OS_MAC || (TARGET_OS_BSD && !defined(__OpenBSD__)) || TARGET_OS_ANDROID
101101
#include <xlocale.h>
102-
#endif // !TARGET_OS_CYGWIN && !defined(__linux__)
102+
#endif // TARGET_OS_MAC || (TARGET_OS_BSD && !defined(__OpenBSD__)) || TARGET_OS_ANDROID
103103

104104
#include <sys/time.h>
105105
#include <signal.h>

CoreFoundation/Base.subproj/CoreFoundation_Prefix.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,13 @@ bool OSAtomicCompareAndSwap32Barrier( int32_t oldValue, int32_t newValue, volati
180180
void OSMemoryBarrier();
181181
#endif // TARGET_OS_LINUX || TARGET_OS_BSD
182182

183-
#if TARGET_OS_LINUX || TARGET_OS_WIN32
183+
#if TARGET_OS_LINUX || TARGET_OS_WIN32 || defined(__OpenBSD__)
184184
#define strtod_l(a,b,locale) strtod(a,b)
185185
#define strtoul_l(a,b,c,locale) strtoul(a,b,c)
186186
#define strtol_l(a,b,c,locale) strtol(a,b,c)
187187

188188
#define fprintf_l(a,locale,b,...) fprintf(a, b, __VA_ARGS__)
189-
#endif // TARGET_OS_LINUX || TARGET_OS_WIN32
189+
#endif // TARGET_OS_LINUX || TARGET_OS_WIN32 || defined(__OpenBSD__)
190190

191191
#if TARGET_OS_LINUX
192192

@@ -236,6 +236,10 @@ CF_INLINE uint64_t mach_absolute_time() {
236236
#define CF_PRIVATE extern __attribute__((visibility("hidden")))
237237
#define __strong
238238
#define __weak
239+
240+
#if defined(__OpenBSD__)
241+
#define strtoll_l(a,b,c,locale) strtoll(a,b,c)
242+
#endif
239243
#endif
240244

241245
#if TARGET_OS_LINUX || TARGET_OS_BSD

0 commit comments

Comments
 (0)