Skip to content

Commit 08979ae

Browse files
authored
Merge pull request #2990 from 3405691582/OpenBSDSupportSimple
Add necessary missing TARGET_OS_BSD directives.
2 parents b7bfec5 + 9ac5bbc commit 08979ae

23 files changed

+83
-83
lines changed

CoreFoundation/Base.subproj/CFInternal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ enum {
10341034
};
10351035
#endif // __has_include(<dispatch/private.h>)
10361036

1037-
#if TARGET_OS_LINUX || TARGET_OS_WIN32
1037+
#if TARGET_OS_LINUX || TARGET_OS_WIN32 || TARGET_OS_BSD
10381038
#define QOS_CLASS_USER_INITIATED DISPATCH_QUEUE_PRIORITY_HIGH
10391039
#define QOS_CLASS_DEFAULT DISPATCH_QUEUE_PRIORITY_DEFAULT
10401040
#define QOS_CLASS_UTILITY DISPATCH_QUEUE_PRIORITY_LOW

CoreFoundation/Base.subproj/CFPlatform.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1649,7 +1649,7 @@ int _CFOpenFile(const char *path, int opts) {
16491649
}
16501650

16511651
CF_CROSS_PLATFORM_EXPORT void *_CFReallocf(void *ptr, size_t size) {
1652-
#if TARGET_OS_WIN32 || TARGET_OS_LINUX
1652+
#if TARGET_OS_WIN32 || TARGET_OS_LINUX || defined(__OpenBSD__)
16531653
void *mem = realloc(ptr, size);
16541654
if (mem == NULL && ptr != NULL && size != 0) {
16551655
free(ptr);

CoreFoundation/Base.subproj/CFRuntime.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,7 @@ extern CFTypeID CFTreeGetTypeID(void);
972972
extern CFTypeID CFPlugInInstanceGetTypeID(void);
973973
extern CFTypeID CFStringTokenizerGetTypeID(void);
974974
extern CFTypeID CFStorageGetTypeID(void);
975-
#if TARGET_OS_LINUX || (TARGET_OS_OSX && !DEPLOYMENT_RUNTIME_OBJC)
975+
#if TARGET_OS_LINUX || TARGET_OS_BSD || (TARGET_OS_OSX && !DEPLOYMENT_RUNTIME_OBJC)
976976
CF_PRIVATE void __CFTSDInitialize(void);
977977
#endif
978978
#if TARGET_OS_WIN32
@@ -1105,7 +1105,7 @@ Boolean __CFInitialized = 0;
11051105
// move the next 2 lines down into the #if below, and make it static, after Foundation gets off this symbol on other platforms.
11061106
CF_EXPORT _CFThreadRef _CFMainPThread;
11071107
_CFThreadRef _CFMainPThread = kNilPthreadT;
1108-
#if TARGET_OS_WIN32 || TARGET_OS_LINUX
1108+
#if TARGET_OS_WIN32 || TARGET_OS_LINUX || TARGET_OS_BSD
11091109

11101110
CF_EXPORT _CFThreadRef _CF_pthread_main_thread_np(void);
11111111
_CFThreadRef _CF_pthread_main_thread_np(void) {
@@ -1144,7 +1144,7 @@ void __CFInitialize(void) {
11441144
#if TARGET_OS_WIN32
11451145
// Must not call any CF functions
11461146
__CFTSDWindowsInitialize();
1147-
#elif TARGET_OS_LINUX || (TARGET_OS_MAC && !DEPLOYMENT_RUNTIME_OBJC)
1147+
#elif TARGET_OS_LINUX || TARGET_OS_BSD || (TARGET_OS_MAC && !DEPLOYMENT_RUNTIME_OBJC)
11481148
__CFTSDInitialize();
11491149
#endif
11501150
__CFProphylacticAutofsAccess = true;

CoreFoundation/Base.subproj/CFUUID.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ CFUUIDRef CFUUIDCreate(CFAllocatorRef alloc) {
152152
long rStatus = UuidCreate(&u);
153153
if (RPC_S_OK != rStatus && RPC_S_UUID_LOCAL_ONLY != rStatus) retval = 1;
154154
memmove(&bytes, &u, sizeof(bytes));
155-
#elif TARGET_OS_MAC || TARGET_OS_LINUX
155+
#elif TARGET_OS_MAC || TARGET_OS_LINUX || TARGET_OS_BSD
156156
static int8_t useV1UUIDs = -1;
157157
uuid_t uuid;
158158
if (useV1UUIDs == -1) {

CoreFoundation/Base.subproj/CFUtilities.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ CF_PRIVATE CFIndex __CFActiveProcessorCount(void) {
544544
if (result != 0) {
545545
pcnt = 0;
546546
}
547-
#elif TARGET_OS_LINUX
547+
#elif TARGET_OS_LINUX || TARGET_OS_BSD
548548

549549
#ifdef HAVE_SCHED_GETAFFINITY
550550
cpu_set_t set;
@@ -571,7 +571,7 @@ CF_PRIVATE CFIndex __CFProcessorCount() {
571571
if (result != 0) {
572572
pcnt = 0;
573573
}
574-
#elif TARGET_OS_LINUX
574+
#elif TARGET_OS_LINUX || TARGET_OS_BSD
575575
pcnt = sysconf(_SC_NPROCESSORS_CONF);
576576
#else
577577
// Assume the worst
@@ -589,7 +589,7 @@ CF_PRIVATE uint64_t __CFMemorySize() {
589589
if (result != 0) {
590590
memsize = 0;
591591
}
592-
#elif TARGET_OS_LINUX
592+
#elif TARGET_OS_LINUX || TARGET_OS_BSD
593593
memsize = sysconf(_SC_PHYS_PAGES);
594594
memsize *= sysconf(_SC_PAGESIZE);
595595
#endif

CoreFoundation/Base.subproj/CoreFoundation_Prefix.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ CF_INLINE uint64_t mach_absolute_time() {
222222
ULONGLONG ullTime;
223223
QueryUnbiasedInterruptTimePrecise(&ullTime);
224224
return ullTime;
225-
#else
225+
#elif TARGET_OS_LINUX || TARGET_OS_BSD || TARGET_OS_MAC
226226
struct timespec ts;
227227
clock_gettime(CLOCK_MONOTONIC, &ts);
228228
return (uint64_t)ts.tv_nsec + (uint64_t)ts.tv_sec * 1000000000UL;

CoreFoundation/Locale.subproj/CFDateFormatter.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,7 +1506,7 @@ static UDate __CFDateFormatterCorrectTimeToARangeAroundCurrentDate(UCalendar *ca
15061506
return __CFDateFormatterCorrectTimeWithTarget(calendar, at, currEraOrCentury+offset, isEra, status);
15071507
}
15081508

1509-
#if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_LINUX
1509+
#if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_LINUX || TARGET_OS_BSD
15101510
static int32_t __CFDateFormatterGetMaxYearGivenJapaneseEra(UCalendar *calendar, int32_t era, UErrorCode *status) {
15111511
int32_t years = 0;
15121512
__cficu_ucal_clear(calendar);
@@ -1559,7 +1559,7 @@ static Boolean __CFDateFormatterHandleAmbiguousYear(CFDateFormatterRef formatter
15591559
}
15601560
}
15611561
} else if (calendar_id == kCFCalendarIdentifierJapanese) { // ??? need more work
1562-
#if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_LINUX
1562+
#if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_LINUX || TARGET_OS_BSD
15631563
__cficu_ucal_clear(cal);
15641564
__cficu_ucal_set(cal, UCAL_ERA, 1);
15651565
__cficu_udat_parseCalendar(df, cal, ustr, length, NULL, status);

0 commit comments

Comments
 (0)