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>
This commit is contained in:
Jacob Garber 2019-07-19 17:35:28 -06:00 committed by Martin Roth
parent ae317695e3
commit 5f7b1164c5
3 changed files with 5 additions and 2 deletions

View File

@ -63,7 +63,7 @@ CFLAGS += $(EXTRA_CFLAGS) $(INCLUDES) -Os -pipe -nostdinc -ggdb3
CFLAGS += -nostdlib -fno-builtin -ffreestanding -fomit-frame-pointer CFLAGS += -nostdlib -fno-builtin -ffreestanding -fomit-frame-pointer
CFLAGS += -ffunction-sections -fdata-sections CFLAGS += -ffunction-sections -fdata-sections
CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wmissing-prototypes 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 CFLAGS += -Wstrict-aliasing -Wshadow -Werror
$(obj)/libpayload-config.h: $(KCONFIG_AUTOHEADER) $(obj)/libpayload-config.h: $(KCONFIG_AUTOHEADER)

View File

@ -274,7 +274,7 @@ static int _pdc_vsscanf(const char *buf, const char *fmt, va_list arg_ptr)
NEXT(c); NEXT(c);
goto string; goto string;
} }
/* no break */ /* fall through */
default: default:
if (fmt[1] == '-' && fmt[2] if (fmt[1] == '-' && fmt[2]
&& f < (unsigned char)fmt[2]) && f < (unsigned char)fmt[2])

View File

@ -585,6 +585,7 @@ static int printf_core(const char *fmt, struct printf_spec *ps, va_list ap)
/* Integer values */ /* Integer values */
case 'P': /* pointer */ case 'P': /* pointer */
flags |= __PRINTF_FLAG_BIGCHARS; flags |= __PRINTF_FLAG_BIGCHARS;
/* fall through */
case 'p': case 'p':
flags |= __PRINTF_FLAG_PREFIX; flags |= __PRINTF_FLAG_PREFIX;
base = 16; base = 16;
@ -599,10 +600,12 @@ static int printf_core(const char *fmt, struct printf_spec *ps, va_list ap)
case 'd': case 'd':
case 'i': case 'i':
flags |= __PRINTF_FLAG_SIGNED; flags |= __PRINTF_FLAG_SIGNED;
break;
case 'u': case 'u':
break; break;
case 'X': case 'X':
flags |= __PRINTF_FLAG_BIGCHARS; flags |= __PRINTF_FLAG_BIGCHARS;
/* fall through */
case 'x': case 'x':
base = 16; base = 16;
break; break;