Go to the documentation of this file.Go to the SVN repository for this file.
1 #ifndef COMMON___NCBI_SANITIZERS__H
2 #define COMMON___NCBI_SANITIZERS__H
35 #if defined(__has_feature)
36 # if __has_feature(address_sanitizer)
37 # define NCBI_USE_ASAN
39 # if __has_feature(leak_sanitizer)
40 # define NCBI_USE_LSAN
42 # if __has_feature(memory_sanitizer)
43 # define NCBI_USE_MSAN
45 # if __has_feature(thread_sanitizer)
46 # define NCBI_USE_TSAN
54 #if !defined(NCBI_USE_ASAN) && defined(__SANITIZE_ADDRESS__)
55 # define NCBI_USE_ASAN
57 #if !defined(NCBI_USE_LSAN) && defined(__SANITIZE_LEAK__)
58 # define NCBI_USE_LSAN
60 #if !defined(NCBI_USE_MSAN) && defined(__SANITIZE_MEMORY__)
61 # define NCBI_USE_MSAN
63 #if !defined(NCBI_USE_TSAN) && defined(__SANITIZE_THREAD__)
64 # define NCBI_USE_TSAN
67 #if defined(NCBI_USE_ASAN) && !defined(NCBI_USE_LSAN)
68 # define NCBI_USE_LSAN
73 #if defined(NCBI_USE_ASAN) || defined(NCBI_USE_LSAN) || defined(NCBI_USE_MSAN) || defined(NCBI_USE_TSAN)
74 # define NCBI_USE_SANITIZER
83 #if defined(NCBI_USE_LSAN)
84 # include <sanitizer/lsan_interface.h>
93 # define NCBI_LSAN_DISABLE __lsan_disable()
94 # define NCBI_LSAN_ENABLE __lsan_enable()
102 # define NCBI_LSAN_DISABLE_GUARD \
103 __lsan::ScopedDisabler _lsan_scoped_disabler
106 # define NCBI_LSAN_ENABLE ((void)0)
107 # define NCBI_LSAN_DISABLE ((void)0)
108 # define NCBI_LSAN_DISABLE_GUARD ((void)0)