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

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


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Chris Apple (cjappl)

<details>
<summary>Changes</summary>

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

---
Full diff: https://github.com/llvm/llvm-project/pull/111392.diff


1 Files Affected:

- (modified) compiler-rt/test/rtsan/blocking_call.cpp (+4-11) 


``````````diff
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*}}
 }

``````````

</details>


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


More information about the llvm-commits mailing list