[PATCH-for-4.1?,6/7] vl: Rewrite a fall through comment
diff mbox series

Message ID 20190719131425.10835-7-philmd@redhat.com
State New
Headers show
Series
  • Trivial switch 'fall through' comment fixes for GCC9
Related show

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:

  vl.c: In function ‘qemu_ref_timedate’:
  vl.c:773:15: error: this statement may fall through [-Werror=implicit-fallthrough=]
    773 |         value -= rtc_realtime_clock_offset;
        |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
  vl.c:775:5: note: here
    775 |     case QEMU_CLOCK_VIRTUAL:
        |     ^~~~
  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>
---
 vl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

John Snow July 25, 2019, 12:28 a.m. UTC | #1
On 7/19/19 9:14 AM, Philippe Mathieu-Daudé wrote:
> GCC9 is confused by this comment when building with CFLAG
> -Wimplicit-fallthrough=2:
> 
>   vl.c: In function ‘qemu_ref_timedate’:
>   vl.c:773:15: error: this statement may fall through [-Werror=implicit-fallthrough=]
>     773 |         value -= rtc_realtime_clock_offset;
>         |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   vl.c:775:5: note: here
>     775 |     case QEMU_CLOCK_VIRTUAL:
>         |     ^~~~
>   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>
> ---
>  vl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/vl.c b/vl.c
> index a5808f9a02..f5cf71e3b4 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -771,7 +771,7 @@ static time_t qemu_ref_timedate(QEMUClockType clock)
>      switch (clock) {
>      case QEMU_CLOCK_REALTIME:
>          value -= rtc_realtime_clock_offset;
> -        /* no break */
> +        /* fall through */
>      case QEMU_CLOCK_VIRTUAL:
>          value += rtc_ref_start_datetime;
>          break;
> 

Reviewed-by: John Snow <jsnow@redhat.com>
Laurent Vivier Aug. 21, 2019, 8:58 a.m. UTC | #2
Le 19/07/2019 à 15:14, Philippe Mathieu-Daudé a écrit :
> GCC9 is confused by this comment when building with CFLAG
> -Wimplicit-fallthrough=2:
> 
>   vl.c: In function ‘qemu_ref_timedate’:
>   vl.c:773:15: error: this statement may fall through [-Werror=implicit-fallthrough=]
>     773 |         value -= rtc_realtime_clock_offset;
>         |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   vl.c:775:5: note: here
>     775 |     case QEMU_CLOCK_VIRTUAL:
>         |     ^~~~
>   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>
> ---
>  vl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/vl.c b/vl.c
> index a5808f9a02..f5cf71e3b4 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -771,7 +771,7 @@ static time_t qemu_ref_timedate(QEMUClockType clock)
>      switch (clock) {
>      case QEMU_CLOCK_REALTIME:
>          value -= rtc_realtime_clock_offset;
> -        /* no break */
> +        /* fall through */
>      case QEMU_CLOCK_VIRTUAL:
>          value += rtc_ref_start_datetime;
>          break;
> 

Applied to my trivial-patches branch.

Thanks,
Laurent

Patch
diff mbox series

diff --git a/vl.c b/vl.c
index a5808f9a02..f5cf71e3b4 100644
--- a/vl.c
+++ b/vl.c
@@ -771,7 +771,7 @@  static time_t qemu_ref_timedate(QEMUClockType clock)
     switch (clock) {
     case QEMU_CLOCK_REALTIME:
         value -= rtc_realtime_clock_offset;
-        /* no break */
+        /* fall through */
     case QEMU_CLOCK_VIRTUAL:
         value += rtc_ref_start_datetime;
         break;