[meta-virtualization] [PATCH] spice: Fix compile errors from gcc 7 with spice 0.12.4

Jason Wessel jason.wessel at windriver.com
Fri Mar 2 13:46:11 PST 2018


../../git/server/red_parse_qxl.c:367:18: error: 'BITMAP_FMT_IS_RGB' defined but not used [-Werror=unused-const-variable=]
 static const int BITMAP_FMT_IS_RGB[] = {0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1};
                  ^~~~~~~~~~~~~~~~~
../../git/server/inputs_channel.c: In function 'inputs_channel_handle_parsed':
../../git/server/inputs_channel.c:317:38: error: this statement may fall through [-Werror=implicit-fallthrough=]
     case SPICE_MSGC_INPUTS_KEY_DOWN: {
                                      ^
../../git/server/inputs_channel.c:324:5: note: here
     case SPICE_MSGC_INPUTS_KEY_UP: {
     ^~~~
../../git/server/reds.c: In function 'vdi_port_read_one_msg_from_device':
../../git/server/reds.c:797:31: error: this statement may fall through [-Werror=implicit-fallthrough=]
             state->read_state = VDI_PORT_READ_STATE_GET_BUFF;
             ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../git/server/reds.c:798:9: note: here
         case VDI_PORT_READ_STATE_GET_BUFF: {
         ^~~~
../../git/server/reds.c:807:31: error: this statement may fall through [-Werror=implicit-fallthrough=]
             state->read_state = VDI_PORT_READ_STATE_READ_DATA;
             ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../git/server/reds.c:809:9: note: here
         case VDI_PORT_READ_STATE_READ_DATA:
         ^~~~

This patch just adds the fallthrough comments which are already
checked in upstream along with the removal of the static variable
which is not used.

The newer versions of spice already have this fixed, so there is no
need to further upstream this patch.  It gets dropped in the future.

Signed-off-by: Jason Wessel <jason.wessel at windriver.com>
---
 ...ompile-problems-against-spice-0.12.4-with.patch | 88 ++++++++++++++++++++++
 recipes-support/spice/spice_git.bb                 |  1 +
 2 files changed, 89 insertions(+)
 create mode 100644 recipes-support/spice/files/v0.12.4_0001-spice-Fix-compile-problems-against-spice-0.12.4-with.patch

diff --git a/recipes-support/spice/files/v0.12.4_0001-spice-Fix-compile-problems-against-spice-0.12.4-with.patch b/recipes-support/spice/files/v0.12.4_0001-spice-Fix-compile-problems-against-spice-0.12.4-with.patch
new file mode 100644
index 0000000..cd5eb85
--- /dev/null
+++ b/recipes-support/spice/files/v0.12.4_0001-spice-Fix-compile-problems-against-spice-0.12.4-with.patch
@@ -0,0 +1,88 @@
+From 26ae6be2c1ac03e6ea017f58d0b126c9eebae5f9 Mon Sep 17 00:00:00 2001
+From: Jason Wessel <jason.wessel at windriver.com>
+Date: Fri, 2 Mar 2018 10:47:09 -0600
+Subject: [PATCH] spice: Fix compile problems against spice 0.12.4 with gcc 7
+
+These errors are generated by gcc 7.
+
+../../git/server/red_parse_qxl.c:367:18: error: 'BITMAP_FMT_IS_RGB' defined but not used [-Werror=unused-const-variable=]
+ static const int BITMAP_FMT_IS_RGB[] = {0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1};
+                  ^~~~~~~~~~~~~~~~~
+../../git/server/inputs_channel.c: In function 'inputs_channel_handle_parsed':
+../../git/server/inputs_channel.c:317:38: error: this statement may fall through [-Werror=implicit-fallthrough=]
+     case SPICE_MSGC_INPUTS_KEY_DOWN: {
+                                      ^
+../../git/server/inputs_channel.c:324:5: note: here
+     case SPICE_MSGC_INPUTS_KEY_UP: {
+     ^~~~
+../../git/server/reds.c: In function 'vdi_port_read_one_msg_from_device':
+../../git/server/reds.c:797:31: error: this statement may fall through [-Werror=implicit-fallthrough=]
+             state->read_state = VDI_PORT_READ_STATE_GET_BUFF;
+             ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+../../git/server/reds.c:798:9: note: here
+         case VDI_PORT_READ_STATE_GET_BUFF: {
+         ^~~~
+../../git/server/reds.c:807:31: error: this statement may fall through [-Werror=implicit-fallthrough=]
+             state->read_state = VDI_PORT_READ_STATE_READ_DATA;
+             ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+../../git/server/reds.c:809:9: note: here
+         case VDI_PORT_READ_STATE_READ_DATA:
+         ^~~~
+
+This patch just adds the fallthrough comments which are already
+checked in upstream along with the removal of the static variable
+which is not used.
+---
+ server/inputs_channel.c | 1 +
+ server/red_parse_qxl.c  | 4 ----
+ server/reds.c           | 2 ++
+ spice-common            | 2 +-
+ 4 files changed, 4 insertions(+), 5 deletions(-)
+
+diff --git a/server/inputs_channel.c b/server/inputs_channel.c
+index 931dac1..d6805c4 100644
+--- a/server/inputs_channel.c
++++ b/server/inputs_channel.c
+@@ -321,6 +321,7 @@ static int inputs_channel_handle_parsed(RedChannelClient *rcc, uint32_t size, ui
+             activate_modifiers_watch();
+         }
+     }
++    /* fallthrough */
+     case SPICE_MSGC_INPUTS_KEY_UP: {
+         SpiceMsgcKeyDown *key_down = (SpiceMsgcKeyDown *)buf;
+         for (i = 0; i < 4; i++) {
+diff --git a/server/red_parse_qxl.c b/server/red_parse_qxl.c
+index 6c0b065..c361e6b 100644
+--- a/server/red_parse_qxl.c
++++ b/server/red_parse_qxl.c
+@@ -362,10 +362,6 @@ static int bitmap_consistent(SpiceBitmap *bitmap)
+     return TRUE;
+ }
+ 
+-// This is based on SPICE_BITMAP_FMT_*, copied from server/red_worker.c
+-// to avoid a possible unoptimization from making it non static.
+-static const int BITMAP_FMT_IS_RGB[] = {0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1};
+-
+ static SpiceImage *red_get_image(RedMemSlotInfo *slots, int group_id,
+                                  QXLPHYSICAL addr, uint32_t flags, int is_mask)
+ {
+diff --git a/server/reds.c b/server/reds.c
+index 6f262b0..4246170 100644
+--- a/server/reds.c
++++ b/server/reds.c
+@@ -795,6 +795,7 @@ static SpiceCharDeviceMsgToClient *vdi_port_read_one_msg_from_device(SpiceCharDe
+             }
+             state->message_recive_len = state->vdi_chunk_header.size;
+             state->read_state = VDI_PORT_READ_STATE_GET_BUFF;
++            /* fallthrough */
+         case VDI_PORT_READ_STATE_GET_BUFF: {
+             if (!(state->current_read_buf = vdi_port_read_buf_get())) {
+                 return NULL;
+@@ -806,6 +807,7 @@ static SpiceCharDeviceMsgToClient *vdi_port_read_one_msg_from_device(SpiceCharDe
+             state->message_recive_len -= state->recive_len;
+             state->read_state = VDI_PORT_READ_STATE_READ_DATA;
+         }
++        /* fallthrough */
+         case VDI_PORT_READ_STATE_READ_DATA:
+             n = sif->read(vdagent, state->recive_pos, state->recive_len);
+             if (!n) {
diff --git a/recipes-support/spice/spice_git.bb b/recipes-support/spice/spice_git.bb
index 828087a..ac30de9 100644
--- a/recipes-support/spice/spice_git.bb
+++ b/recipes-support/spice/spice_git.bb
@@ -35,6 +35,7 @@ SRC_URI += " \
         file://spice-fix-CVE-2013-4282.patch \
         file://configure.ac-add-subdir-objects-to-AM_INIT_AUTOMAKE.patch \
         file://build-allow-separated-src-and-build-dirs.patch \
+        file://v0.12.4_0001-spice-Fix-compile-problems-against-spice-0.12.4-with.patch \
         "
 
 S = "${WORKDIR}/git"
-- 
2.7.4



More information about the meta-virtualization mailing list