This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Warning elimination patches in cp/call.c
- To: Joe Buck <jbuck at synopsys dot com>
- Subject: Re: Warning elimination patches in cp/call.c
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Tue, 10 Mar 1998 10:55:11 -0700
- cc: egcs at cygnus dot com
- Reply-To: law at cygnus dot com
In message <199803101742.JAA19093@atrus.synopsys.com>you write:
> > Yes, there may be a few that should be aborts. But the behavior with
> > the default: break case matches the current behavior -- which is
> > what I think we want to do unless we know its wrong (as has been
> > the case for some of the suggested paren warning fixes).
>
> It seems that inserting default: break should be fine in most cases. The
> only exception is where each case computes a needed result or returns a
> value; here default: break won't compute the result or return a value, so
> it seems that there should be a default: abort in such cases (otherwise
> we'll wind up with an uninitialized variable or fall off the end of
> a function).
Yup. In face I've already fixed a couple where a break caused us
to drop off the end of a non-void function without returning a
value. Of course -Wall told me I'd fallen off the end of the
non-void function :-)
jeff