From fe5d815487de3bcb4aef0b0d6329e563638f3f49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20R=C3=BChsen?= Date: Fri, 21 Jul 2017 23:18:21 +0200 Subject: [PATCH] malloca: Silence a warning from clang's memory sanitizer. * lib/malloca.c (NO_SANITIZE_MEMORY): New macro. (freea): Use it. --- ChangeLog | 6 ++++++ lib/malloca.c | 12 +++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2a59e49..0f0acdc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2017-07-21 Tim Rühsen + + malloca: Silence a warning from clang's memory sanitizer. + * lib/malloca.c (NO_SANITIZE_MEMORY): New macro. + (freea): Use it. + 2017-07-18 Bruno Haible host-cpu-c-abi: Fix detection of MIPS ABI. diff --git a/lib/malloca.c b/lib/malloca.c index 969127a..1a7ac8d 100644 --- a/lib/malloca.c +++ b/lib/malloca.c @@ -25,6 +25,16 @@ #include "verify.h" +/* Silence a warning from clang's MemorySanitizer. */ +#if defined __has_feature +# if __has_feature(memory_sanitizer) +# define NO_SANITIZE_MEMORY __attribute__((no_sanitize("memory"))) +# endif +#endif +#ifndef NO_SANITIZE_MEMORY +# define NO_SANITIZE_MEMORY +#endif + /* The speed critical point in this file is freea() applied to an alloca() result: it must be fast, to match the speed of alloca(). The speed of mmalloca() and freea() in the other case are not critical, because they @@ -112,7 +122,7 @@ mmalloca (size_t n) } #if HAVE_ALLOCA -void +void NO_SANITIZE_MEMORY freea (void *p) { /* mmalloca() may have returned NULL. */ -- 2.7.4