Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add new entry in Release_Notes.
[simgrid.git] / tools / cmake / test_prog / prog_tsan.cpp
1 /* Copyright (c) 2020-2023. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 /* Check availability of ThreadSanitizer */
8
9 #if defined(__has_feature)
10 #define HAS_FEATURE(x) __has_feature(x)
11 #else
12 #define HAS_FEATURE(x) 0
13 #endif
14
15 #if not HAS_FEATURE(thread_sanitizer) && not defined(__SANITIZE_THREAD__)
16 #error "TSan feature not found."
17 #endif
18
19 #if defined(CHECK_FIBER_SUPPORT)
20 #include <sanitizer/tsan_interface.h>
21 // Verify the existence of the fiber annotation interface, with the expected signature
22 void* (*create_fiber)(unsigned)       = __tsan_create_fiber;
23 void (*destroy_fiber)(void*)          = __tsan_destroy_fiber;
24 void (*switch_fiber)(void*, unsigned) = __tsan_switch_to_fiber;
25 #endif
26
27 int main(void) {}