@matheusbsbs / matheus-bagliano / commits / a21077e75f
Fork 0

Fix warnings in nedmalloc when compiling with GCC 4.4.0

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>

Johannes Schindelin committed Jun 8, 2009 at 16:46 UTC a21077e75f55b4696ada33d7d09f016f4ef16167
2 files changed +4 -2
compat/nedmalloc/malloc.c.h
+3 -1
@@ -1270,7 +1270,9 @@ int mspace_mallopt(int, int);
1270 /*------------------------------ internal #includes ---------------------- */
1271
1272 #ifdef WIN32
1273 +#ifndef __GNUC__
1274 #pragma warning( disable : 4146 ) /* no "unsigned" warnings */
1275 +#endif
1276 #endif /* WIN32 */
1277
1278 #include <stdio.h> /* for printing in malloc_stats */
@@ -2541,7 +2543,7 @@ struct malloc_params {
2543 static struct malloc_params mparams;
2544
2545 /* Ensure mparams initialized */
2544 -#define ensure_initialization() (mparams.magic != 0 || init_mparams())
2546 +#define ensure_initialization() ((void)(mparams.magic == 0 || init_mparams()))
2547
2548 #if !ONLY_MSPACES
2549
compat/nedmalloc/nedmalloc.c
+1 -1
@@ -34,7 +34,7 @@ DEALINGS IN THE SOFTWARE.
34 /*#define FULLSANITYCHECKS*/
35
36 #include "nedmalloc.h"
37 -#if defined(WIN32) && !defined(__MINGW32__)
37 +#if defined(WIN32)
38 #include <malloc.h>
39 #endif
40 #define MSPACES 1