|
| 1 | +//===-- tsan_spinlock_defs_mac.h -------------------------------===// |
| 2 | +// |
| 3 | +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | +// See https://llvm.org/LICENSE.txt for license information. |
| 5 | +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | +// |
| 7 | +//===----------------------------------------------------------------------===// |
| 8 | +// |
| 9 | +// This file is a part of ThreadSanitizer (TSan), a race detector. |
| 10 | +// |
| 11 | +// Mac-specific forward-declared function defintions that may be |
| 12 | +// deprecated in later versions of the OS. |
| 13 | +// These are needed for interceptors. |
| 14 | +// |
| 15 | +//===----------------------------------------------------------------------===// |
| 16 | + |
| 17 | +#if SANITIZER_APPLE |
| 18 | + |
| 19 | +#ifndef TSAN_SPINLOCK_DEFS_MAC_H |
| 20 | +#define TSAN_SPINLOCK_DEFS_MAC_H |
| 21 | + |
| 22 | +#include <stdint.h> |
| 23 | + |
| 24 | +extern "C" { |
| 25 | + |
| 26 | +/* |
| 27 | +Provides forward declarations related to OSSpinLocks on Darwin. These functions are |
| 28 | +deprecated on macOS version 10.12 and later, |
| 29 | +and are no longer included in the system headers. |
| 30 | +
|
| 31 | +However, the symbols are still available on the system, so we provide these forward |
| 32 | +declarations to prevent compilation errors in tsan_interceptors_mac.cpp, which |
| 33 | +references these functions when defining TSAN interceptor functions. |
| 34 | +*/ |
| 35 | + |
| 36 | +typedef int32_t OSSpinLock; |
| 37 | + |
| 38 | +void OSSpinLockLock(volatile OSSpinLock *__lock); |
| 39 | +void OSSpinLockUnlock(volatile OSSpinLock *__lock); |
| 40 | +bool OSSpinLockTry(volatile OSSpinLock *__lock); |
| 41 | + |
| 42 | +} |
| 43 | + |
| 44 | +#endif //TSAN_SPINLOCK_DEFS_MAC_H |
| 45 | +#endif // SANITIZER_APPLE |
0 commit comments