Skip to content

Commit 4c83de3

Browse files
committed
Refactor builtin available to macro
1 parent 0a01c4c commit 4c83de3

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,19 @@ TEST(TestRtsanInterceptors, VallocDiesWhenRealtime) {
120120
ExpectNonRealtimeSurvival(Func);
121121
}
122122

123+
#if __has_builtin(__builtin_available) && SANITIZER_APPLE
124+
#define ALIGNED_ALLOC_AVAILABLE() __builtin_available(macOS 10.15, *)
125+
#else
126+
// We are going to assume this is true until we hit systems where it isn't
127+
#define ALIGNED_ALLOC_AVAILABLE() true
128+
#endif
129+
123130
TEST(TestRtsanInterceptors, AlignedAllocDiesWhenRealtime) {
124-
#if SANITIZER_APPLE
125-
if (__builtin_available(macOS 10.15, *)) {
126-
#endif // SANITIZER_APPLE
131+
if (ALIGNED_ALLOC_AVAILABLE()) {
127132
auto Func = []() { EXPECT_NE(nullptr, aligned_alloc(16, 32)); };
128133
ExpectRealtimeDeath(Func, "aligned_alloc");
129134
ExpectNonRealtimeSurvival(Func);
130-
#if SANITIZER_APPLE
131135
}
132-
#endif
133136
}
134137

135138
// free_sized and free_aligned_sized (both C23) are not yet supported

0 commit comments

Comments
 (0)