Re: [PATCH 2/2] Compiler Attributes: auxdisplay: panel: use __fallthrough

From: Kees Cook
Date: Mon Oct 22 2018 - 10:10:11 EST


On Sun, Oct 21, 2018 at 10:14 AM, Miguel Ojeda
<miguel.ojeda.sandonis@xxxxxxxxx> wrote:
> Let gcc know these cases are meant to fall through to the next label
> by annotating them with the new __fallthrough statement attribute;
> and remove the comment since it conveys the same information
> (which was also parsed by gcc to suppress the warning).
>
> Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@xxxxxxxxx>
> ---
> drivers/auxdisplay/panel.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/auxdisplay/panel.c b/drivers/auxdisplay/panel.c
> index 21b9b2f2470a..0755034e49ba 100644
> --- a/drivers/auxdisplay/panel.c
> +++ b/drivers/auxdisplay/panel.c
> @@ -1367,7 +1367,7 @@ static void panel_process_inputs(void)
> break;
> input->rise_timer = 0;
> input->state = INPUT_ST_RISING;
> - /* fall through */
> + __fallthrough;
> case INPUT_ST_RISING:
> if ((phys_curr & input->mask) != input->value) {
> input->state = INPUT_ST_LOW;
> @@ -1380,11 +1380,11 @@ static void panel_process_inputs(void)
> }
> input->high_timer = 0;
> input->state = INPUT_ST_HIGH;
> - /* fall through */
> + __fallthrough;
> case INPUT_ST_HIGH:
> if (input_state_high(input))
> break;
> - /* fall through */
> + __fallthrough;
> case INPUT_ST_FALLING:
> input_state_falling(input);
> }
> --
> 2.17.1
>

I would prefer we continue to use the comment style until we've got
confirmed support for (at least) Clang, Coverity, CPPcheck, smatch,
and eclipse.

-Kees

--
Kees Cook
Pixel Security