diff mbox series

[PATCH-for-4.1,3/7] hw/block/pflash_cfi02: Rewrite a fall through comment

Message ID 20190719131425.10835-4-philmd@redhat.com (mailing list archive)
State New, archived
Headers show
Series Trivial switch 'fall through' comment fixes for GCC9 | expand

Commit Message

Philippe Mathieu-Daudé July 19, 2019, 1:14 p.m. UTC
GCC9 is confused by this comment when building with CFLAG
-Wimplicit-fallthrough=2:

  hw/block/pflash_cfi02.c: In function ‘pflash_write’:
  hw/block/pflash_cfi02.c:574:16: error: this statement may fall through [-Werror=implicit-fallthrough=]
    574 |             if (boff == 0x55 && cmd == 0x98) {
        |                ^
  hw/block/pflash_cfi02.c:581:9: note: here
    581 |         default:
        |         ^~~~~~~
  cc1: all warnings being treated as errors

Rewrite the comment using 'fall through' which is recognized by
GCC and static analyzers.

Reported-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/block/pflash_cfi02.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Peter Maydell July 19, 2019, 1:27 p.m. UTC | #1
On Fri, 19 Jul 2019 at 14:14, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>
> GCC9 is confused by this comment when building with CFLAG
> -Wimplicit-fallthrough=2:
>
>   hw/block/pflash_cfi02.c: In function ‘pflash_write’:
>   hw/block/pflash_cfi02.c:574:16: error: this statement may fall through [-Werror=implicit-fallthrough=]
>     574 |             if (boff == 0x55 && cmd == 0x98) {
>         |                ^
>   hw/block/pflash_cfi02.c:581:9: note: here
>     581 |         default:
>         |         ^~~~~~~
>   cc1: all warnings being treated as errors
>
> Rewrite the comment using 'fall through' which is recognized by
> GCC and static analyzers.
>
> Reported-by: Stefan Weil <sw@weilnetz.de>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  hw/block/pflash_cfi02.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c
> index f68837a449..42886f6af5 100644
> --- a/hw/block/pflash_cfi02.c
> +++ b/hw/block/pflash_cfi02.c
> @@ -577,7 +577,7 @@ static void pflash_write(void *opaque, hwaddr offset, uint64_t value,
>                  pfl->cmd = 0x98;
>                  return;
>              }
> -            /* No break here */
> +            /* fall through */
>          default:
>              DPRINTF("%s: invalid write for command %02x\n",
>                      __func__, pfl->cmd);
> --

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM
Philippe Mathieu-Daudé July 22, 2019, 11:43 a.m. UTC | #2
On 7/19/19 3:14 PM, Philippe Mathieu-Daudé wrote:
> GCC9 is confused by this comment when building with CFLAG
> -Wimplicit-fallthrough=2:
> 
>   hw/block/pflash_cfi02.c: In function ‘pflash_write’:
>   hw/block/pflash_cfi02.c:574:16: error: this statement may fall through [-Werror=implicit-fallthrough=]
>     574 |             if (boff == 0x55 && cmd == 0x98) {
>         |                ^
>   hw/block/pflash_cfi02.c:581:9: note: here
>     581 |         default:
>         |         ^~~~~~~
>   cc1: all warnings being treated as errors
> 
> Rewrite the comment using 'fall through' which is recognized by
> GCC and static analyzers.
> 
> Reported-by: Stefan Weil <sw@weilnetz.de>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  hw/block/pflash_cfi02.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c
> index f68837a449..42886f6af5 100644
> --- a/hw/block/pflash_cfi02.c
> +++ b/hw/block/pflash_cfi02.c
> @@ -577,7 +577,7 @@ static void pflash_write(void *opaque, hwaddr offset, uint64_t value,
>                  pfl->cmd = 0x98;
>                  return;
>              }
> -            /* No break here */
> +            /* fall through */
>          default:
>              DPRINTF("%s: invalid write for command %02x\n",
>                      __func__, pfl->cmd);
> 

Queued to pflash/next, thanks.
John Snow July 25, 2019, 12:27 a.m. UTC | #3
On 7/22/19 7:43 AM, Philippe Mathieu-Daudé wrote:
> On 7/19/19 3:14 PM, Philippe Mathieu-Daudé wrote:
>> GCC9 is confused by this comment when building with CFLAG
>> -Wimplicit-fallthrough=2:
>>
>>   hw/block/pflash_cfi02.c: In function ‘pflash_write’:
>>   hw/block/pflash_cfi02.c:574:16: error: this statement may fall through [-Werror=implicit-fallthrough=]
>>     574 |             if (boff == 0x55 && cmd == 0x98) {
>>         |                ^
>>   hw/block/pflash_cfi02.c:581:9: note: here
>>     581 |         default:
>>         |         ^~~~~~~
>>   cc1: all warnings being treated as errors
>>
>> Rewrite the comment using 'fall through' which is recognized by
>> GCC and static analyzers.
>>
>> Reported-by: Stefan Weil <sw@weilnetz.de>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>>  hw/block/pflash_cfi02.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c
>> index f68837a449..42886f6af5 100644
>> --- a/hw/block/pflash_cfi02.c
>> +++ b/hw/block/pflash_cfi02.c
>> @@ -577,7 +577,7 @@ static void pflash_write(void *opaque, hwaddr offset, uint64_t value,
>>                  pfl->cmd = 0x98;
>>                  return;
>>              }
>> -            /* No break here */
>> +            /* fall through */
>>          default:
>>              DPRINTF("%s: invalid write for command %02x\n",
>>                      __func__, pfl->cmd);
>>
> 
> Queued to pflash/next, thanks.
> 

Are you queueing everything or just this one patch? It would be a little
inconvenient to split a series up like that.

(Most other maintainers will, I believe, expect that with an "ACK" or
similar that someone else will stage the series.)

--js
Philippe Mathieu-Daudé July 25, 2019, 10:59 a.m. UTC | #4
On 7/25/19 2:27 AM, John Snow wrote:
> On 7/22/19 7:43 AM, Philippe Mathieu-Daudé wrote:
>> On 7/19/19 3:14 PM, Philippe Mathieu-Daudé wrote:
>>> GCC9 is confused by this comment when building with CFLAG
>>> -Wimplicit-fallthrough=2:
>>>
>>>   hw/block/pflash_cfi02.c: In function ‘pflash_write’:
>>>   hw/block/pflash_cfi02.c:574:16: error: this statement may fall through [-Werror=implicit-fallthrough=]
>>>     574 |             if (boff == 0x55 && cmd == 0x98) {
>>>         |                ^
>>>   hw/block/pflash_cfi02.c:581:9: note: here
>>>     581 |         default:
>>>         |         ^~~~~~~
>>>   cc1: all warnings being treated as errors
>>>
>>> Rewrite the comment using 'fall through' which is recognized by
>>> GCC and static analyzers.
>>>
>>> Reported-by: Stefan Weil <sw@weilnetz.de>
>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>>> ---
>>>  hw/block/pflash_cfi02.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c
>>> index f68837a449..42886f6af5 100644
>>> --- a/hw/block/pflash_cfi02.c
>>> +++ b/hw/block/pflash_cfi02.c
>>> @@ -577,7 +577,7 @@ static void pflash_write(void *opaque, hwaddr offset, uint64_t value,
>>>                  pfl->cmd = 0x98;
>>>                  return;
>>>              }
>>> -            /* No break here */
>>> +            /* fall through */
>>>          default:
>>>              DPRINTF("%s: invalid write for command %02x\n",
>>>                      __func__, pfl->cmd);
>>>
>>
>> Queued to pflash/next, thanks.
>>
> 
> Are you queueing everything or just this one patch? It would be a little
> inconvenient to split a series up like that.

Oops I simply queued this particular one.

> (Most other maintainers will, I believe, expect that with an "ACK" or
> similar that someone else will stage the series.)

I thought these are not critical bugfixes for 4.1, but since I had to do
a pull request for pflash, I could include it. (I already noticed
maintainers queueing particular patches from cleanup series).

Next time I'll ping/wait.

Regards,

Phil.
diff mbox series

Patch

diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c
index f68837a449..42886f6af5 100644
--- a/hw/block/pflash_cfi02.c
+++ b/hw/block/pflash_cfi02.c
@@ -577,7 +577,7 @@  static void pflash_write(void *opaque, hwaddr offset, uint64_t value,
                 pfl->cmd = 0x98;
                 return;
             }
-            /* No break here */
+            /* fall through */
         default:
             DPRINTF("%s: invalid write for command %02x\n",
                     __func__, pfl->cmd);