Skip to content

Commit

Permalink
Fix warnings in nedmalloc when compiling with GCC 4.4.0
Browse files Browse the repository at this point in the history
Nedmalloc's source code has a cute #define construct to avoid inserting
an if() statement, because that might interact badly with enclosing if()
statements.  However, GCC > 4 complains with a "warning: value computed
is not used".  So we cast the result to "void".

GCC also does not understand the Visual C++ specific pragmas, so we need
to disable them for MinGW.

We need to include malloc.h on Windows even if we happen to compile the
stuff as a MinGW program.  Otherwise the function declaration of alloca()
is missing.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Johannes Schindelin authored and Junio C Hamano committed Jun 8, 2009
1 parent f0ed822 commit a21077e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion compat/nedmalloc/malloc.c.h
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,9 @@ int mspace_mallopt(int, int);
/*------------------------------ internal #includes ---------------------- */

#ifdef WIN32
#ifndef __GNUC__
#pragma warning( disable : 4146 ) /* no "unsigned" warnings */
#endif
#endif /* WIN32 */

#include <stdio.h> /* for printing in malloc_stats */
Expand Down Expand Up @@ -2541,7 +2543,7 @@ struct malloc_params {
static struct malloc_params mparams;

/* Ensure mparams initialized */
#define ensure_initialization() (mparams.magic != 0 || init_mparams())
#define ensure_initialization() ((void)(mparams.magic == 0 || init_mparams()))

#if !ONLY_MSPACES

Expand Down
2 changes: 1 addition & 1 deletion compat/nedmalloc/nedmalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ DEALINGS IN THE SOFTWARE.
/*#define FULLSANITYCHECKS*/

#include "nedmalloc.h"
#if defined(WIN32) && !defined(__MINGW32__)
#if defined(WIN32)
#include <malloc.h>
#endif
#define MSPACES 1
Expand Down

0 comments on commit a21077e

Please sign in to comment.