Revert "Define special macros for asan/msan being enabled"

This reverts commit bdafad879093ef16a9a649154c4b2e4ebf492656.
This commit is contained in:
KJ Tsanaktsidis 2024-01-12 17:32:16 +11:00
parent 688a6ff510
commit 33a03cb236

View File

@ -16,15 +16,11 @@
#endif
#ifdef HAVE_SANITIZER_ASAN_INTERFACE_H
# if __has_feature(address_sanitizer)
# define RUBY_ASAN_ENABLED
# include <sanitizer/asan_interface.h>
# endif
# include <sanitizer/asan_interface.h>
#endif
#ifdef HAVE_SANITIZER_MSAN_INTERFACE_H
# if __has_feature(memory_sanitizer)
# define RUBY_MSAN_ENABLED
# include <sanitizer/msan_interface.h>
# endif
#endif
@ -33,10 +29,10 @@
#include "ruby/ruby.h" /* for VALUE */
#if 0
#elif defined(RUBY_ASAN_ENABLED) && defined(RUBY_MSAN_ENABLED)
#elif __has_feature(memory_sanitizer) && __has_feature(address_sanitizer)
# define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS(x) \
__attribute__((__no_sanitize__("memory, address"), __noinline__)) x
#elif defined(RUBY_ASAN_ENABLED)
#elif __has_feature(address_sanitizer)
# define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS(x) \
__attribute__((__no_sanitize__("address"), __noinline__)) x
#elif defined(NO_SANITIZE_ADDRESS)
@ -64,7 +60,7 @@
# define NO_SANITIZE(x, y) y
#endif
#ifndef RUBY_ASAN_ENABLED
#if !__has_feature(address_sanitizer)
# define __asan_poison_memory_region(x, y)
# define __asan_unpoison_memory_region(x, y)
# define __asan_region_is_poisoned(x, y) 0
@ -72,7 +68,7 @@
# define __asan_addr_is_in_fake_stack(fake_stack, slot, start, end) NULL
#endif
#ifndef RUBY_MSAN_ENABLED
#if !__has_feature(memory_sanitizer)
# define __msan_allocated_memory(x, y) ((void)(x), (void)(y))
# define __msan_poison(x, y) ((void)(x), (void)(y))
# define __msan_unpoison(x, y) ((void)(x), (void)(y))
@ -127,12 +123,12 @@ asan_poison_object(VALUE obj)
asan_poison_memory_region(ptr, SIZEOF_VALUE);
}
#ifdef RUBY_ASAN_ENABLED
#if !__has_feature(address_sanitizer)
#define asan_poison_object_if(ptr, obj) ((void)(ptr), (void)(obj))
#else
#define asan_poison_object_if(ptr, obj) do { \
if (ptr) asan_poison_object(obj); \
} while (0)
#else
#define asan_poison_object_if(ptr, obj) ((void)(ptr), (void)(obj))
#endif
/*!