[PATCH] Separate ignored return type qualifier warning.

Ian Lance Taylor iant@google.com
Thu Jan 10 22:44:00 GMT 2008


Diego Novillo <dnovillo@google.com> writes:

> On 1/10/08 1:28 AM, Doug Kwan (關振德) wrote:
> 
> > 2008-01-09  Doug Kwan  <dougkwan@google.com>
> > 	* c-decl.c: (grokdeclarator): Use
> > OPT_Wignored_return_type_qualifiers
> > 	instead of OPT_Wreturn_type in warning due to ignored return type
> > 	qualifiers.
> > 	* c-opt.c (c_common_handle_option): Add
> > 	* c.opt: New option -Wignored_return_type_qualifiers.
> > 	-Wignored_returned_type_qualifiers to -Wall.
> > 	* doc/invoke.texi (Warning Options, -Wall): Add new option
> > 	-Wignore_return_type_qualifiers.
> > 	(-Wignored-return-type-qualifiers): Document.
> > 	(-Wreturn-type): Remove description of functionality now handled
> > 	by -Wignored-return-type-qualifiers.
> > cp/ChangeLog:
> > 2008-01-09  Doug Kwan  <dougkwan@google.com>
> > 	* decl.c: (grokdeclarator): Use
> > OPT_Wignored_return_type_qualifiers
> > 	instead of OPT_Wreturn_type in warning due to ignored return type
> > 	qualifiers.
> > 	* pt.c: (tsubst_function_type): Use OPT_Wignored_return_type_qualifiers
> > 	instead of OPT_Wreturn_type in warning due to ignored return type
> > 	qualifiers.
> > testsuite/ChangeLog:
> > 2008-01-09  Doug Kwan  <dougkwan@google.com>
> > 	* gcc.dg/qual-return-1.c: Add -Wignored-return-type-qualifiers.
> > 	* g++.dg/warn/Wreturn-type-4.C: Replace -Wreturn-type by
> > 	-Wignored-return-type-qualifiers.
> 
> This looks fine to me for 4.4.  You will need final approval from FE
> maintainers, though.


I think this patch should go into 4.3.

It is not technically a regression, but that is only because 4.2
didn't warn about this case at all.  The current state of things is
that -Wreturn-type controls some warnings which are potentially
serious errors, and it also controls a warning, this one, which is
never a problem (the warning is just saying that in "const int foo()"
the "const" is ignored).  That means that when compiling existing
code, we may now get many new warnings which are not problems.  But
disabling the warning, via -Wno-return-type, means disabling warnings
for code that can be problems.

In short, I think it was a mistake to put this new warning under
-Wreturn-type.  Since this warning is new for gcc 4.3, I think it is
entirely appropriate to move it now, before gcc 4.3 is released.

Does anybody feel otherwise?

Ian



More information about the Gcc-patches mailing list