[PATCH 18/18] [DO NOT MERGE] Makefile: enable switch/case fallthrough warnings
Tom Rini
trini at konsulko.com
Fri Mar 28 17:07:35 CET 2025
On Thu, Mar 27, 2025 at 03:33:13PM +0000, Andre Przywara wrote:
> =================================================================
> This does not fully work yet, there is at least the libbz2 code
> left to be handled. But this patch helps to let CI find more
> places where we need annotations.
> =================================================================
>
> C's implicit fallthrough behaviour in switch/case statements can lead to
> subtle bugs. Quite some while ago many compilers introduced warnings in
> those cases, requiring intentional fallthrough's to be annotated.
>
> So far we were not enabling that compiler option, so many ambiguities
> and some bugs in the code went unnoticed.
>
> With all places that produced warnings fixed or annotated now, we can
> add this compiler option to the build flags, to find new ambiguities
> early, before the code gets merged.
>
> Signed-off-by: Andre Przywara <andre.przywara at arm.com>
> ---
> Makefile | 1 +
> 1 file changed, 1 insertion(+)
For the record, once this is ready to be merged I would like to see us
borrow the CC_IMPLICIT_FALLTHROUGH logic from the linux kernel (which
gets the best flags for gcc or clang) instead, but yes, default to
enabling the check.
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20250328/c137e7d5/attachment.sig>
More information about the U-Boot
mailing list