From: Thomas Huth <thuth@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>, qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, Peter Maydell <peter.maydell@linaro.org>,
Jason Wang <jasowang@redhat.com>,
qemu-arm@nongnu.org, Peter Chubb <peter.chubb@nicta.com.au>
Subject: Re: [PATCH 3/6] hw/net/imx_fec: Rewrite fall through comments
Date: Wed, 18 Dec 2019 20:35:48 +0100 [thread overview]
Message-ID: <54e5071f-b5c2-3cc7-514c-ecc2b7e2bed4@redhat.com> (raw)
In-Reply-To: <2fc74b64-0a0b-c437-e925-4c16d3907da7@redhat.com>
On 17/12/2019 18.55, Thomas Huth wrote:
> On 17/12/2019 18.34, Philippe Mathieu-Daudé wrote:
>> GCC9 is confused by this comment when building with CFLAG
>> -Wimplicit-fallthrough=2:
>>
>> hw/net/imx_fec.c: In function ‘imx_eth_write’:
>> hw/net/imx_fec.c:906:12: error: this statement may fall through [-Werror=implicit-fallthrough=]
>> 906 | if (unlikely(single_tx_ring)) {
>> | ^
>> hw/net/imx_fec.c:912:5: note: here
>> 912 | case ENET_TDAR: /* FALLTHROUGH */
>> | ^~~~
>> cc1: all warnings being treated as errors
>>
>> Rewrite the comments in the correct place, using 'fall through'
>> which is recognized by GCC and static analyzers.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>> Cc: Peter Chubb <peter.chubb@nicta.com.au>
>> Cc: Peter Maydell <peter.maydell@linaro.org>
>> Cc: Jason Wang <jasowang@redhat.com>
>> Cc: qemu-arm@nongnu.org
>> ---
>> hw/net/imx_fec.c | 8 +++++---
>> 1 file changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c
>> index bd99236864..30cc07753d 100644
>> --- a/hw/net/imx_fec.c
>> +++ b/hw/net/imx_fec.c
>> @@ -901,15 +901,17 @@ static void imx_eth_write(void *opaque, hwaddr offset, uint64_t value,
>> s->regs[index] = 0;
>> }
>> break;
>> - case ENET_TDAR1: /* FALLTHROUGH */
>> - case ENET_TDAR2: /* FALLTHROUGH */
>> + /* fall through */
>
> Wrong location. And I think you don't need any comment here at all, GCC
> should stay silent without it?
>
>> + case ENET_TDAR1:
>> + case ENET_TDAR2:
>> if (unlikely(single_tx_ring)) {
>> qemu_log_mask(LOG_GUEST_ERROR,
>> "[%s]%s: trying to access TDAR2 or TDAR1\n",
>> TYPE_IMX_FEC, __func__);
>> return;
>> }
>> - case ENET_TDAR: /* FALLTHROUGH */
>> + /* fall through */
>
> I'd suggest to simply remove it, too.
/me needsmorecoffee
... of course this hunk was fine. Good that you kept it in v2.
Thomas
>> + case ENET_TDAR:
>> if (s->regs[ENET_ECR] & ENET_ECR_ETHEREN) {
>> s->regs[index] = ENET_TDAR_TDAR;
>> imx_eth_do_tx(s, index);
>>
>
> Thomas
>
next prev parent reply other threads:[~2019-12-18 19:39 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-17 17:34 [PATCH 0/6] Fix more GCC9 -O3 warnings Philippe Mathieu-Daudé
2019-12-17 17:34 ` [PATCH 1/6] audio/audio: Add missing fall through comment Philippe Mathieu-Daudé
2019-12-18 3:45 ` Richard Henderson
2019-12-18 8:02 ` Aleksandar Markovic
2019-12-18 10:22 ` Philippe Mathieu-Daudé
2019-12-17 17:34 ` [PATCH 2/6] hw/display/tcx: Add missing fall through comments Philippe Mathieu-Daudé
2019-12-18 3:57 ` Richard Henderson
2019-12-18 7:54 ` Aleksandar Markovic
2019-12-18 10:23 ` Philippe Mathieu-Daudé
2019-12-17 17:34 ` [PATCH 3/6] hw/net/imx_fec: Rewrite " Philippe Mathieu-Daudé
2019-12-17 17:55 ` Thomas Huth
2019-12-18 19:35 ` Thomas Huth [this message]
2019-12-18 3:45 ` Richard Henderson
2019-12-18 8:00 ` Aleksandar Markovic
2019-12-17 17:34 ` [PATCH 4/6] hw/timer/aspeed_timer: Add a fall through comment Philippe Mathieu-Daudé
2019-12-17 17:54 ` Cédric Le Goater
2019-12-18 8:26 ` Aleksandar Markovic
2019-12-17 17:34 ` [PATCH 5/6] hw/scsi/megasas: Silent GCC9 duplicated-cond warning Philippe Mathieu-Daudé
2019-12-18 4:03 ` Richard Henderson
2019-12-18 17:52 ` Philippe Mathieu-Daudé
2019-12-18 19:02 ` Richard Henderson
2020-01-07 14:56 ` Paolo Bonzini
2020-01-07 16:20 ` Hannes Reinecke
2019-12-17 17:34 ` [PATCH 6/6] qemu-io-cmds: Silent GCC9 format-overflow warning Philippe Mathieu-Daudé
2019-12-18 4:15 ` Richard Henderson
2019-12-18 17:45 ` Philippe Mathieu-Daudé
2019-12-18 19:21 ` Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54e5071f-b5c2-3cc7-514c-ecc2b7e2bed4@redhat.com \
--to=thuth@redhat.com \
--cc=jasowang@redhat.com \
--cc=peter.chubb@nicta.com.au \
--cc=peter.maydell@linaro.org \
--cc=philmd@redhat.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).