mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-04 16:54:13 +08:00
mdbx: basic support for ThreadSanitizer (tsan).
Change-Id: Ia23751ac569b64e94cd6f5e6910f77a203259fa3
This commit is contained in:
parent
dec88f8c35
commit
6069149b05
41
reopen.h
41
reopen.h
@ -67,6 +67,14 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif /* __forceinline */
|
#endif /* __forceinline */
|
||||||
|
|
||||||
|
#ifndef __noinline
|
||||||
|
# if defined(__GNUC__) || defined(__clang__)
|
||||||
|
# define __noinline __attribute__((noinline))
|
||||||
|
# elif defined(_MSC_VER)
|
||||||
|
# define __noinline __declspec(noinline)
|
||||||
|
# endif
|
||||||
|
#endif /* __noinline */
|
||||||
|
|
||||||
#ifndef __must_check_result
|
#ifndef __must_check_result
|
||||||
# if defined(__GNUC__) || defined(__clang__)
|
# if defined(__GNUC__) || defined(__clang__)
|
||||||
# define __must_check_result __attribute__((warn_unused_result))
|
# define __must_check_result __attribute__((warn_unused_result))
|
||||||
@ -115,6 +123,8 @@
|
|||||||
#ifndef __noreturn
|
#ifndef __noreturn
|
||||||
# if defined(__GNUC__) || defined(__clang__)
|
# if defined(__GNUC__) || defined(__clang__)
|
||||||
# define __noreturn __attribute__((noreturn))
|
# define __noreturn __attribute__((noreturn))
|
||||||
|
# elif defined(__MSC_VER)
|
||||||
|
# define __noreturn __declspec(noreturn)
|
||||||
# else
|
# else
|
||||||
# define __noreturn
|
# define __noreturn
|
||||||
# endif
|
# endif
|
||||||
@ -123,6 +133,8 @@
|
|||||||
#ifndef __nothrow
|
#ifndef __nothrow
|
||||||
# if defined(__GNUC__) || defined(__clang__)
|
# if defined(__GNUC__) || defined(__clang__)
|
||||||
# define __nothrow __attribute__((nothrow))
|
# define __nothrow __attribute__((nothrow))
|
||||||
|
# elif defined(__MSC_VER)
|
||||||
|
# define __nothrow __declspec(nothrow)
|
||||||
# else
|
# else
|
||||||
# define __nothrow
|
# define __nothrow
|
||||||
# endif
|
# endif
|
||||||
@ -217,4 +229,33 @@ __extern_C void __assert_fail(
|
|||||||
# define VALGRIND_CHECK_MEM_IS_DEFINED(a,s) (0)
|
# define VALGRIND_CHECK_MEM_IS_DEFINED(a,s) (0)
|
||||||
#endif /* ! USE_VALGRIND */
|
#endif /* ! USE_VALGRIND */
|
||||||
|
|
||||||
|
#if defined(__has_feature)
|
||||||
|
# if __has_feature(thread_sanitizer)
|
||||||
|
# define __SANITIZE_THREAD__ 1
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __SANITIZE_THREAD__
|
||||||
|
# define ATTRIBUTE_NO_SANITIZE_THREAD __attribute__((no_sanitize_thread, noinline))
|
||||||
|
#else
|
||||||
|
# define ATTRIBUTE_NO_SANITIZE_THREAD
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__has_feature)
|
||||||
|
# if __has_feature(address_sanitizer)
|
||||||
|
# define __SANITIZE_ADDRESS__ 1
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __SANITIZE_ADDRESS__
|
||||||
|
# include <sanitizer/asan_interface.h>
|
||||||
|
# define ATTRIBUTE_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address, noinline))
|
||||||
|
#else
|
||||||
|
# define ASAN_POISON_MEMORY_REGION(addr, size) \
|
||||||
|
((void)(addr), (void)(size))
|
||||||
|
# define ASAN_UNPOISON_MEMORY_REGION(addr, size) \
|
||||||
|
((void)(addr), (void)(size))
|
||||||
|
# define ATTRIBUTE_NO_SANITIZE_ADDRESS
|
||||||
|
#endif /* __SANITIZE_ADDRESS__ */
|
||||||
|
|
||||||
#endif /* _REOPEN_H */
|
#endif /* _REOPEN_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user