Skip to contentSkip to conversation

Fix warnings (undeclared global symbols)

PATCH Applied Stefan Weil 2 participants 12 messages Feb 6, 2015 – Feb 8, 2015

lore
Share & tools
lore
#0 lore raw

cover Fix warnings (undeclared global symbols)

All warnings were reported by the Sparse static analysis tool.

[PATCH 01/10] disas/cris: Fix warning caused by missing 'static' [PATCH 02/10] disas/sh4: Fix warning caused by missing 'static' [PATCH 03/10] migration: Fix warning caused by missing declaration of [PATCH 04/10] migration: Fix warnings caused by missing 'static' [PATCH 05/10] moxie: Fix warning caused by missing include statement [PATCH 06/10] serial: Fix warnings caused by missing 'static' [PATCH 07/10] spice: Add missing 'static' attribute
[PATCH 08/10] stubs: Fix warning caused by missing include statement [PATCH 09/10] vga: Fix warning caused by missing 'static' attribute [PATCH 10/10] virtio: Fix warning caused by missing 'static'

#1 lore raw

PATCH 1/10 disas/cris: Fix warning caused by missing 'static' attribute

Warning from the Sparse static analysis tool:

disas/cris.c:1218:26: warning:
symbol 'cris_cond15s' was not declared. Should it be static?

---
 disas/cris.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
disas/cris.c +1 -1
index 9dfb4e3..a034dba 100644
@@ -1215,7 +1215,7 @@ cris_cc_strings[] =
 };
 
 /* Different names and semantics for condition 1111 (0xf).  */
