Re: [PATCH 2/4] compiler_attributes.h: Add 'fallthrough' pseudo keyword for switch/case use

From: Miguel Ojeda
Date: Fri Oct 11 2019 - 18:25:59 EST


On Thu, Oct 10, 2019 at 10:37 PM Kees Cook <keescook@xxxxxxxxxxxx> wrote:
>
> On Sat, Oct 05, 2019 at 07:17:36PM +0200, Miguel Ojeda wrote:
> > Hi Joe,
> >
> > On Sat, Oct 5, 2019 at 6:46 PM Joe Perches <joe@xxxxxxxxxxx> wrote:
> > >
> > > Reserve the pseudo keyword 'fallthrough' for the ability to convert the
> > > various case block /* fallthrough */ style comments to appear to be an
> > > actual reserved word with the same gcc case block missing fallthrough
> > > warning capability.
> > >
> > > All switch/case blocks now must end in one of:
> > >
> > > break;
> > > fallthrough;
> > > goto <label>;
> > > return [expression];
> > > continue;
> > >
> > > fallthough is gcc's __attribute__((__fallthrough__)) which was introduced
> > > in gcc version 7..
> >
> > Nits: double period, missing "r" in fallthough.
> >
> > > fallthrough devolves to an empty "do {} while (0)" if the compiler
> > > version (any version less than gcc 7) does not support the attribute.
> >
> > Perhaps add a short note why (empty statement warnings maybe? I don't
> > remember them but it was months ago so maybe it changed).
> >
> > > Signed-off-by: Joe Perches <joe@xxxxxxxxxxx>
> > > Acked-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
> >
> > Please add Dan's Suggested-by and copy the things I wrote in the
> > commit message when I proposed this:
> >
> > https://github.com/ojeda/linux/commit/668f011a2706ea555987e263f609a5deba9c7fc4
>
> Perhaps just take this patch directly with Miguel's authorship into the
> series and tweak the __fallthrough to fallthrough in subject and body.

Since I was going to pick it up, I would have signed-off-by anyway, but yeah ;P

Cheers,
Miguel