|
7 | 7 | #include <stdio.h> |
8 | 8 | #include <stdlib.h> |
9 | 9 |
|
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"); |
21 | 12 | } |
22 | 13 |
|
23 | | -void process() [[clang::nonblocking]] { custom_blocking_function(); } |
| 14 | +void realtime_function() [[clang::nonblocking]] { custom_blocking_function(); } |
| 15 | +void nonrealtime_function() { custom_blocking_function(); } |
24 | 16 |
|
25 | 17 | int main() { |
26 | | - safe_call(); // This shouldn't die, because it isn't in nonblocking context. |
27 | | - process(); |
| 18 | + nonrealtime_function(); |
| 19 | + realtime_function(); |
28 | 20 | 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*}} |
34 | 21 | } |
| 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