Alan Green has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/32798
Change subject: src/security/vboot/misc.h Fix clang fail to compile ......................................................................
src/security/vboot/misc.h Fix clang fail to compile
Clang does not recognize dead_code() as termination of execution. It gives this message:
error: control reaches end of non-void function [-Werror,-Wreturn-type]
The error was being encountered even without VBOOT enabled, because the misc.h file is included from many places, including coreboot_table.c.
This change:
(a) provides dummy return values from the dead code paths to keep clang happy. (b) moves the final case of if-else-if statements out of else clause to keep the linter happy.
Signed-off-by: Alan Green avg@google.com Change-Id: I19e0c9ba36f0ea5110480521a5f9afa0112a3137 --- M src/security/vboot/misc.h 1 file changed, 6 insertions(+), 6 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/98/32798/1
diff --git a/src/security/vboot/misc.h b/src/security/vboot/misc.h index 23159c8..03bf663 100644 --- a/src/security/vboot/misc.h +++ b/src/security/vboot/misc.h @@ -78,7 +78,6 @@ * code should be called. They are implemented inline for better compile-time * code elimination. */ - static inline int verification_should_run(void) { if (CONFIG(VBOOT_SEPARATE_VERSTAGE)) @@ -87,8 +86,9 @@ return ENV_ROMSTAGE; else if (CONFIG(VBOOT_STARTS_IN_BOOTBLOCK)) return ENV_BOOTBLOCK; - else - dead_code(); + + dead_code(); + return 0; }
static inline int verstage_should_load(void) @@ -120,10 +120,10 @@ #else return 1; #endif - } else { - dead_code(); } -}
+ dead_code(); + return 0; +}
#endif /* __VBOOT_MISC_H__ */