Skip to content

Commit 6ace680

Browse files
authored
[rtsan][compiler-rt] Get rid of [[blocking]] stub in tests (llvm#111392)
1 parent 70cbedc commit 6ace680

File tree

1 file changed

+14
-19
lines changed

1 file changed

+14
-19
lines changed

compiler-rt/test/rtsan/blocking_call.cpp

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,23 @@
77
#include <stdio.h>
88
#include <stdlib.h>
99

10-
// TODO: Remove when [[blocking]] is implemented.
11-
extern "C" void __rtsan_notify_blocking_call(const char *function_name);
12-
13-
void custom_blocking_function() {
14-
// TODO: When [[blocking]] is implemented, don't call this directly.
15-
__rtsan_notify_blocking_call(__func__);
16-
}
17-
18-
void safe_call() {
19-
// TODO: When [[blocking]] is implemented, don't call this directly.
20-
__rtsan_notify_blocking_call(__func__);
10+
void custom_blocking_function() [[clang::blocking]] {
11+
printf("In blocking function\n");
2112
}
2213

23-
void process() [[clang::nonblocking]] { custom_blocking_function(); }
14+
void realtime_function() [[clang::nonblocking]] { custom_blocking_function(); }
15+
void nonrealtime_function() { custom_blocking_function(); }
2416

2517
int main() {
26-
safe_call(); // This shouldn't die, because it isn't in nonblocking context.
27-
process();
18+
nonrealtime_function();
19+
realtime_function();
2820
return 0;
29-
// CHECK-NOT: {{.*safe_call*}}
30-
// CHECK: ==ERROR: RealtimeSanitizer: blocking-call
31-
// CHECK-NEXT: Call to blocking function `custom_blocking_function` in real-time context!
32-
// CHECK-NEXT: {{.*custom_blocking_function*}}
33-
// CHECK-NEXT: {{.*process*}}
3421
}
22+
23+
// CHECK: ==ERROR: RealtimeSanitizer: blocking-call
24+
// CHECK-NEXT: Call to blocking function `custom_blocking_function()` in real-time context!
25+
// CHECK-NEXT: {{.*custom_blocking_function*}}
26+
// CHECK-NEXT: {{.*realtime_function*}}
27+
28+
// should only occur once
29+
// CHECK-NOT: ==ERROR: RealtimeSanitizer: blocking-call

0 commit comments

Comments
 (0)