[PATCH] Enable gcc warnings for vsprintf/vsnprintf with "format" attribute

From: Marcelo Tosatti
Date: Sun Mar 13 2005 - 20:20:36 EST



Applied to v2.4 - v2.6 wants the same change.

Against v2.6-BK.

From: Solar Designer <solar@xxxxxxxxxxxx>

Enables gcc warnings for the case when arguments to vsprintf/vsnprintf
function don't match the format string. This helps catch programming
errors.

--- a/include/linux/kernel.h.orig 2005-03-13 14:42:52.069920616 -0300
+++ b/include/linux/kernel.h 2005-03-13 14:45:15.192162728 -0300
@@ -91,10 +91,12 @@
extern long long simple_strtoll(const char *,char **,unsigned int);
extern int sprintf(char * buf, const char * fmt, ...)
__attribute__ ((format (printf, 2, 3)));
-extern int vsprintf(char *buf, const char *, va_list);
+extern int vsprintf(char *buf, const char *, va_list)
+ __attribute__ ((format (printf, 2, 0)));
extern int snprintf(char * buf, size_t size, const char * fmt, ...)
__attribute__ ((format (printf, 3, 4)));
-extern int vsnprintf(char *buf, size_t size, const char *fmt, va_list args);
+extern int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
+ __attribute__ ((format (printf, 3, 0)));
extern int scnprintf(char * buf, size_t size, const char * fmt, ...)
__attribute__ ((format (printf, 3, 4)));
extern int vscnprintf(char *buf, size_t size, const char *fmt, va_list args);



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/