diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2024-10-30 14:57:23 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2024-11-02 11:25:10 -0400 |
commit | d09b784e395554cb67ec91e70544a052fe60a276 (patch) | |
tree | 7ac772d169160cd0d274203e0fd2b09e74023427 /src/sanity.h | |
parent | 1466fb2400af367db9d0cb1041020278a871a4f3 (diff) | |
download | bfs-d09b784e395554cb67ec91e70544a052fe60a276.tar.xz |
sanity: Don't mark memory uninit in sanitize_{alloc,free}()
We might want to change the size of an allocated region without changing
which bytes are initialized.
Diffstat (limited to 'src/sanity.h')
-rw-r--r-- | src/sanity.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/sanity.h b/src/sanity.h index 0b770cf..3f6020b 100644 --- a/src/sanity.h +++ b/src/sanity.h @@ -20,6 +20,11 @@ #define SANITIZE_CALL__(macro, ptr, size, ...) \ macro(ptr, size) +/** + * Squelch unused variable warnings when not sanitizing. + */ +#define sanitize_ignore(ptr, size) ((void)(ptr), (void)(size)) + #if __SANITIZE_ADDRESS__ # include <sanitizer/asan_interface.h> @@ -38,8 +43,8 @@ #define sanitize_free(...) SANITIZE_CALL(__asan_poison_memory_region, __VA_ARGS__) #else -# define sanitize_alloc sanitize_uninit -# define sanitize_free sanitize_uninit +# define sanitize_alloc(...) SANITIZE_CALL(sanitize_ignore, __VA_ARGS__) +# define sanitize_free(...) SANITIZE_CALL(sanitize_ignore, __VA_ARGS__) #endif #if __SANITIZE_MEMORY__ @@ -65,11 +70,6 @@ #endif /** - * Squelch unused variable warnings when not sanitizing. - */ -#define sanitize_ignore(ptr, size) ((void)(ptr), (void)(size)) - -/** * Initialize a variable, unless sanitizers would detect uninitialized uses. */ #if __SANITIZE_MEMORY__ |