This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: DEFAULT_MAIN_RETURN and C99...
- From: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- To: Zack Weinberg <zack at codesourcery dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 18 Jun 2003 21:49:11 +0100 (BST)
- Subject: Re: DEFAULT_MAIN_RETURN and C99...
- References: <87ptlbku3q.fsf@egil.codesourcery.com>
On Wed, 18 Jun 2003, Zack Weinberg wrote:
> I see no reason not to make this behavior unconditional and
> target-independent. In other words, for main, always call
> c_expand_return (integer_zero_node) at this point. This will suppress
> the "control reaches end of non-void function" warning, but we could
> fix that with a little cleverness.
As I noted <http://gcc.gnu.org/ml/gcc-patches/2000-07/msg01009.html>,
users will expect that diagnostic in C90 mode, so we should ensure that we
keep it (and test for that: we already test that C99 mode does not yield
the warning). As VAX/VMS support has gone away, the other definition of
DEFAULT_MAIN_RETURN mentioned in that message is now irrelevant.
Logically, when we have a -Wc90 or similar option (analogous to
-Wtraditional, warn for differences between C90 and C99, including the
various warnings done if (pedantic && !flag_isoc99)) the warning should
also apply for -Wreturn-type -Wc90 (in C99 mode as well as in C90 mode).
--
Joseph S. Myers
jsm28@cam.ac.uk