Skip to contentSkip to conversation

trivial fixes to silence compilation warnings

PATCH In review Carlo Marcelo Arenas Belon 2 participants 11 messages Mar 27, 2008 – Mar 30, 2008 2 messages not in the archive KVM

lore
Share & tools
lore
#0 lore raw

cover trivial fixes to silence compilation warnings

The following series contains unrelated patches with fixes to compilation warnings added since kvm-63; because of redefined macros, undefined functions or mismatched pointer types.

PATCH 1/5 : libkvm: missing declaration for kvm_disable_pit_creation PATCH 2/5 : qemu: cpu_model is a constant string
PATCH 3/5 : qemu: model in NICInfo is a constant string PATCH 4/5 : qemu: PCI_COMMAND_SERR redefined
PATCH 5/5 : qemu: ARRAY_SIZE redefined

Carlo

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

#1 lore raw

PATCH 1/5 libkvm: export kvm_disable_pit_creation to support -no-kvm-pit

qemu/qemu-kvm.c: In function `kvm_qemu_create_context':
qemu/qemu-kvm.c:549: warning: implicit declaration of function `kvm_disable_pit_creation'

---
 libkvm/libkvm.h |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
libkvm/libkvm.h +10 -0
index 61e7e98..29584d9 100644
@@ -107,6 +107,16 @@ void kvm_finalize(kvm_context_t kvm);
 void kvm_disable_irqchip_creation(kvm_context_t kvm);
 
 /*!
+ * \brief Disable the in-kernel PIT creation
+ *
+ * In-kernel pit is enabled by default. If userspace pit is to be used,
+ * this should be called prior to kvm_create().
+ *
+ *  \param kvm Pointer to the kvm_context
+ */
+void kvm_disable_pit_creation(kvm_context_t kvm);
+
+/*!
  * \brief Create new virtual machine
  *
  * This creates a new virtual machine, maps physical RAM to it, and creates a
Signature · 8 lines
1.5.3.7


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
#2 lore raw

PATCH 2/5 qemu: cpu_model is a pointer to a constant string

In reply to Carlo Marcelo Arenas Belon

qemu/hw/pc.c: In function `pc_init1':
qemu/hw/pc.c:1029: warning: passing arg 1 of `qemu_system_hot_add_init' discards qualifiers from pointer target type

---
 qemu/hw/acpi.c |    5 ++---
 qemu/sysemu.h  |    2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)
qemu/hw/acpi.c +2 -3
index 2670642..a7e5e26 100644
@@ -685,10 +685,9 @@ static void pciej_write(void *opaque, uint32_t addr, uint32_t val)
 #endif
 }
 
+static const char *model;
 
-static char *model;
-
-void qemu_system_hot_add_init(char *cpu_model)
+void qemu_system_hot_add_init(const char *cpu_model)
 {
     register_ioport_write(GPE_BASE, 4, 1, gpe_writeb, &gpe);
     register_ioport_read(GPE_BASE, 4, 1,  gpe_readb, &gpe);
qemu/sysemu.h +1 -1
index c728605..c60072d 100644
@@ -175,7 +175,7 @@ extern int drive_init(struct drive_opt *arg, int snapshot, void *machine);
 
 /* acpi */
 void qemu_system_cpu_hot_add(int cpu, int state);
-void qemu_system_hot_add_init(char *cpu_model);
+void qemu_system_hot_add_init(const char *cpu_model);
 void qemu_system_device_hot_add(int pcibus, int slot, int state);
 
 /* device-hotplug */
Signature · 8 lines
1.5.3.7


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
#3 lore raw

PATCH 3/5 qemu: model in NICInfo is a pointer to a constant string

In reply to Carlo Marcelo Arenas Belon

qemu/vl.c: In function `net_client_uninit':
qemu/vl.c:4951: warning: passing arg 1 of `free' discards qualifiers from pointer target type

---
 qemu/vl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
qemu/vl.c +1 -1
index 3570388..3f6eca3 100644
@@ -4944,7 +4944,7 @@ void net_client_uninit(NICInfo *nd)
     nd->vlan->nb_guest_devs--; /* XXX: free vlan on last reference */
     nb_nics--;
     nd->used = 0;
-    free(nd->model);
+    free((void *)nd->model);
 }
 
 void do_info_network(void)
