Sorry for the noise, if this has already been reported or corrected.

tboot is built with the -Wextra Cflag, which is an alias for a
collection of warning flags. tboot's make interprets warnings as errors.

>From GCC 7 forward, the -Wextra Cflag includes -Wimplicit-fallthrough.

The GCC 7+ switch statement requires a break statement after each case.
Without a break statement after a case, then an "implicit fallthrough"
condition exists, where the matched case is executed, and the following
case is also executed. If none of the fallthrough cases has a statement,
and if the last statement in the fallthrough cascade is a break, all is
forgiven, and the GCC 7+ compiler will move on.

Otherwise, GCC 7+ with -Wextra will issue the following error when
-Werror is set, as it is in the tboot make.

error: this statement may fall through [-Werror=implicit-fallthrough=]

That means case statements with implicit fallthroughs will be flagged
as compile errors and crater the build. There exists a number of
compiler specific ways to tell the compiler that the fallthrough is
there by design, but the simplest way to avert this problem is to add
the -Wno-implicit-fallthrough flag to the CFLAGS_WARN variable in tboot's
Config.mk file.

Signed-off-by: Tony Camuso <tcam...@redhat.com>
---
 Config.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Config.mk b/Config.mk
index e730511..4382336 100644
--- a/Config.mk
+++ b/Config.mk
@@ -41,7 +41,7 @@ cc-option = $(shell if test -z "`$(1) $(2) -S -o /dev/null 
-xc \
 
 CFLAGS_WARN       = -Wall -Wformat-security -Werror -Wstrict-prototypes \
                    -Wextra -Winit-self -Wswitch-default -Wunused-parameter \
-                   -Wwrite-strings \
+                   -Wwrite-strings -Wno-implicit-fallthrough \
                    $(call cc-option,$(CC),-Wlogical-op,) \
                    -Wno-missing-field-initializers
 
-- 
2.18.1



_______________________________________________
tboot-devel mailing list
tboot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tboot-devel

Reply via email to