From eec7fd8bc54eacf96d0988741a0d988f374c4db9 Mon Sep 17 00:00:00 2001 From: Ramsay Jones Date: Sat, 27 Apr 2013 19:46:17 +0100 Subject: [PATCH] compat/nedmalloc: Fix compiler warnings on linux On linux, when the build variable USE_NED_ALLOCATOR is set, gcc issues the following warnings: In file included from compat/nedmalloc/nedmalloc.c:63: .../malloc.c.h: In function 'mmap_resize': .../malloc.c.h:3762: warning: implicit declaration of function 'mremap' .../malloc.c.h: In function 'sys_trim': .../malloc.c.h:4195: warning: comparison between pointer and integer The warnings are caused by the header not enabling the (conditional) declaration of the mremap() function. The declaration can be enabled by defining the _GNU_SOURCE symbol prior to including certain system header files. In particular, it may not be sufficient to simply define _GNU_SOURCE just prior to including the header. (e.g. defining the symbol after including will be completely ineffective.) In order to suppress the warnings, we define the _GNU_SOURCE symbol at the start of the malloc.c.h header file. Signed-off-by: Ramsay Jones Signed-off-by: Junio C Hamano --- compat/nedmalloc/malloc.c.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/compat/nedmalloc/malloc.c.h b/compat/nedmalloc/malloc.c.h index fdcca82ba7..5a44dead9d 100644 --- a/compat/nedmalloc/malloc.c.h +++ b/compat/nedmalloc/malloc.c.h @@ -484,6 +484,10 @@ MAX_RELEASE_CHECK_RATE default: 4095 unless not HAVE_MMAP #define DLMALLOC_VERSION 20804 #endif /* DLMALLOC_VERSION */ +#if defined(linux) +#define _GNU_SOURCE 1 +#endif + #ifndef WIN32 #ifdef _WIN32 #define WIN32 1 -- 2.11.4.GIT