Build fixes
PATCH 1/1 Build fixes
Hi,
With default configure, the qemu-kvm client build was failing for me since Werror is enabled by default in configure. Deprecations (gnutls), gcc signed-overflow optimization (Werror=strict-overflows) and few unused-but-set variables were causing it. I have attached the patches after applying which, I got no further errors.
--------------------------
Raghavendra Prabhu
GPG Id : 0xD72BE977
Fingerprint: B93F EBCB 8E05 7039 CD3C A4B8 A616 DCA1 D72B E977
www: wnohang.net
Quoted 1 line
From
51b5cbebc488fc126339651120e923934fe29928Mon Sep 17 00:00:00 2001
Message-Id: <51b5cbebc488fc126339651120e923934fe29928.1309612724.git.rprabhu@wnohang.net>
From: Raghavendra D Prabhu <[email protected]>
Date: Sat, 2 Jul 2011 17:33:40 +0530
Subject: [PATCH 1/3] Avoid the use of deprecated gnutls gnutls_*_set_priority
functions.
The gnutls_*_set_priority family of functions has been marked deprecated in 2.12.x. These functions have been superceded by gnutls_priority_set_direct().
--- ui/vnc-tls.c | 20 +------------------- 1 files changed, 1 insertions(+), 19 deletions(-)
ui/vnc-tls.c +1 -19
@@ -286,10 +286,6 @@ int vnc_tls_validate_certificate(struct VncState *vs)int vnc_tls_client_setup (struct VncState *vs,int needX509Creds) { -static const int cert_type_priority[] = {GNUTLS_CRT_X509 ,0 }; -static const int protocol_priority[]= {GNUTLS_TLS1_1 ,GNUTLS_TLS1_0 ,GNUTLS_SSL3 ,0 }; -static const int kx_anon[] = {GNUTLS_KX_ANON_DH ,0 }; -static const int kx_x509[] = {GNUTLS_KX_DHE_DSS ,GNUTLS_KX_RSA ,GNUTLS_KX_DHE_RSA ,GNUTLS_KX_SRP ,0 };VNC_DEBUG ("Do TLS setup\n" );if (vnc_tls_initialize () <0 ) {
@@ -310,21 +306,7 @@ int vnc_tls_client_setup(struct VncState *vs,return -1 ; } -if (gnutls_kx_set_priority (vs->tls.session, needX509Creds ? kx_x509 : kx_anon) <0 ) { -gnutls_deinit (vs->tls.session); - vs->tls.session =NULL ; -vnc_client_error (vs); -return -1 ; - } - -if (gnutls_certificate_type_set_priority (vs->tls.session, cert_type_priority) <0 ) { -gnutls_deinit (vs->tls.session); - vs->tls.session =NULL ; -vnc_client_error (vs); -return -1 ; - } - -if (gnutls_protocol_set_priority (vs->tls.session, protocol_priority) <0 ) { +if (gnutls_priority_set_direct (vs->tls.session, needX509Creds ?"NORMAL" :"NORMAL:+ANON-DH" ,NULL ) <0 ) {gnutls_deinit (vs->tls.session); vs->tls.session =NULL ;vnc_client_error (vs);
Signature · 1 line
1.7.6
Quoted 1 line
From
bfecbc89c76320fe48a0efaa21fef7085b0d04bbMon Sep 17 00:00:00 2001
Message-Id: <bfecbc89c76320fe48a0efaa21fef7085b0d04bb.1309612724.git.rprabhu@wnohang.net>
In-Reply-To: <51b5cbebc488fc126339651120e923934fe29928.1309612724.git.rprabhu@wnohang.net>
References: <51b5cbebc488fc126339651120e923934fe29928.1309612724.git.rprabhu@wnohang.net>
From: Raghavendra D Prabhu <[email protected]>
Date: Sat, 2 Jul 2011 18:24:20 +0530
Subject: [PATCH 2/3] Add fno-strict-overflow
This is to avoid gcc optimizating out the comparison in assert,
due to assumption of signed overflow being undefined by default (-Werror=strict-overflow).
--- Makefile.hw | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Makefile.hw +1 -1
@@ -9,7 +9,7 @@ include $(SRC_PATH)/rules.mak $(call set-vpath, $(SRC_PATH):$(SRC_PATH)/hw) -QEMU_CFLAGS+=-I.. -I$(SRC_PATH)/fpu +QEMU_CFLAGS+=-I.. -I$(SRC_PATH)/fpu -fno-strict-overflow include $(SRC_PATH)/Makefile.objs
Signature · 1 line
1.7.6
Quoted 1 line
From
2cb2082c25eadc24d1e22ebbd4293e3e6b53c832Mon Sep 17 00:00:00 2001
Message-Id: <2cb2082c25eadc24d1e22ebbd4293e3e6b53c832.1309612724.git.rprabhu@wnohang.net>
In-Reply-To: <51b5cbebc488fc126339651120e923934fe29928.1309612724.git.rprabhu@wnohang.net>
References: <51b5cbebc488fc126339651120e923934fe29928.1309612724.git.rprabhu@wnohang.net>
From: Raghavendra D Prabhu <[email protected]>
Date: Sat, 2 Jul 2011 18:36:39 +0530
Subject: [PATCH 3/3] Avoid Wunsed-but-set warnings (or errors in case of
Werror)
In a few cases, variable attributed 'unused' has been added, in other cases unused variable has been either removed or commented out.
--- hw/device-assignment.c | 6 +++--- simpletrace.c | 2 +- xen-mapcache.c | 7 ++----- 3 files changed, 6 insertions(+), 9 deletions(-)
hw/device-assignment.c +3 -3
@@ -1654,7 +1654,7 @@ static void reset_assigned_device(DeviceState *dev)AssignedDevice *adev =DO_UPCAST (AssignedDevice, dev, pci_dev);char reset_file[64 ];const char reset[] ="1" ; -int fd, ret; + int fd, __attribute__((unused)) ret; snprintf(reset_file, sizeof(reset_file), "/sys/bus/pci/devices/%04x:%02x:%02x.%01x/reset",
@@ -1682,7 +1682,7 @@ static void reset_assigned_device(DeviceState *dev)static int assigned_initfn (struct PCIDevice *pci_dev) {AssignedDevice *dev =DO_UPCAST (AssignedDevice, dev, pci_dev); -uint8_t e_device, e_intx; +uint8_t e_intx;int r;if (!kvm_enabled ()) {
@@ -1709,7 +1709,7 @@ static int assigned_initfn(struct PCIDevice *pci_dev) goto out;/* handle interrupt routing */ - e_device = (dev->dev.devfn >>3 ) &0x1f ; +/*e_device = (dev->dev.devfn >> 3) & 0x1f;*/ e_intx = dev->dev.config[0x3d ] -1 ; dev->intpin = e_intx; dev->run =0 ;
simpletrace.c +1 -1
@@ -119,7 +119,7 @@ static void *writeout_thread(void *opaque)TraceRecord record;unsigned int writeout_idx =0 ;unsigned int num_available, idx; -size_t unused; +size_t __attribute__((unused)) unused;for (;;) {wait_for_trace_records_available ();
xen-mapcache.c +2 -5
@@ -166,7 +166,7 @@ static void qemu_remap_bucket(MapCacheEntry *entry,uint8_t *qemu_map_cache (target_phys_addr_t phys_addr,target_phys_addr_t size,uint8_t lock) { -MapCacheEntry *entry, *pentry =NULL ; +MapCacheEntry *entry;target_phys_addr_t address_index = phys_addr >>MCACHE_BUCKET_SHIFT ;target_phys_addr_t address_offset = phys_addr & (MCACHE_BUCKET_SIZE -1 );target_phys_addr_t __size = size;
@@ -192,12 +192,10 @@ uint8_t *qemu_map_cache(target_phys_addr_t phys_addr, target_phys_addr_t size, u (entry->paddr_index != address_index || entry->size != __size || !test_bits(address_offset >> XC_PAGE_SHIFT, size >> XC_PAGE_SHIFT, entry->valid_mapping))) { - pentry = entry; entry = entry->next; }if (!entry) { entry =qemu_mallocz (sizeof (MapCacheEntry)); - pentry->next = entry;qemu_remap_bucket (entry, __size, address_index); }else if (!entry->lock) { if (!entry->vaddr_base || entry->paddr_index != address_index ||
@@ -232,7 +230,7 @@ uint8_t *qemu_map_cache(target_phys_addr_t phys_addr, target_phys_addr_t size, uram_addr_t qemu_ram_addr_from_mapcache (void *ptr) { -MapCacheEntry *entry =NULL , *pentry =NULL ; +MapCacheEntry *entry =NULL ;MapCacheRev *reventry;target_phys_addr_t paddr_index;target_phys_addr_t size;
@@ -258,7 +256,6 @@ ram_addr_t qemu_ram_addr_from_mapcache(void *ptr) entry = &mapcache->entry[paddr_index % mapcache->nr_buckets];while (entry && (entry->paddr_index != paddr_index || entry->size != size)) { - pentry = entry; entry = entry->next; }if (!entry) {
Signature · 1 line
1.7.6
Quoted 6 lines · Raghavendra D Prabhu
With default configure, the qemu-kvm client build was failing for me since Werror is enabled by default in configure. Deprecations (gnutls), gcc signed-overflow optimization (Werror=strict-overflows) and few unused-but-set variables were causing it. I have attached the patches after applying which, I got no further errors.
Thanks for the patches. Please submit patches as individual inline emails so that it is easy to review and reply to them. For more information, see http://wiki.qemu.org/Contribute/SubmitAPatch.
Stefan
Quoted 9 lines · * On Sat, Jul 02, 2011 at 03:58:34PM +0100, Stefan Hajnoczi…
Quoted 6 lines · Raghavendra D Prabhu
With default configure, the qemu-kvm client build was failing for me since Werror is enabled by default in configure. Deprecations (gnutls), gcc signed-overflow optimization (Werror=strict-overflows) and few unused-but-set variables were causing it. I have attached the patches after applying which, I got no further errors.
Quoted 6 lines
Thanks for the patches. Please submit patches as individual inline emails so that it is easy to review and reply to them. For more information, see http://wiki.qemu.org/Contribute/SubmitAPatch.
Stefan
Thanks. I have sent them correctly this time.
--------------------------
Raghavendra Prabhu
GPG Id : 0xD72BE977
Fingerprint: B93F EBCB 8E05 7039 CD3C A4B8 A616 DCA1 D72B E977
www: wnohang.net