[PATCH] x86/syscalls: Mark expected switch fall-throughs

2019-01-29 Thread Gustavo A. R. Silva
In preparation to enable -Wimplicit-fallthrough by default, mark switch-case statements where fall-through is intentional, explicitly in order to fix a bunch of -Wimplicit-fallthrough warnings. Warning level 3 was used: -Wimplicit-fallthrough=3. Signed-off-by: Gustavo A. R. Silva --- arch/x86/i

Re: [PATCH] x86/syscalls: Mark expected switch fall-throughs

2019-01-29 Thread Thomas Gleixner
On Tue, 29 Jan 2019, Gustavo A. R. Silva wrote: > In preparation to enable -Wimplicit-fallthrough by default, mark > switch-case statements where fall-through is intentional, explicitly in > order to fix a bunch of -Wimplicit-fallthrough warnings. > > Warning level 3 was used: -Wimplicit-fallthro

Re: [PATCH] x86/syscalls: Mark expected switch fall-throughs

2017-11-29 Thread Kees Cook
On Wed, Nov 29, 2017 at 7:14 AM, Thomas Gleixner wrote: > On Wed, 29 Nov 2017, Gustavo A. R. Silva wrote: >> Quoting Thomas Gleixner : >> >> > >> > So I have to ask WHY this information was not in the changelog of the patch >> > in question: >> > >> > 1) How it works >> > >> > 2) Why comments

Re: [PATCH] x86/syscalls: Mark expected switch fall-throughs

2017-11-29 Thread Thomas Gleixner
On Wed, 29 Nov 2017, Gustavo A. R. Silva wrote: > Quoting Thomas Gleixner : > > > > > So I have to ask WHY this information was not in the changelog of the patch > > in question: > > > > 1) How it works > > > > 2) Why comments have been chosen over macros > > > > I will add this info and

Re: [PATCH] x86/syscalls: Mark expected switch fall-throughs

2017-11-29 Thread Gustavo A. R. Silva
Quoting Thomas Gleixner : So I have to ask WHY this information was not in the changelog of the patch in question: 1) How it works 2) Why comments have been chosen over macros I will add this info and send the patch again. In preparation to enabling -Wimplicit-fallthrough, mark sw

Re: [PATCH] x86/syscalls: Mark expected switch fall-throughs

2017-11-29 Thread Geert Uytterhoeven
Hi Joe, On Wed, Nov 29, 2017 at 2:07 AM, Joe Perches wrote: > On Tue, 2017-11-28 at 14:37 -0600, Gustavo A. R. Silva wrote: >> Quoting Linus Torvalds : >> > On Tue, Nov 28, 2017 at 11:00 AM, Alan Cox >> > wrote: >> > > The notation in question has been standard in tools like lint since the >> >

Re: [PATCH] x86/syscalls: Mark expected switch fall-throughs

2017-11-28 Thread Joe Perches
On Tue, 2017-11-28 at 14:37 -0600, Gustavo A. R. Silva wrote: > Quoting Linus Torvalds : > > > On Tue, Nov 28, 2017 at 11:00 AM, Alan Cox > > wrote: > > > > > > The notation in question has been standard in tools like lint since the > > > end of the 1970s > > > > Yes. > > > > That said, mayb

Re: [PATCH] x86/syscalls: Mark expected switch fall-throughs

