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]

Wextra and Wreturn-type interaction (PR7651)


:ADDPATCH C:

Wextra gives a warning when a function may return with and without a
value, for example:

foo (a)
{
 if (a > 0)
   return a;
}

However, this warning is completely redundant, since Wreturn-type
(that is enabled by -Wall) will give a warning for any  'return'
without value, in a function whose return-type is not 'void' and about
a 'return' with a value, in a function whose return-type is 'void'. I
was not able to construct an example for which Wextra warns but
Wreturn-type does not.

So this patch removes this warning from Wextra and improves the
description of Wreturn-type.

Boostrapped and regression tested.

OK for mainline?


2007-02-12 Manuel Lopez-Ibanez <manu@gcc.gnu.org>


 PR middle-end/7651
 * doc/invoke.texi (Wreturn-type): Complete description.
 (Wextra): Delete item about return-type warning.
 * c-decl.c: Delete redundant Wextra warning.

testsuite/
 * gcc.dg/20030906-1.c: Replace Wextra with Wreturn-type.
 * gcc.dg/20030906-2.c: Likewise.
 * objc.dg/method-17.m: Add -Wreturn-type.
 * obj-c++.dg/method-21.mm: Likewise.

Attachment: wextra-wreturn-type.diff
Description: Text document


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