commit c607773a80e6685ab4c922245c33cf2ea5dcfb72
parent 3e00ac383b23479e0df24c531e3128d7076c4755
Author: q66 <q66@chimera-linux.org>
Date: Fri, 15 Dec 2023 22:42:34 +0100
Do not use static inline for C++ to avoid ODR violations
Fixes https://github.com/jvoisin/fortify-headers/issues/31
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/include/fortify-headers.h b/include/fortify-headers.h
@@ -39,8 +39,13 @@
/* clang uses overloads; see https://github.com/llvm/llvm-project/issues/53516 */
/* we can't use extern inline with overloads without making them external */
+#ifdef __cplusplus
+#define _FORTIFY_INLINE __inline__ \
+ __attribute__((__always_inline__,__artificial__,__overloadable__))
+#else
#define _FORTIFY_INLINE static __inline__ \
__attribute__((__always_inline__,__artificial__,__overloadable__))
+#endif
#else /* !__clang__ */