From a89ddb4cf1ce1694b74feb98d62d5600e02904af 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 b116290..e406dce 100644 --- a/include/fortify-headers.h +++ b/include/fortify-headers.h @@ -27,8 +27,13 @@ #endif /* 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