Re: treewide replacement of fallthrough comments with "fallthrough" macro (was Re: [RFC PATCH] compiler_attributes.h: Add 'fallthrough' pseudo keyword for switch/case use)

2019-09-17 Thread Kees Cook
On Tue, Sep 17, 2019 at 03:26:32PM -0700, Joe Perches wrote: > On Mon, 2019-09-16 at 15:19 -0700, Kees Cook wrote: > > On Thu, Aug 15, 2019 at 11:15:53AM -0700, Kees Cook wrote: > > > With that out of the way, yes, let's do a mass conversion. As mentioned > > > before, I think "fallthrough;"

Re: treewide replacement of fallthrough comments with "fallthrough" macro (was Re: [RFC PATCH] compiler_attributes.h: Add 'fallthrough' pseudo keyword for switch/case use)

2019-09-17 Thread Joe Perches
On Mon, 2019-09-16 at 15:19 -0700, Kees Cook wrote: > On Thu, Aug 15, 2019 at 11:15:53AM -0700, Kees Cook wrote: > > With that out of the way, yes, let's do a mass conversion. As mentioned > > before, I think "fallthrough;" should be used here (to match "break;"). > > Let's fork the C language. :)

treewide replacement of fallthrough comments with "fallthrough" macro (was Re: [RFC PATCH] compiler_attributes.h: Add 'fallthrough' pseudo keyword for switch/case use)

2019-09-16 Thread Kees Cook
On Thu, Aug 15, 2019 at 11:15:53AM -0700, Kees Cook wrote: > With that out of the way, yes, let's do a mass conversion. As mentioned > before, I think "fallthrough;" should be used here (to match "break;"). > Let's fork the C language. :) FWIW, last week I asked Linus at the maintainer's summit

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

