Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/51497 )
Change subject: compiler.h: Define a fallthrough statement ......................................................................
compiler.h: Define a fallthrough statement
Copied from the Linux kernel.
Change-Id: I0487698290992162fac6bb74b5082901415e917e Signed-off-by: Arthur Heymans arthur@aheymans.xyz --- M src/commonlib/bsd/include/commonlib/bsd/compiler.h 1 file changed, 10 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/97/51497/1
diff --git a/src/commonlib/bsd/include/commonlib/bsd/compiler.h b/src/commonlib/bsd/include/commonlib/bsd/compiler.h index ee2ff88..dc88cb8 100644 --- a/src/commonlib/bsd/include/commonlib/bsd/compiler.h +++ b/src/commonlib/bsd/include/commonlib/bsd/compiler.h @@ -35,6 +35,16 @@ #define __always_inline inline __attribute__((always_inline)) #endif
+#ifndef fallthrough +#if __has_attribute(__fallthrough__) +#define fallthrough __attribute__((__fallthrough__)) +#else +#define fallthrough \ + do { \ + } while (0) /* fallthrough */ +#endif +#endif + /* This evaluates to the type of the first expression, unless that is constant in which case it evalutates to the type of the second. This is useful when assigning macro parameters to temporary variables, because that would