Fix defines for older gcc
This commit is contained in:
+11
-3
@@ -6,6 +6,15 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifdef __has_feature
|
||||||
|
#if __has_feature(address_sanitizer)
|
||||||
|
#define USE_ASAN 1
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#if defined(__SANITIZE_ADDRESS__)
|
||||||
|
#define USE_ASAN 1
|
||||||
|
#endif
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
typedef int8_t S8;
|
typedef int8_t S8;
|
||||||
typedef int16_t S16;
|
typedef int16_t S16;
|
||||||
@@ -189,7 +198,7 @@ typedef unsigned __int128 U128;
|
|||||||
|
|
||||||
// memory
|
// memory
|
||||||
#define MemSet(ptr, val, len) memset(ptr, val, len)
|
#define MemSet(ptr, val, len) memset(ptr, val, len)
|
||||||
#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
|
#ifdef USE_ASAN
|
||||||
#define MemoryZero(ptr, len) memset(ptr, 0, len)
|
#define MemoryZero(ptr, len) memset(ptr, 0, len)
|
||||||
// explicity bzero is usually not being intercepted
|
// explicity bzero is usually not being intercepted
|
||||||
#else
|
#else
|
||||||
@@ -293,8 +302,7 @@ static INLINE U64 SaturatingMult64(U64 a, U64 b)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// address-sanitizer helpers (-fsanitize=address)
|
// address-sanitizer helpers (-fsanitize=address)
|
||||||
|
#ifdef USE_ASAN
|
||||||
#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
|
|
||||||
#include <sanitizer/asan_interface.h>
|
#include <sanitizer/asan_interface.h>
|
||||||
#define ASAN_POISON_MEMORY_REGION(addr, size) \
|
#define ASAN_POISON_MEMORY_REGION(addr, size) \
|
||||||
__asan_poison_memory_region((addr), (size))
|
__asan_poison_memory_region((addr), (size))
|
||||||
|
|||||||
Reference in New Issue
Block a user