We cannot really rely on __has_feature or __ADDRESS_SANITIZER__ in code
since we are mostly interested in the leak sanitizer and there is
neither a feature nor a macro for that. Early version of GCC have the
address sanitizer, but not the leak sanitizer. We don't support this
configuration, but we need to build correctly either way. So, the user
is expected to enable address sanitizers only on configuration
supporting also the leak sanitizer.
yes) sanitizers="-fsanitize=address" ;;
*) sanitizers="-fsanitize=$enableval" ;;
esac
-LLDP_CFLAGS="$LLDP_CFLAGS $sanitizers"
-LLDP_LDFLAGS="$LLDP_LDFLAGS $sanitizers"
+if test x"$sanitizers" != x; then
+ LLDP_CFLAGS="$LLDP_CFLAGS $sanitizers"
+ LLDP_LDFLAGS="$LLDP_LDFLAGS $sanitizers"
+ AC_DEFINE([HAVE_ADDRESS_SANITIZER], 1, [Define if have both address and leak sanitizer])
+fi
])
# OS
#include "../compat/compat.h"
#include "writer.h"
-#if defined(__has_feature)
-# if __has_feature(address_sanitizer)
-# define __SANITIZE_ADDRESS__
-# endif
-#endif
-#ifdef __SANITIZE_ADDRESS__
+#ifdef HAVE_ADDRESS_SANITIZER
# include <sanitizer/lsan_interface.h>
# define SUPPRESS_LEAK(x) __lsan_ignore_object(x)
#else