-const struct cris_cond15 cris_cond15s[] =
+static const struct cris_cond15 cris_cond15s[] =
 {
   /* FIXME: In what version did condition "ext" disappear?  */
   {"ext", cris_ver_v0_3},
Signature · 1 line
2.1.4
#2 lore raw

PATCH 2/10 disas/sh4: Fix warning caused by missing 'static' attribute

In reply to Stefan Weil

Warning from the Sparse static analysis tool:

disas/sh4.c:335:22: warning:
symbol 'sh_table' was not declared. Should it be static?

---
 disas/sh4.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
disas/sh4.c +1 -1
index f6cadd5..020f5eb 100644
@@ -332,7 +332,7 @@ typedef struct
 
 #ifdef DEFINE_TABLE
 
-const sh_opcode_info sh_table[] =
+static const sh_opcode_info sh_table[] =
   {
 /* 0111nnnni8*1.... add #<imm>,<REG_N>  */{"add",{A_IMM,A_REG_N},{HEX_7,REG_N,IMM0_8}, arch_sh1_up},
 
Signature · 1 line
2.1.4
#3 lore raw

PATCH 3/10 migration: Fix warning caused by missing declaration of vmstate_dummy

In reply to Stefan Weil

Warning from the Sparse static analysis tool:

stubs/vmstate.c:4:26: warning:
symbol 'vmstate_dummy' was not declared. Should it be static?

Cc Juan Quintela <[email protected]>
Cc Amit Shah <[email protected]>
---
 include/migration/vmstate.h | 2 --
 1 file changed, 2 deletions(-)
include/migration/vmstate.h +0 -2
index 0b26bc6..c20f2d1 100644
@@ -139,9 +139,7 @@ struct VMStateDescription {
     const VMStateSubsection *subsections;
 };
 
-#ifdef CONFIG_USER_ONLY
 extern const VMStateDescription vmstate_dummy;
-#endif
 
 extern const VMStateInfo vmstate_info_bool;
 
Signature · 1 line
2.1.4
#4 lore raw

PATCH 4/10 migration: Fix warnings caused by missing 'static' attribute

In reply to Stefan Weil

Warnings from the Sparse static analysis tool:

migration-rdma.c:151:12: warning:
symbol 'wrid_desc' was not declared. Should it be static?
migration-rdma.c:190:12: warning:
symbol 'control_desc' was not declared. Should it be static?
migration-rdma.c:3301:19: warning:
symbol 'rdma_read_ops' was not declared. Should it be static?
migration-rdma.c:3308:19: warning:
symbol 'rdma_write_ops' was not declared. Should it be static?

Cc Juan Quintela <[email protected]>
Cc Amit Shah <[email protected]>
---
 migration/rdma.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
migration/rdma.c +4 -4
index fc351ea..589931a 100644
@@ -121,7 +121,7 @@ enum {
     RDMA_WRID_RECV_CONTROL = 4000,
 };
 
-const char *wrid_desc[] = {
+static const char *wrid_desc[] = {
     [RDMA_WRID_NONE] = "NONE",
     [RDMA_WRID_RDMA_WRITE] = "WRITE RDMA",
     [RDMA_WRID_SEND_CONTROL] = "CONTROL SEND",
@@ -160,7 +160,7 @@ enum {
     RDMA_CONTROL_UNREGISTER_FINISHED, /* unpinning finished */
 };
 
-const char *control_desc[] = {
+static const char *control_desc[] = {
     [RDMA_CONTROL_NONE] = "NONE",
     [RDMA_CONTROL_ERROR] = "ERROR",
     [RDMA_CONTROL_READY] = "READY",
@@ -3253,14 +3253,14 @@ static int qemu_rdma_get_fd(void *opaque)
     return rdma->comp_channel->fd;
 }
 
-const QEMUFileOps rdma_read_ops = {
+static const QEMUFileOps rdma_read_ops = {
     .get_buffer    = qemu_rdma_get_buffer,
     .get_fd        = qemu_rdma_get_fd,
     .close         = qemu_rdma_close,
     .hook_ram_load = qemu_rdma_registration_handle,
 };
 
-const QEMUFileOps rdma_write_ops = {
+static const QEMUFileOps rdma_write_ops = {
     .put_buffer         = qemu_rdma_put_buffer,
     .close              = qemu_rdma_close,
     .before_ram_iterate = qemu_rdma_registration_start,
Signature · 1 line
2.1.4
#5 lore raw

PATCH 5/10 moxie: Fix warning caused by missing include statement

In reply to Stefan Weil

Warning from the Sparse static analysis tool:

target-moxie/machine.c:4:26:
warning: symbol 'vmstate_moxie_cpu' was not declared. Should it be static?

machine.h includes the missing declaration.

---
 target-moxie/machine.c | 1 +
 1 file changed, 1 insertion(+)
target-moxie/machine.c +1 -0
index da1a857..b9316f0 100644
@@ -1,5 +1,6 @@
 #include "hw/hw.h"
 #include "hw/boards.h"
+#include "machine.h"
 
 const VMStateDescription vmstate_moxie_cpu = {
     .name = "cpu",
Signature · 1 line
2.1.4
#6 lore raw

PATCH 6/10 serial: Fix warnings caused by missing 'static' attribute

In reply to Stefan Weil

Warnings from the Sparse static analysis tool:

hw/char/serial.c:630:26: warning: symbol
'vmstate_serial_thr_ipending' was not declared. Should it be static?
hw/char/serial.c:646:26: warning: symbol
'vmstate_serial_tsr' was not declared. Should it be static?
hw/char/serial.c:665:26: warning: symbol
'vmstate_serial_recv_fifo' was not declared. Should it be static?
hw/char/serial.c:681:26: warning: symbol
'vmstate_serial_xmit_fifo' was not declared. Should it be static?
hw/char/serial.c:697:26: warning: symbol
'vmstate_serial_fifo_timeout_timer' was not declared. Should it be static?
hw/char/serial.c:713:26: warning: symbol
'vmstate_serial_timeout_ipending' was not declared. Should it be static?
hw/char/serial.c:729:26: warning: symbol
'vmstate_serial_poll' was not declared. Should it be static?

---
 hw/char/serial.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
hw/char/serial.c +7 -7
index bd25c03..0491897 100644
@@ -658,7 +658,7 @@ static bool serial_thr_ipending_needed(void *opaque)
     }
 }
 
-const VMStateDescription vmstate_serial_thr_ipending = {
+static const VMStateDescription vmstate_serial_thr_ipending = {
     .name = "serial/thr_ipending",
     .version_id = 1,
     .minimum_version_id = 1,
@@ -674,7 +674,7 @@ static bool serial_tsr_needed(void *opaque)
     return s->tsr_retry != 0;
 }
 
-const VMStateDescription vmstate_serial_tsr = {
+static const VMStateDescription vmstate_serial_tsr = {
     .name = "serial/tsr",
     .version_id = 1,
     .minimum_version_id = 1,
@@ -693,7 +693,7 @@ static bool serial_recv_fifo_needed(void *opaque)
 
 }
 
-const VMStateDescription vmstate_serial_recv_fifo = {
+static const VMStateDescription vmstate_serial_recv_fifo = {
     .name = "serial/recv_fifo",
     .version_id = 1,
     .minimum_version_id = 1,
@@ -709,7 +709,7 @@ static bool serial_xmit_fifo_needed(void *opaque)
     return !fifo8_is_empty(&s->xmit_fifo);
 }
 
-const VMStateDescription vmstate_serial_xmit_fifo = {
+static const VMStateDescription vmstate_serial_xmit_fifo = {
     .name = "serial/xmit_fifo",
     .version_id = 1,
     .minimum_version_id = 1,
@@ -725,7 +725,7 @@ static bool serial_fifo_timeout_timer_needed(void *opaque)
     return timer_pending(s->fifo_timeout_timer);
 }
 
-const VMStateDescription vmstate_serial_fifo_timeout_timer = {
+static const VMStateDescription vmstate_serial_fifo_timeout_timer = {
     .name = "serial/fifo_timeout_timer",
     .version_id = 1,
     .minimum_version_id = 1,
@@ -741,7 +741,7 @@ static bool serial_timeout_ipending_needed(void *opaque)
     return s->timeout_ipending != 0;
 }
 
-const VMStateDescription vmstate_serial_timeout_ipending = {
+static const VMStateDescription vmstate_serial_timeout_ipending = {
     .name = "serial/timeout_ipending",
     .version_id = 1,
     .minimum_version_id = 1,
@@ -757,7 +757,7 @@ static bool serial_poll_needed(void *opaque)
     return s->poll_msl >= 0;
 }
 
-const VMStateDescription vmstate_serial_poll = {
+static const VMStateDescription vmstate_serial_poll = {
     .name = "serial/poll",
     .version_id = 1,
     .minimum_version_id = 1,
Signature · 1 line
2.1.4
#7 lore raw

PATCH 7/10 spice: Add missing 'static' attribute

In reply to Stefan Weil
---
 spice-qemu-char.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
spice-qemu-char.c +1 -1
index 7e0d300..a4f4e57 100644
@@ -158,7 +158,7 @@ static gboolean spice_char_source_dispatch(GSource *source,
     return func(NULL, G_IO_OUT, user_data);
 }
 
-GSourceFuncs SpiceCharSourceFuncs = {
+static GSourceFuncs SpiceCharSourceFuncs = {
     .prepare  = spice_char_source_prepare,
     .check    = spice_char_source_check,
     .dispatch = spice_char_source_dispatch,
Signature · 1 line
2.1.4
#8 lore raw

PATCH 8/10 stubs: Fix warning caused by missing include statement

In reply to Stefan Weil

Warning from the Sparse static analysis tool:

stubs/qtest.c:14:6:
warning: symbol 'qtest_allowed' was not declared. Should it be static?

Add the missing include statement which declares qtest_allowed.

---
 stubs/qtest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
stubs/qtest.c +1 -1
index e671ed8..dc17594 100644
@@ -8,7 +8,7 @@
  * See the COPYING file in the top-level directory.
  */
 
-#include "qemu-common.h"
+#include "sysemu/qtest.h"
 
 /* Needed for qtest_allowed() */
 bool qtest_allowed;
Signature · 1 line
2.1.4
#9 lore raw

PATCH 9/10 vga: Fix warning caused by missing 'static' attribute

In reply to Stefan Weil

Warning from the Sparse static analysis tool:

hw/display/vga.c:2012:26: warning:
symbol 'vmstate_vga_endian' was not declared. Should it be static?

---
 hw/display/vga.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/display/vga.c +1 -1
index ffcfce3..9c62fbf 100644
@@ -2032,7 +2032,7 @@ static bool vga_endian_state_needed(void *opaque)
     return s->default_endian_fb != s->big_endian_fb;
 }
 
-const VMStateDescription vmstate_vga_endian = {
+static const VMStateDescription vmstate_vga_endian = {
     .name = "vga.endian",
     .version_id = 1,
     .minimum_version_id = 1,
Signature · 1 line
2.1.4
#10 lore raw

PATCH 10/10 virtio: Fix warning caused by missing 'static' attribute

In reply to Stefan Weil

Warning from the Sparse static analysis tool:

hw/char/virtio-serial-bus.c:31:3:
warning: symbol 'vserdevices' was not declared. Should it be static?

Cc Amit Shah <[email protected]>
Cc Anthony Liguori <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
---
 hw/char/virtio-serial-bus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/char/virtio-serial-bus.c +1 -1
index 37a6f44..47fbb34 100644
@@ -26,7 +26,7 @@
 #include "hw/virtio/virtio-serial.h"
 #include "hw/virtio/virtio-access.h"
 
-struct VirtIOSerialDevices {
+static struct VirtIOSerialDevices {
     QLIST_HEAD(, VirtIOSerial) devices;
 } vserdevices;
 
Signature · 1 line
2.1.4
#11 lore raw
In reply to Stefan Weil
Quoted 12 lines · Stefan Weil

All warnings were reported by the Sparse static analysis tool.

[PATCH 01/10] disas/cris: Fix warning caused by missing 'static' [PATCH 02/10] disas/sh4: Fix warning caused by missing 'static' [PATCH 03/10] migration: Fix warning caused by missing declaration of [PATCH 04/10] migration: Fix warnings caused by missing 'static' [PATCH 05/10] moxie: Fix warning caused by missing include statement [PATCH 06/10] serial: Fix warnings caused by missing 'static' [PATCH 07/10] spice: Add missing 'static' attribute
[PATCH 08/10] stubs: Fix warning caused by missing include statement [PATCH 09/10] vga: Fix warning caused by missing 'static' attribute [PATCH 10/10] virtio: Fix warning caused by missing 'static'

Applied all 10 to -trivial, good stuff!
Thanks,

/mjt