Skip to content

Commit

Permalink
Forward declare OSSpinLockLock on MacOS since it's not shipped on the…
Browse files Browse the repository at this point in the history
… system. (llvm#101392)

Fixes build errors on some SDKs.

rdar://132607572
  • Loading branch information
aemerson authored Jul 31, 2024
1 parent 3403b59 commit 3a4c7cc
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions compiler-rt/lib/rtsan/rtsan_interceptors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@
#include "rtsan/rtsan_context.h"

#if SANITIZER_APPLE

#if TARGET_OS_MAC
// On MacOS OSSpinLockLock is deprecated and no longer present in the headers,
// but the symbol still exists on the system. Forward declare here so we
// don't get compilation errors.
#include <stdint.h>
extern "C" {
typedef int32_t OSSpinLock;
void OSSpinLockLock(volatile OSSpinLock *__lock);
}
#endif

#include <libkern/OSAtomic.h>
#include <os/lock.h>
#endif
Expand Down

0 comments on commit 3a4c7cc

Please sign in to comment.