aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra/clib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/vppinfra/clib.h')
-rw-r--r--src/vppinfra/clib.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/vppinfra/clib.h b/src/vppinfra/clib.h
index 8d1674945dd..2db611d969b 100644
--- a/src/vppinfra/clib.h
+++ b/src/vppinfra/clib.h
@@ -95,6 +95,15 @@
/* Make a string from the macro's argument */
#define CLIB_STRING_MACRO(x) #x
+/* sanitizers */
+#ifdef __has_feature
+#if __has_feature(address_sanitizer)
+#define CLIB_SANITIZE_ADDR 1
+#endif
+#elif defined(__SANITIZE_ADDRESS__)
+#define CLIB_SANITIZE_ADDR 1
+#endif
+
#define __clib_unused __attribute__ ((unused))
#define __clib_weak __attribute__ ((weak))
#define __clib_packed __attribute__ ((packed))
@@ -117,6 +126,12 @@
__attribute__ ((optimize ("no-optimize-sibling-calls")))
#endif
+#ifdef CLIB_SANITIZE_ADDR
+#define __clib_nosanitize_addr __attribute__ ((no_sanitize_address))
+#else
+#define __clib_nosanitize_addr
+#endif
+
#define never_inline __attribute__ ((__noinline__))
#if CLIB_DEBUG > 0