git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 6/6] compat/nedmalloc: Fix compiler warnings on linux

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Apr 29, 2013, 05:06 UTC
Message-ID
<20130429050616.GB8031@elie.Belkin>
In-Reply-To
<517C1CF9.2080903@ramsay1.demon.co.uk>
Hi,
Ramsay Jones wrote:
Show 9 quoted lines
> --- 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

If we want to do this, I'd suggest defining _GNU_SOURCE unconditionally. Other platforms using glibc would benefit from it, too, and other platforms not using glibc shouldn't care.

Alternatively it could make sense to see if the latest version from Niall Douglas[1] works, which includes the following:

	#ifndef HAVE_MREMAP
	#ifdef linux
	#define HAVE_MREMAP 1
	#ifndef _GNU_SOURCE
	#define _GNU_SOURCE /* Turns on mremap() definition */
	#endif
	#else   /* linux */
	#define HAVE_MREMAP 0
	#endif  /* linux */
	#endif  /* HAVE_MREMAP */

It looks equally wrong there, but since it comes from upstream we could just punt to him if anyone runs into problems. ;-)

My two cents, Jonathan

[1] http://www.nedprod.com/programs/portable/nedmalloc/
Previous: Ramsay JonesNext: Ramsay Jones
Message 4 of 5 in “compat/nedmalloc: Fix compiler warnings on linux”
  1. 6/6 compat/nedmalloc: Fix compiler warnings on linuxRamsay Jones, Apr 27, 2013
  2. Junio C HamanoApr 28, 2013
  3. Ramsay JonesApr 29, 2013
  4. Jonathan NiederApr 29, 2013
  5. Ramsay JonesApr 29, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.