diff options
author | Kaveh R. Ghazi <ghazi@caip.rutgers.edu> | 1999-10-28 10:53:12 +0000 |
---|---|---|
committer | Kaveh Ghazi <ghazi@gcc.gnu.org> | 1999-10-28 10:53:12 +0000 |
commit | 301452153700ff8c81d28e58a9e10117655b6a00 (patch) | |
tree | 9d365ca91c18b8d79fd064f558e97fee4360397f | |
parent | 4404ce281deeb8bff4464e6987fc649510c8c639 (diff) | |
download | gcc-301452153700ff8c81d28e58a9e10117655b6a00.zip gcc-301452153700ff8c81d28e58a9e10117655b6a00.tar.gz gcc-301452153700ff8c81d28e58a9e10117655b6a00.tar.bz2 |
c-common.c (check_format_info): Avoid non-literal format string warnings when `first_arg_num' is zero.
* c-common.c (check_format_info): Avoid non-literal format string
warnings when `first_arg_num' is zero.
From-SVN: r30240
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/c-common.c | 12 |
2 files changed, 15 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c48bcfd..66642cd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +Thu Oct 28 06:47:32 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * c-common.c (check_format_info): Avoid non-literal format string + warnings when `first_arg_num' is zero. + Thu Oct 28 12:28:48 1999 Bernd Schmidt <bernds@cygnus.co.uk> * rtl.texi: Delete explicit Prev, Up and Next entries in "@node"s. diff --git a/gcc/c-common.c b/gcc/c-common.c index 3e9d962..8b2f69c 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -1491,7 +1491,11 @@ check_format_info (info, params) { /* The user may get multiple warnings if the supplied argument isn't even a string pointer. */ - warning ("format not a string literal, argument types not checked"); + /* Functions taking a va_list normally pass a non-literal format + string. These functions typically are declared with + first_arg_num == 0, so avoid warning in those cases. */ + if (info->first_arg_num != 0) + warning ("format not a string literal, argument types not checked"); return; } format_tree = TREE_OPERAND (format_tree, 0); @@ -1499,7 +1503,11 @@ check_format_info (info, params) { /* The user may get multiple warnings if the supplied argument isn't even a string pointer. */ - warning ("format not a string literal, argument types not checked"); + /* Functions taking a va_list normally pass a non-literal format + string. These functions typically are declared with + first_arg_num == 0, so avoid warning in those cases. */ + if (info->first_arg_num != 0) + warning ("format not a string literal, argument types not checked"); return; } format_chars = TREE_STRING_POINTER (format_tree); |