[CRIU] [PATCH 4/4] compel std_printf: annotate with printf

Dmitry Safonov 0x7f454c46 at gmail.com
Mon Feb 13 01:12:26 PST 2017


2017-02-12 14:34 GMT+03:00 Kir Kolyshkin <kir at openvz.org>:
> 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 <kir at openvz.org>
> ---
>  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 ddc1ea3..5129017 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);

BTW, as we're already here: printk() version looks misnamed: it's vprintf().
Care to fix that too?

> -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)
> --
> 2.9.3


-- 
             Dmitry


More information about the CRIU mailing list