diff mbox series

tests/test-char: Use a proper fallthrough comment

Message ID 20201002171343.283426-1-thuth@redhat.com
State New
Headers show
Series tests/test-char: Use a proper fallthrough comment | expand

Commit Message

Thomas Huth Oct. 2, 2020, 5:13 p.m. UTC
For being able to compile with -Werror=implicit-fallthrough we need
to use comments that the compiler recognizes. Use "fallthrough" instead
of "no break" here.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 tests/test-char.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Marc-André Lureau Oct. 2, 2020, 5:16 p.m. UTC | #1
On Fri, Oct 2, 2020 at 9:14 PM Thomas Huth <thuth@redhat.com> wrote:

> For being able to compile with -Werror=implicit-fallthrough we need
> to use comments that the compiler recognizes. Use "fallthrough" instead
> of "no break" here.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

---
>  tests/test-char.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tests/test-char.c b/tests/test-char.c
> index d35cc839bc..9196e566e9 100644
> --- a/tests/test-char.c
> +++ b/tests/test-char.c
> @@ -70,7 +70,7 @@ static void fe_event(void *opaque, QEMUChrEvent event)
>              h->openclose_mismatch = true;
>          }
>          h->is_open = new_open_state;
> -        /* no break */
> +        /* fallthrough */
>      default:
>          quit = true;
>          break;
> --
> 2.18.2
>
>
>
Philippe Mathieu-Daudé Oct. 2, 2020, 5:22 p.m. UTC | #2
On 10/2/20 7:13 PM, Thomas Huth wrote:
> For being able to compile with -Werror=implicit-fallthrough we need
> to use comments that the compiler recognizes. Use "fallthrough" instead
> of "no break" here.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  tests/test-char.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/test-char.c b/tests/test-char.c
> index d35cc839bc..9196e566e9 100644
> --- a/tests/test-char.c
> +++ b/tests/test-char.c
> @@ -70,7 +70,7 @@ static void fe_event(void *opaque, QEMUChrEvent event)
>              h->openclose_mismatch = true;
>          }
>          h->is_open = new_open_state;
> -        /* no break */
> +        /* fallthrough */
>      default:
>          quit = true;
>          break;
> 

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Laurent Vivier Oct. 12, 2020, 2:12 p.m. UTC | #3
Le 02/10/2020 à 19:13, Thomas Huth a écrit :
> For being able to compile with -Werror=implicit-fallthrough we need

> to use comments that the compiler recognizes. Use "fallthrough" instead

> of "no break" here.

> 

> Signed-off-by: Thomas Huth <thuth@redhat.com>

> ---

>  tests/test-char.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/tests/test-char.c b/tests/test-char.c

> index d35cc839bc..9196e566e9 100644

> --- a/tests/test-char.c

> +++ b/tests/test-char.c

> @@ -70,7 +70,7 @@ static void fe_event(void *opaque, QEMUChrEvent event)

>              h->openclose_mismatch = true;

>          }

>          h->is_open = new_open_state;

> -        /* no break */

> +        /* fallthrough */

>      default:

>          quit = true;

>          break;

> 


Applied to my trivial-patches branch.

Thanks,
Laurent
diff mbox series

Patch

diff --git a/tests/test-char.c b/tests/test-char.c
index d35cc839bc..9196e566e9 100644
--- a/tests/test-char.c
+++ b/tests/test-char.c
@@ -70,7 +70,7 @@  static void fe_event(void *opaque, QEMUChrEvent event)
             h->openclose_mismatch = true;
         }
         h->is_open = new_open_state;
-        /* no break */
+        /* fallthrough */
     default:
         quit = true;
         break;