aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-01-31 03:31:26 +0000
committerUlrich Drepper <drepper@gcc.gnu.org>2000-01-31 03:31:26 +0000
commit1d682cca6ec62698ace4bf6808048eeb71c77f03 (patch)
treee047a2eac2af9f74e7a679067edfd0a36f939b8c /gcc
parent4d32029d61393cb78c7d4d5498666ebaef2b12f2 (diff)
downloadgcc-1d682cca6ec62698ace4bf6808048eeb71c77f03.zip
gcc-1d682cca6ec62698ace4bf6808048eeb71c77f03.tar.gz
gcc-1d682cca6ec62698ace4bf6808048eeb71c77f03.tar.bz2
c-decl.c (c_decode_option): Accept optional numeric argument to -Wformat and set warn_format.
* c-decl.c (c_decode_option): Accept optional numeric argument to -Wformat and set warn_format. * c-common.c: Don't emit warning about non-constant printf format string unless warn_format > 1. From-SVN: r31706
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/c-common.c4
-rw-r--r--gcc/c-decl.c2
3 files changed, 11 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 81b8f62..62fd1f6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2000-01-28 Ulrich Drepper <drepper@redhat.com>
+
+ * c-decl.c (c_decode_option): Accept optional numeric argument to
+ -Wformat and set warn_format.
+ * c-common.c: Don't emit warning about non-constant printf format
+ string unless warn_format > 1.
+
2000-01-30 Richard Henderson <rth@cygnus.com>
* alpha.md (return_internal): Allow after reload only.
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 1cfb765..c5899e2 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -1529,7 +1529,7 @@ check_format_info (info, params)
/* 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)
+ if (info->first_arg_num != 0 && warn_format > 1)
warning ("format not a string literal, argument types not checked");
return;
}
@@ -1541,7 +1541,7 @@ check_format_info (info, params)
/* 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)
+ if (info->first_arg_num != 0 && warn_format > 1)
warning ("format not a string literal, argument types not checked");
return;
}
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 864ea8b..ed15761 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -677,6 +677,8 @@ c_decode_option (argc, argv)
warn_traditional = 1;
else if (!strcmp (p, "-Wno-traditional"))
warn_traditional = 0;
+ else if (!strncmp (p, "-Wformat=", 9))
+ warn_format = atol (p + 9);
else if (!strcmp (p, "-Wformat"))
warn_format = 1;
else if (!strcmp (p, "-Wno-format"))