From e8b8e4f51481121a5ce042812e7e62e7b27e6116 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Mon, 21 Aug 2023 17:22:28 +0200 Subject: Make use of __diagnose_if --- include/fortify-headers.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include/fortify-headers.h') diff --git a/include/fortify-headers.h b/include/fortify-headers.h index 88a0875..3e2140f 100644 --- a/include/fortify-headers.h +++ b/include/fortify-headers.h @@ -99,6 +99,14 @@ #define __diagnose_as_builtin(...) #endif +#if __has_attribute (__diagnose_if) +#define __warning_if(cond, msg) __attribute__ ((__diagnose_if (cond, msg, "warning"))) +#define __error_if(cond, msg) __attribute__ ((__diagnose_if (cond, msg, "error"))) +#else +#define __warning_if(cond, msg) +#define __error_if(cond, msg) +#endif + #endif /* __has_attribute */ /* -- cgit v1.3