* [PATCH] net: smc_close: mark expected switch fall-throughs
@ 2017-10-19 22:02 Gustavo A. R. Silva
2017-10-22 1:08 ` David Miller
0 siblings, 1 reply; 6+ messages in thread
From: Gustavo A. R. Silva @ 2017-10-19 22:02 UTC (permalink / raw)
To: Ursula Braun, David S. Miller
Cc: linux-s390, netdev, linux-kernel, Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.
Notice that in this particular case I placed a "fall through" comment on
its own line, which is what GCC is expecting to find.
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
net/smc/smc_close.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/smc/smc_close.c b/net/smc/smc_close.c
index f0d16fb..9b16f40 100644
--- a/net/smc/smc_close.c
+++ b/net/smc/smc_close.c
@@ -360,7 +360,8 @@ static void smc_close_passive_work(struct work_struct *work)
case SMC_PEERCLOSEWAIT1:
if (rxflags->peer_done_writing)
sk->sk_state = SMC_PEERCLOSEWAIT2;
- /* fall through to check for closing */
+ /* to check for closing */
+ /* fall through */
case SMC_PEERCLOSEWAIT2:
case SMC_PEERFINCLOSEWAIT:
if (!smc_cdc_rxed_any_close(&smc->conn))
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] net: smc_close: mark expected switch fall-throughs
2017-10-19 22:02 [PATCH] net: smc_close: mark expected switch fall-throughs Gustavo A. R. Silva
@ 2017-10-22 1:08 ` David Miller
2017-10-22 1:21 ` Gustavo A. R. Silva
0 siblings, 1 reply; 6+ messages in thread
From: David Miller @ 2017-10-22 1:08 UTC (permalink / raw)
To: garsilva; +Cc: ubraun, linux-s390, netdev, linux-kernel
From: "Gustavo A. R. Silva" <garsilva@embeddedor.com>
Date: Thu, 19 Oct 2017 17:02:44 -0500
> @@ -360,7 +360,8 @@ static void smc_close_passive_work(struct work_struct *work)
> case SMC_PEERCLOSEWAIT1:
> if (rxflags->peer_done_writing)
> sk->sk_state = SMC_PEERCLOSEWAIT2;
> - /* fall through to check for closing */
> + /* to check for closing */
> + /* fall through */
Gustavo please look at what you are doing to the code.
This was a nice easy to read sentence in the comment, and now
you've chopped it up into two pieces and made it awkward and
more difficult to read.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] net: smc_close: mark expected switch fall-throughs
2017-10-22 1:08 ` David Miller
@ 2017-10-22 1:21 ` Gustavo A. R. Silva
2017-10-22 1:35 ` [PATCH v2] net: smc_close: mark expected switch fall-through Gustavo A. R. Silva
2017-10-22 2:19 ` [PATCH] net: smc_close: mark expected switch fall-throughs David Miller
0 siblings, 2 replies; 6+ messages in thread
From: Gustavo A. R. Silva @ 2017-10-22 1:21 UTC (permalink / raw)
To: David Miller; +Cc: ubraun, linux-s390, netdev, linux-kernel
Quoting David Miller <davem@davemloft.net>:
> From: "Gustavo A. R. Silva" <garsilva@embeddedor.com>
> Date: Thu, 19 Oct 2017 17:02:44 -0500
>
>> @@ -360,7 +360,8 @@ static void smc_close_passive_work(struct
>> work_struct *work)
>> case SMC_PEERCLOSEWAIT1:
>> if (rxflags->peer_done_writing)
>> sk->sk_state = SMC_PEERCLOSEWAIT2;
>> - /* fall through to check for closing */
>> + /* to check for closing */
>> + /* fall through */
>
> Gustavo please look at what you are doing to the code.
>
> This was a nice easy to read sentence in the comment, and now
> you've chopped it up into two pieces and made it awkward and
> more difficult to read.
You're right.
What about this instead:
/* fall through */
/* to check for closing */
--
Gustavo A. R. Silva
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2] net: smc_close: mark expected switch fall-through
2017-10-22 1:21 ` Gustavo A. R. Silva
@ 2017-10-22 1:35 ` Gustavo A. R. Silva
2017-10-24 9:30 ` David Miller
2017-10-22 2:19 ` [PATCH] net: smc_close: mark expected switch fall-throughs David Miller
1 sibling, 1 reply; 6+ messages in thread
From: Gustavo A. R. Silva @ 2017-10-22 1:35 UTC (permalink / raw)
To: Ursula Braun, David S. Miller
Cc: linux-s390, netdev, linux-kernel, Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.
Notice that in this particular case I placed the "fall through" comment
on its own line, which is what GCC is expecting to find.
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
Changes in v2:
Move the "fall through" comment on its own line
above the rest of the sentence.
net/smc/smc_close.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/smc/smc_close.c b/net/smc/smc_close.c
index f0d16fb..a6c6559 100644
--- a/net/smc/smc_close.c
+++ b/net/smc/smc_close.c
@@ -360,7 +360,8 @@ static void smc_close_passive_work(struct work_struct *work)
case SMC_PEERCLOSEWAIT1:
if (rxflags->peer_done_writing)
sk->sk_state = SMC_PEERCLOSEWAIT2;
- /* fall through to check for closing */
+ /* fall through */
+ /* to check for closing */
case SMC_PEERCLOSEWAIT2:
case SMC_PEERFINCLOSEWAIT:
if (!smc_cdc_rxed_any_close(&smc->conn))
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] net: smc_close: mark expected switch fall-throughs
2017-10-22 1:21 ` Gustavo A. R. Silva
2017-10-22 1:35 ` [PATCH v2] net: smc_close: mark expected switch fall-through Gustavo A. R. Silva
@ 2017-10-22 2:19 ` David Miller
1 sibling, 0 replies; 6+ messages in thread
From: David Miller @ 2017-10-22 2:19 UTC (permalink / raw)
To: garsilva; +Cc: ubraun, linux-s390, netdev, linux-kernel
From: "Gustavo A. R. Silva" <garsilva@embeddedor.com>
Date: Sat, 21 Oct 2017 20:21:00 -0500
>
> Quoting David Miller <davem@davemloft.net>:
>
>> From: "Gustavo A. R. Silva" <garsilva@embeddedor.com>
>> Date: Thu, 19 Oct 2017 17:02:44 -0500
>>
>>> @@ -360,7 +360,8 @@ static void smc_close_passive_work(struct
>>> work_struct *work)
>>> case SMC_PEERCLOSEWAIT1:
>>> if (rxflags->peer_done_writing)
>>> sk->sk_state = SMC_PEERCLOSEWAIT2;
>>> - /* fall through to check for closing */
>>> + /* to check for closing */
>>> + /* fall through */
>>
>> Gustavo please look at what you are doing to the code.
>>
>> This was a nice easy to read sentence in the comment, and now
>> you've chopped it up into two pieces and made it awkward and
>> more difficult to read.
>
> You're right.
>
> What about this instead:
>
> /* fall through */
> /* to check for closing */
I'm surprised gcc cares if it's all on one line or not, actually.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] net: smc_close: mark expected switch fall-through
2017-10-22 1:35 ` [PATCH v2] net: smc_close: mark expected switch fall-through Gustavo A. R. Silva
@ 2017-10-24 9:30 ` David Miller
0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2017-10-24 9:30 UTC (permalink / raw)
To: garsilva; +Cc: ubraun, linux-s390, netdev, linux-kernel
From: "Gustavo A. R. Silva" <garsilva@embeddedor.com>
Date: Sat, 21 Oct 2017 20:35:30 -0500
> In preparation to enabling -Wimplicit-fallthrough, mark switch cases
> where we are expecting to fall through.
>
> Notice that in this particular case I placed the "fall through" comment
> on its own line, which is what GCC is expecting to find.
>
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
> ---
> Changes in v2:
> Move the "fall through" comment on its own line
> above the rest of the sentence.
Applied.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-10-24 9:30 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-19 22:02 [PATCH] net: smc_close: mark expected switch fall-throughs Gustavo A. R. Silva
2017-10-22 1:08 ` David Miller
2017-10-22 1:21 ` Gustavo A. R. Silva
2017-10-22 1:35 ` [PATCH v2] net: smc_close: mark expected switch fall-through Gustavo A. R. Silva
2017-10-24 9:30 ` David Miller
2017-10-22 2:19 ` [PATCH] net: smc_close: mark expected switch fall-throughs David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).