This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] breakpoint.c, create_breakpoint, document that the case statement falls through.
- From: Pedro Alves <pedro at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Cc: Joel Brobecker <brobecker at adacore dot com>, Michael Snyder <msnyder at vmware dot com>
- Date: Thu, 3 Mar 2011 09:55:43 +0000
- Subject: Re: [RFA] breakpoint.c, create_breakpoint, document that the case statement falls through.
- References: <4D6EE3D9.2040108@vmware.com> <20110303042652.GU30306@adacore.com>
On Thursday 03 March 2011 04:26:52, Joel Brobecker wrote:
> > 2011-03-02 Michael Snyder <msnyder@vmware.com>
> >
> > * breakpoint.c (create_breakpoint): Document that case falls through.
> >
> > Index: breakpoint.c
> > ===================================================================
> > RCS file: /cvs/src/src/gdb/breakpoint.c,v
> > retrieving revision 1.546
> > diff -u -p -u -p -r1.546 breakpoint.c
> > --- breakpoint.c 1 Mar 2011 02:16:56 -0000 1.546
> > +++ breakpoint.c 3 Mar 2011 00:38:01 -0000
> > @@ -7843,6 +7843,7 @@ create_breakpoint (struct gdbarch *gdbar
> > default:
> > throw_exception (e);
> > }
> > + /* FALLTHROUGH */
> > default:
> > if (!sals.nelts)
> > return 0;
>
> Just some thoughts:
>
> It's actually never going to fall through, is it? Can we use "break;"
> instead, even if we know it's never going to be reached? I think
> it would make it clearer by not suggesting something that isn't
> supposed to happen (the fall through).
The root problem seems to be that lint hasn't been tought that
throw_exception doesn't return, so it thinks we do fall-through.
There are mechanisms to teach lint about the no-return property
of functions.
--
Pedro Alves