lkml.org 
[lkml]   [2019]   [Jul]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH] compiler_attributes.h: Add 'fallthrough' pseudo keyword for switch/case use
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 capability.
>
> All switch/case blocks now must end in one of:
>
> break;
> fallthrough;
> goto <label>;
> return [expression];
>
> fallthough is gcc's __attribute__((__fallthrough__)) which was introduced
> in gcc version 7..
>
> fallthrough devolves to an empty "do {} while (0)" if the compiler version
> (any version less than gcc 7) does not support the attribute.
>
> Signed-off-by: Joe Perches <joe@perches.com>

_MUCH_ better than that silly comment, thanks for doing this!

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>

\
 
 \ /
  Last update: 2019-07-31 11:02    [W:0.259 / U:2.528 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site