headers: Don't use __gnu_inline__ with __mingw_ovr in C++ mode

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

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

Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
Martin Storsjö 2019-09-03 09:35:45 +03:00
parent 330025c54b
commit 94efbac6cd

View File

@ -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 */