From 0ba81d7db377e37e9e50ce243e173e1bcfa33e9a Mon Sep 17 00:00:00 2001 From: Arthur Heymans Date: Fri, 25 Aug 2023 13:05:19 +0200 Subject: libpayload: Fix clang fallthrough warning Clang does not recognize comments to indicate falltrough is intended behavior. Signed-off-by: Arthur Heymans Change-Id: Idcf7a24fc763b80863902702172b4ea950e132b8 Reviewed-on: https://review.coreboot.org/c/coreboot/+/77431 Reviewed-by: Martin L Roth Tested-by: build bot (Jenkins) Reviewed-by: Elyes Haouas Reviewed-by: Paul Menzel --- payloads/libpayload/curses/PDCurses/pdcurses/addch.c | 4 +++- payloads/libpayload/curses/PDCurses/pdcurses/scanw.c | 2 +- payloads/libpayload/drivers/i8042/keyboard.c | 2 +- payloads/libpayload/libc/printf.c | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/payloads/libpayload/curses/PDCurses/pdcurses/addch.c b/payloads/libpayload/curses/PDCurses/pdcurses/addch.c index 5934b54b96..12f767f7e6 100644 --- a/payloads/libpayload/curses/PDCurses/pdcurses/addch.c +++ b/payloads/libpayload/curses/PDCurses/pdcurses/addch.c @@ -173,8 +173,10 @@ int waddch(WINDOW *win, const chtype ch) /* don't back over left margin */ if (--x < 0) - case '\r': x = 0; + break; + case '\r': + x = 0; break; diff --git a/payloads/libpayload/curses/PDCurses/pdcurses/scanw.c b/payloads/libpayload/curses/PDCurses/pdcurses/scanw.c index d1fd908dab..97eaf70b4f 100644 --- a/payloads/libpayload/curses/PDCurses/pdcurses/scanw.c +++ b/payloads/libpayload/curses/PDCurses/pdcurses/scanw.c @@ -274,7 +274,7 @@ static int _pdc_vsscanf(const char *buf, const char *fmt, va_list arg_ptr) NEXT(c); goto string; } - /* fall through */ + __fallthrough; default: if (fmt[1] == '-' && fmt[2] && f < (unsigned char)fmt[2]) diff --git a/payloads/libpayload/drivers/i8042/keyboard.c b/payloads/libpayload/drivers/i8042/keyboard.c index 952f5f1456..2453392ecf 100644 --- a/payloads/libpayload/drivers/i8042/keyboard.c +++ b/payloads/libpayload/drivers/i8042/keyboard.c @@ -578,7 +578,7 @@ int keyboard_getchar(void) /* vulcan nerve pinch */ if ((modifier & KB_MOD_ALT) && reset_handler) reset_handler(); - /* fallthrough */ + __fallthrough; default: ret = 0; } diff --git a/payloads/libpayload/libc/printf.c b/payloads/libpayload/libc/printf.c index feab4b5f22..3edf166b98 100644 --- a/payloads/libpayload/libc/printf.c +++ b/payloads/libpayload/libc/printf.c @@ -584,7 +584,7 @@ static int printf_core(const char *fmt, struct printf_spec *ps, va_list ap) /* Integer values */ case 'P': /* pointer */ flags |= __PRINTF_FLAG_BIGCHARS; - /* fall through */ + __fallthrough; case 'p': flags |= __PRINTF_FLAG_PREFIX; base = 16; @@ -604,7 +604,7 @@ static int printf_core(const char *fmt, struct printf_spec *ps, va_list ap) break; case 'X': flags |= __PRINTF_FLAG_BIGCHARS; - /* fall through */ + __fallthrough; case 'x': base = 16; break; -- cgit v1.2.3