[Spice-devel] [PATCH spice] Add "fall through" comments where necessary

Victor Toso victortoso at redhat.com
Tue Apr 11 06:39:34 UTC 2017


Hey,

Now on Fedora 26 too :)

On Thu, Feb 09, 2017 at 06:09:53AM -0500, Frediano Ziglio wrote:
> >
> > Make gcc 7.0.1 happy
> > ---
> > I am unable to compile using defaults on Fedora 26
>
> Looking at https://gcc.gnu.org/ looks like 7.0 is in development.
> I would prefer you disable the warnings and wait for a final release.
>
> OT (nothing personal):
> Maybe we are enabling too much warning? Is not possible that
> every week somebody came with patches fixing warnings of this
> or that compiler version.

As Pavel said, it is default now on -Wall. Attached patched removes the
warning but IMHO this warnings seems useful enough to keep and fixed -
Pavel patch works great for that.

Cheers,

>
> > ---
> >  server/dcc.c            | 3 ++-
> >  server/inputs-channel.c | 2 +-
> >  server/reds.c           | 2 ++
> >  3 files changed, 5 insertions(+), 2 deletions(-)
> > 
> > diff --git a/server/dcc.c b/server/dcc.c
> > index afe37b1a..7c3d3765 100644
> > --- a/server/dcc.c
> > +++ b/server/dcc.c
> > @@ -885,8 +885,9 @@ int dcc_compress_image(DisplayChannelClient *dcc,
> >              break;
> >          }
> >  #endif
> > -lz_compress:
> > +        /* fall through */
> >      case SPICE_IMAGE_COMPRESSION_LZ:
> > +lz_compress:
> >          success = image_encoders_compress_lz(&dcc->priv->encoders, dest,
> >          src, o_comp_data);
> >          if (success && !bitmap_fmt_is_rgb(src->format)) {
> >              dcc_palette_cache_palette(dcc, dest->u.lz_plt.palette,
> >              &(dest->u.lz_plt.flags));
> > diff --git a/server/inputs-channel.c b/server/inputs-channel.c
> > index f105b4d0..0fb4d949 100644
> > --- a/server/inputs-channel.c
> > +++ b/server/inputs-channel.c
> > @@ -295,8 +295,8 @@ static int inputs_channel_handle_parsed(RedChannelClient
> > *rcc, uint32_t size, ui
> >              key_down->code == SCROLL_LOCK_SCAN_CODE) {
> >              activate_modifiers_watch(inputs_channel, reds);
> >          }
> > -        /* fallthrough */
> >      }
> > +        /* fallthrough */
> >      case SPICE_MSGC_INPUTS_KEY_UP: {
> >          SpiceMsgcKeyUp *key_up = message;
> >          for (i = 0; i < 4; i++) {
> > diff --git a/server/reds.c b/server/reds.c
> > index 953a95a4..bd24741b 100644
> > --- a/server/reds.c
> > +++ b/server/reds.c
> > @@ -766,6 +766,7 @@ static RedPipeItem
> > *vdi_port_read_one_msg_from_device(RedCharDevice *self,
> >              }
> >              dev->priv->message_receive_len =
> >              dev->priv->vdi_chunk_header.size;
> >              dev->priv->read_state = VDI_PORT_READ_STATE_GET_BUFF;
> > +            /* fall through */
> >          case VDI_PORT_READ_STATE_GET_BUFF: {
> >              if (!(dev->priv->current_read_buf =
> >              vdi_port_get_read_buf(reds->agent_dev))) {
> >                  return NULL;
> > @@ -777,6 +778,7 @@ static RedPipeItem
> > *vdi_port_read_one_msg_from_device(RedCharDevice *self,
> >              dev->priv->message_receive_len -= dev->priv->receive_len;
> >              dev->priv->read_state = VDI_PORT_READ_STATE_READ_DATA;
> >          }
> > +            /* fall through */
> >          case VDI_PORT_READ_STATE_READ_DATA: {
> >              n = sif->read(reds->vdagent, dev->priv->receive_pos,
> >              dev->priv->receive_len);
> >              if (!n) {
> 
> Frediano
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
From 202de1135ce3640eacfe4202a77139545be700b0 Mon Sep 17 00:00:00 2001
From: Victor Toso <me at victortoso.com>
Date: Tue, 11 Apr 2017 08:26:32 +0200
Subject: [PATCH] m4/spice-compile-warnings: Disable implicit-fallthrough

Signed-off-by: Victor Toso <victortoso at redhat.com>
---
 m4/spice-compile-warnings.m4 | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/m4/spice-compile-warnings.m4 b/m4/spice-compile-warnings.m4
index 5a601209..a2544a84 100644
--- a/m4/spice-compile-warnings.m4
+++ b/m4/spice-compile-warnings.m4
@@ -92,6 +92,10 @@ AC_DEFUN([SPICE_COMPILE_WARNINGS],[
     # signature
     gl_WARN_ADD([-Wno-format-nonliteral])
 
+    # implicit-fallthrough was included in -Wall In gcc 7.0.1
+    # which is default in Fedora 26
+    gl_WARN_ADD([-Wno-implicit-fallthrough])
+
     # This should be < 1024 really. pixman_utils is the blackspot
     # preventing lower usage
     gl_WARN_ADD([-Wframe-larger-than=20460])
-- 
2.12.2



More information about the Spice-devel mailing list