Signature · 8 lines
1.5.3.7


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
#4 lore raw

PATCH 4/5 qemu: PCI_COMMAND_SERR redefined from linux headers

In reply to Carlo Marcelo Arenas Belon

qemu/hw/cirrus_vga.c:193:1: warning: "PCI_COMMAND_SERR" redefined In file included from /usr/include/linux/pci.h:21,

                 from /var/tmp/portage/app-emulation/kvm-64/work/kvm-64/qemu/hw/pci.h:6,
                 from /var/tmp/portage/app-emulation/kvm-64/work/kvm-64/qemu/hw/cirrus_vga.c:31:

/usr/include/linux/pci_regs.h:40:1: warning: this is the location of the previous definition

---
 qemu/hw/cirrus_vga.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
qemu/hw/cirrus_vga.c +1 -1
index e14ec35..86ed511 100644
@@ -190,7 +190,7 @@
 #define PCI_COMMAND_PALETTESNOOPING         0x0020
 #define PCI_COMMAND_PARITYDETECTION         0x0040
 #define PCI_COMMAND_ADDRESSDATASTEPPING     0x0080
-#define PCI_COMMAND_SERR                    0x0100
+#define PCI_COMMAND_SOFTERR                 0x0100
 #define PCI_COMMAND_BACKTOBACKTRANS         0x0200
 // PCI 0x08, 0xff000000 (0x09-0x0b:class,0x08:rev)
 #define PCI_CLASS_BASE_DISPLAY        0x03
Signature · 8 lines
1.5.3.7


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

PATCH 1/1 qemu: remove conflicting dependency to <linux/pci.h>

remove dependency to the pci linux headers added since c10bf6159ff24501852c91a342c3077d5388b184 and that was generating the following conflict :

qemu/hw/cirrus_vga.c:193:1: warning: "PCI_COMMAND_SERR" redefined
In file included from /usr/include/linux/pci.h:21,
from qemu/hw/pci.h:6,
from qemu/hw/cirrus_vga.c:31:
/usr/include/linux/pci_regs.h:40:1: warning: this is the location of the previous definition

---
 qemu/hw/pci.h |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
qemu/hw/pci.h +4 -2
index 036e914..60e4094 100644
@@ -3,10 +3,12 @@
 
 /* PCI includes legacy ISA access.  */
 #include "isa.h"
-#include <linux/pci.h>
 
-/* PCI bus */
+/* imported from <linux/pci.h> */
+#define PCI_SLOT(devfn)         (((devfn) >> 3) & 0x1f)
+#define PCI_FUNC(devfn)         ((devfn) & 0x07)
 
