From e9b6cb7e2eb7029902ae92ef43fb905e5072785b Mon Sep 17 00:00:00 2001 From: jvoisin Date: Fri, 14 Nov 2025 15:06:23 +0100 Subject: Add `format` annotations --- include/fortify-headers.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'include/fortify-headers.h') diff --git a/include/fortify-headers.h b/include/fortify-headers.h index a9b7498..67c4792 100644 --- a/include/fortify-headers.h +++ b/include/fortify-headers.h @@ -59,15 +59,20 @@ #define __bos(ptr, type) __builtin_object_size (ptr, type) #endif -/* This needs to be two different conditions: https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005fattribute.html */ #if defined __has_attribute + #if __has_attribute (access) #define __access(...) __attribute__ ((access (__VA_ARGS__))) #else #define __access(...) #endif + +#if __has_attribute (format) +#define __format(...) __attribute__ ((format (__VA_ARGS__))) #else -#define __access(...) +#define __format(...) +#endif + #endif #endif -- cgit v1.3