* [PATCH 1/1] net: replace /* Fall through */
@ 2023-04-01 7:30 Heinrich Schuchardt
2023-04-01 18:52 ` Ramon Fried
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Heinrich Schuchardt @ 2023-04-01 7:30 UTC (permalink / raw)
To: Joe Hershberger, Ramon Fried; +Cc: u-boot, Heinrich Schuchardt
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] net: replace /* Fall through */
2023-04-01 7:30 [PATCH 1/1] net: replace /* Fall through */ Heinrich Schuchardt
@ 2023-04-01 18:52 ` Ramon Fried
2023-04-02 2:37 ` Simon Glass
2023-04-06 21:10 ` Tom Rini
2 siblings, 0 replies; 4+ messages in thread
From: Ramon Fried @ 2023-04-01 18:52 UTC (permalink / raw)
To: Heinrich Schuchardt; +Cc: Joe Hershberger, u-boot
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 ?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] net: replace /* Fall through */
2023-04-01 7:30 [PATCH 1/1] net: replace /* Fall through */ Heinrich Schuchardt
2023-04-01 18:52 ` Ramon Fried
@ 2023-04-02 2:37 ` Simon Glass
2023-04-06 21:10 ` Tom Rini
2 siblings, 0 replies; 4+ messages in thread
From: Simon Glass @ 2023-04-02 2:37 UTC (permalink / raw)
To: Heinrich Schuchardt; +Cc: Joe Hershberger, Ramon Fried, U-Boot Mailing List
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>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] net: replace /* Fall through */
2023-04-01 7:30 [PATCH 1/1] net: replace /* Fall through */ Heinrich Schuchardt
2023-04-01 18:52 ` Ramon Fried
2023-04-02 2:37 ` Simon Glass
@ 2023-04-06 21:10 ` Tom Rini
2 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2023-04-06 21:10 UTC (permalink / raw)
To: Heinrich Schuchardt; +Cc: Joe Hershberger, Ramon Fried, u-boot
[-- Attachment #1: Type: text/plain, Size: 833 bytes --]
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.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-04-06 21:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-01 7:30 [PATCH 1/1] net: replace /* Fall through */ Heinrich Schuchardt
2023-04-01 18:52 ` Ramon Fried
2023-04-02 2:37 ` Simon Glass
2023-04-06 21:10 ` Tom Rini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.