1 // RUN: %clangxx -fsanitize=realtime %s -o %t
2 // RUN: not %run %t 2>&1 | FileCheck %s
5 // Intent: Check that a function marked with [[clang::nonblocking]] cannot call a function that is blocking.
10 void custom_blocking_function() [[clang::blocking
]] {
11 printf("In blocking function\n");
14 void realtime_function() [[clang::nonblocking
]] { custom_blocking_function(); }
15 void nonrealtime_function() { custom_blocking_function(); }
18 nonrealtime_function();
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*}}
28 // should only occur once
29 // CHECK-NOT: ==ERROR: RealtimeSanitizer: blocking-call