[PATCH 1/6] audio/audio: Add missing fall through comment

Philippe Mathieu-Daudé posted 6 patches 6 years, 1 month ago
Maintainers: Kevin Wolf <kwolf@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Joel Stanley <joel@jms.id.au>, Gerd Hoffmann <kraxel@redhat.com>, Peter Chubb <peter.chubb@nicta.com.au>, Andrew Jeffery <andrew@aj.id.au>, Hannes Reinecke <hare@suse.com>, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Peter Maydell <peter.maydell@linaro.org>, Jason Wang <jasowang@redhat.com>, Fam Zheng <fam@euphon.net>, "Cédric Le Goater" <clg@kaod.org>, Max Reitz <mreitz@redhat.com>
There is a newer version of this series
[PATCH 1/6] audio/audio: Add missing fall through comment
Posted by Philippe Mathieu-Daudé 6 years, 1 month ago
GCC9 is confused by this comment when building with
CFLAG -Wimplicit-fallthrough=2:

  audio/audio.c: In function ‘audio_pcm_init_info’:
  audio/audio.c:306:14: error: this statement may fall through [-Werror=implicit-fallthrough=]
    306 |         sign = 1;
        |         ~~~~~^~~
  audio/audio.c:307:5: note: here
    307 |     case AUDIO_FORMAT_U8:
        |     ^~~~
  cc1: all warnings being treated as errors

Add the missing fall through comment, similarly to e46349414.

Fixes: 2b9cce8c8c
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: "Kővágó, Zoltán" <dirty.ice.hu@gmail.com>
---
 audio/audio.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/audio/audio.c b/audio/audio.c
index 56fae55047..57daf3f620 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -304,6 +304,7 @@ void audio_pcm_init_info (struct audio_pcm_info *info, struct audsettings *as)
     switch (as->fmt) {
     case AUDIO_FORMAT_S8:
         sign = 1;
+        /* fall through */
     case AUDIO_FORMAT_U8:
         mul = 1;
         break;
-- 
2.21.0


Re: [PATCH 1/6] audio/audio: Add missing fall through comment
Posted by Richard Henderson 6 years, 1 month ago
On 12/17/19 7:34 AM, Philippe Mathieu-Daudé wrote:
> GCC9 is confused by this comment when building with
> CFLAG -Wimplicit-fallthrough=2:
> 
>   audio/audio.c: In function ‘audio_pcm_init_info’:
>   audio/audio.c:306:14: error: this statement may fall through [-Werror=implicit-fallthrough=]
>     306 |         sign = 1;
>         |         ~~~~~^~~
>   audio/audio.c:307:5: note: here
>     307 |     case AUDIO_FORMAT_U8:
>         |     ^~~~
>   cc1: all warnings being treated as errors
> 
> Add the missing fall through comment, similarly to e46349414.
...
> diff --git a/audio/audio.c b/audio/audio.c
> index 56fae55047..57daf3f620 100644
> --- a/audio/audio.c
> +++ b/audio/audio.c
> @@ -304,6 +304,7 @@ void audio_pcm_init_info (struct audio_pcm_info *info, struct audsettings *as)
>      switch (as->fmt) {
>      case AUDIO_FORMAT_S8:
>          sign = 1;
> +        /* fall through */
>      case AUDIO_FORMAT_U8:
>          mul = 1;
>          break;

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


Re: [PATCH 1/6] audio/audio: Add missing fall through comment
Posted by Aleksandar Markovic 6 years, 1 month ago
On Tuesday, December 17, 2019, Philippe Mathieu-Daudé <philmd@redhat.com>
wrote:

> GCC9 is confused by this comment when building with
> CFLAG -Wimplicit-fallthrough=2:
>
>
Gcc is not confused whatsoever.



>   audio/audio.c: In function ‘audio_pcm_init_info’:
>   audio/audio.c:306:14: error: this statement may fall through
> [-Werror=implicit-fallthrough=]
>     306 |         sign = 1;
>         |         ~~~~~^~~
>   audio/audio.c:307:5: note: here
>     307 |     case AUDIO_FORMAT_U8:
>         |     ^~~~
>   cc1: all warnings being treated as errors
>
> Add the missing fall through comment, similarly to e46349414.
>
> Fixes: 2b9cce8c8c
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: "Kővágó, Zoltán" <dirty.ice.hu@gmail.com>
> ---
>  audio/audio.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/audio/audio.c b/audio/audio.c
> index 56fae55047..57daf3f620 100644
> --- a/audio/audio.c
> +++ b/audio/audio.c
> @@ -304,6 +304,7 @@ void audio_pcm_init_info (struct audio_pcm_info *info,
> struct audsettings *as)
>      switch (as->fmt) {
>      case AUDIO_FORMAT_S8:
>          sign = 1;
> +        /* fall through */
>      case AUDIO_FORMAT_U8:
>          mul = 1;
>          break;
> --
> 2.21.0
>
>
>
Re: [PATCH 1/6] audio/audio: Add missing fall through comment
Posted by Philippe Mathieu-Daudé 6 years, 1 month ago
On 12/18/19 9:02 AM, Aleksandar Markovic wrote:
> 
> 
> On Tuesday, December 17, 2019, Philippe Mathieu-Daudé <philmd@redhat.com 
> <mailto:philmd@redhat.com>> wrote:
> 
>     GCC9 is confused by this comment when building with
>     CFLAG -Wimplicit-fallthrough=2:
> 
> 
> Gcc is not confused whatsoever.

It is right! I'll update the description :)

> 
>        audio/audio.c: In function ‘audio_pcm_init_info’:
>        audio/audio.c:306:14: error: this statement may fall through
>     [-Werror=implicit-fallthrough=]
>          306 |         sign = 1;
>              |         ~~~~~^~~
>        audio/audio.c:307:5: note: here
>          307 |     case AUDIO_FORMAT_U8:
>              |     ^~~~
>        cc1: all warnings being treated as errors
> 
>     Add the missing fall through comment, similarly to e46349414.
> 
>     Fixes: 2b9cce8c8c
>     Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com
>     <mailto:philmd@redhat.com>>
>     ---
>     Cc: Gerd Hoffmann <kraxel@redhat.com <mailto:kraxel@redhat.com>>
>     Cc: "Kővágó, Zoltán" <dirty.ice.hu@gmail.com
>     <mailto:dirty.ice.hu@gmail.com>>
>     ---
>       audio/audio.c | 1 +
>       1 file changed, 1 insertion(+)
> 
>     diff --git a/audio/audio.c b/audio/audio.c
>     index 56fae55047..57daf3f620 100644
>     --- a/audio/audio.c
>     +++ b/audio/audio.c
>     @@ -304,6 +304,7 @@ void audio_pcm_init_info (struct audio_pcm_info
>     *info, struct audsettings *as)
>           switch (as->fmt) {
>           case AUDIO_FORMAT_S8:
>               sign = 1;
>     +        /* fall through */
>           case AUDIO_FORMAT_U8:
>               mul = 1;
>               break;
>     -- 
>     2.21.0
> 
>