From c607773a80e6685ab4c922245c33cf2ea5dcfb72 Mon Sep 17 00:00:00 2001 From: q66 Date: Fri, 15 Dec 2023 22:42:34 +0100 Subject: Do not use static inline for C++ to avoid ODR violations Fixes https://github.com/jvoisin/fortify-headers/issues/31 --- include/fortify-headers.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') diff --git a/include/fortify-headers.h b/include/fortify-headers.h index bd53954..70b7952 100644 --- 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__ */ -- cgit v1.3