From 306b1b9bef131e558b5da58df8e68fdc0dfc6a1c Mon Sep 17 00:00:00 2001 From: Kamil Kopryk Date: Thu, 13 Nov 2025 15:31:03 +0000 Subject: [PATCH] test: check if tsan enabled also on gcc Signed-off-by: Kamil Kopryk --- .../host_function/host_function_tests_mt.cpp | 35 +++++++------------ 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/shared/test/unit_test/mt_tests/host_function/host_function_tests_mt.cpp b/shared/test/unit_test/mt_tests/host_function/host_function_tests_mt.cpp index 4db9df1dad..d17a121f3f 100644 --- a/shared/test/unit_test/mt_tests/host_function/host_function_tests_mt.cpp +++ b/shared/test/unit_test/mt_tests/host_function/host_function_tests_mt.cpp @@ -12,35 +12,26 @@ #include "shared/test/common/mocks/mock_execution_environment.h" #include "shared/test/common/test_macros/test.h" -#define TSAN_ANNOTATE_IGNORE_BEGIN() \ - do { \ - } while (0) -#define TSAN_ANNOTATE_IGNORE_END() \ - do { \ - } while (0) - #if defined(__clang__) #if defined(__has_feature) #if __has_feature(thread_sanitizer) - #define NEO_TSAN_ENABLED 1 +#endif +#endif +#elif defined(__GNUC__) +#if defined(__SANITIZE_THREAD__) +#define NEO_TSAN_ENABLED 1 +#endif +#endif +#ifdef NEO_TSAN_ENABLED extern "C" void __tsan_ignore_thread_begin(); extern "C" void __tsan_ignore_thread_end(); - -#undef TSAN_ANNOTATE_IGNORE_BEGIN -#undef TSAN_ANNOTATE_IGNORE_END -#define TSAN_ANNOTATE_IGNORE_BEGIN() \ - do { \ - __tsan_ignore_thread_begin(); \ - } while (0) -#define TSAN_ANNOTATE_IGNORE_END() \ - do { \ - __tsan_ignore_thread_end(); \ - } while (0) - -#endif -#endif +#define TSAN_ANNOTATE_IGNORE_BEGIN() __tsan_ignore_thread_begin() +#define TSAN_ANNOTATE_IGNORE_END() __tsan_ignore_thread_end() +#else +#define TSAN_ANNOTATE_IGNORE_BEGIN() ((void)0) +#define TSAN_ANNOTATE_IGNORE_END() ((void)0) #endif namespace {