Skip to content

Commit 9ed6f7f

Browse files
authored
[rtsan] Add include guards around posix interceptors, tests (#113188)
1 parent 4e40b71 commit 9ed6f7f

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
//
99
//===----------------------------------------------------------------------===//
1010

11+
#include "sanitizer_common/sanitizer_platform.h"
12+
#if SANITIZER_POSIX
13+
1114
#include "rtsan/rtsan_interceptors.h"
1215

1316
#include "interception/interception.h"
1417
#include "sanitizer_common/sanitizer_allocator_dlsym.h"
1518
#include "sanitizer_common/sanitizer_allocator_internal.h"
16-
#include "sanitizer_common/sanitizer_platform.h"
1719
#include "sanitizer_common/sanitizer_platform_interceptors.h"
1820

1921
#include "interception/interception.h"
@@ -608,3 +610,5 @@ void __rtsan::InitializeInterceptors() {
608610
INTERCEPT_FUNCTION(recvfrom);
609611
INTERCEPT_FUNCTION(shutdown);
610612
}
613+
614+
#endif // SANITIZER_POSIX

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88
//
99
//===----------------------------------------------------------------------===//
1010

11+
#include "sanitizer_common/sanitizer_platform.h"
12+
#if SANITIZER_POSIX
13+
1114
#include "gtest/gtest.h"
1215

13-
#include "sanitizer_common/sanitizer_platform.h"
1416
#include "sanitizer_common/sanitizer_platform_interceptors.h"
1517

1618
#include "rtsan_test_utilities.h"
@@ -704,3 +706,5 @@ TEST(TestRtsanInterceptors, ShutdownOnASocketDiesWhenRealtime) {
704706
ExpectRealtimeDeath(Func, "shutdown");
705707
ExpectNonRealtimeSurvival(Func);
706708
}
709+
710+
#endif // SANITIZER_POSIX

0 commit comments

Comments
 (0)