summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon <ron@debian.org>2009-06-27 04:44:16 +0930
committerMike Frysinger <vapier@gentoo.org>2009-07-05 20:27:16 -0400
commit443d0c54d0465071d3f9908c67449e526ea67795 (patch)
tree8d0546a9b9c0b42222b6d2015b1629799a79fd07
parent651d0688d20de555564b393ea7fee79ea1a1611d (diff)
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 <ron@debian.org> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r--include/stdio.h15
1 files changed, 10 insertions, 5 deletions
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