[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 04/12] hw/timer/renesas_tmr: silence the compiler warnings
From: |
Thomas Huth |
Subject: |
Re: [PATCH 04/12] hw/timer/renesas_tmr: silence the compiler warnings |
Date: |
Fri, 11 Dec 2020 16:46:57 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 |
On 11/12/2020 16.38, Peter Maydell wrote:
> On Fri, 11 Dec 2020 at 15:24, Thomas Huth <thuth@redhat.com> wrote:
>>
>> From: Chen Qun <kuhn.chenqun@huawei.com>
>>
>> When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed warning:
>> ../hw/timer/renesas_tmr.c: In function ‘tmr_read’:
>> ../hw/timer/renesas_tmr.c:221:19: warning: this statement may fall through
>> [-Wimplicit-fallthrough=]
>> 221 | } else if (ch == 0) {i
>> | ^
>> ../hw/timer/renesas_tmr.c:224:5: note: here
>> 224 | case A_TCORB:
>> | ^~~~
>>
>> Add the corresponding "fall through" comment to fix it.
>>
>> Reported-by: Euler Robot <euler.robot@huawei.com>
>> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
>> Message-Id: <20201028041819.2169003-10-kuhn.chenqun@huawei.com>
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>> ---
>> hw/timer/renesas_tmr.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/hw/timer/renesas_tmr.c b/hw/timer/renesas_tmr.c
>> index 446f2eacdd..e03a8155b2 100644
>> --- a/hw/timer/renesas_tmr.c
>> +++ b/hw/timer/renesas_tmr.c
>> @@ -221,6 +221,7 @@ static uint64_t tmr_read(void *opaque, hwaddr addr,
>> unsigned size)
>> } else if (ch == 0) {
>> return concat_reg(tmr->tcora);
>> }
>> + /* fall through */
>> case A_TCORB:
>> if (size == 1) {
>> return tmr->tcorb[ch];
>
> Yes, but maybe we should just get the patch that
> refactors this code in instead ?
I think that patch had a bug in it:
https://lore.kernel.org/qemu-devel/28b04149-bbd9-12ed-0e40-3c3da9fee672@redhat.com/
So I was hoping that Yoshinori Sato would send a new version or at least a
reply with a clarification, but I've never seen a response... so for the
time being, I'd suggest to go with Chen Qun's patch instead, which certainly
does not hurt.
Thomas
- [PATCH 00/12] Compile QEMU with -Wimplicit-fallthrough, Thomas Huth, 2020/12/11
- [PATCH 01/12] disas/libvixl: Fix fall-through annotation for GCC >= 7, Thomas Huth, 2020/12/11
- [PATCH 03/12] hw/rtc/twl92230: Silence warnings about missing fallthrough statements, Thomas Huth, 2020/12/11
- [PATCH 02/12] target/unicore32/translate: Add missing fallthrough annotations, Thomas Huth, 2020/12/11
- [PATCH 04/12] hw/timer/renesas_tmr: silence the compiler warnings, Thomas Huth, 2020/12/11
- [PATCH 05/12] target/i386: silence the compiler warnings in gen_shiftd_rm_T1, Thomas Huth, 2020/12/11
- [PATCH 07/12] accel/tcg/user-exec: silence the compiler warnings, Thomas Huth, 2020/12/11
- [PATCH 06/12] hw/intc/arm_gicv3_kvm: silence the compiler warnings, Thomas Huth, 2020/12/11
- [PATCH 08/12] target/sparc/translate: silence the compiler warnings, Thomas Huth, 2020/12/11
- [PATCH 10/12] tcg/optimize: Add fallthrough annotations, Thomas Huth, 2020/12/11
- [PATCH 12/12] configure: Compile with -Wimplicit-fallthrough=2, Thomas Huth, 2020/12/11
- [PATCH 11/12] tests/fp: Do not emit implicit-fallthrough warnings in the softfloat tests, Thomas Huth, 2020/12/11