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

[PATCH v2 3/5] nedmalloc: allow compiling with MSys2's compiler

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jan 14, 2016, 16:51 UTC
Message-ID
<0436c74f0fcd46d9a77a3012d146d741ca2c7a0a.1452790142.git.johannes.schindelin@gmx.de>
In-Reply-To
<cover.1452790142.git.johannes.schindelin@gmx.de>

With MSys2's GCC, `ReadWriteBarrier` is already defined, and FORCEINLINE unfortunately gets defined incorrectly.

Let's work around both problems, using the MSys2-specific __MINGW64_VERSION_MAJOR constant to guard the FORCEINLINE definition so as not to affect other platforms.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 compat/nedmalloc/malloc.c.h | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/compat/nedmalloc/malloc.c.h b/compat/nedmalloc/malloc.c.h
index f216a2a..bf70037 100644
--- a/compat/nedmalloc/malloc.c.h
+++ b/compat/nedmalloc/malloc.c.h
@@ -720,6 +720,9 @@ struct mallinfo {
   inlining are defined as macros, so these aren't used for them.
 */
 
+#ifdef __MINGW64_VERSION_MAJOR
+#undef FORCEINLINE
+#endif
 #ifndef FORCEINLINE
   #if defined(__GNUC__)
 #define FORCEINLINE __inline __attribute__ ((always_inline))
@@ -1382,6 +1385,7 @@ LONG __cdecl _InterlockedExchange(LONG volatile *Target, LONG Value);
 
   /*** Atomic operations ***/
   #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100
+    #undef _ReadWriteBarrier
     #define _ReadWriteBarrier() __sync_synchronize()
   #else
     static __inline__ __attribute__((always_inline)) long __sync_lock_test_and_set(volatile long * const Target, const long Value)
-- 
2.7.0.windows.1.7.g55a05c8
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 19 of 23 in “Fix compile errors with MSys2”
  1. 0/5 Fix compile errors with MSys2Johannes Schindelin, Jan 13, 2016
  2. 1/5 config.mak.uname: support MSys2Johannes Schindelin, Jan 13, 2016
  3. Jeff KingJan 13, 2016
  4. Johannes SchindelinJan 13, 2016
  5. Dennis KaarsemakerJan 13, 2016
  6. 2/5 config.mak.uname: supporting 64-bit MSys2Johannes Schindelin, Jan 13, 2016
  7. SZEDER GáborJan 21, 2016
  8. Johannes SchindelinJan 21, 2016
  9. 3/5 nedmalloc: allow compiling with MSys2's compilerJohannes Schindelin, Jan 13, 2016
  10. Junio C HamanoJan 13, 2016
  11. 4/5 compat/mingw: support MSys2-based MinGW buildJohannes Schindelin, Jan 13, 2016
  12. 5/5 compat/winansi: support compiling with MSys2Johannes Schindelin, Jan 13, 2016
  13. Junio C HamanoJan 13, 2016
  14. Johannes SchindelinJan 14, 2016
  15. 0/5 Fix compile errors with MSys2Johannes Schindelin, Jan 14, 2016
  16. 1/5 config.mak.uname: support MSys2Johannes Schindelin, Jan 14, 2016
  17. Johannes SixtJan 14, 2016
  18. 2/5 config.mak.uname: supporting 64-bit MSys2Johannes Schindelin, Jan 14, 2016
  19. 3/5 nedmalloc: allow compiling with MSys2's compilerJohannes Schindelin, Jan 14, 2016
  20. 4/5 compat/mingw: support MSys2-based MinGW buildJohannes Schindelin, Jan 14, 2016
  21. 5/5 compat/winansi: support compiling with MSys2Johannes Schindelin, Jan 14, 2016
  22. Junio C HamanoJan 14, 2016
  23. Johannes SixtJan 14, 2016

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.