1 | // RUN: %clangxx_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s |
2 | |
3 | #include <sanitizer/tsan_interface.h> |
4 | #include <stdio.h> |
5 | |
6 | namespace __tsan { |
7 | |
8 | #if (__APPLE__) |
9 | __attribute__((weak)) |
10 | #endif |
11 | void OnPotentiallyBlockingRegionBegin() { |
12 | printf(format: "Enter __cxa_guard_acquire\n" ); |
13 | } |
14 | |
15 | #if (__APPLE__) |
16 | __attribute__((weak)) |
17 | #endif |
18 | void OnPotentiallyBlockingRegionEnd() { printf(format: "Exit __cxa_guard_acquire\n" ); } |
19 | |
20 | } // namespace __tsan |
21 | |
22 | int main(int argc, char **argv) { |
23 | // CHECK: Enter main |
24 | printf(format: "Enter main\n" ); |
25 | // CHECK-NEXT: Enter __cxa_guard_acquire |
26 | // CHECK-NEXT: Exit __cxa_guard_acquire |
27 | static int s = argc; |
28 | (void)s; |
29 | // CHECK-NEXT: Exit main |
30 | printf(format: "Exit main\n" ); |
31 | return 0; |
32 | } |
33 | |