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

[PATCH 10/11 v2] Fix warnings in nedmalloc when compiling with GCC 4.4.0

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jun 8, 2009, 14:46 UTC
Message-ID
<alpine.DEB.1.00.0906081645490.4461@intel-tinevez-2-302>
In-Reply-To
<7vprdl9qon.fsf@alter.siamese.dyndns.org>

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>
---
	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
Previous: Junio C HamanoNext: Junio C Hamano
Message 30 of 37 in “Various msysgit patches”
  1. 00/11 Various msysgit patchesSteffen Prohaska, May 31, 2009
  2. 01/11 MinGW: GCC >= 4 does not need SNPRINTF_SIZE_CORR anymoreSteffen Prohaska, May 31, 2009
  3. 02/11 Quiet make: do not leave Windows behindSteffen Prohaska, May 31, 2009
  4. 03/11 Work around a regression in Windows 7, causing erase_in_line() to crash sometimesSteffen Prohaska, May 31, 2009
  5. 04/11 test-chmtime: work around Windows limitationSteffen Prohaska, May 31, 2009
  6. 05/11 winansi: fix compile warningsSteffen Prohaska, May 31, 2009
  7. 06/11 git: browsing paths with spaces when using the start commandSteffen Prohaska, May 31, 2009
  8. 07/11 connect.c: Support PuTTY plink and TortoisePlink as SSH on WindowsSteffen Prohaska, May 31, 2009
  9. 08/11 MinGW readdir reimplementation to support d_typeSteffen Prohaska, May 31, 2009
  10. Johannes SixtMay 31, 2009
  11. Johannes SixtMay 31, 2009
  12. 05/11 MinGW: fix warning about implicit declaration of _getch()Steffen Prohaska, Jun 1, 2009
  13. 03/11 Work around a regression in Windows 7, causing erase_in_line() to crash sometimesSteffen Prohaska, Jun 1, 2009
  14. Johannes SchindelinJun 1, 2009
  15. Steffen ProhaskaJun 1, 2009
  16. Johannes SchindelinJun 1, 2009
  17. Junio C HamanoJun 1, 2009
  18. Johannes SchindelinJun 1, 2009
  19. Johannes SixtMay 31, 2009
  20. 10/11 Fix warnings in nedmalloc when compiling with GCC 4.4.0Steffen Prohaska, May 31, 2009
  21. 11/11 MinGW: Teach Makefile to detect msysgit and apply specific settingsSteffen Prohaska, May 31, 2009
  22. Junio C HamanoJun 1, 2009
  23. Johannes SchindelinJun 1, 2009
  24. Junio C HamanoJun 1, 2009
  25. GeunSik LimJun 1, 2009
  26. Johannes SchindelinJun 2, 2009
  27. Junio C HamanoJun 2, 2009
  28. Johannes SchindelinJun 3, 2009
  29. Junio C HamanoJun 3, 2009
  30. 10/11 Fix warnings in nedmalloc when compiling with GCC 4.4.0Johannes Schindelin, Jun 8, 2009
  31. Junio C HamanoJun 8, 2009
  32. Johannes SixtJun 8, 2009
  33. Steffen ProhaskaJun 9, 2009
  34. Johannes SixtJun 10, 2009
  35. Fix typo in nedmalloc warning fixJohannes Sixt, Jun 11, 2009
  36. compat/ has subdirectories: do not omit them in 'make clean'Johannes Sixt, Jun 11, 2009
  37. Johannes SchindelinJun 11, 2009

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.