2019-08-15 Thread Kees Cook
On Thu, Aug 15, 2019 at 11:15:53AM -0700, Kees Cook wrote: > I want to recant my position on Coverity coverage being a requirement > here. While I was originally concerned about suddenly adding thousands > more warnings to Coverity scans (if it doesn't support the flag -- > I should know soon),

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

2019-08-15 Thread Kees Cook
On Wed, Jul 31, 2019 at 01:02:07PM -0700, Kees Cook wrote: > On Wed, Jul 31, 2019 at 08:48:32PM +0200, Peter Zijlstra wrote: > > On Wed, Jul 31, 2019 at 11:24:36AM -0700, h...@zytor.com wrote: > > > >> > +/* > > > >> > + * Add the pseudo keyword 'fallthrough' so case statement blocks > > > >> > +

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

2019-08-04 Thread Joe Perches
On Sun, 2019-08-04 at 18:18 -0700, Nathan Chancellor wrote: > On Sun, Aug 04, 2019 at 05:39:28PM -0700, Joe Perches wrote: > Hi Joe, Hi Nathan. > This patch resolves that while adding support for the attribute. > https://reviews.llvm.org/D64838 [] > > The __has_attribute use is at least clang

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

2019-08-04 Thread Nathan Chancellor
Hi Joe, On Sun, Aug 04, 2019 at 05:39:28PM -0700, Joe Perches wrote: > On Sun, 2019-08-04 at 11:09 -0700, Linus Torvalds wrote: > > On Sun, Aug 4, 2019 at 11:01 AM Joe Perches wrote: > > > Linus? Do you have an opinion about this RFC/patch? > > > > So my only real concern is that the comment

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

2019-08-04 Thread Joe Perches
On Sun, 2019-08-04 at 11:09 -0700, Linus Torvalds wrote: > On Sun, Aug 4, 2019 at 11:01 AM Joe Perches wrote: > > Linus? Do you have an opinion about this RFC/patch? > > So my only real concern is that the comment approach has always been > the really traditional one, going back all the way to

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

2019-08-04 Thread Miguel Ojeda
On Sun, Aug 4, 2019 at 8:09 PM Linus Torvalds wrote: > > So my only real concern is that the comment approach has always been > the really traditional one, going back all the way to 'lint' days. > > And you obviously cannot use a #define to create a comment, so this > whole keyword model will

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

2019-08-04 Thread Linus Torvalds
On Sun, Aug 4, 2019 at 11:01 AM Joe Perches wrote: > > Linus? Do you have an opinion about this RFC/patch? So my only real concern is that the comment approach has always been the really traditional one, going back all the way to 'lint' days. And you obviously cannot use a #define to create a

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

2019-08-04 Thread Joe Perches
On Tue, 2019-07-30 at 22:35 -0700, Joe Perches 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.

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

2019-08-02 Thread Joe Perches
On Fri, 2019-08-02 at 09:09 -0700, Kees Cook wrote: > On Fri, Aug 02, 2019 at 02:34:18PM +0200, Pavel Machek wrote: > > I like the "fallthrough". It looks like "return" and it should, no > > need to have __'s there.. > > Yeah, it would have the same feel as "break", "continue", "return"... > >

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

2019-08-02 Thread Kees Cook
On Fri, Aug 02, 2019 at 02:34:18PM +0200, Pavel Machek wrote: > I like the "fallthrough". It looks like "return" and it should, no > need to have __'s there.. Yeah, it would have the same feel as "break", "continue", "return"... The only place I see this already used is in

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

2019-08-02 Thread Pavel Machek
On Fri 2019-08-02 07:00:42, Neil Horman wrote: > On Thu, Aug 01, 2019 at 10:26:29PM +0200, Miguel Ojeda wrote: > > On Thu, Aug 1, 2019 at 10:10 PM wrote: > > > > > > I'm not disagreeing... I think using a macro makes sense. > > > > It is either a macro or waiting for 5+ years (while we keep

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

2019-08-02 Thread Neil Horman
On Thu, Aug 01, 2019 at 10:26:29PM +0200, Miguel Ojeda wrote: > On Thu, Aug 1, 2019 at 10:10 PM wrote: > > > > I'm not disagreeing... I think using a macro makes sense. > > It is either a macro or waiting for 5+ years (while we keep using the > comment style) :-) > > In case it helps to make

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

2019-08-01 Thread Joe Perches
On Thu, 2019-08-01 at 22:26 +0200, Miguel Ojeda wrote: > On Thu, Aug 1, 2019 at 10:10 PM wrote: > > I'm not disagreeing... I think using a macro makes sense. > > It is either a macro or waiting for 5+ years (while we keep using the > comment style) :-) > > In case it helps to make one's mind

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

2019-08-01 Thread Miguel Ojeda
On Thu, Aug 1, 2019 at 10:10 PM wrote: > > I'm not disagreeing... I think using a macro makes sense. It is either a macro or waiting for 5+ years (while we keep using the comment style) :-) In case it helps to make one's mind about whether to go for it or not, I summarized the advantages and a

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

2019-08-01 Thread hpa
On August 1, 2019 5:24:29 AM PDT, Peter Zijlstra wrote: >On Wed, Jul 31, 2019 at 11:10:36PM -0700, h...@zytor.com wrote: >> On July 31, 2019 4:55:47 PM PDT, Miguel Ojeda > wrote: >> >On Wed, Jul 31, 2019 at 11:01 PM wrote: >> >> >> >> The standard is moving toward adding this as an attribute

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

2019-08-01 Thread Peter Zijlstra
On Wed, Jul 31, 2019 at 11:10:36PM -0700, h...@zytor.com wrote: > On July 31, 2019 4:55:47 PM PDT, Miguel Ojeda > wrote: > >On Wed, Jul 31, 2019 at 11:01 PM wrote: > >> > >> The standard is moving toward adding this as an attribute with the > >[[fallthrough]] syntax; it is in C++17, not sure

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

2019-08-01 Thread Peter Zijlstra
On Wed, Jul 31, 2019 at 01:02:07PM -0700, Kees Cook wrote: > On Wed, Jul 31, 2019 at 08:48:32PM +0200, Peter Zijlstra wrote: > > On Wed, Jul 31, 2019 at 11:24:36AM -0700, h...@zytor.com wrote: > > > >> > +/* > > > >> > + * Add the pseudo keyword 'fallthrough' so case statement blocks > > > >> > +

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

2019-08-01 Thread Joe Perches
On Wed, 2019-07-31 at 23:10 -0700, h...@zytor.com wrote: > On July 31, 2019 4:55:47 PM PDT, Miguel Ojeda > wrote: > > On Wed, Jul 31, 2019 at 11:01 PM wrote: > > > The standard is moving toward adding this as an attribute with the > > [[fallthrough]] syntax; it is in C++17, not sure when it

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

2019-08-01 Thread hpa
On July 31, 2019 4:55:47 PM PDT, Miguel Ojeda wrote: >On Wed, Jul 31, 2019 at 11:01 PM wrote: >> >> The standard is moving toward adding this as an attribute with the >[[fallthrough]] syntax; it is in C++17, not sure when it will be in C >be if it isn't already. > >Not yet, but it seems to be

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

2019-07-31 Thread Miguel Ojeda
On Thu, Aug 1, 2019 at 12:07 AM Joe Perches wrote: > > Note also that this doesn't actually _use_ fallthrough > it just reserves it. If we are reserving it, we should be giving a compile error instead. I don't see how users will understand they shouldn't use it just yet (it is the same as adding

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

2019-07-31 Thread Miguel Ojeda
On Wed, Jul 31, 2019 at 11:01 PM wrote: > > The standard is moving toward adding this as an attribute with the > [[fallthrough]] syntax; it is in C++17, not sure when it will be in C be if > it isn't already. Not yet, but it seems to be coming:

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

2019-07-31 Thread Joe Perches
On Wed, 2019-07-31 at 22:59 +0200, Miguel Ojeda wrote: > On Wed, Jul 31, 2019 at 10:02 PM Kees Cook wrote: > > On Wed, Jul 31, 2019 at 08:48:32PM +0200, Peter Zijlstra wrote: > > > On Wed, Jul 31, 2019 at 11:24:36AM -0700, h...@zytor.com wrote: > > > > > > > +/* > > > > > > > + * Add the pseudo

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

2019-07-31 Thread hpa
On July 31, 2019 11:48:32 AM PDT, Peter Zijlstra wrote: >On Wed, Jul 31, 2019 at 11:24:36AM -0700, h...@zytor.com wrote: >> >> > +/* >> >> > + * Add the pseudo keyword 'fallthrough' so case statement >blocks >> >> > + * must end with any of these keywords: >> >> > + * break; >> >> > + *

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

2019-07-31 Thread Miguel Ojeda
On Wed, Jul 31, 2019 at 10:02 PM Kees Cook wrote: > > On Wed, Jul 31, 2019 at 08:48:32PM +0200, Peter Zijlstra wrote: > > On Wed, Jul 31, 2019 at 11:24:36AM -0700, h...@zytor.com wrote: > > > >> > +/* > > > >> > + * Add the pseudo keyword 'fallthrough' so case statement blocks > > > >> > + * must

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

2019-07-31 Thread Kees Cook
On Wed, Jul 31, 2019 at 08:48:32PM +0200, Peter Zijlstra wrote: > On Wed, Jul 31, 2019 at 11:24:36AM -0700, h...@zytor.com wrote: > > >> > +/* > > >> > + * Add the pseudo keyword 'fallthrough' so case statement blocks > > >> > + * must end with any of these keywords: > > >> > + * break; > > >> >

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

2019-07-31 Thread Peter Zijlstra
On Wed, Jul 31, 2019 at 11:24:36AM -0700, h...@zytor.com wrote: > >> > +/* > >> > + * Add the pseudo keyword 'fallthrough' so case statement blocks > >> > + * must end with any of these keywords: > >> > + * break; > >> > + * fallthrough; > >> > + * goto ; > >> > + * return [expression]; >

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

2019-07-31 Thread hpa
On July 31, 2019 10:51:37 AM PDT, Joe Perches wrote: >On Wed, 2019-07-31 at 19:14 +0200, Pavel Machek wrote: >> On Tue 2019-07-30 22:35:18, Joe Perches wrote: >> > Reserve the pseudo keyword 'fallthrough' for the ability to convert >the >> > various case block /* fallthrough */ style comments to

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

2019-07-31 Thread Joe Perches
On Wed, 2019-07-31 at 19:14 +0200, Pavel Machek wrote: > On Tue 2019-07-30 22:35:18, Joe Perches 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

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

2019-07-31 Thread Pavel Machek
On Tue 2019-07-30 22:35:18, Joe Perches 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. Acked-by:

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

2019-07-31 Thread Joe Perches
On Wed, 2019-07-31 at 11:02 +0200, Peter Zijlstra wrote: > On Tue, Jul 30, 2019 at 10:35:18PM -0700, Joe Perches 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

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

2019-07-31 Thread Peter Zijlstra
On Tue, Jul 30, 2019 at 10:35:18PM -0700, Joe Perches 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

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

2019-07-30 Thread Joe Perches
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;