From e7c10a1b27be94a09bb03bf31b4b66233e3d1bdc Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sun, 9 Jul 2023 19:14:44 +0200 Subject: Add some malloc annotations --- include/fortify-headers.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include/fortify-headers.h') diff --git a/include/fortify-headers.h b/include/fortify-headers.h index 24af881..42a283f 100644 --- a/include/fortify-headers.h +++ b/include/fortify-headers.h @@ -66,6 +66,12 @@ #define __format(...) #endif +#if defined __has_attribute && __has_attribute (malloc) +#define __malloc(...) __attribute__ ((malloc, __VA_ARGS__)) +#else +#define __malloc(...) +#endif + /* TODO(jvoisin) Figure a nice way to make use of __builtin_mul_overflow while ignoring the result. */ /* TODO(jvoisin) Make use of C23's stdckdint header: https://gustedt.gitlabpages.inria.fr/c23-library/#stdckdint */ -- cgit v1.3