Commit 1d682cca by Ulrich Drepper Committed by Ulrich Drepper

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
parent 4d32029d
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> 2000-01-30 Richard Henderson <rth@cygnus.com>
* alpha.md (return_internal): Allow after reload only. * alpha.md (return_internal): Allow after reload only.
......
...@@ -1529,7 +1529,7 @@ check_format_info (info, params) ...@@ -1529,7 +1529,7 @@ check_format_info (info, params)
/* Functions taking a va_list normally pass a non-literal format /* Functions taking a va_list normally pass a non-literal format
string. These functions typically are declared with string. These functions typically are declared with
first_arg_num == 0, so avoid warning in those cases. */ 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"); warning ("format not a string literal, argument types not checked");
return; return;
} }
...@@ -1541,7 +1541,7 @@ check_format_info (info, params) ...@@ -1541,7 +1541,7 @@ check_format_info (info, params)
/* Functions taking a va_list normally pass a non-literal format /* Functions taking a va_list normally pass a non-literal format
string. These functions typically are declared with string. These functions typically are declared with
first_arg_num == 0, so avoid warning in those cases. */ 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"); warning ("format not a string literal, argument types not checked");
return; return;
} }
......
...@@ -677,6 +677,8 @@ c_decode_option (argc, argv) ...@@ -677,6 +677,8 @@ c_decode_option (argc, argv)
warn_traditional = 1; warn_traditional = 1;
else if (!strcmp (p, "-Wno-traditional")) else if (!strcmp (p, "-Wno-traditional"))
warn_traditional = 0; warn_traditional = 0;
else if (!strncmp (p, "-Wformat=", 9))
warn_format = atol (p + 9);
else if (!strcmp (p, "-Wformat")) else if (!strcmp (p, "-Wformat"))
warn_format = 1; warn_format = 1;
else if (!strcmp (p, "-Wno-format")) else if (!strcmp (p, "-Wno-format"))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment