From 026968f63ae50840ca8e3e6968ab65324eaac6ea Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Mon, 13 Feb 2017 16:59:38 -0800 Subject: [PATCH] compel std_printf: annotate with printf This function works like printf, and it helps the compiler to know that, so it can check whether arguments fit the format string. Signed-off-by: Kir Kolyshkin Signed-off-by: Andrei Vagin --- compel/plugins/include/uapi/std/string.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compel/plugins/include/uapi/std/string.h b/compel/plugins/include/uapi/std/string.h index ddc1ea3cf..5129017d2 100644 --- a/compel/plugins/include/uapi/std/string.h +++ b/compel/plugins/include/uapi/std/string.h @@ -14,7 +14,9 @@ extern void __std_putc(int fd, char c); extern void __std_puts(int fd, const char *s); extern void __std_printk(int fd, const char *format, va_list args); -extern void __std_printf(int fd, const char *format, ...); +extern void __std_printf(int fd, const char *format, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + #define std_printf(fmt, ...) __std_printf(STDOUT_FILENO, fmt, ##__VA_ARGS__) #define std_puts(s) __std_puts(STDOUT_FILENO, s)