Consider the following code: void func () { } void func2 () { return func (); } gcc -pedantic correctly warns about "return func();", but the warning text is very confusing: 'return' with a value, in function returning void It talks about "value" where there is no value involved. It took me a while to understand what exactly is wrong. Warning says "value", so I obviously checked signatures first; then I looked for a problem with includes; then I asked in comp.lang.c. It would be better if gcc said something like 'return' with an expression, in function returning void or ISO C forbids ... The latter would be the best, I guess.
Confirmed.
Subject: Bug number PR 29521 A patch for this bug has been added to the patch tracker. The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2007-01/msg01533.html
Subject: Bug number PR 29521 A patch for this bug has been added to the patch tracker. The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2007-02/msg01110.html
Subject: Bug 29521 Author: manu Date: Tue Feb 13 00:29:17 2007 New Revision: 121876 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=121876 Log: 2007-02-13 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR c/29521 * c-typeck.c (c_finish_return): Improve warning message. testsuite/ * gcc.dg/c90-return-1.c: Update output. * gcc.dg/c99-return-1.c: Likewise. Added: trunk/gcc/testsuite/gcc.dg/pr29521-2.c trunk/gcc/testsuite/gcc.dg/pr29521.c Modified: trunk/gcc/ChangeLog trunk/gcc/c-typeck.c trunk/gcc/testsuite/ChangeLog
Fixed in GCC 4.3