This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] C++ FE warning control cleanup
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: lee dot millward at gmail dot com (Lee Millward)
- Cc: gcc-patches at gcc dot gnu dot org, gdr at cs dot tamu dot edu
- Date: Tue, 31 Jan 2006 15:08:06 -0500 (EST)
- Subject: Re: [patch] C++ FE warning control cleanup
> Index: typeck.c
> ===================================================================
> --- typeck.c (revision 110412)
> +++ typeck.c (working copy)
> @@ -1500,7 +1500,7 @@ string_conv_p (tree totype, tree exp, in
>
> /* This warning is not very useful, as it complains about printf. */
> if (warn && warn_write_strings)
> - warning (0, "deprecated conversion from string constant to %qT'", totype);
> + warning (OPT_Wwrite_strings, "deprecated conversion from string constant to %qT'", totype);
You can remove warn_write_strings from the if statement now.
> @@ -4440,7 +4440,7 @@ cxx_mark_addressable (tree exp)
> }
> else if (extra_warnings)
> warning
> - (0, "address requested for %qD, which is declared %<register%>", x);
> + (OPT_Wextra, "address requested for %qD, which is declared %<register%>", x);
Likewise.
> ===================================================================
> --- class.c (revision 110412)
> +++ class.c (working copy)
> @@ -2937,7 +2937,7 @@ check_field_decls (tree t, tree *access_
>
> if (! TYPE_HAS_CONSTRUCTOR (t) && CLASSTYPE_NON_AGGREGATE (t)
> && extra_warnings)
> - warning (0, "non-static reference %q+#D in class without a constructor", x);
> + warning (OPT_Wextra, "non-static reference %q+#D in class without a constructor", x);
> }
Likewise.
>
> type = strip_array_types (type);
> @@ -2984,7 +2984,7 @@ check_field_decls (tree t, tree *access_
>
> if (! TYPE_HAS_CONSTRUCTOR (t) && CLASSTYPE_NON_AGGREGATE (t)
> && extra_warnings)
> - warning (0, "non-static const member %q+#D in class without a constructor", x);
> + warning (OPT_Wextra, "non-static const member %q+#D in class without a constructor", x);
Likewise.
> if (! TREE_PUBLIC (newdecl))
> {
> if (warn_shadow)
> - warning (0, "shadowing %s function %q#D",
> + warning (OPT_Wshadow, "shadowing %s function %q#D",
Likewise.
> else if (warn_shadow)
> - warning (0, "shadowing %s function %q#D",
> + warning (OPT_Wshadow, "shadowing %s function %q#D",
Likewise.
The general rule if the warn_* variable is last (or is the only one
in the conditional) it can be removed.
Thanks,
Andrew Pinski