From 4e5b57095bee4cd50e2095ad7043f5a885c2c180 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 | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include/fortify-headers.h') diff --git a/include/fortify-headers.h b/include/fortify-headers.h index a9b7498..deff351 100644 --- a/include/fortify-headers.h +++ b/include/fortify-headers.h @@ -70,4 +70,15 @@ #define __access(...) #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 (format) +#define __format(...) __attribute__ ((format (__VA_ARGS__))) +#else +#define __format(...) +#endif +#else +#define __format(...) +#endif + #endif -- cgit v1.3