From e2b38d570b449e3c66a571b39a5c736e6ac6b94f Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Sun, 5 Nov 2023 00:58:10 +0100 Subject: [PATCH] Do not use __attribute__((malloc(free))) with Clang This extension is not implemented by Clang. --- utils.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/utils.h b/utils.h index 7cb0947..68c486c 100644 --- a/utils.h +++ b/utils.h @@ -17,13 +17,16 @@ /* Portability macros */ #ifdef __GNUC__ # define NORETURN __attribute__((noreturn)) -# define MALLOC_FREE __attribute__((malloc(free))) # define NONNULL __attribute__((returns_nonnull)) #else # define NORETURN -# define MALLOC_FREE # define NONNULL #endif +#if defined __GNUC__ && !defined __clang__ +# define MALLOC_FREE __attribute__((malloc(free))) +#else +# define MALLOC_FREE +#endif #ifndef AI_IDN # define AI_IDN 0