[compiler-rt] [rtsan] Add include guards around posix interceptors, tests (PR #113188)
Chris Apple via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 21 09:12:44 PDT 2024
https://github.com/cjappl created https://github.com/llvm/llvm-project/pull/113188
None
>From 1ba006bf3f9bd9f65ff6c1606ed172a17cc70614 Mon Sep 17 00:00:00 2001
From: Chris Apple <cja-private at pm.me>
Date: Mon, 21 Oct 2024 09:12:06 -0700
Subject: [PATCH] [rtsan] Add include guards around posix interceptors, tests
---
compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp | 6 +++++-
.../lib/rtsan/tests/rtsan_test_interceptors_posix.cpp | 6 +++++-
2 files changed, 10 insertions(+), 2 deletions(-)
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
More information about the llvm-commits
mailing list