From 764b8086d1ee8c105460fcc59173f9daf423838f Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Wed, 13 Nov 2024 20:22:32 +0100 Subject: [PATCH] tests: Fix sanitizer version check on old Apple clang See #669. --- libxml.h | 3 ++- testdict.c | 15 ++------------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/libxml.h b/libxml.h index ee3d57c7..1b737ad4 100644 --- a/libxml.h +++ b/libxml.h @@ -72,7 +72,8 @@ #endif #ifdef __clang__ - #if __clang_major__ >= 12 + #if (!defined(__apple_build_version__) && __clang_major__ >= 12) || \ + (defined(__apple_build_version__) && __clang_major__ >= 13) #define ATTRIBUTE_NO_SANITIZE_INTEGER \ ATTRIBUTE_NO_SANITIZE("unsigned-integer-overflow") \ ATTRIBUTE_NO_SANITIZE("unsigned-shift-base") diff --git a/testdict.c b/testdict.c index 94f18c2c..f9a1d991 100644 --- a/testdict.c +++ b/testdict.c @@ -1,3 +1,5 @@ +#include "libxml.h" + #include #include #include @@ -6,19 +8,6 @@ /**** dictionary tests ****/ -#ifdef __clang__ - #if __clang_major__ >= 12 - #define ATTRIBUTE_NO_SANITIZE_INTEGER \ - __attribute__ ((no_sanitize("unsigned-integer-overflow"))) \ - __attribute__ ((no_sanitize("unsigned-shift-base"))) - #else - #define ATTRIBUTE_NO_SANITIZE_INTEGER \ - __attribute__ ((no_sanitize("unsigned-integer-overflow"))) - #endif -#else - #define ATTRIBUTE_NO_SANITIZE_INTEGER -#endif - /* #define WITH_PRINT */ static const char *seeds1[] = {