Skip to content

Commit f0ef1d3

Browse files
[CompilerRT][Darwin] Silence the warnings for deprecated APIs (#102977)
Silence deprecated API warnings in compiler-rt on Darwin platforms.
1 parent a9604cd commit f0ef1d3

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,11 @@ void WriteOneLineToSyslog(const char *s) {
788788
if (GetMacosAlignedVersion() >= MacosVersion(10, 12)) {
789789
os_log_error(OS_LOG_DEFAULT, "%{public}s", s);
790790
} else {
791+
#pragma clang diagnostic push
792+
// as_log is deprecated.
793+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
791794
asl_log(nullptr, nullptr, ASL_LEVEL_ERR, "%s", s);
795+
#pragma clang diagnostic pop
792796
}
793797
#endif
794798
}
@@ -843,6 +847,9 @@ void LogFullErrorReport(const char *buffer) {
843847
#if !SANITIZER_GO
844848
// Log with os_trace. This will make it into the crash log.
845849
#if SANITIZER_OS_TRACE
850+
#pragma clang diagnostic push
851+
// os_trace is deprecated.
852+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
846853
if (GetMacosAlignedVersion() >= MacosVersion(10, 10)) {
847854
// os_trace requires the message (format parameter) to be a string literal.
848855
if (internal_strncmp(SanitizerToolName, "AddressSanitizer",
@@ -860,6 +867,7 @@ void LogFullErrorReport(const char *buffer) {
860867
if (common_flags()->log_to_syslog)
861868
os_trace("Consult syslog for more information.");
862869
}
870+
#pragma clang diagnostic pop
863871
#endif
864872

865873
// Log to syslog.

compiler-rt/lib/tsan/rtl/tsan_interceptors_mac.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ static constexpr morder kMacFailureOrder = mo_relaxed;
9494
m_orig(int32_t, uint32_t, a32, f##32##OrigBarrier, \
9595
__tsan_atomic32_##tsan_atomic_f, kMacOrderBarrier)
9696

97+
98+
#pragma clang diagnostic push
99+
// OSAtomic* functions are deprecated.
100+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
97101
OSATOMIC_INTERCEPTORS_ARITHMETIC(OSAtomicAdd, fetch_add,
98102
OSATOMIC_INTERCEPTOR_PLUS_X)
99103
OSATOMIC_INTERCEPTORS_ARITHMETIC(OSAtomicIncrement, fetch_add,
@@ -123,6 +127,9 @@ OSATOMIC_INTERCEPTORS_BITWISE(OSAtomicXor, fetch_xor,
123127
kMacOrderBarrier, kMacFailureOrder); \
124128
}
125129

130+
#pragma clang diagnostic push
131+
// OSAtomicCompareAndSwap* functions are deprecated.
132+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
126133
OSATOMIC_INTERCEPTORS_CAS(OSAtomicCompareAndSwapInt, __tsan_atomic32, a32, int)
127134
OSATOMIC_INTERCEPTORS_CAS(OSAtomicCompareAndSwapLong, __tsan_atomic64, a64,
128135
long_t)
@@ -132,6 +139,7 @@ OSATOMIC_INTERCEPTORS_CAS(OSAtomicCompareAndSwap32, __tsan_atomic32, a32,
132139
int32_t)
133140
OSATOMIC_INTERCEPTORS_CAS(OSAtomicCompareAndSwap64, __tsan_atomic64, a64,
134141
int64_t)
142+
#pragma clang diagnostic pop
135143

136144
#define OSATOMIC_INTERCEPTOR_BITOP(f, op, clear, mo) \
137145
TSAN_INTERCEPTOR(bool, f, uint32_t n, volatile void *ptr) { \

0 commit comments

Comments
 (0)