bootutil: add fallthrough to fix implicit fallthrough warning#2705
bootutil: add fallthrough to fix implicit fallthrough warning#2705supperthomas wants to merge 1 commit intomcu-tools:mainfrom
Conversation
The comment style is already used elsewhere in the codebase (loader.c) and is recognized by GCC -Wimplicit-fallthrough without relying on any platform-specific macro definitions. Signed-off-by: Supper Thomas <78900636@qq.com>
dcd537e to
ccfec78
Compare
| break; | ||
| } | ||
| /* Pass */ | ||
| /* fallthrough */ |
There was a problem hiding this comment.
not sure I follow this, it appears to be a C23 feature and is done using [] style brackets https://en.cppreference.com/c/language/attributes/fallthrough - not that doing that would be acceptable in MCUboot because of supporting old compilers. Do you have a reference to something this fixes?
There was a problem hiding this comment.
mcuboot/boot/bootutil/src/loader.c
Lines 1838 to 1842 in 95a6e38
When I enable the fallthrough compilation warning as an error, an error is reported during compilation at this code segment. I have made corresponding modifications by referring to other loader.c files, which should theoretically comply with the modification conventions of MCUboot. If the old compiler fails to handle this part properly, other code areas would presumably encounter the same issue as well.
Add /* fallthrough */ annotation in the switch statement within boot_set_next() to explicitly mark the intended fallthrough from BOOT_MAGIC_UNSET to BOOT_MAGIC_GOOD, suppressing the compiler warning.