[PATCH 1/1] net: replace /* Fall through */

gcc 12 does not understand /* Fall through */. Use the fallthrough macro instead.
Fallthrough at the start of a switch statement makes no sense.
Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com --- net/net.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/net/net.c b/net/net.c index c9a749f6cc..b3199572b7 100644 --- a/net/net.c +++ b/net/net.c @@ -1435,7 +1435,6 @@ void net_process_received_packet(uchar *in_packet, int len) static int net_check_prereq(enum proto_t protocol) { switch (protocol) { - /* Fall through */ #if defined(CONFIG_CMD_PING) case PING: if (net_ping_ip.s_addr == 0) { @@ -1470,7 +1469,7 @@ static int net_check_prereq(enum proto_t protocol) #if defined(CONFIG_CMD_NFS) case NFS: #endif - /* Fall through */ + fallthrough; case TFTPGET: case TFTPPUT: if (IS_ENABLED(CONFIG_IPV6) && use_ip6) { @@ -1484,11 +1483,11 @@ static int net_check_prereq(enum proto_t protocol) puts("*** ERROR: `serverip' not set\n"); return 1; } + fallthrough; #if defined(CONFIG_CMD_PING) || \ defined(CONFIG_CMD_DNS) || defined(CONFIG_PROT_UDP) common: #endif - /* Fall through */
case NETCONS: case FASTBOOT: @@ -1503,7 +1502,7 @@ common: puts("*** ERROR: `ipaddr' not set\n"); return 1; } - /* Fall through */ + fallthrough;
#ifdef CONFIG_CMD_RARP case RARP: @@ -1534,7 +1533,7 @@ common: net_start_again(); return 2; } - /* Fall through */ + fallthrough; default: return 0; }

On Sat, Apr 1, 2023 at 10:30 AM Heinrich Schuchardt heinrich.schuchardt@canonical.com wrote:
gcc 12 does not understand /* Fall through */. Use the fallthrough macro instead.
Fallthrough at the start of a switch statement makes no sense.
Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com
net/net.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/net/net.c b/net/net.c index c9a749f6cc..b3199572b7 100644 --- a/net/net.c +++ b/net/net.c @@ -1435,7 +1435,6 @@ void net_process_received_packet(uchar *in_packet, int len) static int net_check_prereq(enum proto_t protocol) { switch (protocol) {
/* Fall through */
#if defined(CONFIG_CMD_PING) case PING: if (net_ping_ip.s_addr == 0) { @@ -1470,7 +1469,7 @@ static int net_check_prereq(enum proto_t protocol) #if defined(CONFIG_CMD_NFS) case NFS: #endif
/* Fall through */
fallthrough; case TFTPGET: case TFTPPUT: if (IS_ENABLED(CONFIG_IPV6) && use_ip6) {
@@ -1484,11 +1483,11 @@ static int net_check_prereq(enum proto_t protocol) puts("*** ERROR: `serverip' not set\n"); return 1; }
fallthrough;
#if defined(CONFIG_CMD_PING) || \ defined(CONFIG_CMD_DNS) || defined(CONFIG_PROT_UDP) common: #endif
/* Fall through */ case NETCONS: case FASTBOOT:
@@ -1503,7 +1502,7 @@ common: puts("*** ERROR: `ipaddr' not set\n"); return 1; }
/* Fall through */
fallthrough;
#ifdef CONFIG_CMD_RARP case RARP: @@ -1534,7 +1533,7 @@ common: net_start_again(); return 2; }
/* Fall through */
fallthrough; default: return 0; }
-- 2.39.2
Reviewed-by: Ramon Fried rfried.dev@gmail.com BTW, where is the fallthrough macro defined ?

On Sat, 1 Apr 2023 at 20:30, Heinrich Schuchardt < heinrich.schuchardt@canonical.com> wrote:
gcc 12 does not understand /* Fall through */. Use the fallthrough macro instead.
Fallthrough at the start of a switch statement makes no sense.
Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com
net/net.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

On Sat, Apr 01, 2023 at 09:30:05AM +0200, Heinrich Schuchardt wrote:
gcc 12 does not understand /* Fall through */. Use the fallthrough macro instead.
Fallthrough at the start of a switch statement makes no sense.
Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com Reviewed-by: Ramon Fried rfried.dev@gmail.com Reviewed-by: Simon Glass sjg@chromium.org
[snip]
@@ -1484,11 +1483,11 @@ static int net_check_prereq(enum proto_t protocol) puts("*** ERROR: `serverip' not set\n"); return 1; }
fallthrough;
#if defined(CONFIG_CMD_PING) || \ defined(CONFIG_CMD_DNS) || defined(CONFIG_PROT_UDP) common: #endif
This leads to: net/net.c:1486:3: error: fallthrough annotation does not directly precede switch label with clang.
participants (4)
-
Heinrich Schuchardt
-
Ramon Fried
-
Simon Glass
-
Tom Rini