Johannes Schindelin [off-list ref] writes:
quoted
As to the second one, I think you lost "even if we happen to" part (that
logically corresponds to "... that is why we do not want to limit the
inclusion to !__MINGW32__ case") from the description, making it less
readable...
You mean "even if we happen to be on Windows"?
I meant this part from your earlier message.
It helps in that malloc.h is included even if we happen to compile the
stuff as a MinGW program. Otherwise necessary function declarations are
missing.
compared with the newer "how about" version, which is
quoted
quoted
Also, with the version of MinGW's headers in msysGit, we need to include
malloc.h lest the compiler complain about an "incompatible implicit
declaration of built-in function 'alloca'".
I thought the former explains the change in question
quoted
quoted
-#if defined(WIN32) && !defined(__MINGW32__)
+#if defined(WIN32)
much more clearly: "If you are compiling for Windows, regardless of
MINGW32, you would want this section to apply".
... Want me to resend a fixed patch?
Surely. I think I could come up with something based on the discussion
here, but I'd rather not. A patch signed off by either you or Steffen, or
both is very much appreciated.
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 <redacted>
---
Forgot to send.
compat/nedmalloc/malloc.c.h | 4 +++-
compat/nedmalloc/nedmalloc.c | 2 +-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/compat/nedmalloc/malloc.c.h b/compat/nedmalloc/malloc.c.h
index bb0f482..b5b1495 100644
--- a/compat/nedmalloc/malloc.c.h
+++ b/compat/nedmalloc/malloc.c.h
@@ -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 */
@@ -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
diff --git a/compat/nedmalloc/nedmalloc.c b/compat/nedmalloc/nedmalloc.c
index 41a3234..d9a17a8 100644
--- a/compat/nedmalloc/nedmalloc.c
+++ b/compat/nedmalloc/nedmalloc.c
@@ -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
--
1.6.3.284.g6fecc