[compiler-rt] [rtsan][compiler-rt] Get rid of [[blocking]] stub in tests (PR #111392)

Chris Apple via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 7 08:12:12 PDT 2024


https://github.com/cjappl created https://github.com/llvm/llvm-project/pull/111392

Added the printfs to ensure we wouldn't have these empty functions compiled out.

>From 04fde0767ab513cf9e9fc65c7b54c1f5c7c6750c Mon Sep 17 00:00:00 2001
From: Chris Apple <cja-private at pm.me>
Date: Mon, 7 Oct 2024 08:10:55 -0700
Subject: [PATCH] [rtsan][compiler-rt] Get rid of [[blocking]] stub in tests

---
 compiler-rt/test/rtsan/blocking_call.cpp | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/compiler-rt/test/rtsan/blocking_call.cpp b/compiler-rt/test/rtsan/blocking_call.cpp
index 47ce3d5544cbd6..7bc46f24fd5432 100644
--- a/compiler-rt/test/rtsan/blocking_call.cpp
+++ b/compiler-rt/test/rtsan/blocking_call.cpp
@@ -7,18 +7,11 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-// TODO: Remove when [[blocking]] is implemented.
-extern "C" void __rtsan_notify_blocking_call(const char *function_name);
-
-void custom_blocking_function() {
-  // TODO: When [[blocking]] is implemented, don't call this directly.
-  __rtsan_notify_blocking_call(__func__);
+void custom_blocking_function() [[clang::blocking]] {
+  printf("In blocking function\n");
 }
 
-void safe_call() {
-  // TODO: When [[blocking]] is implemented, don't call this directly.
-  __rtsan_notify_blocking_call(__func__);
-}
+void safe_call() [[clang::blocking]] { printf("In safe call\n"); }
 
 void process() [[clang::nonblocking]] { custom_blocking_function(); }
 
@@ -28,7 +21,7 @@ int main() {
   return 0;
   // CHECK-NOT: {{.*safe_call*}}
   // CHECK: ==ERROR: RealtimeSanitizer: blocking-call
-  // CHECK-NEXT: Call to blocking function `custom_blocking_function` in real-time context!
+  // CHECK-NEXT: Call to blocking function `custom_blocking_function()` in real-time context!
   // CHECK-NEXT: {{.*custom_blocking_function*}}
   // CHECK-NEXT: {{.*process*}}
 }



More information about the llvm-commits mailing list