mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-23 02:04:02 +00:00
tools/nolibc: compiler: add macro __nolibc_fallthrough
Recent version of GCC and clang gained -Wimplicit-fallthrough, warning about implicit fall-through between switch labels. As nolibc does not control the compilation flags, this can trigger warnings for when built by the user. Make use of the "fallthrough" attribute to explicitly annotate the expected fall-throughs and silence the warning. Link: https://lore.kernel.org/r/20240930-nolibc-fallthrough-v2-1-2e8d10fe3430@weissschuh.net Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
This commit is contained in:
@@ -32,4 +32,10 @@
|
||||
# define __no_stack_protector __attribute__((__optimize__("-fno-stack-protector")))
|
||||
#endif /* __nolibc_has_attribute(no_stack_protector) */
|
||||
|
||||
#if __nolibc_has_attribute(fallthrough)
|
||||
# define __nolibc_fallthrough do { } while (0); __attribute__((fallthrough))
|
||||
#else
|
||||
# define __nolibc_fallthrough do { } while (0)
|
||||
#endif /* __nolibc_has_attribute(fallthrough) */
|
||||
|
||||
#endif /* _NOLIBC_COMPILER_H */
|
||||
|
||||
Reference in New Issue
Block a user