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: RFA: fix PR c/48116


Tom> This patch fixes PR c/48116.

Tom> The bug is that -Wreturn-type does not follow the documentation.  In
Tom> particular, it should warn for this code, but does not:

Tom> static void f() {}
Tom> static void g() { return f(); }

Tom> I think the bug is that c-typeck.c calls pedwarn with either 0 or
Tom> OPT_pedantic, but it should use OPT_Wreturn_type in some cases.

Jakub> I think it is wrong if -Wreturn-type, which is enabled by default
Jakub> in -Wall, warns about the above.  Returning a void value in a
Jakub> void function is a GNU extension, which is heavily used in
Jakub> various projects.  Warning about this just with -pedantic is IMHO
Jakub> the right thing to do.

It seems ok to me to accept it as a GNU extension.
But, it still doesn't warn with -std=c89 or -std=c99.
-pedantic seems too heavy for this, to me.

If you agree I will look at fixing the patch.
Otherwise I guess I will write a documentation patch to remove this
text, since it is just incorrect.

Tom


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