[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 09:49:26 PDT 2024
https://github.com/cjappl updated https://github.com/llvm/llvm-project/pull/111392
>From e8bc15b5230f60899ab658255d1f399d226db03d 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 | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/compiler-rt/test/rtsan/blocking_call.cpp b/compiler-rt/test/rtsan/blocking_call.cpp
index 47ce3d5544cbd6..481040e81999db 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(); }
@@ -26,9 +19,14 @@ int main() {
safe_call(); // This shouldn't die, because it isn't in nonblocking context.
process();
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*}}
+
+ // We should crash before this line is printed
+ // CHECK-NOT: {{.*In blocking function.*}}
+
+ // should only occur once
+ // CHECK-NOT: ==ERROR: RealtimeSanitizer: blocking-call
}
More information about the llvm-commits
mailing list