Jacob Garber has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/34457 )
Change subject: libpayload: Enable -Wimplicit-fallthrough ......................................................................
libpayload: Enable -Wimplicit-fallthrough
Add comments to intentional fall throughs and enable the warning.
Change-Id: I93e071c4fb139fa6e9cd8a1bfb5800f5f4eac50b Signed-off-by: Jacob Garber jgarber1@ualberta.ca --- M payloads/libpayload/Makefile.inc M payloads/libpayload/curses/PDCurses/pdcurses/scanw.c M payloads/libpayload/libc/printf.c 3 files changed, 5 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/57/34457/1
diff --git a/payloads/libpayload/Makefile.inc b/payloads/libpayload/Makefile.inc index 1fa07f9..f0aaa27 100644 --- a/payloads/libpayload/Makefile.inc +++ b/payloads/libpayload/Makefile.inc @@ -63,7 +63,7 @@ CFLAGS += -nostdlib -fno-builtin -ffreestanding -fomit-frame-pointer CFLAGS += -ffunction-sections -fdata-sections CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wmissing-prototypes -CFLAGS += -Wwrite-strings -Wredundant-decls -Wno-trigraphs +CFLAGS += -Wwrite-strings -Wredundant-decls -Wno-trigraphs -Wimplicit-fallthrough CFLAGS += -Wstrict-aliasing -Wshadow -Werror
$(obj)/libpayload-config.h: $(KCONFIG_AUTOHEADER) diff --git a/payloads/libpayload/curses/PDCurses/pdcurses/scanw.c b/payloads/libpayload/curses/PDCurses/pdcurses/scanw.c index 47f2050..d1fd908 100644 --- a/payloads/libpayload/curses/PDCurses/pdcurses/scanw.c +++ b/payloads/libpayload/curses/PDCurses/pdcurses/scanw.c @@ -274,7 +274,7 @@ NEXT(c); goto string; } - /* no break */ + /* fall through */ default: if (fmt[1] == '-' && fmt[2] && f < (unsigned char)fmt[2]) diff --git a/payloads/libpayload/libc/printf.c b/payloads/libpayload/libc/printf.c index cb623aa..3896f01 100644 --- a/payloads/libpayload/libc/printf.c +++ b/payloads/libpayload/libc/printf.c @@ -585,6 +585,7 @@ /* Integer values */ case 'P': /* pointer */ flags |= __PRINTF_FLAG_BIGCHARS; + /* fall through */ case 'p': flags |= __PRINTF_FLAG_PREFIX; base = 16; @@ -599,10 +600,12 @@ case 'd': case 'i': flags |= __PRINTF_FLAG_SIGNED; + break; case 'u': break; case 'X': flags |= __PRINTF_FLAG_BIGCHARS; + /* fall through */ case 'x': base = 16; break;
HAOUAS Elyes has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/34457 )
Change subject: libpayload: Enable -Wimplicit-fallthrough ......................................................................
Patch Set 1: Code-Review+2
Martin Roth has submitted this change and it was merged. ( https://review.coreboot.org/c/coreboot/+/34457 )
Change subject: libpayload: Enable -Wimplicit-fallthrough ......................................................................
libpayload: Enable -Wimplicit-fallthrough
Add comments to intentional fall throughs and enable the warning.
Change-Id: I93e071c4fb139fa6e9cd8a1bfb5800f5f4eac50b Signed-off-by: Jacob Garber jgarber1@ualberta.ca Reviewed-on: https://review.coreboot.org/c/coreboot/+/34457 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: HAOUAS Elyes ehaouas@noos.fr --- M payloads/libpayload/Makefile.inc M payloads/libpayload/curses/PDCurses/pdcurses/scanw.c M payloads/libpayload/libc/printf.c 3 files changed, 5 insertions(+), 2 deletions(-)
Approvals: build bot (Jenkins): Verified HAOUAS Elyes: Looks good to me, approved
diff --git a/payloads/libpayload/Makefile.inc b/payloads/libpayload/Makefile.inc index 1fa07f9..f0aaa27 100644 --- a/payloads/libpayload/Makefile.inc +++ b/payloads/libpayload/Makefile.inc @@ -63,7 +63,7 @@ CFLAGS += -nostdlib -fno-builtin -ffreestanding -fomit-frame-pointer CFLAGS += -ffunction-sections -fdata-sections CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wmissing-prototypes -CFLAGS += -Wwrite-strings -Wredundant-decls -Wno-trigraphs +CFLAGS += -Wwrite-strings -Wredundant-decls -Wno-trigraphs -Wimplicit-fallthrough CFLAGS += -Wstrict-aliasing -Wshadow -Werror
$(obj)/libpayload-config.h: $(KCONFIG_AUTOHEADER) diff --git a/payloads/libpayload/curses/PDCurses/pdcurses/scanw.c b/payloads/libpayload/curses/PDCurses/pdcurses/scanw.c index 47f2050..d1fd908 100644 --- a/payloads/libpayload/curses/PDCurses/pdcurses/scanw.c +++ b/payloads/libpayload/curses/PDCurses/pdcurses/scanw.c @@ -274,7 +274,7 @@ NEXT(c); goto string; } - /* no break */ + /* fall through */ default: if (fmt[1] == '-' && fmt[2] && f < (unsigned char)fmt[2]) diff --git a/payloads/libpayload/libc/printf.c b/payloads/libpayload/libc/printf.c index cb623aa..3896f01 100644 --- a/payloads/libpayload/libc/printf.c +++ b/payloads/libpayload/libc/printf.c @@ -585,6 +585,7 @@ /* Integer values */ case 'P': /* pointer */ flags |= __PRINTF_FLAG_BIGCHARS; + /* fall through */ case 'p': flags |= __PRINTF_FLAG_PREFIX; base = 16; @@ -599,10 +600,12 @@ case 'd': case 'i': flags |= __PRINTF_FLAG_SIGNED; + break; case 'u': break; case 'X': flags |= __PRINTF_FLAG_BIGCHARS; + /* fall through */ case 'x': base = 16; break;