This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Implement -Wimplicit-fallthrough (version 9)
On Tue, Sep 27, 2016 at 12:12:30PM +0100, Kyrill Tkachov wrote:
>
> On 27/09/16 11:41, Jakub Jelinek wrote:
> > On Tue, Sep 27, 2016 at 11:32:42AM +0100, Kyrill Tkachov wrote:
> > > where the code is:
> > > 2156 /* Fall through - if the lane index isn't a constant then
> > > 2157 the next case will error. */
> > > 2158
> > > 2159 case NEON_ARG_CONSTANT:
> > >
> > >
> > > Is there supposed to be no empty line between the case statement and the comment?
> > > Or is the comment only supposed to contain "Fall through"?
> > The last comment before case or default keyword (or user label before
> > case/default) has to match one of the following regexps:
> > //-fallthrough$
> > //@fallthrough@$
> > //[ \t]*FALL(S | |-)?THR(OUGH|U)\.?[ \t]*$
> > //[ \t]*Fall(s | |-)?[Tt]hr(ough|u)\.?[ \t]*$
> > //[ \t]*fall(s | |-)?thr(ough|u)\.?[ \t]*$
> > /\*-fallthrough\*/
> > /\*@fallthrough@\*/
> > /\*[ \t]*FALL(S | |-)?THR(OUGH|U)\.?[ \t]*\*/
> > /\*[ \t]*Fall(s | |-)?[Tt]hr(ough|u)\.?[ \t]*\*/
> > /\*[ \t]*fall(s | |-)?thr(ough|u)\.?[ \t]*\*/
> >
> > So, you could e.g. write:
> > /* If the lane index isn't a constant, then the next case will error. */
> > /* Fall through. */
> > but not what you have, free form is not accepted.
> Thanks. Given the discussion going on about the acceptable comment formats,
> is it preferable to use comments in the gcc codebase at all, or should I
> use gcc_fallthrough () (with an explanatory comment if needed)?
It's probably that the comments are preferable, but sometimes you can't use
them (if e.g. something like CASE_CONVERT or another comment or } follows).
Marek