Skip to content

Commit 8af68ef

Browse files
committed
fix invalid use of config defines in API/SPI headers
Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
1 parent 3b42f6b commit 8af68ef

File tree

4 files changed

+26
-30
lines changed

4 files changed

+26
-30
lines changed

dispatch/dispatch.h

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,30 +24,17 @@
2424
#ifdef __APPLE__
2525
#include <Availability.h>
2626
#include <TargetConditionals.h>
27-
#else
28-
#ifndef API_AVAILABLE
29-
#define API_AVAILABLE(...)
27+
#include <os/base.h>
28+
#elif defined(__linux__)
29+
#include <os/linux_base.h>
3030
#endif
31-
#ifndef API_DEPRECATED
32-
#define API_DEPRECATED(...)
33-
#endif
34-
#ifndef API_UNAVAILABLE
35-
#define API_UNAVAILABLE(...)
36-
#endif
37-
#ifndef API_DEPRECATED_WITH_REPLACEMENT
38-
#define API_DEPRECATED_WITH_REPLACEMENT(...)
39-
#endif
40-
#endif // __APPLE__
4131

42-
#if HAVE_SYS_CDEFS_H
43-
#include <sys/cdefs.h>
44-
#endif
4532
#include <sys/types.h>
4633
#include <stddef.h>
4734
#include <stdint.h>
4835
#include <stdbool.h>
4936
#include <stdarg.h>
50-
#if HAVE_UNISTD_H
37+
#if !defined(HAVE_UNISTD_H) || HAVE_UNISTD_H
5138
#include <unistd.h>
5239
#endif
5340
#include <fcntl.h>

os/linux_base.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,23 @@
1515

1616
#include <sys/param.h>
1717

18+
#if HAVE_SYS_CDEFS_H
19+
#include <sys/cdefs.h>
20+
#endif
21+
22+
#ifndef API_AVAILABLE
23+
#define API_AVAILABLE(...)
24+
#endif
25+
#ifndef API_DEPRECATED
26+
#define API_DEPRECATED(...)
27+
#endif
28+
#ifndef API_UNAVAILABLE
29+
#define API_UNAVAILABLE(...)
30+
#endif
31+
#ifndef API_DEPRECATED_WITH_REPLACEMENT
32+
#define API_DEPRECATED_WITH_REPLACEMENT(...)
33+
#endif
34+
1835
#if __GNUC__
1936
#define OS_EXPECT(x, v) __builtin_expect((x), (v))
2037
#define OS_UNUSED __attribute__((__unused__))

os/object.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,11 @@
2323

2424
#ifdef __APPLE__
2525
#include <Availability.h>
26-
#include <TargetConditionals.h>
2726
#include <os/availability.h>
28-
#endif
29-
#ifdef __linux__
30-
#include <os/linux_base.h>
31-
#else
27+
#include <TargetConditionals.h>
3228
#include <os/base.h>
29+
#elif defined(__linux__)
30+
#include <os/linux_base.h>
3331
#endif
3432

3533
/*!

os/object_private.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,9 @@
2727
#ifndef __OS_OBJECT_PRIVATE__
2828
#define __OS_OBJECT_PRIVATE__
2929

30-
#if HAVE_SYS_CDEFS_H
31-
#include <sys/cdefs.h>
32-
#endif
33-
#include <stddef.h>
3430
#include <os/object.h>
35-
36-
#ifndef API_AVAILABLE
37-
#define API_AVAILABLE(...)
38-
#endif
31+
#include <stddef.h>
32+
#include <stdint.h>
3933

4034
#if __GNUC__
4135
#define OS_OBJECT_NOTHROW __attribute__((__nothrow__))

0 commit comments

Comments
 (0)