In C++ mode, __mingw_ovr is a plain "inline" without "static".

Clang emits a standalone copy of functions in C++ for the combination
of non-static inline and __gnu_inline__, leading to multiple definitions
of symbols.

Signed-off-by: Martin Storsjö <[email protected]>
---
 mingw-w64-headers/crt/_mingw_mac.h | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/mingw-w64-headers/crt/_mingw_mac.h 
b/mingw-w64-headers/crt/_mingw_mac.h
index adca7bd17..404d109a0 100644
--- a/mingw-w64-headers/crt/_mingw_mac.h
+++ b/mingw-w64-headers/crt/_mingw_mac.h
@@ -335,12 +335,21 @@
 #  define __mingw_bos_ptr_chk_warn(p, n) \
      (__mingw_bos_known(p) && __builtin_constant_p((n)) && __mingw_bos(p) < 
(size_t)(n) \
      ? __mingw_chk_fail_warn() : __mingw_bos_ptr_chk(p, n))
-#  define __mingw_bos_ovr __mingw_ovr \
-     __attribute__((__always_inline__, __gnu_inline__)) \
-     __mingw_attribute_artificial
-#  define __mingw_bos_extern_ovr extern __inline__ __cdecl \
-     __attribute__((__always_inline__, __gnu_inline__)) \
-     __mingw_attribute_artificial
+#  ifdef __cplusplus
+#    define __mingw_bos_ovr __mingw_ovr \
+       __attribute__((__always_inline__)) \
+       __mingw_attribute_artificial
+#    define __mingw_bos_extern_ovr extern __inline__ __cdecl \
+       __attribute__((__always_inline__)) \
+       __mingw_attribute_artificial
+#  else
+#    define __mingw_bos_ovr __mingw_ovr \
+       __attribute__((__always_inline__, __gnu_inline__)) \
+       __mingw_attribute_artificial
+#    define __mingw_bos_extern_ovr extern __inline__ __cdecl \
+       __attribute__((__always_inline__, __gnu_inline__)) \
+       __mingw_attribute_artificial
+#  endif
 #else
 #  define __mingw_bos_ovr __mingw_ovr
 #endif /* __MINGW_FORTIFY_LEVEL > 0 */
-- 
2.17.1



_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to