+/* PCI bus */
 extern target_phys_addr_t pci_mem_base;
 
 typedef void PCIConfigWriteFunc(PCIDevice *pci_dev,
Signature · 8 lines
1.5.3.7


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
Applied
#7 lore raw

Re: [PATCH] qemu: remove conflicting dependency to <linux/pci.h>

Quoted 11 lines · Carlo Marcelo Arenas Belon

remove dependency to the pci linux headers added since c10bf6159ff24501852c91a342c3077d5388b184 and that was generating the following conflict :

qemu/hw/cirrus_vga.c:193:1: warning: "PCI_COMMAND_SERR" redefined
In file included from /usr/include/linux/pci.h:21,
from qemu/hw/pci.h:6,
from qemu/hw/cirrus_vga.c:31:
/usr/include/linux/pci_regs.h:40:1: warning: this is the location of the previous definition

Applied, thanks.

Signature · 8 lines
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
#8 lore raw

PATCH 5/5 qemu: ARRAY_SIZE redefined

In reply to Carlo Marcelo Arenas Belon

qemu/qemu-kvm-x86.c:23:1: warning: "ARRAY_SIZE" redefined In file included from ../cpu-defs.h:30,

                 from /var/tmp/portage/app-emulation/kvm-64/work/kvm-64/qemu/target-i386/cpu.h:45,
                 from ../qemu-common.h:62,
                 from /var/tmp/portage/app-emulation/kvm-64/work/kvm-64/qemu/hw/hw.h:5,
                 from /var/tmp/portage/app-emulation/kvm-64/work/kvm-64/qemu/qemu-kvm-x86.c:13:

../osdep.h:30:1: warning: this is the location of the previous definition

---
 qemu/qemu-kvm-x86.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
qemu/qemu-kvm-x86.c +2 -0
index 78490c5..ab91ff2 100644
@@ -20,7 +20,9 @@
 
 #define MSR_IA32_TSC		0x10
 
+#ifndef ARRAY_SIZE
 #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
+#endif
 
 static struct kvm_msr_list *kvm_msr_list;
 extern unsigned int kvm_shadow_memory;
Signature · 8 lines
1.5.3.7


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

A message that is not in the archive (sent off-list or not yet received): [email protected]

#10 lore raw

Re: [PATCH 5/5] qemu: ARRAY_SIZE redefined

Quoted 25 lines · Avi Kivity
Quoted 24 lines · Carlo Marcelo Arenas Belon

qemu/qemu-kvm-x86.c:23:1: warning: "ARRAY_SIZE" redefined In file included from ../cpu-defs.h:30,

                from 
                /var/tmp/portage/app-emulation/kvm-64/work/kvm-64/qemu/target-i386/cpu.h:45,
                from ../qemu-common.h:62,
                from 
                /var/tmp/portage/app-emulation/kvm-64/work/kvm-64/qemu/hw/hw.h:5,
                from 
                /var/tmp/portage/app-emulation/kvm-64/work/kvm-64/qemu/qemu-kvm-x86.c:13:

../osdep.h:30:1: warning: this is the location of the previous definition

---
qemu/qemu-kvm-x86.c | 2 ++

1 files changed, 2 insertions(+), 0 deletions(-)
qemu/qemu-kvm-x86.c +0 -0
index 78490c5..ab91ff2 100644
@@ -20,7 +20,9 @@
 
 #define MSR_IA32_TSC		0x10
 
Quoted 8 lines

qemu/qemu-kvm-x86.c line 28

Quoted 6 lines
qemu/qemu-kvm-x86.c +2 -0
+#ifndef ARRAY_SIZE
 #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
+#endif
 
 static struct kvm_msr_list *kvm_msr_list;
 extern unsigned int kvm_shadow_memory;

Why note remove the definition completely, and #include osdep.h instead?

that was my first choice as there is not even a need to include osdep.h as it is already included and the source for this conflict.

but ARRAY_SIZE is also defined in qemu in a mips file (mips-dis.c) and therefore assumed its current state was transitional and having it redefined as a fallback was safer until consolidated correctly upstream.

Carlo

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

#11 lore raw

PATCH 1/1 qemu: use ARRAY_SIZE macro as provided by osdep.h

included through "qemu-kvm.h" -> "cpu.h" -> "cpu-defs.h" for all architectures and resulting otherwise in :

qemu/qemu-kvm-x86.c:23:1: warning: "ARRAY_SIZE" redefined In file included from ../cpu-defs.h:30,

    from qemu/target-i386/cpu.h:45,
    from ../qemu-common.h:62,
    from qemu/hw/hw.h:5,
    from qemu/qemu-kvm-x86.c:13:

../osdep.h:30:1: warning: this is the location of the previous definition

---
 qemu/qemu-kvm-x86.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
qemu/qemu-kvm-x86.c +0 -2
index 78490c5..35fb535 100644
@@ -20,8 +20,6 @@
 
 #define MSR_IA32_TSC		0x10
 
-#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
-
 static struct kvm_msr_list *kvm_msr_list;
 extern unsigned int kvm_shadow_memory;
 extern kvm_context_t kvm_context;
Signature · 8 lines
1.5.3.7


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
Applied
#12 lore raw

Re: [PATCH] qemu: use ARRAY_SIZE macro as provided by osdep.h

Quoted 11 lines · Carlo Marcelo Arenas Belon

included through "qemu-kvm.h" -> "cpu.h" -> "cpu-defs.h" for all architectures and resulting otherwise in :

qemu/qemu-kvm-x86.c:23:1: warning: "ARRAY_SIZE" redefined In file included from ../cpu-defs.h:30,

    from qemu/target-i386/cpu.h:45,
    from ../qemu-common.h:62,
    from qemu/hw/hw.h:5,
    from qemu/qemu-kvm-x86.c:13:

../osdep.h:30:1: warning: this is the location of the previous definition

Applied, thanks.

Signature · 8 lines
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace