diff mbox series

[2/3] hw/timer/sh_timer: Silence warnings about missing fallthrough statements

Message ID 20201020153935.54315-3-thuth@redhat.com (mailing list archive)
State New, archived
Headers show
Series sh4: Trivial clean-ups for sh_timer.c | expand

Commit Message

Thomas Huth Oct. 20, 2020, 3:39 p.m. UTC
When compiling with -Werror=implicit-fallthrough, gcc complains about
missing fallthrough annotations in this file. Looking at the code,
the fallthrough is very likely intended here, so add some comments
to silence the compiler warnings.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 hw/timer/sh_timer.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Philippe Mathieu-Daudé Oct. 24, 2020, 8:10 p.m. UTC | #1
On 10/20/20 5:39 PM, Thomas Huth wrote:
> When compiling with -Werror=implicit-fallthrough, gcc complains about
> missing fallthrough annotations in this file. Looking at the code,
> the fallthrough is very likely intended here, so add some comments
> to silence the compiler warnings.
> 

Fixes: cd1a3f6840e ("Stand-alone TMU emulation code")

> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>   hw/timer/sh_timer.c | 4 ++++
>   1 file changed, 4 insertions(+)

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
diff mbox series

Patch

diff --git a/hw/timer/sh_timer.c b/hw/timer/sh_timer.c
index b09e30f938..934daaa7dc 100644
--- a/hw/timer/sh_timer.c
+++ b/hw/timer/sh_timer.c
@@ -122,6 +122,7 @@  static void sh_timer_write(void *opaque, hwaddr offset,
             if (s->feat & TIMER_FEAT_EXTCLK) {
                 break;
             }
+            /* fallthrough */
         default:
             hw_error("sh_timer_write: Reserved TPSC value\n");
             break;
@@ -135,6 +136,7 @@  static void sh_timer_write(void *opaque, hwaddr offset,
             if (s->feat & TIMER_FEAT_EXTCLK) {
                 break;
             }
+            /* fallthrough */
         default:
             hw_error("sh_timer_write: Reserved CKEG value\n");
             break;
@@ -147,6 +149,7 @@  static void sh_timer_write(void *opaque, hwaddr offset,
             if (s->feat & TIMER_FEAT_CAPT) {
                 break;
             }
+            /* fallthrough */
         default:
             hw_error("sh_timer_write: Reserved ICPE value\n");
             break;
@@ -180,6 +183,7 @@  static void sh_timer_write(void *opaque, hwaddr offset,
             s->tcpr = value;
             break;
         }
+        /* fallthrough */
     default:
         hw_error("sh_timer_write: Bad offset %x\n", (int)offset);
     }