Skip to contentSkip to conversation

audio: Add missing fall through comments

PATCH In review Stefan Weil 5 participants 6 messages Jul 18, 2019 – Aug 13, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 audio: Add missing fall through comments

---
 audio/audio.c | 2 ++
 1 file changed, 2 insertions(+)
audio/audio.c +2 -0
index 5fd9a58a80..a7a13e900a 100644
@@ -304,6 +304,7 @@ void audio_pcm_init_info (struct audio_pcm_info *info, struct audsettings *as)
 
     case AUDIO_FORMAT_S16:
         sign = 1;
+        /* fall through */
     case AUDIO_FORMAT_U16:
         bits = 16;
         shift = 1;
@@ -311,6 +312,7 @@ void audio_pcm_init_info (struct audio_pcm_info *info, struct audsettings *as)
 
     case AUDIO_FORMAT_S32:
         sign = 1;
+        /* fall through */
     case AUDIO_FORMAT_U32:
         bits = 32;
         shift = 2;
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 2 lines · Stefan Weil
Quoted 28 lines
---
 audio/audio.c | 2 ++
 1 file changed, 2 insertions(+)
audio/audio.c +2 -1
index 5fd9a58a80..a7a13e900a 100644
@@ -304,6 +304,7 @@ void audio_pcm_init_info (struct audio_pcm_info *info, struct audsettings *as)
 
     case AUDIO_FORMAT_S16:
         sign = 1;
+        /* fall through */
     case AUDIO_FORMAT_U16:
         bits = 16;
         shift = 1;
@@ -311,6 +312,7 @@ void audio_pcm_init_info (struct audio_pcm_info *info, struct audsettings *as)
 
     case AUDIO_FORMAT_S32:
         sign = 1;
+        /* fall through */
     case AUDIO_FORMAT_U32:
         bits = 32;
         shift = 2;
--

2.20.1

Signature · 1 line
Marc-André Lureau
Reviewed-by Tested-by on v1 1/1
#2 lore raw
In reply to Stefan Weil
Quoted 1 line · Stefan Weil
Quoted 25 lines
---
 audio/audio.c | 2 ++
 1 file changed, 2 insertions(+)
audio/audio.c +2 -0
index 5fd9a58a80..a7a13e900a 100644
@@ -304,6 +304,7 @@ void audio_pcm_init_info (struct audio_pcm_info *info, struct audsettings *as)
 
     case AUDIO_FORMAT_S16:
         sign = 1;
+        /* fall through */
     case AUDIO_FORMAT_U16:
         bits = 16;
         shift = 1;
@@ -311,6 +312,7 @@ void audio_pcm_init_info (struct audio_pcm_info *info, struct audsettings *as)
 
     case AUDIO_FORMAT_S32:
         sign = 1;
+        /* fall through */
     case AUDIO_FORMAT_U32:
         bits = 32;
         shift = 2;
#3 lore raw
Quoted 7 lines · Philippe Mathieu-Daudé
Quoted 1 line · Stefan Weil

Philippe, how do you test these comments?

Yours, Aleksandar

Quoted 9 lines

audio/audio.c void audio_pcm_init_info (struct audio_pcm_info

Quoted 9 lines
---
 audio/audio.c | 2 ++
 1 file changed, 2 insertions(+)
audio/audio.c +0 -0
index 5fd9a58a80..a7a13e900a 100644
@@ -304,6 +304,7 @@ void audio_pcm_init_info (struct audio_pcm_info

*info, struct audsettings *as)

Quoted 8 lines

audio/audio.c void audio_pcm_init_info (struct audio_pcm_info

Quoted 8 lines
audio/audio.c +1 -0
     case AUDIO_FORMAT_S16:
         sign = 1;
+        /* fall through */
     case AUDIO_FORMAT_U16:
         bits = 16;
         shift = 1;
@@ -311,6 +312,7 @@ void audio_pcm_init_info (struct audio_pcm_info

*info, struct audsettings *as)

Quoted 9 lines
Quoted 8 lines
audio/audio.c +1 -0
     case AUDIO_FORMAT_S32:
         sign = 1;
+        /* fall through */
     case AUDIO_FORMAT_U32:
         bits = 32;
         shift = 2;
 
#4 lore raw
Quoted 7 lines · Aleksandar Markovic
Quoted 4 lines · On Jul 19, 2019 9:30 AM, "Philippe Mathieu-Daudé" <[email protected]…
Quoted 1 line · Stefan Weil
Signed-off-by Stefan Weil <[email protected] <mailto:[email protected]>>
Quoted 7 lines
Quoted 1 line

<mailto:[email protected]>>

Quoted 1 line

<mailto:[email protected]>>

Quoted 1 line

Philippe, how do you test these comments?

The testing is quite easy since it doesn't build with '-Wimplicit-fallthrough=2':

CC audio/audio.o
/home/phil/source/qemu/audio/audio.c: In function ‘audio_pcm_init_info’:
/home/phil/source/qemu/audio/audio.c:308:14: error: this statement may fall through [-Werror=implicit-fallthrough=]

  308 |         sign = 1;
      |         ~~~~~^~~
/home/phil/source/qemu/audio/audio.c:309:5: note: here
  309 |     case AUDIO_FORMAT_U16:
      |     ^~~~
/home/phil/source/qemu/audio/audio.c:315:14: error: this statement may
fall through [-Werror=implicit-fallthrough=]
  315 |         sign = 1;
      |         ~~~~~^~~
/home/phil/source/qemu/audio/audio.c:316:5: note: here
  316 |     case AUDIO_FORMAT_U32:
      |     ^~~~

cc1: all warnings being treated as errors

With Stefan patch applied:

  CC      audio/audio.o
  CC      audio/audio_legacy.o
  CC      audio/noaudio.o
  CC      audio/wavaudio.o
  CC      audio/mixeng.o
  CC      audio/spiceaudio.o
  CC      audio/wavcapture.o

[...]

Quoted 32 lines

Yours, Aleksandar

Quoted 9 lines

audio/audio.c void audio_pcm_init_info (struct audio_pcm_info

Quoted 9 lines

---
  audio/audio.c | 2 ++

  1 file changed, 2 insertions(+)
audio/audio.c +0 -0
index 5fd9a58a80..a7a13e900a 100644
@@ -304,6 +304,7 @@ void audio_pcm_init_info (struct audio_pcm_info

*info, struct audsettings *as)

Quoted 8 lines

audio/audio.c void audio_pcm_init_info (struct audio_pcm_info

Quoted 8 lines


      case AUDIO_FORMAT_S16:
          sign = 1;
+        /* fall through */
      case AUDIO_FORMAT_U16:
          bits = 16;
          shift = 1;

audio/audio.c +0 -0
@@ -311,6 +312,7 @@ void audio_pcm_init_info (struct audio_pcm_info

*info, struct audsettings *as)

Quoted 9 lines
Quoted 8 lines


      case AUDIO_FORMAT_S32:
          sign = 1;
+        /* fall through */
      case AUDIO_FORMAT_U32:
          bits = 32;
          shift = 2;