[compiler-rt] [rtsan] Add include guards around posix interceptors, tests (PR #113188)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 21 09:13:26 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-compiler-rt-sanitizer
Author: Chris Apple (cjappl)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/113188.diff
2 Files Affected:
- (modified) compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp (+5-1)
- (modified) compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp (+5-1)
``````````diff
diff --git a/compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp b/compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp
index 63b0ca28a1f409..890d6c11c40762 100644
--- a/compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp
+++ b/compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp
@@ -8,12 +8,14 @@
//
//===----------------------------------------------------------------------===//
+#include "sanitizer_common/sanitizer_platform.h"
+#if SANITIZER_POSIX
+
#include "rtsan/rtsan_interceptors.h"
#include "interception/interception.h"
#include "sanitizer_common/sanitizer_allocator_dlsym.h"
#include "sanitizer_common/sanitizer_allocator_internal.h"
-#include "sanitizer_common/sanitizer_platform.h"
#include "sanitizer_common/sanitizer_platform_interceptors.h"
#include "interception/interception.h"
@@ -608,3 +610,5 @@ void __rtsan::InitializeInterceptors() {
INTERCEPT_FUNCTION(recvfrom);
INTERCEPT_FUNCTION(shutdown);
}
+
+#endif // SANITIZER_POSIX
diff --git a/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp b/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp
index f7a281f13e2ff6..6233c3e91800e1 100644
--- a/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp
+++ b/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp
@@ -8,9 +8,11 @@
//
//===----------------------------------------------------------------------===//
+#include "sanitizer_common/sanitizer_platform.h"
+#if SANITIZER_POSIX
+
#include "gtest/gtest.h"
-#include "sanitizer_common/sanitizer_platform.h"
#include "sanitizer_common/sanitizer_platform_interceptors.h"
#include "rtsan_test_utilities.h"
@@ -704,3 +706,5 @@ TEST(TestRtsanInterceptors, ShutdownOnASocketDiesWhenRealtime) {
ExpectRealtimeDeath(Func, "shutdown");
ExpectNonRealtimeSurvival(Func);
}
+
+#endif // SANITIZER_POSIX
``````````
</details>
https://github.com/llvm/llvm-project/pull/113188
More information about the llvm-commits
mailing list