From e6d536dd3f12bc7f5c56062a008d5c17e3417fa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Fri, 20 Nov 2020 17:04:19 +0100 Subject: Add compiler hints on memory allocating utility functions --- Macros.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Macros.h') diff --git a/Macros.h b/Macros.h index 64aaefa5..31ba37b5 100644 --- a/Macros.h +++ b/Macros.h @@ -33,6 +33,9 @@ #define ATTR_NONNULL __attribute__((nonnull)) #define ATTR_NORETURN __attribute__((noreturn)) #define ATTR_UNUSED __attribute__((unused)) +#define ATTR_ALLOC_SIZE1(a) __attribute__((alloc_size (a))) +#define ATTR_ALLOC_SIZE2(a, b) __attribute__((alloc_size (a, b))) +#define ATTR_MALLOC __attribute__((malloc)) #else /* __GNUC__ */ @@ -40,6 +43,9 @@ #define ATTR_NONNULL #define ATTR_NORETURN #define ATTR_UNUSED +#define ATTR_ALLOC_SIZE1(a) +#define ATTR_ALLOC_SIZE2(a, b) +#define ATTR_MALLOC #endif /* __GNUC__ */ -- cgit v1.2.3