Fix a number of unused-but-set-variable warnings (new with gcc-4.6)
PATCH 1/1 Fix a number of unused-but-set-variable warnings (new with gcc-4.6)
--- target-i386/kvm.c | 4 ++-- tcg/tcg.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
target-i386/kvm.c +2 -2
@@ -950,7 +950,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);
@@ -966,7 +966,7 @@ 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 ); +/* fop = (uint16_t)(xsave->region[1] >> 16); */ env->fpstt = (swd >>11 ) &7 ; env->fpus = swd; env->fpuc = cwd;
tcg/tcg.c +2 -2
@@ -585,7 +585,7 @@ void tcg_register_helper(void *func, const char *name)void tcg_gen_callN (TCGContext *s,TCGv_ptr func,unsigned int flags,int sizemask,TCGArg ret,int nargs,TCGArg *args) { -#ifdef TCG_TARGET_I386 +#if definedTCG_TARGET_I386 &&TCG_TARGET_REG_BITS <64 int call_type;#endif int i;
@@ -612,7 +612,7 @@ void tcg_gen_callN(TCGContext *s, TCGv_ptr func, unsigned int flags, *gen_opc_ptr++ = INDEX_op_call; nparam = gen_opparam_ptr++; -#ifdef TCG_TARGET_I386 +#if definedTCG_TARGET_I386 &&TCG_TARGET_REG_BITS <64 call_type = (flags &TCG_CALL_TYPE_MASK );#endif if (ret !=TCG_CALL_DUMMY_ARG ) {
Signature · 1 line
1.7.5
Hi Hans,
target-i386/kvm.c static int kvm_get_xsave(CPUState *env) · line 969
Quoted 11 lines · Hans de Goede
target-i386/kvm.c +1
-1@@ -950,7 +950,7 @@ static int kvm_get_xsave(CPUState *env)@@ -966,7 +966,7 @@ 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 ); +/* fop = (uint16_t)(xsave->region[1] >> 16); */
Wouldn't it be better to drop this line?
tcg/tcg.c void tcg_register_helper(void *func, const char *name) · line 588
Quoted 13 lines
target-i386/kvm.c +0
-0env->fpstt = (swd >>11 ) &7 ; env->fpus = swd; env->fpuc = cwd;tcg/tcg.c +1
-1@@ -585,7 +585,7 @@ void tcg_register_helper(void *func, const char *name)void tcg_gen_callN (TCGContext *s,TCGv_ptr func,unsigned int flags,int sizemask,TCGArg ret,int nargs,TCGArg *args) { -#ifdef TCG_TARGET_I386 +#if definedTCG_TARGET_I386 &&TCG_TARGET_REG_BITS <64
This function uses #if defined(TCG_TARGET_I386) in other places, so I'd use parentheses here for consistency.
tcg/tcg.c void tcg_gen_callN(TCGContext *s, TCGv_ptr func, unsigned int flags, · line 615
Quoted 9 lines
tcg/tcg.c +1
-1int call_type;#endif int i;@@ -612,7 +612,7 @@ void tcg_gen_callN(TCGContext *s, TCGv_ptr func, unsigned int flags, *gen_opc_ptr++ = INDEX_op_call; nparam = gen_opparam_ptr++; -#ifdef TCG_TARGET_I386 +#if definedTCG_TARGET_I386 &&TCG_TARGET_REG_BITS <64
Same here.
Apart from that, I also need this patch to be able to build qemu on fedora 15 :)
Christophe
Quoted 46 lines · Christophe Fergeau
Hi Hans,
target-i386/kvm.c static int kvm_get_xsave(CPUState *env) · line 969
Quoted 11 lines · Hans de Goede
target-i386/kvm.c +1
-1@@ -950,7 +950,7 @@ static int kvm_get_xsave(CPUState *env)@@ -966,7 +966,7 @@ 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 ); +/* fop = (uint16_t)(xsave->region[1] >> 16); */ Wouldn't it be better to drop this line?
tcg/tcg.c void tcg_register_helper(void *func, const char *name) · line 588
Quoted 13 lines
target-i386/kvm.c +0
-0env->fpstt = (swd >>11 ) &7 ; env->fpus = swd; env->fpuc = cwd;tcg/tcg.c +1
-1@@ -585,7 +585,7 @@ void tcg_register_helper(void *func, const char *name)void tcg_gen_callN (TCGContext *s,TCGv_ptr func,unsigned int flags,int sizemask,TCGArg ret,int nargs,TCGArg *args) { -#ifdef TCG_TARGET_I386 +#if definedTCG_TARGET_I386 &&TCG_TARGET_REG_BITS <64 This function uses #if
defined(TCG_TARGET_I386)in other places, so I'd use parentheses here for consistency.tcg/tcg.c void tcg_gen_callN(TCGContext *s, TCGv_ptr func, unsigned int flags, · line 615
Quoted 9 lines
tcg/tcg.c +1
-1int call_type;#endif int i;@@ -612,7 +612,7 @@ void tcg_gen_callN(TCGContext *s, TCGv_ptr func, unsigned int flags, *gen_opc_ptr++ = INDEX_op_call; nparam = gen_opparam_ptr++; -#ifdef TCG_TARGET_I386 +#if definedTCG_TARGET_I386 &&TCG_TARGET_REG_BITS <64 Same here.
Quoted 3 lines
Apart from that, I also need this patch to be able to build qemu on fedora 15 :)
You should also probably split the patch in two parts, as it touch totally different parts of QEMU, and thus is going to be reviewed/applied by different person. I am fine with the TCG part after the comments from Christophe, so I'll apply it as soon as the new version is out.
Signature · 2 lines
Aurelien Jarno GPG: 1024D/F1BCDB73 [email protected] http://www.aurel32.net
Quoted 4 lines · Hans de Goede
--- target-i386/kvm.c | 4 ++-- tcg/tcg.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
Thanks; just got hit by this.
However, there are a couple of whitespace issues:
Quoted 12 lines
tcg/tcg.c +1
-1@@ -585,7 +585,7 @@ void tcg_register_helper(void *func, const char *name)void tcg_gen_callN (TCGContext *s,TCGv_ptr func,unsigned int flags,int sizemask,TCGArg ret,int nargs,TCGArg *args) { -#ifdef TCG_TARGET_I386 +#if definedTCG_TARGET_I386 &&TCG_TARGET_REG_BITS <64 int call_type;#endif int i;
tcg/tcg.c void tcg_gen_callN(TCGContext *s, TCGv_ptr func, unsigned int flags, · line 618
Quoted 8 lines
tcg/tcg.c +1
-1@@ -612,7 +612,7 @@ void tcg_gen_callN(TCGContext *s, TCGv_ptr func, unsigned int flags, *gen_opc_ptr++ = INDEX_op_call; nparam = gen_opparam_ptr++; -#ifdef TCG_TARGET_I386 +#if definedTCG_TARGET_I386 &&TCG_TARGET_REG_BITS <64 call_type = (flags &TCG_CALL_TYPE_MASK );#endif if (ret !=TCG_CALL_DUMMY_ARG ) {
Both these lines have a trailing space.
Care to resubmit with Anthony in CC? You can add:
Amit
cover Fix unused-but-set-variable warnings
Hi,
Here are Hans's patches split and with the various issues that were pointed out fixed. I'm not sure how I'm supposed to handle acks, original author, ... when reworking patches this way, let me know if I should proceed differently.
Christophe
Christophe Fergeau (2):
tcg: Fix unused-but-set-variable warning
kvm: Fix unused-but-set-variable warning
target-i386/kvm.c | 3 +-- tcg/tcg.c | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-)
Signature · 1 line
1.7.5.2
PATCH 1/2 tcg: Fix unused-but-set-variable warning
Based on a patch from Hans de Goede <[email protected]>
This warning is new in gcc 4.6.
--- tcg/tcg.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
tcg/tcg.c +2 -2
@@ -585,7 +585,7 @@ void tcg_register_helper(void *func, const char *name)void tcg_gen_callN (TCGContext *s,TCGv_ptr func,unsigned int flags,int sizemask,TCGArg ret,int nargs,TCGArg *args) { -#ifdef TCG_TARGET_I386 +#if defined(TCG_TARGET_I386 ) &&TCG_TARGET_REG_BITS <64 int call_type;#endif int i;
@@ -612,7 +612,7 @@ void tcg_gen_callN(TCGContext *s, TCGv_ptr func, unsigned int flags, *gen_opc_ptr++ = INDEX_op_call; nparam = gen_opparam_ptr++; -#ifdef TCG_TARGET_I386 +#if defined(TCG_TARGET_I386 ) &&TCG_TARGET_REG_BITS <64 call_type = (flags &TCG_CALL_TYPE_MASK );#endif if (ret !=TCG_CALL_DUMMY_ARG ) {
Signature · 1 line
1.7.5.2
PATCH 2/2 kvm: Fix unused-but-set-variable warning
In reply to Christophe FergeauBased on a patch from Hans de Goede <[email protected]>
This warning is new in gcc 4.6.
--- target-i386/kvm.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
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.2
Re: [Qemu-devel] [PATCH 0/2] Fix unused-but-set-variable warnings
In reply to Christophe FergeauQuoted 6 lines · Christophe Fergeau
Hi,
Here are Hans's patches split and with the various issues that were pointed out fixed. I'm not sure how I'm supposed to handle acks, original author, ... when reworking patches this way, let me know if I should proceed differently.
You should keep From: as the same person, keep his Signed-off-by, add your Signed-off-by and mention what you have changed in the series.
Thanks for re-sending this, btw.
Amit
Re: [Qemu-devel] [PATCH 0/2] Fix unused-but-set-variable warnings
Quoted 2 lines · Amit Shah
You should keep From: as the same person, keep his Signed-off-by, add your Signed-off-by and mention what you have changed in the series.
Hans's patches didn't have a S-o-b. I can resend the same patches again with my S-o-b (I'm fine with doing this without Hans's since I came up with exactly the same patches independently from Hans) and detailing the changes from the initial patch. Does that sound good?
Christophe
Re: [Qemu-devel] [PATCH 0/2] Fix unused-but-set-variable warnings
Quoted 8 lines · Christophe Fergeau
Quoted 2 lines · Amit Shah
You should keep From: as the same person, keep his Signed-off-by, add your Signed-off-by and mention what you have changed in the series.
Hans's patches didn't have a S-o-b. I can resend the same patches again with my S-o-b (I'm fine with doing this without Hans's since I came up with exactly the same patches independently from Hans) and detailing the changes from the initial patch. Does that sound good?
Yes, that's fine.
Amit
v3 cover Fix unused-but-set-variable warnings
Here is another version of these patches.
Christophe
Changes:
v3
- added S-o-b
v2
- split patches
- removed whitespace at end of lines in tcm.
- changed #if defined XXX to #if defined(XXX)
- removed commented out line from kvm.c in the 1st patch
v1
- initial version from Hans
Christophe Fergeau (2):
tcg: Fix unused-but-set-variable warning
kvm: Fix unused-but-set-variable warning
target-i386/kvm.c | 3 +-- tcg/tcg.c | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-)
Signature · 1 line
1.7.5.2
PATCH v3 1/2 tcg: Fix unused-but-set-variable warning
Based on a patch from Hans de Goede <[email protected]>
This warning is new in gcc 4.6.
--- tcg/tcg.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
tcg/tcg.c +2 -2
@@ -585,7 +585,7 @@ void tcg_register_helper(void *func, const char *name)void tcg_gen_callN (TCGContext *s,TCGv_ptr func,unsigned int flags,int sizemask,TCGArg ret,int nargs,TCGArg *args) { -#ifdef TCG_TARGET_I386 +#if defined(TCG_TARGET_I386 ) &&TCG_TARGET_REG_BITS <64 int call_type;#endif int i;
@@ -612,7 +612,7 @@ void tcg_gen_callN(TCGContext *s, TCGv_ptr func, unsigned int flags, *gen_opc_ptr++ = INDEX_op_call; nparam = gen_opparam_ptr++; -#ifdef TCG_TARGET_I386 +#if defined(TCG_TARGET_I386 ) &&TCG_TARGET_REG_BITS <64 call_type = (flags &TCG_CALL_TYPE_MASK );#endif if (ret !=TCG_CALL_DUMMY_ARG ) {
Signature · 1 line
1.7.5.2
Aurelien Jarno
AppliedRe: [Qemu-devel] [PATCH-v3 1/2] tcg: Fix unused-but-set-variable warning
Quoted 9 lines · Christophe Fergeau
Based on a patch from Hans de Goede <[email protected]>
This warning is new in gcc 4.6.
Acked-by Amit Shah <[email protected]>Signed-off-by Christophe Fergeau <[email protected]>--- tcg/tcg.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
Thanks, applied.
Quoted 27 lines
tcg/tcg.c +2
-2@@ -585,7 +585,7 @@ void tcg_register_helper(void *func, const char *name)void tcg_gen_callN (TCGContext *s,TCGv_ptr func,unsigned int flags,int sizemask,TCGArg ret,int nargs,TCGArg *args) { -#ifdef TCG_TARGET_I386 +#if defined(TCG_TARGET_I386 ) &&TCG_TARGET_REG_BITS <64 int call_type;#endif int i;@@ -612,7 +612,7 @@ void tcg_gen_callN(TCGContext *s, TCGv_ptr func, unsigned int flags, *gen_opc_ptr++ = INDEX_op_call; nparam = gen_opparam_ptr++; -#ifdef TCG_TARGET_I386 +#if defined(TCG_TARGET_I386 ) &&TCG_TARGET_REG_BITS <64 call_type = (flags &TCG_CALL_TYPE_MASK );#endif if (ret !=TCG_CALL_DUMMY_ARG ) {Signature · 1 line
1.7.5.2
Signature · 2 lines
Aurelien Jarno GPG: 1024D/F1BCDB73 [email protected] http://www.aurel32.net
PATCH v3 2/2 kvm: Fix unused-but-set-variable warning
In reply to Christophe FergeauBased on a patch from Hans de Goede <[email protected]>
This warning is new in gcc 4.6.
--- target-i386/kvm.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
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.2
Re: [Qemu-devel] [PATCH-v3 2/2] kvm: Fix unused-but-set-variable warning
Ping?
Quoted 35 lines · Christophe Fergeau
Based on a patch from Hans de Goede <[email protected]>
This warning is new in gcc 4.6.
Acked-by Amit Shah <[email protected]>Signed-off-by Christophe Fergeau <[email protected]>--- target-i386/kvm.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)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.2
Re: [Qemu-devel] [PATCH-v3 2/2] kvm: Fix unused-but-set-variable warning
Quoted 1 line · Christophe Fergeau
Ping?
Let me add these patches to the trivial-patches tree since they haven't been picked up.
Stefan
Stefan Hajnoczi
AppliedRe: [Qemu-devel] [PATCH-v3 2/2] kvm: Fix unused-but-set-variable warning
In reply to Christophe FergeauQuoted 9 lines · Christophe Fergeau
Based on a patch from Hans de Goede <[email protected]>
This warning is new in gcc 4.6.
Acked-by Amit Shah <[email protected]>Signed-off-by Christophe Fergeau <[email protected]>--- target-i386/kvm.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
Thanks, applied to the trivial patches tree:
http://repo.or.cz/w/qemu/stefanha.git/shortlog/refs/heads/trivial-patches
Stefan
Re: [Qemu-devel] [PATCH-v3 2/2] kvm: Fix unused-but-set-variable warning
Quoted 5 lines · Stefan Hajnoczi
Quoted 4 lines · Christophe Fergeau
Based on a patch from Hans de Goede <[email protected]>
This warning is new in gcc 4.6.
Quoted 8 lines
Quoted 5 lines
Acked-by Amit Shah <[email protected]>Signed-off-by Christophe Fergeau <[email protected]>--- target-i386/kvm.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)Thanks, applied to the trivial patches tree:
http://repo.or.cz/w/qemu/stefanha.git/shortlog/refs/heads/trivial-patches
Please skip this one. I'll post a patch fixing the issue that this warning revealed (lacking save/restore of FPU OP, IP and DP).
Jan
Re: [Qemu-devel] [PATCH-v3 2/2] kvm: Fix unused-but-set-variable warning
Quoted 12 lines · Jan Kiszka
Quoted 11 lines · Stefan Hajnoczi
Quoted 9 lines · Christophe Fergeau
Based on a patch from Hans de Goede <[email protected]>
This warning is new in gcc 4.6.
Acked-by Amit Shah <[email protected]>Signed-off-by Christophe Fergeau <[email protected]>---
target-i386/kvm.c | 3 +--1 files changed, 1 insertions(+), 2 deletions(-)
Quoted 5 lines
Quoted 2 lines
Thanks, applied to the trivial patches tree:
http://repo.or.cz/w/qemu/stefanha.git/shortlog/refs/heads/trivial-patchesPlease skip this one. I'll post a patch fixing the issue that this warning revealed (lacking save/restore of FPU OP, IP and DP).
Okay, dropped from trivial-patches in favor of Jan's fix.
Stefan
Re: [Qemu-devel] [PATCH-v3 2/2] kvm: Fix unused-but-set-variable warning
Quoted 5 lines · Stefan Hajnoczi
Quoted 2 lines · Jan Kiszka
Please skip this one. I'll post a patch fixing the issue that this warning revealed (lacking save/restore of FPU OP, IP and DP).
Okay, dropped from trivial-patches in favor of Jan's fix.
Great, thanks to all!
Christophe
Quoted 2 lines
Stefan