* configure.ac: Use AC_CHECK_FUNCS_ONCE for __lsan_ignore_object.
* src/buffer.c, src/data.c, src/emacs-module.c, src/regex-emacs.c:
* src/search.c: Use __lsan_ignore_object unconditionally, and don’t
include sanitizer/lsan_interface.h.
* src/lisp.h (__lsan_ignore_object): Provide a dummy in the
typical case where leak sanitization is not available.
AC_CHECK_MEMBERS([struct unipair.unicode], [], [], [[#include <linux/kd.h>]])
-AC_CHECK_FUNCS_ONCE([sbrk])
+AC_CHECK_FUNCS_ONCE([__lsan_ignore_object sbrk])
AC_FUNC_FORK
-AC_CHECK_FUNCS(snprintf __lsan_ignore_object)
+dnl AC_CHECK_FUNCS_ONCE wouldn’t be right for snprintf, which needs
+dnl the current CFLAGS etc.
+AC_CHECK_FUNCS(snprintf)
dnl Check for glib. This differs from other library checks in that
dnl Emacs need not link to glib unless some other library is already
#include <stdlib.h>
#include <unistd.h>
-#ifdef HAVE_SANITIZER_LSAN_INTERFACE_H
-#include <sanitizer/lsan_interface.h>
-#endif
-
#include <verify.h>
#include "lisp.h"
#else
p = xrealloc (b->text->beg, new_nbytes);
#endif
-#ifdef HAVE___LSAN_IGNORE_OBJECT
__lsan_ignore_object (p);
-#endif
if (p == NULL)
{
#include <math.h>
#include <stdio.h>
-#ifdef HAVE_SANITIZER_LSAN_INTERFACE_H
-#include <sanitizer/lsan_interface.h>
-#endif
-
#include <byteswap.h>
#include <count-one-bits.h>
#include <count-trailing-zeros.h>
set_blv_defcell (blv, tem);
set_blv_valcell (blv, tem);
set_blv_found (blv, false);
-#ifdef HAVE___LSAN_IGNORE_OBJECT
__lsan_ignore_object (blv);
-#endif
return blv;
}
#include <stdlib.h>
#include <time.h>
-#ifdef HAVE_SANITIZER_LSAN_INTERFACE_H
-#include <sanitizer/lsan_interface.h>
-#endif
-
#include "lisp.h"
#include "bignum.h"
#include "dynlib.h"
if (module_assertions)
{
rt = xmalloc (sizeof *rt);
-#ifdef HAVE___LSAN_IGNORE_OBJECT
__lsan_ignore_object (rt);
-#endif
}
else
rt = &rt_pub;
if (module_assertions)
{
env = xmalloc (sizeof *env);
-#ifdef HAVE___LSAN_IGNORE_OBJECT
__lsan_ignore_object (env);
-#endif
}
priv->pending_non_local_exit = emacs_funcall_exit_return;
return dest + len;
}
+#if (defined HAVE___LSAN_IGNORE_OBJECT \
+ && defined HAVE_SANITIZER_LSAN_INTERFACE_H)
+# include <sanitizer/lsan_interface.h>
+#else
+/* Treat *P as a non-leak. */
+INLINE void
+__lsan_ignore_object (void const *p)
+{
+}
+#endif
+
extern void xputenv (const char *);
extern char *egetenv_internal (const char *, ptrdiff_t);
#include <stdlib.h>
-#ifdef HAVE_SANITIZER_LSAN_INTERFACE_H
-#include <sanitizer/lsan_interface.h>
-#endif
-
#include "character.h"
#include "buffer.h"
#include "syntax.h"
/* Initialize the compile stack. */
compile_stack.stack = xmalloc (INIT_COMPILE_STACK_SIZE
* sizeof *compile_stack.stack);
-#ifdef HAVE___LSAN_IGNORE_OBJECT
__lsan_ignore_object (compile_stack.stack);
-#endif
compile_stack.size = INIT_COMPILE_STACK_SIZE;
compile_stack.avail = 0;
#include <config.h>
-#ifdef HAVE_SANITIZER_LSAN_INTERFACE_H
-#include <sanitizer/lsan_interface.h>
-#endif
-
#include "lisp.h"
#include "character.h"
#include "buffer.h"
if (base_buf->newline_cache == 0)
{
base_buf->newline_cache = new_region_cache ();
-#ifdef HAVE___LSAN_IGNORE_OBJECT
__lsan_ignore_object (base_buf->newline_cache);
-#endif
}
}
return base_buf->newline_cache;