From 32e50c2faa3e48acb2eae29c23feb5511df2f9ab Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Wed, 24 Apr 2024 13:17:18 -0400 Subject: printf: Check dynamic format strings more carefully --- src/prelude.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/prelude.h') diff --git a/src/prelude.h b/src/prelude.h index 7a646a7..ddeacbd 100644 --- a/src/prelude.h +++ b/src/prelude.h @@ -243,6 +243,15 @@ typedef union { # define attr_printf(fmt, args) #endif +/** + * Annotates functions that potentially modify and return format strings. + */ +#if __has_attribute(format_arg) +# define attr_format_arg(arg) __attribute__((format_arg(arg))) +#else +# define attr_format_arg(args) +#endif + /** * Annotates allocator-like functions. */ -- cgit v1.2.3