[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 9/9] hw/timer/renesas_tmr: silence the compiler warnings
From: |
Thomas Huth |
Subject: |
Re: [PATCH 9/9] hw/timer/renesas_tmr: silence the compiler warnings |
Date: |
Wed, 28 Oct 2020 16:04:06 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 |
On 28/10/2020 10.59, Philippe Mathieu-Daudé wrote:
> On 10/28/20 5:18 AM, Chen Qun wrote:
>> 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>
>> ---
>> Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
>> Cc: Magnus Damm <magnus.damm@gmail.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];
>>
>
> You fixed A_TCORA but not A_TCORB...
A_TCORB cannot fall through, since it always does a "return" in both
branches of the if-statement.
However, it also looks really odd that A_TCORA falls through to A_TCORB here
and return that register value instead. Is this really intended? Yoshinori,
could you please double-check whether this is a bug here, or intended?
Thanks,
Thomas
- [PATCH 4/9] linux-user/mips/cpu_loop: silence the compiler warnings, (continued)
[PATCH 9/9] hw/timer/renesas_tmr: silence the compiler warnings, Chen Qun, 2020/10/28
RE: [PATCH 9/9] hw/timer/renesas_tmr: silence the compiler warnings, Chenqun (kuhn), 2020/10/29
[PATCH 3/9] accel/tcg/user-exec: silence the compiler warnings, Chen Qun, 2020/10/28