>From 8834194fddbeb093f6ffda952a13316c7a6faaa3 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 30 Jan 2016 00:47:26 -0800 Subject: [PATCH 11/12] Fix extern symbols defined and not used * src/alloc.c: Always include . (malloc_warning) [!SIGDANGER && (SYSTEM_MALLOC || HYBRID_MALLOC)]: Do not define; unused. * src/emacs.c, src/lisp.h (might_dump) [!DOUG_LEA_MALLOC]: Now static. * src/gmalloc.c (gdefault_morecore): Rename from __default_morecore, to avoid collision with glibc. Now static. All uses changed. * src/lastfile.c (my_edata): Define only if ((!defined SYSTEM_MALLOC && !defined HYBRID_MALLOC && !defined WINDOWSNT) \ || defined CYGWIN || defined DARWIN_OS). (Bug#22086) --- src/alloc.c | 8 ++++---- src/emacs.c | 3 +++ src/gmalloc.c | 7 +++---- src/lastfile.c | 3 +++ src/lisp.h | 2 ++ 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/alloc.c b/src/alloc.c index b1d3f2e..57ef4c5 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -22,10 +22,7 @@ along with GNU Emacs. If not, see . */ #include #include /* For CHAR_BIT. */ - -#ifdef ENABLE_CHECKING -#include /* For SIGABRT. */ -#endif +#include /* For SIGABRT, SIGDANGER. */ #ifdef HAVE_PTHREAD #include @@ -565,6 +562,8 @@ static struct Lisp_Finalizer doomed_finalizers; Malloc ************************************************************************/ +#if defined SIGDANGER || (!defined SYSTEM_MALLOC && !defined HYBRID_MALLOC) + /* Function malloc calls this if it finds we are near exhausting storage. */ void @@ -573,6 +572,7 @@ malloc_warning (const char *str) pending_malloc_warning = str; } +#endif /* Display an already-pending malloc warning. */ diff --git a/src/emacs.c b/src/emacs.c index 73c857d..c65c76c 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -128,6 +128,9 @@ Lisp_Object Vlibrary_cache; bool initialized; /* Set to true if this instance of Emacs might dump. */ +#ifndef DOUG_LEA_MALLOC +static +#endif bool might_dump; #ifdef DARWIN_OS diff --git a/src/gmalloc.c b/src/gmalloc.c index ca86276..282216a 100644 --- a/src/gmalloc.c +++ b/src/gmalloc.c @@ -56,7 +56,6 @@ License along with this library. If not, see . extern void (*__MALLOC_HOOK_VOLATILE __after_morecore_hook) (void); extern void (*__MALLOC_HOOK_VOLATILE __malloc_initialize_hook) (void); extern void *(*__morecore) (ptrdiff_t); -extern void *__default_morecore (ptrdiff_t); #endif /* If HYBRID_MALLOC is defined, then temacs will use malloc, @@ -1512,8 +1511,8 @@ extern void *__sbrk (ptrdiff_t increment); /* Allocate INCREMENT more bytes of data space, and return the start of data space, or NULL on errors. If INCREMENT is negative, shrink data space. */ -void * -__default_morecore (ptrdiff_t increment) +static void * +gdefault_morecore (ptrdiff_t increment) { void *result; #ifdef HYBRID_MALLOC @@ -1528,7 +1527,7 @@ __default_morecore (ptrdiff_t increment) return result; } -void *(*__morecore) (ptrdiff_t) = __default_morecore; +void *(*__morecore) (ptrdiff_t) = gdefault_morecore; /* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc. diff --git a/src/lastfile.c b/src/lastfile.c index 2d0bcc7..9c73fb4 100644 --- a/src/lastfile.c +++ b/src/lastfile.c @@ -38,7 +38,10 @@ along with GNU Emacs. If not, see . */ #include "lisp.h" +#if ((!defined SYSTEM_MALLOC && !defined HYBRID_MALLOC && !defined WINDOWSNT) \ + || defined CYGWIN || defined DARWIN_OS) char my_edata[] = "End of Emacs initialized data"; +#endif /* Help unexec locate the end of the .bss area used by Emacs (which isn't always a separate section in NT executables). */ diff --git a/src/lisp.h b/src/lisp.h index cafcfde..ef86c4f 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -619,7 +619,9 @@ extern _Noreturn Lisp_Object wrong_type_argument (Lisp_Object, Lisp_Object); extern _Noreturn void wrong_choice (Lisp_Object, Lisp_Object); /* Defined in emacs.c. */ +#ifdef DOUG_LEA_MALLOC extern bool might_dump; +#endif /* True means Emacs has already been initialized. Used during startup to detect startup of dumped Emacs. */ extern bool initialized; -- 2.5.0