2017-11-28 Thread Thomas Gleixner
On Tue, 28 Nov 2017, Gustavo A. R. Silva wrote: > The thing about taking 'any comment' as valid is false if you add the > following to your Makefile: > > KBUILD_CFLAGS += $(call cc-option,-Wimplicit-fallthrough) > > This option takes the following comments as valid: > > /* fall through */ > /*

Re: [PATCH] x86/syscalls: Mark expected switch fall-throughs

2017-11-28 Thread Gustavo A. R. Silva
Quoting Linus Torvalds : On Tue, Nov 28, 2017 at 11:00 AM, Alan Cox wrote: The notation in question has been standard in tools like lint since the end of the 1970s Yes. That said, maybe one option would be to annotate the "case:" and "default:" statements if that makes people happier. I

Re: [PATCH] x86/syscalls: Mark expected switch fall-throughs

2017-11-28 Thread Kees Cook
On Tue, Nov 28, 2017 at 12:08 PM, Thomas Gleixner wrote: > On Tue, 28 Nov 2017, Linus Torvalds wrote: > >> On Tue, Nov 28, 2017 at 11:00 AM, Alan Cox >> wrote: >> > >> > The notation in question has been standard in tools like lint since the >> > end of the 1970s >> >> Yes. >> >> That said, mayb

Re: [PATCH] x86/syscalls: Mark expected switch fall-throughs

2017-11-28 Thread Gustavo A. R. Silva
Quoting Thomas Gleixner : On Tue, 28 Nov 2017, Alan Cox wrote: > I have no idea who came up with that brilliant idea of parsing comments in > the code. It's so simple to make this parser completely fail that it's not Stephen Johnson (author of the V7 portable C compiler), which is where it's

Re: [PATCH] x86/syscalls: Mark expected switch fall-throughs

2017-11-28 Thread Thomas Gleixner
On Tue, 28 Nov 2017, Alan Cox wrote: > > I have no idea who came up with that brilliant idea of parsing comments in > > the code. It's so simple to make this parser completely fail that it's not > > Stephen Johnson (author of the V7 portable C compiler), which is where > it's from (the lint tool)

Re: [PATCH] x86/syscalls: Mark expected switch fall-throughs

2017-11-28 Thread Thomas Gleixner
On Tue, 28 Nov 2017, Linus Torvalds wrote: > On Tue, Nov 28, 2017 at 11:00 AM, Alan Cox wrote: > > > > The notation in question has been standard in tools like lint since the > > end of the 1970s > > Yes. > > That said, maybe one option would be to annotate the "case:" and > "default:" statemen

Re: [PATCH] x86/syscalls: Mark expected switch fall-throughs

2017-11-28 Thread Joe Perches
On Tue, 2017-11-28 at 11:10 -0800, Linus Torvalds wrote: > On Tue, Nov 28, 2017 at 11:00 AM, Alan Cox wrote: > > > > The notation in question has been standard in tools like lint since the > > end of the 1970s > > Yes. > > That said, maybe one option would be to annotate the "case:" and > "defa

Re: [PATCH] x86/syscalls: Mark expected switch fall-throughs

2017-11-28 Thread Thomas Gleixner
On Tue, 28 Nov 2017, Gustavo A. R. Silva wrote: > This is what we want to add: > > # Warn about missing switch break or fall-through comment. > KBUILD_CFLAGS += $(call cc-option,-Wimplicit-fallthrough) Can this be made to ignore comments and only accept the proper annotation? > > > I have no id

Re: [PATCH] x86/syscalls: Mark expected switch fall-throughs

2017-11-28 Thread Linus Torvalds
On Tue, Nov 28, 2017 at 11:00 AM, Alan Cox wrote: > > The notation in question has been standard in tools like lint since the > end of the 1970s Yes. That said, maybe one option would be to annotate the "case:" and "default:" statements if that makes people happier. IOW, we could do something l

Re: [PATCH] x86/syscalls: Mark expected switch fall-throughs

2017-11-28 Thread Alan Cox
> I have no idea who came up with that brilliant idea of parsing comments in > the code. It's so simple to make this parser completely fail that it's not Stephen Johnson (author of the V7 portable C compiler), which is where it's from (the lint tool). He also wrote yacc so he does know a bit about

Re: [PATCH] x86/syscalls: Mark expected switch fall-throughs

2017-11-28 Thread Gustavo A. R. Silva
Quoting Thomas Gleixner : On Tue, 28 Nov 2017, Thomas Gleixner wrote: +CC Linus. On Tue, 28 Nov 2017, Thomas Gleixner wrote: > On Tue, 28 Nov 2017, Gustavo A. R. Silva wrote: > > Quoting Thomas Gleixner : > > > > To be honest, such comments annoy me during a code review especially when >

Re: [PATCH] x86/syscalls: Mark expected switch fall-throughs

2017-11-28 Thread Thomas Gleixner
On Tue, 28 Nov 2017, Thomas Gleixner wrote: +CC Linus. > On Tue, 28 Nov 2017, Thomas Gleixner wrote: > > > On Tue, 28 Nov 2017, Gustavo A. R. Silva wrote: > > > Quoting Thomas Gleixner : > > > > > To be honest, such comments annoy me during a code review especially > > > > > when > > > > > the

Re: [PATCH] x86/syscalls: Mark expected switch fall-throughs

2017-11-28 Thread Thomas Gleixner
On Tue, 28 Nov 2017, Thomas Gleixner wrote: > On Tue, 28 Nov 2017, Gustavo A. R. Silva wrote: > > Quoting Thomas Gleixner : > > > > To be honest, such comments annoy me during a code review especially > > > > when > > > > the fallthrough is so obvious as in this case. There might be cases > > >

Re: [PATCH] x86/syscalls: Mark expected switch fall-throughs

2017-11-28 Thread Thomas Gleixner
On Tue, 28 Nov 2017, Gustavo A. R. Silva wrote: > Quoting Thomas Gleixner : > > > To be honest, such comments annoy me during a code review especially when > > > the fallthrough is so obvious as in this case. There might be cases where > > > its worth to document because it's non obvious, but docum

Re: [PATCH] x86/syscalls: Mark expected switch fall-throughs

2017-11-28 Thread Gustavo A. R. Silva
Quoting Thomas Gleixner : On Tue, 28 Nov 2017, Thomas Gleixner wrote: On Tue, 28 Nov 2017, Gustavo A. R. Silva wrote: > Quoting Thomas Gleixner : > > > On Mon, 27 Nov 2017, Gustavo A. R. Silva wrote: > > > > > In preparation to enabling -Wimplicit-fallthrough, mark switch cases > > > where we

Re: [PATCH] x86/syscalls: Mark expected switch fall-throughs

2017-11-28 Thread Thomas Gleixner
On Tue, 28 Nov 2017, Thomas Gleixner wrote: > On Tue, 28 Nov 2017, Gustavo A. R. Silva wrote: > > Quoting Thomas Gleixner : > > > > > On Mon, 27 Nov 2017, Gustavo A. R. Silva wrote: > > > > > > > In preparation to enabling -Wimplicit-fallthrough, mark switch cases > > > > where we are expecting t

Re: [PATCH] x86/syscalls: Mark expected switch fall-throughs

2017-11-28 Thread Thomas Gleixner
On Tue, 28 Nov 2017, Gustavo A. R. Silva wrote: > Quoting Thomas Gleixner : > > > On Mon, 27 Nov 2017, Gustavo A. R. Silva wrote: > > > > > In preparation to enabling -Wimplicit-fallthrough, mark switch cases > > > where we are expecting to fall through. > > > > > case 0: > > >

Re: [PATCH] x86/syscalls: Mark expected switch fall-throughs

2017-11-28 Thread Gustavo A. R. Silva
Quoting Thomas Gleixner : On Mon, 27 Nov 2017, Gustavo A. R. Silva wrote: In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. case 0: if (!n--) break; *args++ = regs->bx

Re: [PATCH] x86/syscalls: Mark expected switch fall-throughs

2017-11-28 Thread Thomas Gleixner
On Mon, 27 Nov 2017, Gustavo A. R. Silva wrote: > In preparation to enabling -Wimplicit-fallthrough, mark switch cases > where we are expecting to fall through. > case 0: > if (!n--) break; > *args++ = regs->bx; > + /*

[PATCH] x86/syscalls: Mark expected switch fall-throughs

2017-11-27 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva --- arch/x86/include/asm/syscall.h | 28 1 file changed, 28 insertions(+) diff --git a/arch/x86/include/asm/syscall.h b/ar