qemu: remove set but unused variables
cover qemu: remove set but unused variables
Switched to FC15 and qemu build with -Werror fails. The reason is that with gcc 4.6.0, -Werror makes the build fail on variables that are set but never used.
XXX: In function ‘xxx’:
XXX:XXX:XX: error: variable ‘xx’ set but not used [-Werror=unused-but-set-variable]
The following patchset removes such variables
from the codebase.
Note: the warning could actually point to a
bug in code. Pls review carefully.
Build tested only.
Signature · 32 lines
MST Michael S. Tsirkin (10): ppce500: move device/vendor/class id to qdev usb-ehci: move device/vendor/class id to qdev usb-ehci: remove unused variables lsi53c895a: remove unused variables wdt: remove unused variables kvm: remove unused variables alpha/translate: remve unused variables alpha: remove unused variable exec: remove unused variable linux-user: remove unused variables exec.c | 4 ++++ hw/lsi53c895a.c | 2 -- hw/ppce500_pci.c | 13 +++---------- hw/usb-ehci.c | 19 +++++-------------- hw/virtio-pci.h | 8 +++++--- hw/wdt_i6300esb.c | 3 --- linux-user/flatload.c | 10 ++++++---- linux-user/linuxload.c | 25 +------------------------ linux-user/main.c | 6 +++--- linux-user/signal.c | 5 ----- linux-user/syscall.c | 6 ------ target-alpha/translate.c | 10 +++++++--- target-i386/kvm.c | 3 +-- 13 files changed, 35 insertions(+), 79 deletions(-) -- 1.7.5.53.gc233e
PATCH 1/10 ppce500: move device/vendor/class id to qdev
--- hw/ppce500_pci.c | 13 +++---------- 1 files changed, 3 insertions(+), 10 deletions(-)
hw/ppce500_pci.c +3 -10
@@ -304,20 +304,13 @@ static int e500_pcihost_initfn(SysBusDevice *dev)return 0 ; } -static int e500_host_bridge_initfn (PCIDevice *dev) -{ -pci_config_set_vendor_id (dev->config,PCI_VENDOR_ID_FREESCALE ); -pci_config_set_device_id (dev->config,PCI_DEVICE_ID_MPC8533E ); -pci_config_set_class (dev->config,PCI_CLASS_PROCESSOR_POWERPC ); - -return 0 ; -} -static PCIDeviceInfo e500_host_bridge_info = { .qdev.name ="e500-host-bridge" , .qdev.desc ="Host bridge" , .qdev.size =sizeof (PCIDevice), - .init = e500_host_bridge_initfn, + .vendor_id =PCI_VENDOR_ID_FREESCALE , + .device_id =PCI_DEVICE_ID_MPC8533E , + .class_id =PCI_CLASS_PROCESSOR_POWERPC , };static SysBusDeviceInfo e500_pcihost_info = {
Signature · 1 line
1.7.5.53.gc233e
Re: [PATCH 01/10] ppce500: move device/vendor/class id to qdev
Quoted 36 lines · Michael S. Tsirkin
Signed-off-by Michael S. Tsirkin <[email protected]>--- hw/ppce500_pci.c | 13 +++---------- 1 files changed, 3 insertions(+), 10 deletions(-)hw/ppce500_pci.c +3
-10@@ -304,20 +304,13 @@ static int e500_pcihost_initfn(SysBusDevice *dev)return 0 ; } -static int e500_host_bridge_initfn (PCIDevice *dev) -{ -pci_config_set_vendor_id (dev->config,PCI_VENDOR_ID_FREESCALE ); -pci_config_set_device_id (dev->config,PCI_DEVICE_ID_MPC8533E ); -pci_config_set_class (dev->config,PCI_CLASS_PROCESSOR_POWERPC ); - -return 0 ; -} -static PCIDeviceInfo e500_host_bridge_info = { .qdev.name ="e500-host-bridge" , .qdev.desc ="Host bridge" , .qdev.size =sizeof (PCIDevice), - .init = e500_host_bridge_initfn, + .vendor_id =PCI_VENDOR_ID_FREESCALE , + .device_id =PCI_DEVICE_ID_MPC8533E , + .class_id =PCI_CLASS_PROCESSOR_POWERPC , };static SysBusDeviceInfo e500_pcihost_info = {Signature · 1 line
1.7.5.53.gc233e
Now PCIDeviceInfo::init is NULL. So we want the following patch.
Quoted 1 line
From
45ea80e32966bf8105e56b7d08926d1e6675ae48Mon Sep 17 00:00:00 2001
Message-Id: <45ea80e32966bf8105e56b7d08926d1e6675ae48.1308091239.git.yamahata@valinux.co.jp>
In-Reply-To: <[email protected]>
References: <[email protected]>
From: Isaku Yamahata <[email protected]>
Date: Wed, 15 Jun 2011 07:37:47 +0900
Subject: [PATCH] pci: don't call qdev pci init method
As pci id initialization is moved to common layer, some initialization function can be empty. So don't call init method if NULL.
--- hw/pci.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-)
hw/pci.c +6 -4
@@ -1681,10 +1681,12 @@ static int pci_qdev_init(DeviceState *qdev, DeviceInfo *base)do_pci_unregister_device (pci_dev);return -1 ; } - rc = info->init (pci_dev); -if (rc !=0 ) { -do_pci_unregister_device (pci_dev); -return rc; +if (info->init) { + rc = info->init (pci_dev); +if (rc !=0 ) { +do_pci_unregister_device (pci_dev); +return rc; + } }/* rom loading */
Signature · 5 lines
1.7.1.1 -- yamahata
PATCH 2/10 usb-ehci: move device/vendor/class id to qdev
In reply to Michael S. Tsirkin--- hw/usb-ehci.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-)
hw/usb-ehci.c +4 -5
@@ -1945,6 +1945,10 @@ static PCIDeviceInfo ehci_info = { .qdev.name = "usb-ehci", .qdev.size = sizeof(EHCIState), .init = usb_ehci_initfn, + .vendor_id = PCI_VENDOR_ID_INTEL, + .device_id = PCI_DEVICE_ID_INTEL_82801D, + .revision = 0x10, + .class_id = PCI_CLASS_SERIAL_USB, };static int usb_ehci_initfn (PCIDevice *dev)
@@ -1953,12 +1957,7 @@ static int usb_ehci_initfn(PCIDevice *dev)uint8_t *pci_conf = s->dev.config;int i; -pci_config_set_vendor_id (pci_conf,PCI_VENDOR_ID_INTEL ); -pci_config_set_device_id (pci_conf,PCI_DEVICE_ID_INTEL_82801D ); -pci_set_byte (&pci_conf[PCI_REVISION_ID ],0x10 );pci_set_byte (&pci_conf[PCI_CLASS_PROG ],0x20 ); -pci_config_set_class (pci_conf,PCI_CLASS_SERIAL_USB ); -pci_set_byte (&pci_conf[PCI_HEADER_TYPE ],PCI_HEADER_TYPE_NORMAL );/* capabilities pointer */ pci_set_byte (&pci_conf[PCI_CAPABILITY_LIST ],0x00 );
Signature · 1 line
1.7.5.53.gc233e
PATCH 3/10 usb-ehci: remove unused variables
In reply to Michael S. Tsirkin--- hw/usb-ehci.c | 10 +--------- 1 files changed, 1 insertions(+), 9 deletions(-)
hw/usb-ehci.c +1 -9
@@ -523,11 +523,8 @@ static void ehci_detach(USBPort *port)static void ehci_reset (void *opaque) {EHCIState *s = opaque; -uint8_t *pci_conf;int i; - pci_conf = s->dev.config; -memset (&s->mmio[OPREGBASE ],0x00 ,MMIO_SIZE -OPREGBASE ); s->usbcmd =NB_MAXINTRATE <<USBCMD_ITC_SH ;
@@ -1105,18 +1102,15 @@ static int ehci_process_itd(EHCIState *ehci,int ret;int i, j;int ptr; -int pid;int pg;int len;int dir;int devadr;int endp; -int maxpkt; dir =(itd->bufptr[1 ] &ITD_BUFPTR_DIRECTION ); devadr =get_field (itd->bufptr[0 ],ITD_BUFPTR_DEVADDR ); endp =get_field (itd->bufptr[0 ],ITD_BUFPTR_EP ); - maxpkt =get_field (itd->bufptr[1 ],ITD_BUFPTR_MAXPKT );for (i =0 ; i <8 ; i++) {if (itd->transact[i] &ITD_XACT_ACTIVE ) {
@@ -1136,9 +1130,7 @@ static int ehci_process_itd(EHCIState *ehci,if (!dir) {cpu_physical_memory_rw (ptr, &ehci->buffer[0 ], len,0 ); - pid =USB_TOKEN_OUT ; - }else - pid =USB_TOKEN_IN ; + } ret =USB_RET_NODEV ;
Signature · 1 line
1.7.5.53.gc233e
Re: [PATCH 03/10] usb-ehci: remove unused variables
Quoted 1 line · Michael S. Tsirkin
Signed-off-by Michael S. Tsirkin<[email protected]>
usb patch queue has a simliar fix already. I'd suggest to drop this to reduce merge conflicts.
cheers,
Gerd
PATCH 4/10 lsi53c895a: remove unused variables
In reply to Michael S. Tsirkin--- hw/lsi53c895a.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
hw/lsi53c895a.c +0 -2
@@ -889,7 +889,6 @@ static void lsi_do_msgout(LSIState *s)uint8_t msg;int len;uint32_t current_tag; -SCSIDevice *current_dev;lsi_request *current_req, *p, *p_next;int id;
@@ -901,7 +900,6 @@ static void lsi_do_msgout(LSIState *s) current_req =lsi_find_by_tag (s, current_tag); } id = (current_tag >>8 ) &0xf ; - current_dev = s->bus.devs[id];DPRINTF ("MSG out len=%d\n" , s->dbc);while (s->dbc) {
Signature · 1 line
1.7.5.53.gc233e
Re: [PATCH 04/10] lsi53c895a: remove unused variables
Quoted 4 lines · Michael S. Tsirkin
Signed-off-by Michael S. Tsirkin <[email protected]>--- hw/lsi53c895a.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
This one is already in the trivial-patches tree.
Stefan
PATCH 5/10 wdt: remove unused variables
In reply to Michael S. Tsirkin--- hw/wdt_i6300esb.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
hw/wdt_i6300esb.c +0 -3
@@ -381,7 +381,6 @@ static const VMStateDescription vmstate_i6300esb = {static int i6300esb_init (PCIDevice *dev) {I6300State *d =DO_UPCAST (I6300State, dev, dev); -uint8_t *pci_conf;int io_mem;static CPUReadMemoryFunc *const mem_read[3 ] = { i6300esb_mem_readb,
@@ -399,8 +398,6 @@ static int i6300esb_init(PCIDevice *dev) d->timer =qemu_new_timer_ns (vm_clock, i6300esb_timer_expired, d); d->previous_reboot_flag =0 ; - pci_conf = d->dev.config; - io_mem =cpu_register_io_memory (mem_read, mem_write, d,DEVICE_NATIVE_ENDIAN );pci_register_bar_simple (&d->dev,0 ,0x10 ,0 , io_mem);
Signature · 1 line
1.7.5.53.gc233e
Re: [PATCH 05/10] wdt: remove unused variables
It seems that I overlooked the variable when pci id conversion.
Quoted 29 lines · Michael S. Tsirkin
Signed-off-by Michael S. Tsirkin <[email protected]>--- hw/wdt_i6300esb.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)hw/wdt_i6300esb.c +0
-3@@ -381,7 +381,6 @@ static const VMStateDescription vmstate_i6300esb = {static int i6300esb_init (PCIDevice *dev) {I6300State *d =DO_UPCAST (I6300State, dev, dev); -uint8_t *pci_conf;int io_mem;static CPUReadMemoryFunc *const mem_read[3 ] = { i6300esb_mem_readb,@@ -399,8 +398,6 @@ static int i6300esb_init(PCIDevice *dev) d->timer =qemu_new_timer_ns (vm_clock, i6300esb_timer_expired, d); d->previous_reboot_flag =0 ; - pci_conf = d->dev.config; - io_mem =cpu_register_io_memory (mem_read, mem_write, d,DEVICE_NATIVE_ENDIAN );pci_register_bar_simple (&d->dev,0 ,0x10 ,0 , io_mem);Signature · 1 line
1.7.5.53.gc233e
Signature · 1 line
yamahata
PATCH 6/10 kvm: remove unused variables
In reply to Michael S. Tsirkin--- hw/virtio-pci.h | 8 +++++--- target-i386/kvm.c | 3 +-- 2 files changed, 6 insertions(+), 5 deletions(-)
hw/virtio-pci.h +5 -3
@@ -37,7 +37,9 @@ typedef struct { bool ioeventfd_started; } VirtIOPCIProxy; -extern void virtio_init_pci (VirtIOPCIProxy *proxy,VirtIODevice *vdev, -uint16_t vendor,uint16_t device, -uint16_t class_code,uint8_t pif); +void virtio_init_pci (VirtIOPCIProxy *proxy,VirtIODevice *vdev); + +/* Virtio ABI version, if we increment this, we break the guest driver. */ +#define VIRTIO_PCI_ABI_VERSION 0 +#endif
target-i386/kvm.c +1 -2
@@ -970,7 +970,7 @@ static int kvm_get_xsave(CPUState *env)#ifdef KVM_CAP_XSAVE struct kvm_xsave * xsave;int ret, i; -uint16_t cwd, swd, twd, fop; +uint16_t cwd, swd, twd;if (!kvm_has_xsave ()) {return kvm_get_fpu (env);
@@ -986,7 +986,6 @@ static int kvm_get_xsave(CPUState *env) cwd = (uint16_t )xsave->region[0 ]; swd = (uint16_t )(xsave->region[0 ] >>16 ); twd = (uint16_t )xsave->region[1 ]; - fop = (uint16_t )(xsave->region[1 ] >>16 ); env->fpstt = (swd >>11 ) &7 ; env->fpus = swd; env->fpuc = cwd;
Signature · 1 line
1.7.5.53.gc233e
Re: [PATCH 06/10] kvm: remove unused variables
Am 14.06.2011 19:36, schrieb Michael S. Tsirkin:
Quoted 13 lines
Signed-off-by Michael S. Tsirkin <[email protected]>--- hw/virtio-pci.h | 8 +++++--- target-i386/kvm.c | 3 +-- 2 files changed, 6 insertions(+), 5 deletions(-)hw/virtio-pci.h +0
-0@@ -37,7 +37,9 @@ typedef struct {bool ioeventfd_started; } VirtIOPCIProxy;
hw/virtio-pci.h typedef struct { · line 45
Quoted 10 lines
hw/virtio-pci.h +5
-3-extern void virtio_init_pci (VirtIOPCIProxy *proxy,VirtIODevice *vdev, -uint16_t vendor,uint16_t device, -uint16_t class_code,uint8_t pif); +void virtio_init_pci (VirtIOPCIProxy *proxy,VirtIODevice *vdev); + +/* Virtio ABI version, if we increment this, we break the guest driver. */ +#define VIRTIO_PCI_ABI_VERSION 0 +#endif
Is this hunk there intentionally?
Kevin
Quoted 21 lines
target-i386/kvm.c +1
-2@@ -970,7 +970,7 @@ static int kvm_get_xsave(CPUState *env)#ifdef KVM_CAP_XSAVE struct kvm_xsave * xsave;int ret, i; -uint16_t cwd, swd, twd, fop; +uint16_t cwd, swd, twd;if (!kvm_has_xsave ()) {return kvm_get_fpu (env);@@ -986,7 +986,6 @@ static int kvm_get_xsave(CPUState *env) cwd = (uint16_t )xsave->region[0 ]; swd = (uint16_t )(xsave->region[0 ] >>16 ); twd = (uint16_t )xsave->region[1 ]; - fop = (uint16_t )(xsave->region[1 ] >>16 ); env->fpstt = (swd >>11 ) &7 ; env->fpus = swd; env->fpuc = cwd;
Re: [PATCH 06/10] kvm: remove unused variables
Quoted 27 lines · Kevin Wolf
Am 14.06.2011 19:36, schrieb Michael S. Tsirkin:
Quoted 13 lines
Signed-off-by Michael S. Tsirkin <[email protected]>--- hw/virtio-pci.h | 8 +++++--- target-i386/kvm.c | 3 +-- 2 files changed, 6 insertions(+), 5 deletions(-)hw/virtio-pci.h +0
-0@@ -37,7 +37,9 @@ typedef struct {bool ioeventfd_started; } VirtIOPCIProxy;hw/virtio-pci.h typedef struct { · line 45
Quoted 10 lines
hw/virtio-pci.h +5
-3-extern void virtio_init_pci (VirtIOPCIProxy *proxy,VirtIODevice *vdev, -uint16_t vendor,uint16_t device, -uint16_t class_code,uint8_t pif); +void virtio_init_pci (VirtIOPCIProxy *proxy,VirtIODevice *vdev); + +/* Virtio ABI version, if we increment this, we break the guest driver. */ +#define VIRTIO_PCI_ABI_VERSION 0 +#endif Is this hunk there intentionally?
Quoted 1 line
Kevin
Sorry, this belongs in another patch.
Thanks for pointing this out.
Otherwise ack?
Quoted 22 lines
Quoted 22 lines
target-i386/kvm.c +1
-2@@ -970,7 +970,7 @@ static int kvm_get_xsave(CPUState *env)#ifdef KVM_CAP_XSAVE struct kvm_xsave * xsave;int ret, i; -uint16_t cwd, swd, twd, fop; +uint16_t cwd, swd, twd;if (!kvm_has_xsave ()) {return kvm_get_fpu (env);@@ -986,7 +986,6 @@ static int kvm_get_xsave(CPUState *env) cwd = (uint16_t )xsave->region[0 ]; swd = (uint16_t )(xsave->region[0 ] >>16 ); twd = (uint16_t )xsave->region[1 ]; - fop = (uint16_t )(xsave->region[1 ] >>16 ); env->fpstt = (swd >>11 ) &7 ; env->fpus = swd; env->fpuc = cwd;
Re: [PATCH 06/10] kvm: remove unused variables
Quoted 28 lines · Michael S. Tsirkin
Quoted 27 lines · Kevin Wolf
Am 14.06.2011 19:36, schrieb Michael S. Tsirkin:
Quoted 13 lines
Signed-off-by Michael S. Tsirkin <[email protected]>--- hw/virtio-pci.h | 8 +++++--- target-i386/kvm.c | 3 +-- 2 files changed, 6 insertions(+), 5 deletions(-)hw/virtio-pci.h +0
-0@@ -37,7 +37,9 @@ typedef struct {bool ioeventfd_started; } VirtIOPCIProxy;hw/virtio-pci.h typedef struct { · line 45
Quoted 10 lines
hw/virtio-pci.h +5
-3-extern void virtio_init_pci (VirtIOPCIProxy *proxy,VirtIODevice *vdev, -uint16_t vendor,uint16_t device, -uint16_t class_code,uint8_t pif); +void virtio_init_pci (VirtIOPCIProxy *proxy,VirtIODevice *vdev); + +/* Virtio ABI version, if we increment this, we break the guest driver. */ +#define VIRTIO_PCI_ABI_VERSION 0 +#endif Is this hunk there intentionally?
Quoted 5 lines
Quoted 1 line
Kevin
Sorry, this belongs in another patch.
Thanks for pointing this out.
Otherwise ack?
I've still the true fix pending, but there are concerns about the associated savevm version increase for the CPU. Not sure what will happen the next days till -rc0, so we may also go with any of these removal patches (you weren't the first by far).
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux
Re: [Qemu-devel] [PATCH 06/10] kvm: remove unused variables
In reply to Michael S. TsirkinQuoted 11 lines · Michael S. Tsirkin
Signed-off-by Michael S. Tsirkin<[email protected]>--- hw/virtio-pci.h | 8 +++++--- target-i386/kvm.c | 3 +-- 2 files changed, 6 insertions(+), 5 deletions(-)hw/virtio-pci.h +0
-0
hw/virtio-pci.h typedef struct { · line 40
Quoted 7 lines
hw/virtio-pci.h +1
-3@@ -37,7 +37,9 @@ typedef struct {bool ioeventfd_started; } VirtIOPCIProxy; -extern void virtio_init_pci (VirtIOPCIProxy *proxy,VirtIODevice *vdev, -uint16_t vendor,uint16_t device, -uint16_t class_code,uint8_t pif); +void virtio_init_pci (VirtIOPCIProxy *proxy,VirtIODevice *vdev);
Hello MST,
The above change shows why we should be including a header, rather than having private prototypes (w/bitrot).
hw/virtio-pci.h typedef struct { · line 44
Quoted 4 lines
hw/virtio-pci.h +4
-0+ +/* Virtio ABI version, if we increment this, we break the guest driver. */ +#define VIRTIO_PCI_ABI_VERSION 0 +
This change seems unrelated.
Thanks
Chris
Quoted 22 lines
hw/virtio-pci.h +0
-0#endif target-i386/kvm.c +1
-2@@ -970,7 +970,7 @@ static int kvm_get_xsave(CPUState *env)#ifdef KVM_CAP_XSAVE struct kvm_xsave * xsave;int ret, i; -uint16_t cwd, swd, twd, fop; +uint16_t cwd, swd, twd;if (!kvm_has_xsave ()) {return kvm_get_fpu (env);@@ -986,7 +986,6 @@ static int kvm_get_xsave(CPUState *env) cwd = (uint16_t )xsave->region[0 ]; swd = (uint16_t )(xsave->region[0 ]>>16 ); twd = (uint16_t )xsave->region[1 ]; - fop = (uint16_t )(xsave->region[1 ]>>16 ); env->fpstt = (swd>>11 )&7 ; env->fpus = swd; env->fpuc = cwd;
Re: [Qemu-devel] [PATCH 06/10] kvm: remove unused variables
Quoted 22 lines · Chris Krumme
Quoted 11 lines · Michael S. Tsirkin
Signed-off-by Michael S. Tsirkin<[email protected]>--- hw/virtio-pci.h | 8 +++++--- target-i386/kvm.c | 3 +-- 2 files changed, 6 insertions(+), 5 deletions(-)hw/virtio-pci.h +0
-0hw/virtio-pci.h typedef struct { · line 40
Quoted 7 lines
hw/virtio-pci.h +1
-3@@ -37,7 +37,9 @@ typedef struct {bool ioeventfd_started; } VirtIOPCIProxy; -extern void virtio_init_pci (VirtIOPCIProxy *proxy,VirtIODevice *vdev, -uint16_t vendor,uint16_t device, -uint16_t class_code,uint8_t pif); +void virtio_init_pci (VirtIOPCIProxy *proxy,VirtIODevice *vdev);Hello MST,
Quoted 2 lines
The above change shows why we should be including a header, rather than having private prototypes (w/bitrot).
Which header?
Quoted 10 lines
hw/virtio-pci.h typedef struct { · line 44
Quoted 4 lines
hw/virtio-pci.h +4
-0+ +/* Virtio ABI version, if we increment this, we break the guest driver. */ +#define VIRTIO_PCI_ABI_VERSION 0 +This change seems unrelated.
Thanks
Chris
Yes.
Quoted 22 lines
Quoted 22 lines
hw/virtio-pci.h +0
-0#endif target-i386/kvm.c +1
-2@@ -970,7 +970,7 @@ static int kvm_get_xsave(CPUState *env)#ifdef KVM_CAP_XSAVE struct kvm_xsave * xsave;int ret, i; -uint16_t cwd, swd, twd, fop; +uint16_t cwd, swd, twd;if (!kvm_has_xsave ()) {return kvm_get_fpu (env);@@ -986,7 +986,6 @@ static int kvm_get_xsave(CPUState *env) cwd = (uint16_t )xsave->region[0 ]; swd = (uint16_t )(xsave->region[0 ]>>16 ); twd = (uint16_t )xsave->region[1 ]; - fop = (uint16_t )(xsave->region[1 ]>>16 ); env->fpstt = (swd>>11 )&7 ; env->fpus = swd; env->fpuc = cwd;
PATCH 7/10 alpha/translate: remve unused variables
In reply to Michael S. Tsirkin--- target-alpha/translate.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
target-alpha/translate.c +1 -2
@@ -1663,7 +1663,7 @@ static ExitStatus translate_one(DisasContext *ctx, uint32_t insn)uint32_t palcode;int32_t disp21, disp16, disp12;uint16_t fn11; -uint8_t opc, ra, rb, rc, fpfn, fn7, fn2, islit, real_islit; +uint8_t opc, ra, rb, rc, fpfn, fn7, islit, real_islit;uint8_t lit;ExitStatus ret;
@@ -1685,7 +1685,6 @@ static ExitStatus translate_one(DisasContext *ctx, uint32_t insn) fn11 = (insn >>5 ) &0x000007FF ; fpfn = fn11 &0x3F ; fn7 = (insn >>5 ) &0x0000007F ; - fn2 = (insn >>5 ) &0x00000003 ;LOG_DISAS ("opc %02x ra %2d rb %2d rc %2d disp16 %6d\n" , opc, ra, rb, rc, disp16);
Signature · 1 line
1.7.5.53.gc233e
Re: [PATCH 07/10] alpha/translate: remve unused variables
Quoted 4 lines · Michael S. Tsirkin
Signed-off-by Michael S. Tsirkin <[email protected]>--- target-alpha/translate.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
r~
PATCH 8/10 alpha: remove unused variable
In reply to Michael S. Tsirkin--- target-alpha/translate.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
target-alpha/translate.c +6 -1
@@ -1661,7 +1661,10 @@ static void gen_mtpr(int rb, int regno)static ExitStatus translate_one (DisasContext *ctx,uint32_t insn) {uint32_t palcode; -int32_t disp21, disp16, disp12; +int32_t disp21, disp16; +#ifndef CONFIG_USER_ONLY +int32_t disp12; +#endif uint16_t fn11;uint8_t opc, ra, rb, rc, fpfn, fn7, islit, real_islit;uint8_t lit;
@@ -1681,7 +1684,9 @@ static ExitStatus translate_one(DisasContext *ctx, uint32_t insn) palcode = insn &0x03FFFFFF ; disp21 = ((int32_t )((insn &0x001FFFFF ) <<11 )) >>11 ; disp16 = (int16_t )(insn &0x0000FFFF ); +#ifndef CONFIG_USER_ONLY disp12 = (int32_t )((insn &0x00000FFF ) <<20 ) >>20 ; +#endif fn11 = (insn >>5 ) &0x000007FF ; fpfn = fn11 &0x3F ; fn7 = (insn >>5 ) &0x0000007F ;
Signature · 1 line
1.7.5.53.gc233e
Re: [PATCH 08/10] alpha: remove unused variable
Quoted 4 lines · Michael S. Tsirkin
Signed-off-by Michael S. Tsirkin <[email protected]>--- target-alpha/translate.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
r~
Re: [Qemu-devel] [PATCH 08/10] alpha: remove unused variable
Quoted 7 lines · Richard Henderson
Quoted 4 lines · Michael S. Tsirkin
Signed-off-by Michael S. Tsirkin <[email protected]>---
target-alpha/translate.c | 7 ++++++-1 files changed, 6 insertions(+), 1 deletions(-)
Richard, does this ack mean you've taken this patch (and the other target-alpha gcc 4.6 warning fix patch) into an alpha patches queue, or would you prefer these to be routed via the trivial-patches queue?
thanks
-- PMM
Re: [Qemu-devel] [PATCH 08/10] alpha: remove unused variable
Quoted 7 lines · Peter Maydell
Quoted 6 lines · Richard Henderson
Quoted 4 lines · Michael S. Tsirkin
Signed-off-by Michael S. Tsirkin <[email protected]>--- target-alpha/translate.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
Quoted 6 lines
Quoted 1 line
Richard, does this ack mean you've taken this patch (and the other target-alpha gcc 4.6 warning fix patch) into an alpha patches queue, or would you prefer these to be routed via the trivial-patches queue?
I did not bring it into my patch queue. Please route it through trivial.
r~
PATCH 9/10 exec: remove unused variable
In reply to Michael S. Tsirkin--- exec.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
exec.c +4 -0
@@ -1207,12 +1207,16 @@ static inline void tb_alloc_page(TranslationBlock *tb, unsigned int n, tb_page_addr_t page_addr) {PageDesc *p; +#if !defined(CONFIG_USER_ONLY )TranslationBlock *last_first_tb; +#endif tb->page_addr[n] = page_addr; p =page_find_alloc (page_addr >>TARGET_PAGE_BITS ,1 ); tb->page_next[n] = p->first_tb; +#if !defined(CONFIG_USER_ONLY ) last_first_tb = p->first_tb; +#endif p->first_tb = (TranslationBlock *)((long )tb | n);invalidate_page_bitmap (p);
Signature · 1 line
1.7.5.53.gc233e
Re: [PATCH 09/10] exec: remove unused variable
Quoted 1 line · Michael S. Tsirkin
Signed-off-by Michael S. Tsirkin <[email protected]>
Any comments on this one?
Quoted 27 lines
--- exec.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)exec.c +4
-0@@ -1207,12 +1207,16 @@ static inline void tb_alloc_page(TranslationBlock *tb, unsigned int n, tb_page_addr_t page_addr) {PageDesc *p; +#if !defined(CONFIG_USER_ONLY )TranslationBlock *last_first_tb; +#endif tb->page_addr[n] = page_addr; p =page_find_alloc (page_addr >>TARGET_PAGE_BITS ,1 ); tb->page_next[n] = p->first_tb; +#if !defined(CONFIG_USER_ONLY ) last_first_tb = p->first_tb; +#endif p->first_tb = (TranslationBlock *)((long )tb | n);invalidate_page_bitmap (p);Signature · 1 line
1.7.5.53.gc233e
Re: [PATCH 09/10] exec: remove unused variable
Quoted 4 lines · Michael S. Tsirkin
Quoted 1 line · Michael S. Tsirkin
Signed-off-by Michael S. Tsirkin <[email protected]>Any comments on this one?
Juan Quintela's "exec: last_first_tb was only used in !ONLY_USER case" patch is equivalent and the trivial-patches pull request containing it is on qemu-devel. We're waiting for it to be merged.
http://patchwork.ozlabs.org/patch/101875/
Stefan
PATCH 10/10 linux-user: remove unused variables
In reply to Michael S. Tsirkin--- linux-user/flatload.c | 10 ++++++---- linux-user/linuxload.c | 25 +------------------------ linux-user/main.c | 6 +++--- linux-user/signal.c | 5 ----- linux-user/syscall.c | 6 ------ 5 files changed, 10 insertions(+), 42 deletions(-)
linux-user/flatload.c +6 -4
@@ -379,12 +379,14 @@ static int load_flat_file(struct linux_binprm * bprm,abi_long result;abi_ulong realdatastart =0 ;abi_ulong text_len, data_len, bss_len, stack_len, flags; -abi_ulong memp =0 ;/* for finding the brk area */ abi_ulong extra;abi_ulong reloc =0 , rp;int i, rev, relocs =0 ;abi_ulong fpos; -abi_ulong start_code, end_code; +abi_ulong start_code; +#ifdef DEBUG +abi_ulong end_code; +#endif abi_ulong indx_len; hdr = ((struct flat_hdr *) bprm->buf);/* exec-header */
@@ -491,7 +493,6 @@ static int load_flat_file(struct linux_binprm * bprm, } reloc = datapos + (ntohl (hdr->reloc_start) - text_len); - memp = realdatastart; }else {
@@ -506,7 +507,6 @@ static int load_flat_file(struct linux_binprm * bprm, realdatastart = textpos +ntohl (hdr->data_start); datapos = realdatastart + indx_len; reloc = (textpos +ntohl (hdr->reloc_start) + indx_len); - memp = textpos;#ifdef CONFIG_BINFMT_ZFLAT #error code needs checking
@@ -552,7 +552,9 @@ static int load_flat_file(struct linux_binprm * bprm,/* The main program needs a little extra setup in the task structure */ start_code = textpos +sizeof (struct flat_hdr ); +#ifdef DEBUG end_code = textpos + text_len; +#endif DBG_FLT("%s %s: TEXT=%x-%x DATA=%x-%x BSS=%x-%x\n", id ? "Lib" : "Load", bprm->filename,
linux-user/linuxload.c +1 -24
@@ -26,22 +26,6 @@ abi_long memcpy_to_target(abi_ulong dest, const void *src,return 0 ; } -static int in_group_p (gid_t g) -{ -/* return TRUE if we're in the specified group, FALSE otherwise */ -int ngroup; -int i; -gid_t grouplist[NGROUPS ]; - - ngroup =getgroups (NGROUPS , grouplist); -for (i =0 ; i < ngroup; i++) { -if (grouplist[i] == g) { -return 1 ; - } - } -return 0 ; -} -static int count (char ** vec) {int i;
@@ -57,7 +41,7 @@ static int prepare_binprm(struct linux_binprm *bprm) {struct stat st;int mode; -int retval, id_change; +int retval;if (fstat (bprm->fd, &st) <0 ) {return (-errno);
@@ -73,14 +57,10 @@ static int prepare_binprm(struct linux_binprm *bprm) bprm->e_uid =geteuid (); bprm->e_gid =getegid (); - id_change =0 ;/* Set-uid? */ if (mode &S_ISUID ) { bprm->e_uid = st.st_uid; -if (bprm->e_uid !=geteuid ()) { - id_change =1 ; - } }/* Set-gid? */
@@ -91,9 +71,6 @@ static int prepare_binprm(struct linux_binprm *bprm)*/ if ((mode & (S_ISGID |S_IXGRP )) == (S_ISGID |S_IXGRP )) { bprm->e_gid = st.st_gid; -if (!in_group_p (bprm->e_gid)) { - id_change =1 ; - } } retval =read (bprm->fd, bprm->buf,BPRM_BUF_SIZE );
linux-user/main.c +3 -3
@@ -2053,15 +2053,15 @@ void cpu_loop(CPUMIPSState *env) }else {int nb_args;abi_ulong sp_reg; -abi_ulong arg5 =0 , arg6 =0 , arg7 =0 , arg8 =0 ; +abi_ulong arg5 =0 , arg6 =0 ; nb_args = mips_syscall_args[syscall_num]; sp_reg = env->active_tc.gpr[29 ];switch (nb_args) {/* these arguments are taken from the stack */ /* FIXME - what to do if get_user() fails? */ -case 8 :get_user_ual (arg8, sp_reg +28 ); -case 7 :get_user_ual (arg7, sp_reg +24 ); +case 8 :/* get_user_ual(arg8, sp_reg + 28); */ +case 7 :/* get_user_ual(arg7, sp_reg + 24); */ case 6 :get_user_ual (arg6, sp_reg +20 );case 5 :get_user_ual (arg5, sp_reg +16 );default :
linux-user/signal.c +0 -5
@@ -2080,7 +2080,6 @@ long do_sigreturn(CPUState *env)uint32_t up_psr, pc, npc;target_sigset_t set;sigset_t host_set; -abi_ulong fpu_save_addr;int err, i; sf_addr = env->regwptr[UREG_FP ];
@@ -2120,8 +2119,6 @@ long do_sigreturn(CPUState *env) err |=__get_user (env->regwptr[i +UREG_I0 ], &sf->info.si_regs.u_regs[i+8 ]); } - err |=__get_user (fpu_save_addr, &sf->fpu_save); -//if (fpu_save) // err |= restore_fpu_state(env, fpu_save);
@@ -2228,7 +2225,6 @@ void sparc64_set_context(CPUSPARCState *env)target_mc_gregset_t *grp;abi_ulong pc, npc, tstate;abi_ulong fp, i7, w_addr; -unsigned char fenab;int err;unsigned int i;
@@ -2293,7 +2289,6 @@ void sparc64_set_context(CPUSPARCState *env) if (put_user(i7, w_addr + offsetof(struct target_reg_window, ins[7]), abi_ulong) != 0) goto do_sigsegv; - err |=__get_user (fenab, &(ucp->tuc_mcontext.mc_fpregs.mcfpu_enab)); err |=__get_user (env->fprs, &(ucp->tuc_mcontext.mc_fpregs.mcfpu_fprs)); {uint32_t *src, *dst;
linux-user/syscall.c +0 -6
@@ -3751,7 +3751,6 @@ static abi_long do_get_thread_area(CPUX86State *env, abi_ulong ptr)#ifndef TARGET_ABI32 static abi_long do_arch_prctl (CPUX86State *env,int code,abi_ulong addr) { -abi_long ret;abi_ulong val;int idx;
@@ -3776,7 +3775,6 @@ static abi_long do_arch_prctl(CPUX86State *env, int code, abi_ulong addr)return -TARGET_EFAULT ;break ;default : - ret = -TARGET_EINVAL ;break ; }return 0 ;
@@ -7058,18 +7056,14 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,case TARGET_NR_osf_sigprocmask: {abi_ulong mask; -int how = arg1;sigset_t set, oldset;switch (arg1) {case TARGET_SIG_BLOCK : - how =SIG_BLOCK ;break ;case TARGET_SIG_UNBLOCK : - how =SIG_UNBLOCK ;break ;case TARGET_SIG_SETMASK : - how =SIG_SETMASK ;break ;default : ret = -TARGET_EINVAL ;
Signature · 1 line
1.7.5.53.gc233e
Re: [PATCH 10/10] linux-user: remove unused variables
Quoted 127 lines · Michael S. Tsirkin
Signed-off-by Michael S. Tsirkin <[email protected]>---
linux-user/flatload.c | 10 ++++++---- linux-user/linuxload.c | 25 +------------------------ linux-user/main.c | 6 +++--- linux-user/signal.c | 5 ----- linux-user/syscall.c | 6 ------ 5 files changed, 10 insertions(+), 42 deletions(-)linux-user/flatload.c +6
-4@@ -379,12 +379,14 @@ static int load_flat_file(struct linux_binprm * bprm,abi_long result;abi_ulong realdatastart =0 ;abi_ulong text_len, data_len, bss_len, stack_len, flags; -abi_ulong memp =0 ;/* for finding the brk area */ abi_ulong extra;abi_ulong reloc =0 , rp;int i, rev, relocs =0 ;abi_ulong fpos; -abi_ulong start_code, end_code; +abi_ulong start_code; +#ifdef DEBUG +abi_ulong end_code; +#endif abi_ulong indx_len; hdr = ((struct flat_hdr *) bprm->buf);/* exec-header */ @@ -491,7 +493,6 @@ static int load_flat_file(struct linux_binprm * bprm, } reloc = datapos + (ntohl (hdr->reloc_start) - text_len); - memp = realdatastart; }else {@@ -506,7 +507,6 @@ static int load_flat_file(struct linux_binprm * bprm, realdatastart = textpos +ntohl (hdr->data_start); datapos = realdatastart + indx_len; reloc = (textpos +ntohl (hdr->reloc_start) + indx_len); - memp = textpos;#ifdef CONFIG_BINFMT_ZFLAT #error code needs checking@@ -552,7 +552,9 @@ static int load_flat_file(struct linux_binprm * bprm,/* The main program needs a little extra setup in the task structure */ start_code = textpos +sizeof (struct flat_hdr ); +#ifdef DEBUG end_code = textpos + text_len; +#endif DBG_FLT("%s %s: TEXT=%x-%x DATA=%x-%x BSS=%x-%x\n", id ? "Lib" : "Load", bprm->filename,linux-user/linuxload.c +1
-24@@ -26,22 +26,6 @@ abi_long memcpy_to_target(abi_ulong dest, const void *src,return 0 ; } -static int in_group_p (gid_t g) -{ -/* return TRUE if we're in the specified group, FALSE otherwise */ -int ngroup; -int i; -gid_t grouplist[NGROUPS ]; - - ngroup =getgroups (NGROUPS , grouplist); -for (i =0 ; i < ngroup; i++) { -if (grouplist[i] == g) { -return 1 ; - } - } -return 0 ; -} -static int count (char ** vec) {int i;@@ -57,7 +41,7 @@ static int prepare_binprm(struct linux_binprm *bprm) {struct stat st;int mode; -int retval, id_change; +int retval;if (fstat (bprm->fd, &st) <0 ) {return (-errno);@@ -73,14 +57,10 @@ static int prepare_binprm(struct linux_binprm *bprm) bprm->e_uid =geteuid (); bprm->e_gid =getegid (); - id_change =0 ;/* Set-uid? */ if (mode &S_ISUID ) { bprm->e_uid = st.st_uid; -if (bprm->e_uid !=geteuid ()) { - id_change =1 ; - } }/* Set-gid? */ @@ -91,9 +71,6 @@ static int prepare_binprm(struct linux_binprm *bprm)*/ if ((mode & (S_ISGID |S_IXGRP )) == (S_ISGID |S_IXGRP )) { bprm->e_gid = st.st_gid; -if (!in_group_p (bprm->e_gid)) { - id_change =1 ; - } } retval =read (bprm->fd, bprm->buf,BPRM_BUF_SIZE );linux-user/main.c +1
-1@@ -2053,15 +2053,15 @@ void cpu_loop(CPUMIPSState *env) }else {int nb_args;abi_ulong sp_reg; -abi_ulong arg5 =0 , arg6 =0 , arg7 =0 , arg8 =0 ; +abi_ulong arg5 =0 , arg6 =0 ;
linux-user/main.c void cpu_loop(CPUMIPSState *env) · line 2064
Quoted 10 lines
linux-user/main.c +2
-2nb_args = mips_syscall_args[syscall_num]; sp_reg = env->active_tc.gpr[29 ];switch (nb_args) {/* these arguments are taken from the stack */ /* FIXME - what to do if get_user() fails? */ -case 8 :get_user_ual (arg8, sp_reg +28 ); -case 7 :get_user_ual (arg7, sp_reg +24 ); +case 8 :/* get_user_ual(arg8, sp_reg + 28); */ +case 7 :/* get_user_ual(arg7, sp_reg + 24); */
I'd prefer to see these and the respective variable definitions #if 0'd with a comment, stating that they're currently unused.
Quoted 16 lines
linux-user/main.c +0
-0case 6 :get_user_ual (arg6, sp_reg +20 );case 5 :get_user_ual (arg5, sp_reg +16 );default :linux-user/signal.c +0
-1@@ -2080,7 +2080,6 @@ long do_sigreturn(CPUState *env)uint32_t up_psr, pc, npc;target_sigset_t set;sigset_t host_set; -abi_ulong fpu_save_addr;int err, i; sf_addr = env->regwptr[UREG_FP ];
linux-user/signal.c long do_sigreturn(CPUState *env) · line 2123
Quoted 4 lines
linux-user/signal.c +0
-1@@ -2120,8 +2119,6 @@ long do_sigreturn(CPUState *env) err |=__get_user (env->regwptr[i +UREG_I0 ], &sf->info.si_regs.u_regs[i+8 ]); } - err |=__get_user (fpu_save_addr, &sf->fpu_save);
This probably goes along the same line. Please keep the code around - it seems related to the commented out code below.
Quoted 13 lines
linux-user/signal.c +0
-2-//if (fpu_save) // err |= restore_fpu_state(env, fpu_save); @@ -2228,7 +2225,6 @@ void sparc64_set_context(CPUSPARCState *env)target_mc_gregset_t *grp;abi_ulong pc, npc, tstate;abi_ulong fp, i7, w_addr; -unsigned char fenab;int err;unsigned int i;
linux-user/signal.c void sparc64_set_context(CPUSPARCState *env) · line 2296
Quoted 4 lines
linux-user/signal.c +0
-1@@ -2293,7 +2289,6 @@ void sparc64_set_context(CPUSPARCState *env) if (put_user(i7, w_addr + offsetof(struct target_reg_window, ins[7]), abi_ulong) != 0) goto do_sigsegv; - err |=__get_user (fenab, &(ucp->tuc_mcontext.mc_fpregs.mcfpu_enab));
not sure here - might be the same as above?
Quoted 16 lines
linux-user/signal.c +0
-0err |=__get_user (env->fprs, &(ucp->tuc_mcontext.mc_fpregs.mcfpu_fprs)); {uint32_t *src, *dst;linux-user/syscall.c +0
-1@@ -3751,7 +3751,6 @@ static abi_long do_get_thread_area(CPUX86State *env, abi_ulong ptr)#ifndef TARGET_ABI32 static abi_long do_arch_prctl (CPUX86State *env,int code,abi_ulong addr) { -abi_long ret;abi_ulong val;int idx;
linux-user/syscall.c static abi_long do_arch_prctl(CPUX86State *env, int code, abi_ulong addr) · line 3779
Quoted 4 lines
linux-user/syscall.c +0
-1@@ -3776,7 +3775,6 @@ static abi_long do_arch_prctl(CPUX86State *env, int code, abi_ulong addr)return -TARGET_EFAULT ;break ;default : - ret = -TARGET_EINVAL ;
I'm fairly sure this was supposed to be "return -TARGET_EINVAL".
Quoted 9 lines
linux-user/syscall.c +0
-1break ; }return 0 ;@@ -7058,18 +7056,14 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,case TARGET_NR_osf_sigprocmask: {abi_ulong mask; -int how = arg1;sigset_t set, oldset;
linux-user/syscall.c abi_long do_syscall(void *cpu_env, int num, abi_long arg1, · line 7072
Quoted 10 lines
linux-user/syscall.c +0
-3switch (arg1) {case TARGET_SIG_BLOCK : - how =SIG_BLOCK ;break ;case TARGET_SIG_UNBLOCK : - how =SIG_UNBLOCK ;break ;case TARGET_SIG_SETMASK : - how =SIG_SETMASK ;
why go through the effort of setting "how" and then not using it? I'm pretty sure this is a bug as well. A few lines down is the following code:
sigprocmask(arg1, &set, &oldset);
which in TARGET_NR_sigprocmask would be:
ret = get_errno(sigprocmask(how, &set, &oldset));
So we end up sending guest masks to the host. Richard, this is Alpha specific code. Mind to double-check?
Alex
Re: [PATCH 10/10] linux-user: remove unused variables
Quoted 233 lines · Alexander Graf
Quoted 127 lines · Michael S. Tsirkin
Signed-off-by Michael S. Tsirkin <[email protected]>---
linux-user/flatload.c | 10 ++++++---- linux-user/linuxload.c | 25 +------------------------ linux-user/main.c | 6 +++--- linux-user/signal.c | 5 ----- linux-user/syscall.c | 6 ------ 5 files changed, 10 insertions(+), 42 deletions(-)linux-user/flatload.c +6
-4@@ -379,12 +379,14 @@ static int load_flat_file(struct linux_binprm * bprm,abi_long result;abi_ulong realdatastart =0 ;abi_ulong text_len, data_len, bss_len, stack_len, flags; -abi_ulong memp =0 ;/* for finding the brk area */ abi_ulong extra;abi_ulong reloc =0 , rp;int i, rev, relocs =0 ;abi_ulong fpos; -abi_ulong start_code, end_code; +abi_ulong start_code; +#ifdef DEBUG +abi_ulong end_code; +#endif abi_ulong indx_len; hdr = ((struct flat_hdr *) bprm->buf);/* exec-header */ @@ -491,7 +493,6 @@ static int load_flat_file(struct linux_binprm * bprm, } reloc = datapos + (ntohl (hdr->reloc_start) - text_len); - memp = realdatastart; }else {@@ -506,7 +507,6 @@ static int load_flat_file(struct linux_binprm * bprm, realdatastart = textpos +ntohl (hdr->data_start); datapos = realdatastart + indx_len; reloc = (textpos +ntohl (hdr->reloc_start) + indx_len); - memp = textpos;#ifdef CONFIG_BINFMT_ZFLAT #error code needs checking@@ -552,7 +552,9 @@ static int load_flat_file(struct linux_binprm * bprm,/* The main program needs a little extra setup in the task structure */ start_code = textpos +sizeof (struct flat_hdr ); +#ifdef DEBUG end_code = textpos + text_len; +#endif DBG_FLT("%s %s: TEXT=%x-%x DATA=%x-%x BSS=%x-%x\n", id ? "Lib" : "Load", bprm->filename,linux-user/linuxload.c +1
-24@@ -26,22 +26,6 @@ abi_long memcpy_to_target(abi_ulong dest, const void *src,return 0 ; } -static int in_group_p (gid_t g) -{ -/* return TRUE if we're in the specified group, FALSE otherwise */ -int ngroup; -int i; -gid_t grouplist[NGROUPS ]; - - ngroup =getgroups (NGROUPS , grouplist); -for (i =0 ; i < ngroup; i++) { -if (grouplist[i] == g) { -return 1 ; - } - } -return 0 ; -} -static int count (char ** vec) {int i;@@ -57,7 +41,7 @@ static int prepare_binprm(struct linux_binprm *bprm) {struct stat st;int mode; -int retval, id_change; +int retval;if (fstat (bprm->fd, &st) <0 ) {return (-errno);@@ -73,14 +57,10 @@ static int prepare_binprm(struct linux_binprm *bprm) bprm->e_uid =geteuid (); bprm->e_gid =getegid (); - id_change =0 ;/* Set-uid? */ if (mode &S_ISUID ) { bprm->e_uid = st.st_uid; -if (bprm->e_uid !=geteuid ()) { - id_change =1 ; - } }/* Set-gid? */ @@ -91,9 +71,6 @@ static int prepare_binprm(struct linux_binprm *bprm)*/ if ((mode & (S_ISGID |S_IXGRP )) == (S_ISGID |S_IXGRP )) { bprm->e_gid = st.st_gid; -if (!in_group_p (bprm->e_gid)) { - id_change =1 ; - } } retval =read (bprm->fd, bprm->buf,BPRM_BUF_SIZE );linux-user/main.c +1
-1@@ -2053,15 +2053,15 @@ void cpu_loop(CPUMIPSState *env) }else {int nb_args;abi_ulong sp_reg; -abi_ulong arg5 =0 , arg6 =0 , arg7 =0 , arg8 =0 ; +abi_ulong arg5 =0 , arg6 =0 ;linux-user/main.c void cpu_loop(CPUMIPSState *env) · line 2064
Quoted 10 lines
linux-user/main.c +2
-2nb_args = mips_syscall_args[syscall_num]; sp_reg = env->active_tc.gpr[29 ];switch (nb_args) {/* these arguments are taken from the stack */ /* FIXME - what to do if get_user() fails? */ -case 8 :get_user_ual (arg8, sp_reg +28 ); -case 7 :get_user_ual (arg7, sp_reg +24 ); +case 8 :/* get_user_ual(arg8, sp_reg + 28); */ +case 7 :/* get_user_ual(arg7, sp_reg + 24); */ I'd prefer to see these and the respective variable definitions #if 0'd with a comment, stating that they're currently unused.
Quoted 16 lines
linux-user/main.c +0
-0case 6 :get_user_ual (arg6, sp_reg +20 );case 5 :get_user_ual (arg5, sp_reg +16 );default :linux-user/signal.c +0
-1@@ -2080,7 +2080,6 @@ long do_sigreturn(CPUState *env)uint32_t up_psr, pc, npc;target_sigset_t set;sigset_t host_set; -abi_ulong fpu_save_addr;int err, i; sf_addr = env->regwptr[UREG_FP ];linux-user/signal.c long do_sigreturn(CPUState *env) · line 2123
Quoted 4 lines
linux-user/signal.c +0
-1@@ -2120,8 +2119,6 @@ long do_sigreturn(CPUState *env) err |=__get_user (env->regwptr[i +UREG_I0 ], &sf->info.si_regs.u_regs[i+8 ]); } - err |=__get_user (fpu_save_addr, &sf->fpu_save);This probably goes along the same line. Please keep the code around - it seems related to the commented out code below.
Quoted 13 lines
linux-user/signal.c +0
-2-//if (fpu_save) // err |= restore_fpu_state(env, fpu_save); @@ -2228,7 +2225,6 @@ void sparc64_set_context(CPUSPARCState *env)target_mc_gregset_t *grp;abi_ulong pc, npc, tstate;abi_ulong fp, i7, w_addr; -unsigned char fenab;int err;unsigned int i;linux-user/signal.c void sparc64_set_context(CPUSPARCState *env) · line 2296
Quoted 4 lines
linux-user/signal.c +0
-1@@ -2293,7 +2289,6 @@ void sparc64_set_context(CPUSPARCState *env) if (put_user(i7, w_addr + offsetof(struct target_reg_window, ins[7]), abi_ulong) != 0) goto do_sigsegv; - err |=__get_user (fenab, &(ucp->tuc_mcontext.mc_fpregs.mcfpu_enab));not sure here - might be the same as above?
Quoted 16 lines
linux-user/signal.c +0
-0err |=__get_user (env->fprs, &(ucp->tuc_mcontext.mc_fpregs.mcfpu_fprs)); {uint32_t *src, *dst;linux-user/syscall.c +0
-1@@ -3751,7 +3751,6 @@ static abi_long do_get_thread_area(CPUX86State *env, abi_ulong ptr)#ifndef TARGET_ABI32 static abi_long do_arch_prctl (CPUX86State *env,int code,abi_ulong addr) { -abi_long ret;abi_ulong val;int idx;linux-user/syscall.c static abi_long do_arch_prctl(CPUX86State *env, int code, abi_ulong addr) · line 3779
Quoted 4 lines
linux-user/syscall.c +0
-1@@ -3776,7 +3775,6 @@ static abi_long do_arch_prctl(CPUX86State *env, int code, abi_ulong addr)return -TARGET_EFAULT ;break ;default : - ret = -TARGET_EINVAL ;I'm fairly sure this was supposed to be "return -TARGET_EINVAL".
Quoted 9 lines
linux-user/syscall.c +0
-1break ; }return 0 ;@@ -7058,18 +7056,14 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,case TARGET_NR_osf_sigprocmask: {abi_ulong mask; -int how = arg1;sigset_t set, oldset;linux-user/syscall.c abi_long do_syscall(void *cpu_env, int num, abi_long arg1, · line 7072
Quoted 10 lines
linux-user/syscall.c +0
-3switch (arg1) {case TARGET_SIG_BLOCK : - how =SIG_BLOCK ;break ;case TARGET_SIG_UNBLOCK : - how =SIG_UNBLOCK ;break ;case TARGET_SIG_SETMASK : - how =SIG_SETMASK ;why go through the effort of setting "how" and then not using it? I'm pretty sure this is a bug as well. A few lines down is the following code:
sigprocmask(arg1, &set, &oldset);
Quoted 8 lines
which in
TARGET_NR_sigprocmaskwould be:ret = get_errno(sigprocmask(how, &set, &oldset));So we end up sending guest masks to the host. Richard, this is Alpha specific code. Mind to double-check?
Alex
Could you guys fix these the way you like?
I just want my build to pass ...
Signature · 1 line
MST
Re: [PATCH 10/10] linux-user: remove unused variables
In reply to Alexander GrafQuoted 13 lines · Alexander Graf
linux-user/main.c void cpu_loop(CPUMIPSState *env) · line 2064
Quoted 12 lines
linux-user/main.c +3
-3-abi_ulong arg5 =0 , arg6 =0 , arg7 =0 , arg8 =0 ; +abi_ulong arg5 =0 , arg6 =0 ; nb_args = mips_syscall_args[syscall_num]; sp_reg = env->active_tc.gpr[29 ];switch (nb_args) {/* these arguments are taken from the stack */ /* FIXME - what to do if get_user() fails? */ -case 8 :get_user_ual (arg8, sp_reg +28 ); -case 7 :get_user_ual (arg7, sp_reg +24 ); +case 8 :/* get_user_ual(arg8, sp_reg + 28); */ +case 7 :/* get_user_ual(arg7, sp_reg + 24); */
Quoted 2 lines
I'd prefer to see these and the respective variable definitions #if 0'd with a comment, stating that they're currently unused.
I'd prefer not to see if 0 code. Better, I think, to mark the variables as __attribute__((unused)) with that same comment.
Quoted 21 lines
Quoted 6 lines
linux-user/syscall.c +0
-1@@ -7058,18 +7056,14 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,case TARGET_NR_osf_sigprocmask: {abi_ulong mask; -int how = arg1;sigset_t set, oldset;linux-user/syscall.c abi_long do_syscall(void *cpu_env, int num, abi_long arg1, · line 7072
Quoted 10 lines
linux-user/syscall.c +0
-3switch (arg1) {case TARGET_SIG_BLOCK : - how =SIG_BLOCK ;break ;case TARGET_SIG_UNBLOCK : - how =SIG_UNBLOCK ;break ;case TARGET_SIG_SETMASK : - how =SIG_SETMASK ;why go through the effort of setting "how" and then not using it? I'm pretty sure this is a bug as well. A few lines down is the following code:
Quoted 8 lines
sigprocmask(arg1, &set, &oldset);which in
TARGET_NR_sigprocmaskwould be:ret = get_errno(sigprocmask(how, &set, &oldset));So we end up sending guest masks to the host. Richard, this is Alpha specific code. Mind to double-check?
I remember fixing this before. Perhaps it was in a patch tree that never got pulled...
r~
Re: [PATCH 10/10] linux-user: remove unused variables
Quoted 14 lines · Richard Henderson
Quoted 13 lines · Alexander Graf
Quoted 12 lines
linux-user/main.c +3
-3-abi_ulong arg5 =0 , arg6 =0 , arg7 =0 , arg8 =0 ; +abi_ulong arg5 =0 , arg6 =0 ; nb_args = mips_syscall_args[syscall_num]; sp_reg = env->active_tc.gpr[29 ];switch (nb_args) {/* these arguments are taken from the stack */ /* FIXME - what to do if get_user() fails? */ -case 8 :get_user_ual (arg8, sp_reg +28 ); -case 7 :get_user_ual (arg7, sp_reg +24 ); +case 8 :/* get_user_ual(arg8, sp_reg + 28); */ +case 7 :/* get_user_ual(arg7, sp_reg + 24); */
Quoted 5 lines
Quoted 2 lines
I'd prefer to see these and the respective variable definitions #if 0'd with a comment, stating that they're currently unused.
I'd prefer not to see if 0 code. Better, I think, to mark the variables as __attribute__((unused)) with that same comment.
Why keep dead code around? If it's for documentation pruposes comment or if 0 seems more appropriate than attributes.
Quoted 35 lines
Quoted 21 lines
Quoted 6 lines
linux-user/syscall.c +0
-1@@ -7058,18 +7056,14 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,case TARGET_NR_osf_sigprocmask: {abi_ulong mask; -int how = arg1;sigset_t set, oldset;linux-user/syscall.c abi_long do_syscall(void *cpu_env, int num, abi_long arg1, · line 7072
Quoted 10 lines
linux-user/syscall.c +0
-3switch (arg1) {case TARGET_SIG_BLOCK : - how =SIG_BLOCK ;break ;case TARGET_SIG_UNBLOCK : - how =SIG_UNBLOCK ;break ;case TARGET_SIG_SETMASK : - how =SIG_SETMASK ;why go through the effort of setting "how" and then not using it? I'm pretty sure this is a bug as well. A few lines down is the following code:
Quoted 8 lines
sigprocmask(arg1, &set, &oldset);which in
TARGET_NR_sigprocmaskwould be:ret = get_errno(sigprocmask(how, &set, &oldset));So we end up sending guest masks to the host. Richard, this is Alpha specific code. Mind to double-check?
I remember fixing this before. Perhaps it was in a patch tree that never got pulled...
r~
Re: [Qemu-devel] [PATCH 10/10] linux-user: remove unused variables
In reply to Richard HendersonQuoted 14 lines · Richard Henderson
Quoted 13 lines · Alexander Graf
Quoted 12 lines
- abi_ulong arg5 = 0, arg6 = 0, arg7 = 0, arg8 = 0;
+ abi_ulong arg5 = 0, arg6 = 0;
nb_args= mips_syscall_args[syscall_num];sp_reg= env->active_tc.gpr[29]; switch (nb_args) {
/* these arguments are taken from the stack */ /* FIXME - what to do ifget_user()fails? */
- case 8:get_user_ual(arg8, sp_reg + 28);
- case 7:get_user_ual(arg7, sp_reg + 24);
+ case 8: /*get_user_ual(arg8, sp_reg + 28); */
+ case 7: /*get_user_ual(arg7, sp_reg + 24); */
Quoted 5 lines
Quoted 2 lines
I'd prefer to see these and the respective variable definitions #if 0'd with a comment, stating that they're currently unused.
I'd prefer not to see if 0 code. Better, I think, to mark the variables as __attribute__((unused)) with that same comment.
Ideally what we ought to be doing here is actually plumbing arg7 and arg8 through to do_syscall().
Two syscalls in the table, sys_fadvise64_64 and sys_sync_file_range, take 7 arguments (and we can deduce that they're misimplemented in do_syscall() for 32 bit MIPS targets, probably by not gluing together two 32 bit arguments into a 64 bit value to pass to the libc function); arg8 is needed in order to be able to invoke these 7 argument syscalls via sys_syscall. (sys_syscall's entry in the mips_syscall_args[] array says it takes zero arguments, which I think is just broken.)
Actually fixing the 7-argument syscalls is a bit out of scope, but I think widening do_syscall() to take 8 arguments is straightforward enough.
(Incidentally this whole code looks a bit 32 bit specific, do we support 64 bit mips targets in linux-user mode ?)
-- PMM
Re: [Qemu-devel] [PATCH 10/10] linux-user: remove unused variables
In reply to Alexander GrafQuoted 23 lines · Alexander Graf
Quoted 8 lines · Michael S. Tsirkin
return 0;
(quoted diff) +0
-0@@ -7058,18 +7056,14 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,case
TARGET_NR_osf_sigprocmask:
{
abi_ulongmask;
- int how = arg1;
sigset_tset, oldset;Quoted 9 lines
switch(arg1) {
caseTARGET_SIG_BLOCK:
- how =SIG_BLOCK;
break;
caseTARGET_SIG_UNBLOCK:
- how =SIG_UNBLOCK;
break;
caseTARGET_SIG_SETMASK:
- how =SIG_SETMASK;why go through the effort of setting "how" and then not using it? I'm pretty sure this is a bug as well. A few lines down is the following code:
Quoted 7 lines
sigprocmask(arg1, &set, &oldset);which in
TARGET_NR_sigprocmaskwould be:ret =
get_errno(sigprocmask(how, &set, &oldset));So we end up sending guest masks to the host.
Yes, this change is wrong. We've had a better version of these fixes posted to the list already by Juan:
http://patchwork.ozlabs.org/patch/98376/
at least some of which have already been reviewed.
-- PMM
Re: [PATCH 10/10] linux-user: remove unused variables
In reply to Michael S. TsirkinQuoted 1 line · Michael S. Tsirkin
Signed-off-by Michael S. Tsirkin <[email protected]>
Riku, could you fix this up in a way that makes sense please? All I really care about is that -Werror build passes with the latest gcc.
Signature · 1 line
MST
Re: [Qemu-devel] [PATCH 10/10] linux-user: remove unused variables
Quoted 6 lines · Michael S. Tsirkin
Quoted 1 line · Michael S. Tsirkin
Signed-off-by Michael S. Tsirkin <[email protected]>Riku, could you fix this up in a way that makes sense please? All I really care about is that -Werror build passes with the latest gcc.
These warnings are all fixed in master + latest linux-user pullreq
+ latest trivial-patches pullreq, with the exception of one new one introduced by the pselect6 patch in the linaro pullreq.
-- PMM
Re: [Qemu-devel] [PATCH 10/10] linux-user: remove unused variables
Quoted 11 lines · Peter Maydell
Quoted 6 lines · Michael S. Tsirkin
Quoted 1 line · Michael S. Tsirkin
Signed-off-by Michael S. Tsirkin <[email protected]>Riku, could you fix this up in a way that makes sense please? All I really care about is that -Werror build passes with the latest gcc.
These warnings are all fixed in master + latest linux-user pullreq
+ latest trivial-patches pullreq, with the exception of one new one introduced by the pselect6 patch in the linaro pullreq.
oops, s/linaro/linux-user/
-- PMM