use proper fallthrough annotations
authorAndre Przywara <andre.przywara@arm.com>
Thu, 27 Mar 2025 15:32:59 +0000 (15:32 +0000)
committerTom Rini <trini@konsulko.com>
Tue, 8 Apr 2025 22:23:51 +0000 (16:23 -0600)
In some cases in the generic code, we were already using switch/case
fallthrough annotations comments, though in a way which might not be
understood by most compilers.

Replace two non-standard /* no break */ comments with our fallthrough;
statement-like macro, to make this visible to the compiler.
Also use this macro in place of an /* Fall through */ comment, to be
more consistent.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
common/command.c
lib/tiny-printf.c
net/net.c

index 3f69139..0f9dd06 100644 (file)
@@ -484,7 +484,7 @@ int cmd_get_data_size(const char *arg, int default_size)
                case 'q':
                        if (MEM_SUPPORT_64BIT_DATA)
                                return 8;
-                       /* no break */
+                       fallthrough;
                default:
                        return CMD_DATA_SIZE_ERR;
                }
index 0503c17..b8fc835 100644 (file)
@@ -282,7 +282,7 @@ static int _vprintf(struct printf_info *info, const char *fmt, va_list va)
                                        break;
                                }
                                islong = true;
-                               /* no break */
+                               fallthrough;
                        case 'x':
                                if (islong) {
                                        num = va_arg(va, unsigned long);
index 1828f1c..5219367 100644 (file)
--- a/net/net.c
+++ b/net/net.c
@@ -1559,7 +1559,7 @@ common:
                        puts("*** ERROR: `ipaddr' not set\n");
                        return 1;
                }
-               /* Fall through */
+               fallthrough;
 
 #ifdef CONFIG_CMD_RARP
        case RARP: