[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <beb1762387a4132a2bb4c47397b737d77dd88742.camel@perches.com>
Date: Wed, 31 Jul 2019 15:07:50 -0700
From: Joe Perches <joe@...ches.com>
To: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>,
Kees Cook <keescook@...omium.org>
Cc: Peter Zijlstra <peterz@...radead.org>,
"H. Peter Anvin" <hpa@...or.com>, Pavel Machek <pavel@....cz>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Borislav Petkov <bp@...en8.de>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"Gustavo A . R . Silva" <gustavo@...eddedor.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Kan Liang <kan.liang@...ux.intel.com>,
Namhyung Kim <namhyung@...nel.org>,
Jiri Olsa <jolsa@...hat.com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Shawn Landden <shawn@....icu>,
"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@...nel.org>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH] compiler_attributes.h: Add 'fallthrough' pseudo
keyword for switch/case use
On Wed, 2019-07-31 at 22:59 +0200, Miguel Ojeda wrote:
> On Wed, Jul 31, 2019 at 10:02 PM Kees Cook <keescook@...omium.org> wrote:
> > On Wed, Jul 31, 2019 at 08:48:32PM +0200, Peter Zijlstra wrote:
> > > On Wed, Jul 31, 2019 at 11:24:36AM -0700, hpa@...or.com wrote:
> > > > > > > +/*
> > > > > > > + * Add the pseudo keyword 'fallthrough' so case statement blocks
> > > > > > > + * must end with any of these keywords:
> > > > > > > + * break;
> > > > > > > + * fallthrough;
> > > > > > > + * goto <label>;
> > > > > > > + * return [expression];
> > > > > > > + *
> > > > > > > + * gcc: >https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html#Statement-Attributes
> > > > > > > + */
> > > > > > > +#if __has_attribute(__fallthrough__)
> > > > > > > +# define fallthrough __attribute__((__fallthrough__))
> > > > > > > +#else
> > > > > > > +# define fallthrough do {} while (0) /* fallthrough */
> > > > > > > +#endif
> > > > > > > +
> > > > If the comments are stripped, how would the compiler see them to be
> > > > able to issue a warning? I would guess that it is retained or replaced
> > > > with some other magic token.
> > >
> > > Everything that has the warning (GCC-7+/CLANG-9) has that attribute.
> >
> > I'd like to make sure we don't regress Coverity most of all. If the
> > recent updates to the Coverity scanner include support for the attribute
> > now, then I'm all for it. :)
>
> We had this discussion a while ago (October) and the consensus was
> that we would like to wait for a while until all tools were ready to
> use the attribute and everyone's would be happy:
>
> https://lore.kernel.org/lkml/20181021171414.22674-1-miguel.ojeda.sandonis@gmail.com/
>
> Is everyone happy this time around? :-)
Note also that this doesn't actually _use_ fallthrough
it just reserves it.
Patches that convert /* fallthrough */ et al, to fallthrough
would only be published when everyone's happy enough.
Powered by blists - more mailing lists