Skip to content
Snippets Groups Projects
Commit 9ad2cbd2 authored by Jan Doskočil's avatar Jan Doskočil Committed by David Vasek
Browse files

asan: silence a faulty GCC warning

fixes #933
parent 43040561
No related branches found
No related tags found
No related merge requests found
Pipeline #130202 passed
......@@ -22,20 +22,35 @@
#ifndef __has_feature
#define __has_feature(feature) 0
#endif
#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
void __asan_poison_memory_region(void const volatile *addr, size_t size);
void __asan_unpoison_memory_region(void const volatile *addr, size_t size);
#if defined(__GNUC__) && !defined(__clang__) /* A faulty GCC workaround. */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
#define ASAN_POISON_MEMORY_REGION(addr, size) \
__asan_poison_memory_region((addr), (size))
#if defined(__GNUC__) && !defined(__clang__) /* End of the workaround. */
#pragma GCC diagnostic pop
#endif
#define ASAN_UNPOISON_MEMORY_REGION(addr, size) \
__asan_unpoison_memory_region((addr), (size))
#if defined(__GNUC__) && !defined(__clang__) /* A faulty GCC workaround. */
#if (__GNUC__ >= 14) /* newer versions of gcc */
#define ASAN_POISON_MEMORY_REGION(addr, size) \
do { \
_Pragma("GCC diagnostic push"); \
_Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\""); \
__asan_poison_memory_region((addr), (size)); \
_Pragma("GCC diagnostic pop"); \
} while (0)
#else /* older versions of gcc */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#define ASAN_POISON_MEMORY_REGION(addr, size) \
__asan_poison_memory_region((addr), (size));
#pragma GCC diagnostic pop
#endif
#else /* non-gcc (clang) definition */
#define ASAN_POISON_MEMORY_REGION(addr, size) \
__asan_poison_memory_region((addr), (size));
#endif
#else /* __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__) */
#define ASAN_POISON_MEMORY_REGION(addr, size) \
((void)(addr), (void)(size))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment