4#ifndef _Stroika_Foundation_Debug_Sanitizer_h_
5#define _Stroika_Foundation_Debug_Sanitizer_h_ 1
7#include "Stroika/Foundation/StroikaPreComp.h"
9#if __has_include(<sanitizer/asan_interface.h>)
10#include <sanitizer/asan_interface.h>
12#if __has_include(<sanitizer/lsan_interface.h>)
13#include <sanitizer/lsan_interface.h>
15#if __has_include(<sanitizer/tsan_interface.h>)
16#include <sanitizer/tsan_interface.h>
19#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 14
22extern "C" void __attribute__ ((weak)) __ubsan_handle_builtin_unreachable (
void*);
66#if defined(__cplusplus)
67namespace Stroika::Foundation::Debug {
85#if defined(__SANITIZE_ADDRESS__)
86 constexpr bool kBuiltWithAddressSanitizer =
true;
87#elif defined(__has_feature)
88 constexpr bool kBuiltWithAddressSanitizer = __has_feature (address_sanitizer);
90 constexpr bool kBuiltWithAddressSanitizer =
false;
114#if defined(__has_attribute)
115#if __has_attribute(no_sanitize)
116#define Stroika_Foundation_Debug_ATTRIBUTE_NO_SANITIZE_ADDRESS __attribute__ ((no_sanitize ("address")))
119#if !defined(Stroika_Foundation_Debug_ATTRIBUTE_NO_SANITIZE_ADDRESS)
124#define Stroika_Foundation_Debug_ATTRIBUTE_NO_SANITIZE_ADDRESS __declspec (no_sanitize_address)
126#define Stroika_Foundation_Debug_ATTRIBUTE_NO_SANITIZE_ADDRESS
146#if defined(__SANITIZE_THREAD__)
147 constexpr bool kBuiltWithThreadSanitizer =
true;
148#elif defined(__has_feature)
149 constexpr bool kBuiltWithThreadSanitizer = __has_feature (thread_sanitizer);
151 constexpr bool kBuiltWithThreadSanitizer =
false;
165#if defined(__has_attribute)
166#if __has_attribute(no_sanitize)
167#define Stroika_Foundation_Debug_ATTRIBUTE_NO_SANITIZE_THREAD __attribute__ ((no_sanitize ("thread")))
170#if !defined(Stroika_Foundation_Debug_ATTRIBUTE_NO_SANITIZE_THREAD)
171#define Stroika_Foundation_Debug_ATTRIBUTE_NO_SANITIZE_THREAD
196#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 14
197 inline const bool kBuiltWithUndefinedBehaviorSanitizer = &__ubsan_handle_builtin_unreachable !=
nullptr;
198#elif defined(__has_feature)
199 constexpr bool kBuiltWithUndefinedBehaviorSanitizer = __has_feature (undefined_behavior_sanitizer);
201 constexpr bool kBuiltWithUndefinedBehaviorSanitizer =
false;
218#if defined(__has_attribute)
219#if __has_attribute(no_sanitize)
220#define Stroika_Foundation_Debug_ATTRIBUTE_NO_SANITIZE_UNDEFINED __attribute__ ((no_sanitize ("undefined")))
223#if !defined(Stroika_Foundation_Debug_ATTRIBUTE_NO_SANITIZE_UNDEFINED)
224#define Stroika_Foundation_Debug_ATTRIBUTE_NO_SANITIZE_UNDEFINED
235#include "Sanitizer.inl"