[CRIU] [PATCH 3/4] compel_print_on_level(): annotate with printf

Kir Kolyshkin kir at openvz.org
Sun Feb 12 03:34:20 PST 2017


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/include/log.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/compel/include/log.h b/compel/include/log.h
index 1f0442b..559f909 100644
--- a/compel/include/log.h
+++ b/compel/include/log.h
@@ -15,7 +15,8 @@ static inline int pr_quelled(unsigned int loglevel)
 }
 
 extern void compel_print_on_level(unsigned int loglevel,
-		const char *format, ...);
+		const char *format, ...)
+		__attribute__ ((__format__ (__printf__, 2, 3)));
 
 #define pr_msg(fmt, ...)						\
 	compel_print_on_level(COMPEL_LOG_MSG,				\
-- 
2.9.3



More information about the CRIU mailing list