This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]