#endif
#endif
+/* Address sanitizer */
+#ifdef __clang__
+# if __has_feature(address_sanitizer)
+/* emulate gcc's __SANITIZE_ADDRESS__ flag */
+# define __SANITIZE_ADDRESS__
+# define RSPAMD_NO_SANITIZE \
+ __attribute__((no_sanitize("address", "hwaddress")))
+# else
+# define RSPAMD_NO_SANITIZE
+# endif
+#elif defined(__GNUC__)
+/* GCC based */
+# if __has_attribute(__no_sanitize_address__)
+# define RSPAMD_NO_SANITIZE __attribute__((no_sanitize_address))
+# else
+# define RSPAMD_NO_SANITIZE
+# endif
+#else
+# define RSPAMD_NO_SANITIZE
+#endif
+
+
#ifndef BITSPERBYTE
# define BITSPERBYTE (NBBY * sizeof (char))
#endif
/* extracts a few bits from bitstring, returning them as an integer */
static inline btrie_oct_t extract_bits(const btrie_oct_t *prefix, unsigned pos,
- unsigned nbits)
+ unsigned nbits) RSPAMD_NO_SANITIZE
{
if (nbits == 0)
return 0;
#define __has_extension(x) (0)
#endif
-#if __has_feature(address_sanitizer)
-#define __SANITIZE_ADDRESS__ 1
-#endif
-
#if __GNUC_PREREQ(4, 4) || defined(__clang__)
#if defined(__ia32__) || defined(__e2k__)