I'm using svn trunk gcc as of today. -Wreturn-type is documented as: [... warn] about a `return' statement with a expression in a function whose return-type is `void'. I tried it with this test case: void x (void) { } void y(void) { return x(); } I expected a warning on the `return', but did not get one: I used "gcc -Wreturn-type -O2 -c q.c"
apinski@apinskidesktop:~$ gcc t.c -W -Wall -pedantic -S t.c: In function ‘y’: t.c:2: warning: ISO C forbids ‘return’ with expression, in function returning void
Thanks, but I think it is still a bug as-is. I don't see why -pedantic should be required here.
Mine.
Hi Marek, Do you have even an unfinished patch? I will add this to the list of EasyHacks.
(In reply to Manuel López-Ibáñez from comment #4) > Do you have even an unfinished patch? I will add this to the list of > EasyHacks. I have nothing so far, I couldn't get to this one yet. I'm going to unassign myself for now, maybe I'll get to this one some day. Feel free to put it on EasyHacks.
GCC 5.1 has been released.
GCC 5.2 is being released, adjusting target milestone to 5.3.
GCC 5.3 is being released, adjusting target milestone.
Only regressions have target milestone.
Proposed patch: https://gcc.gnu.org/ml/gcc-patches/2016-06/msg00032.html
Author: msebor Date: Sat Jun 4 20:50:50 2016 New Revision: 237093 URL: https://gcc.gnu.org/viewcvs?rev=237093&root=gcc&view=rev Log: PR c/48116 - -Wreturn-type does not work as advertised gcc/ChangeLog: 2016-06-04 Martin Sebor <msebor@redhat.com> Marcin Baczyński <marbacz@gmail.com> PR c/48116 * doc/invoke.texi (-Wreturn-type): Mention not warning on return with a void expression in a void function. Modified: trunk/gcc/ChangeLog trunk/gcc/doc/invoke.texi
Fixed in r23709 by correcting the manual .