qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] tcg/ppc/tcg-target.c: Avoid 'set but not used' gcc warnings
@ 2011-09-01 15:45 Peter Maydell
  2011-09-01 17:27 ` malc
  2011-09-01 19:41 ` Michael S. Tsirkin
  0 siblings, 2 replies; 3+ messages in thread
From: Peter Maydell @ 2011-09-01 15:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: patches

Move the declaration and initialisation of some variables in
tcg_out_qemu_ld and tcg_out_qemu_st inside CONFIG_SOFTMMU, to
avoid the "variable set but not used" warning of gcc 4.6.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 tcg/ppc/tcg-target.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/tcg/ppc/tcg-target.c b/tcg/ppc/tcg-target.c
index 58c8621..a003210 100644
--- a/tcg/ppc/tcg-target.c
+++ b/tcg/ppc/tcg-target.c
@@ -525,14 +525,14 @@ static void *qemu_st_helpers[4] = {
 
 static void tcg_out_qemu_ld (TCGContext *s, const TCGArg *args, int opc)
 {
-    int addr_reg, data_reg, data_reg2, r0, r1, rbase, mem_index, s_bits, bswap;
+    int addr_reg, data_reg, data_reg2, r0, r1, rbase, bswap;
 #ifdef CONFIG_SOFTMMU
-    int r2;
+    int mem_index, s_bits, r2;
     void *label1_ptr, *label2_ptr;
-#endif
 #if TARGET_LONG_BITS == 64
     int addr_reg2;
 #endif
+#endif
 
     data_reg = *args++;
     if (opc == 3)
@@ -540,13 +540,13 @@ static void tcg_out_qemu_ld (TCGContext *s, const TCGArg *args, int opc)
     else
         data_reg2 = 0;
     addr_reg = *args++;
+
+#ifdef CONFIG_SOFTMMU
 #if TARGET_LONG_BITS == 64
     addr_reg2 = *args++;
 #endif
     mem_index = *args;
     s_bits = opc & 3;
-
-#ifdef CONFIG_SOFTMMU
     r0 = 3;
     r1 = 4;
     r2 = 0;
@@ -722,14 +722,14 @@ static void tcg_out_qemu_ld (TCGContext *s, const TCGArg *args, int opc)
 
 static void tcg_out_qemu_st (TCGContext *s, const TCGArg *args, int opc)
 {
-    int addr_reg, r0, r1, data_reg, data_reg2, mem_index, bswap, rbase;
+    int addr_reg, r0, r1, data_reg, data_reg2, bswap, rbase;
 #ifdef CONFIG_SOFTMMU
-    int r2, ir;
+    int mem_index, r2, ir;
     void *label1_ptr, *label2_ptr;
-#endif
 #if TARGET_LONG_BITS == 64
     int addr_reg2;
 #endif
+#endif
 
     data_reg = *args++;
     if (opc == 3)
@@ -737,12 +737,12 @@ static void tcg_out_qemu_st (TCGContext *s, const TCGArg *args, int opc)
     else
         data_reg2 = 0;
     addr_reg = *args++;
+
+#ifdef CONFIG_SOFTMMU
 #if TARGET_LONG_BITS == 64
     addr_reg2 = *args++;
 #endif
     mem_index = *args;
-
-#ifdef CONFIG_SOFTMMU
     r0 = 3;
     r1 = 4;
     r2 = 0;
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] tcg/ppc/tcg-target.c: Avoid 'set but not used' gcc warnings
  2011-09-01 15:45 [Qemu-devel] [PATCH] tcg/ppc/tcg-target.c: Avoid 'set but not used' gcc warnings Peter Maydell
@ 2011-09-01 17:27 ` malc
  2011-09-01 19:41 ` Michael S. Tsirkin
  1 sibling, 0 replies; 3+ messages in thread
From: malc @ 2011-09-01 17:27 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel, patches

On Thu, 1 Sep 2011, Peter Maydell wrote:

> Move the declaration and initialisation of some variables in
> tcg_out_qemu_ld and tcg_out_qemu_st inside CONFIG_SOFTMMU, to
> avoid the "variable set but not used" warning of gcc 4.6.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  tcg/ppc/tcg-target.c |   20 ++++++++++----------
>  1 files changed, 10 insertions(+), 10 deletions(-)

Applied, thanks.

[..snip..]

-- 
mailto:av1474@comtv.ru

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] tcg/ppc/tcg-target.c: Avoid 'set but not used' gcc warnings
  2011-09-01 15:45 [Qemu-devel] [PATCH] tcg/ppc/tcg-target.c: Avoid 'set but not used' gcc warnings Peter Maydell
  2011-09-01 17:27 ` malc
@ 2011-09-01 19:41 ` Michael S. Tsirkin
  1 sibling, 0 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2011-09-01 19:41 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel, patches

On Thu, Sep 01, 2011 at 04:45:01PM +0100, Peter Maydell wrote:
> Move the declaration and initialisation of some variables in
> tcg_out_qemu_ld and tcg_out_qemu_st inside CONFIG_SOFTMMU, to
> avoid the "variable set but not used" warning of gcc 4.6.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  tcg/ppc/tcg-target.c |   20 ++++++++++----------
>  1 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/tcg/ppc/tcg-target.c b/tcg/ppc/tcg-target.c
> index 58c8621..a003210 100644
> --- a/tcg/ppc/tcg-target.c
> +++ b/tcg/ppc/tcg-target.c
> @@ -525,14 +525,14 @@ static void *qemu_st_helpers[4] = {
>  
>  static void tcg_out_qemu_ld (TCGContext *s, const TCGArg *args, int opc)
>  {
> -    int addr_reg, data_reg, data_reg2, r0, r1, rbase, mem_index, s_bits, bswap;
> +    int addr_reg, data_reg, data_reg2, r0, r1, rbase, bswap;
>  #ifdef CONFIG_SOFTMMU
> -    int r2;
> +    int mem_index, s_bits, r2;
>      void *label1_ptr, *label2_ptr;
> -#endif
>  #if TARGET_LONG_BITS == 64
>      int addr_reg2;
>  #endif
> +#endif
>  
>      data_reg = *args++;
>      if (opc == 3)
> @@ -540,13 +540,13 @@ static void tcg_out_qemu_ld (TCGContext *s, const TCGArg *args, int opc)
>      else
>          data_reg2 = 0;
>      addr_reg = *args++;
> +
> +#ifdef CONFIG_SOFTMMU
>  #if TARGET_LONG_BITS == 64
>      addr_reg2 = *args++;
>  #endif
>      mem_index = *args;
>      s_bits = opc & 3;
> -
> -#ifdef CONFIG_SOFTMMU
>      r0 = 3;
>      r1 = 4;
>      r2 = 0;
> @@ -722,14 +722,14 @@ static void tcg_out_qemu_ld (TCGContext *s, const TCGArg *args, int opc)
>  
>  static void tcg_out_qemu_st (TCGContext *s, const TCGArg *args, int opc)
>  {
> -    int addr_reg, r0, r1, data_reg, data_reg2, mem_index, bswap, rbase;
> +    int addr_reg, r0, r1, data_reg, data_reg2, bswap, rbase;
>  #ifdef CONFIG_SOFTMMU
> -    int r2, ir;
> +    int mem_index, r2, ir;
>      void *label1_ptr, *label2_ptr;
> -#endif
>  #if TARGET_LONG_BITS == 64
>      int addr_reg2;
>  #endif
> +#endif
>  
>      data_reg = *args++;
>      if (opc == 3)
> @@ -737,12 +737,12 @@ static void tcg_out_qemu_st (TCGContext *s, const TCGArg *args, int opc)
>      else
>          data_reg2 = 0;
>      addr_reg = *args++;
> +
> +#ifdef CONFIG_SOFTMMU
>  #if TARGET_LONG_BITS == 64
>      addr_reg2 = *args++;
>  #endif
>      mem_index = *args;
> -
> -#ifdef CONFIG_SOFTMMU
>      r0 = 3;
>      r1 = 4;
>      r2 = 0;
> -- 
> 1.7.4.1
> 

No problem with the patch.  BTW, does someone care about this code
enough to refactor it fixing the ifdef spagetty?  Ideally there would be
whole functions within ifdefs.  They can be inline for efficiency.

-- 
MST

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-09-01 19:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-01 15:45 [Qemu-devel] [PATCH] tcg/ppc/tcg-target.c: Avoid 'set but not used' gcc warnings Peter Maydell
2011-09-01 17:27 ` malc
2011-09-01 19:41 ` Michael S. Tsirkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).