summaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>1999-10-28 10:53:12 +0000
committerghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>1999-10-28 10:53:12 +0000
commit75da12e2bab73442d6b85594f8f64419d640ef03 (patch)
tree9d365ca91c18b8d79fd064f558e97fee4360397f /gcc/c-common.c
parentb3fb49ae186f738a553aa6cee4f340c9a4509cfb (diff)
downloadgcc-75da12e2bab73442d6b85594f8f64419d640ef03.tar.gz
* c-common.c (check_format_info): Avoid non-literal format string
warnings when `first_arg_num' is zero. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@30240 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 3e9d962bde9..8b2f69c5ab4 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);