summaryrefslogtreecommitdiff
path: root/lib/malloca.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/malloca.c')
-rw-r--r--lib/malloca.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/malloca.c b/lib/malloca.c
index f1c387f..0e86b1b 100644
--- a/lib/malloca.c
+++ b/lib/malloca.c
@@ -1,5 +1,5 @@
/* Safe automatic memory allocation.
- Copyright (C) 2003, 2006-2007, 2009-2016 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2006-2007, 2009-2017 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2003.
This program is free software: you can redistribute it and/or
@@ -22,7 +22,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
+ along with this program; if not, see <https://www.gnu.org/licenses/>. */
#define _GL_USE_STDLIB_ALLOC 1
#include <config.h>
@@ -34,6 +34,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
@@ -121,7 +131,7 @@ mmalloca (size_t n)
}
#if HAVE_ALLOCA
-void
+void NO_SANITIZE_MEMORY
freea (void *p)
{
/* mmalloca() may have returned NULL. */