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
Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Date
Apr 29, 2013, 23:01 UTC
Message-ID
<517EFBB5.9040502@ramsay1.demon.co.uk>
In-Reply-To
<7v7gjmqwxn.fsf@alter.siamese.dyndns.org>
Junio C Hamano wrote:
Show 27 quoted lines
> Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:
> 
>> 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 <sys/mman.h> 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 <sys/mman.h>
>> header. (e.g. defining the symbol after including <sys/types.h> 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 <ramsay@ramsay1.demon.co.uk>
>> ---
> 
> Hmmmm, is this even worth worrying about?  I somehow thought this
> was only meant to replace malloc on non GNU systems...

Maybe not. I certainly won't be using it on Linux. But I wanted to test the previous patch on Linux and it didn't compile cleanly, so ... (It passed all tests BTW).

ATB, Ramsay Jones

Previous: Junio C HamanoNext: Jonathan Nieder
Message 3 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.