From 443d0c54d0465071d3f9908c67449e526ea67795 Mon Sep 17 00:00:00 2001 From: Ron Date: Sat, 27 Jun 2009 04:44:16 +0930 Subject: Add some missing printf/scanf format attributes The gcc-4.4 documentation still suggests that the compiler will automatically do format checking for the standard format function prototypes, but it is now also barking warnings suggesting that we add them for this lot too. So added. Signed-off-by: Ron Lee Signed-off-by: Mike Frysinger --- include/stdio.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'include/stdio.h') diff --git a/include/stdio.h b/include/stdio.h index dea839c5a..9336fe3cc 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -337,7 +337,8 @@ extern int printf (__const char *__restrict __format, ...); libc_hidden_proto(printf) /* Write formatted output to S. */ extern int sprintf (char *__restrict __s, - __const char *__restrict __format, ...) __THROW; + __const char *__restrict __format, ...) + __THROW __attribute__ ((__format__ (__printf__, 2, 3))); libc_hidden_proto(sprintf) /* Write formatted output to S from argument list ARG. @@ -354,7 +355,8 @@ libc_hidden_proto(vfprintf) extern int vprintf (__const char *__restrict __format, __gnuc_va_list __arg); /* Write formatted output to S from argument list ARG. */ extern int vsprintf (char *__restrict __s, __const char *__restrict __format, - __gnuc_va_list __arg) __THROW; + __gnuc_va_list __arg) + __THROW __attribute__ ((__format__ (__printf__, 2, 0))); __END_NAMESPACE_STD #if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98 @@ -410,16 +412,19 @@ __BEGIN_NAMESPACE_STD This function is a possible cancellation point and therefore not marked with __THROW. */ extern int fscanf (FILE *__restrict __stream, - __const char *__restrict __format, ...) __wur; + __const char *__restrict __format, ...) + __attribute__ ((__format__ (__scanf__, 2, 3))) __wur; libc_hidden_proto(fscanf) /* Read formatted input from stdin. This function is a possible cancellation point and therefore not marked with __THROW. */ -extern int scanf (__const char *__restrict __format, ...) __wur; +extern int scanf (__const char *__restrict __format, ...) + __attribute__ ((__format__ (__scanf__, 1, 2))) __wur; /* Read formatted input from S. */ extern int sscanf (__const char *__restrict __s, - __const char *__restrict __format, ...) __THROW; + __const char *__restrict __format, ...) + __THROW __attribute__ ((__format__ (__scanf__, 2, 3))); libc_hidden_proto(sscanf) __END_NAMESPACE_STD -- cgit v1.2.3