Skip to content

Commit 48eb383

Browse files
committed
RunLoop: define __unused for Windows
The macro needs to be defined for the Windows port. Duplicate the definition from the Linux path.
1 parent f8db3db commit 48eb383

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

Diff for: CoreFoundation/RunLoop.subproj/CFRunLoop.c

+14-8
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,20 @@ static pthread_t const kNilPthreadT = (pthread_t)0;
210210
#define CFRUNLOOP_WAKEUP_FOR_WAKEUP_ENABLED() (0)
211211
#endif
212212

213+
214+
// NOTE: this is locally defined rather than in CFInternal.h as on Linux,
215+
// `linux/sysctl.h` defines `struct __sysctl_args` with an `__unused` member
216+
// which breaks the build.
217+
#if DEPLOYMENT_TARGET_WINDOWS || TARGET_OS_CYGWIN || DEPLOYMENT_TARGET_LINUX
218+
#ifndef __unused
219+
#if __has_attribute(unused)
220+
#define __unused __attribute__((unused))
221+
#else
222+
#define __unused
223+
#endif
224+
#endif // !defined(__unused)
225+
#endif
226+
213227
// In order to reuse most of the code across Mach and Windows v1 RunLoopSources, we define a
214228
// simple abstraction layer spanning Mach ports and Windows HANDLES
215229
#if DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED || DEPLOYMENT_TARGET_EMBEDDED_MINI
@@ -488,14 +502,6 @@ typedef int __CFPort;
488502
typedef int __CFPortSet;
489503
#define CFPORTSET_NULL -1
490504

491-
#ifndef __unused
492-
#if __has_attribute(unused)
493-
#define __unused __attribute__((unused))
494-
#else
495-
#define __unused
496-
#endif
497-
#endif // !defined(__unused)
498-
499505
static __CFPort __CFPortAllocate(__unused uintptr_t guard) {
500506
return eventfd(0, EFD_CLOEXEC|EFD_NONBLOCK);
501507
}

0 commit comments

Comments
 (0)