qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/3] target-sparc: fixed unused function warnings
@ 2014-06-23 23:01 Peter Maydell
  2014-06-23 23:01 ` Peter Maydell
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Peter Maydell @ 2014-06-23 23:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: Blue Swirl, Mark Cave-Ayland, Richard Henderson

These patchsets fix clang 3.4 warnings about unused static inline
functions (clang now warns about these if they're defined in a
.c file but then not used; gcc doesn't). The first patch just
removes two totally unused functions; the second two patches
use ifdeffery to avoid defining the functions in non-TARGET_SPARC64
builds.

Incidentally, Mark, if you wanted to send a patch to MAINTAINERS
to add yourself as a listed comaintainer for SPARC I'd be happy
to apply it...

Peter Maydell (3):
  target-sparc: Remove unused gen_op_subi_cc and gen_op_addi_cc
  target-sparc: address_mask(), asi_address_mask() are TARGET_SPARC64
    only
  target-sparc: is_translating_asi() is TARGET_SPARC64 only

 target-sparc/ldst_helper.c | 10 +++++-----
 target-sparc/translate.c   | 24 ------------------------
 2 files changed, 5 insertions(+), 29 deletions(-)

-- 
2.0.0

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

* [Qemu-devel] [PATCH 0/3] target-sparc: fixed unused function warnings
  2014-06-23 23:01 [Qemu-devel] [PATCH 0/3] target-sparc: fixed unused function warnings Peter Maydell
@ 2014-06-23 23:01 ` Peter Maydell
  2014-06-23 23:01 ` [Qemu-devel] [PATCH 1/3] target-sparc: Remove unused gen_op_subi_cc and gen_op_addi_cc Peter Maydell
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Peter Maydell @ 2014-06-23 23:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: Blue Swirl, Mark Cave-Ayland, Richard Henderson

These patchsets fix clang 3.4 warnings about unused static inline
functions (clang now warns about these if they're defined in a
.c file but then not used; gcc doesn't). The first patch just
removes two totally unused functions; the second two patches
use ifdeffery to avoid defining the functions in non-TARGET_SPARC64
builds.


Peter Maydell (3):
  target-sparc: Remove unused gen_op_subi_cc and gen_op_addi_cc
  target-sparc: address_mask(), asi_address_mask() are TARGET_SPARC64
    only
  target-sparc: is_translating_asi() is TARGET_SPARC64 only

 target-sparc/ldst_helper.c | 10 +++++-----
 target-sparc/translate.c   | 24 ------------------------
 2 files changed, 5 insertions(+), 29 deletions(-)

-- 
2.0.0

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

* [Qemu-devel] [PATCH 1/3] target-sparc: Remove unused gen_op_subi_cc and gen_op_addi_cc
  2014-06-23 23:01 [Qemu-devel] [PATCH 0/3] target-sparc: fixed unused function warnings Peter Maydell
  2014-06-23 23:01 ` Peter Maydell
@ 2014-06-23 23:01 ` Peter Maydell
  2014-06-23 23:01 ` [Qemu-devel] [PATCH 2/3] target-sparc: address_mask(), asi_address_mask() are TARGET_SPARC64 only Peter Maydell
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Peter Maydell @ 2014-06-23 23:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: Blue Swirl, Mark Cave-Ayland, Richard Henderson

The functions gen_op_addi_cc() and gen_op_subi_cc() are unused; remove them.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target-sparc/translate.c | 24 ------------------------
 1 file changed, 24 deletions(-)

diff --git a/target-sparc/translate.c b/target-sparc/translate.c
index 1ab07a1..b19673a 100644
--- a/target-sparc/translate.c
+++ b/target-sparc/translate.c
@@ -360,14 +360,6 @@ static inline void gen_mov_reg_C(TCGv reg, TCGv_i32 src)
     tcg_gen_andi_tl(reg, reg, 0x1);
 }
 
-static inline void gen_op_addi_cc(TCGv dst, TCGv src1, target_long src2)
-{
-    tcg_gen_mov_tl(cpu_cc_src, src1);
-    tcg_gen_movi_tl(cpu_cc_src2, src2);
-    tcg_gen_addi_tl(cpu_cc_dst, cpu_cc_src, src2);
-    tcg_gen_mov_tl(dst, cpu_cc_dst);
-}
-
 static inline void gen_op_add_cc(TCGv dst, TCGv src1, TCGv src2)
 {
     tcg_gen_mov_tl(cpu_cc_src, src1);
@@ -499,22 +491,6 @@ static void gen_op_addx_int(DisasContext *dc, TCGv dst, TCGv src1,
     }
 }
 
-static inline void gen_op_subi_cc(TCGv dst, TCGv src1, target_long src2, DisasContext *dc)
-{
-    tcg_gen_mov_tl(cpu_cc_src, src1);
-    tcg_gen_movi_tl(cpu_cc_src2, src2);
-    if (src2 == 0) {
-        tcg_gen_mov_tl(cpu_cc_dst, src1);
-        tcg_gen_movi_i32(cpu_cc_op, CC_OP_LOGIC);
-        dc->cc_op = CC_OP_LOGIC;
-    } else {
-        tcg_gen_subi_tl(cpu_cc_dst, cpu_cc_src, src2);
-        tcg_gen_movi_i32(cpu_cc_op, CC_OP_SUB);
-        dc->cc_op = CC_OP_SUB;
-    }
-    tcg_gen_mov_tl(dst, cpu_cc_dst);
-}
-
 static inline void gen_op_sub_cc(TCGv dst, TCGv src1, TCGv src2)
 {
     tcg_gen_mov_tl(cpu_cc_src, src1);
-- 
2.0.0

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

* [Qemu-devel] [PATCH 2/3] target-sparc: address_mask(), asi_address_mask() are TARGET_SPARC64 only
  2014-06-23 23:01 [Qemu-devel] [PATCH 0/3] target-sparc: fixed unused function warnings Peter Maydell
  2014-06-23 23:01 ` Peter Maydell
  2014-06-23 23:01 ` [Qemu-devel] [PATCH 1/3] target-sparc: Remove unused gen_op_subi_cc and gen_op_addi_cc Peter Maydell
@ 2014-06-23 23:01 ` Peter Maydell
  2014-06-23 23:01 ` [Qemu-devel] [PATCH 3/3] target-sparc: is_translating_asi() is " Peter Maydell
  2014-06-24  4:24 ` [Qemu-devel] [PATCH 0/3] target-sparc: fixed unused function warnings Richard Henderson
  4 siblings, 0 replies; 7+ messages in thread
From: Peter Maydell @ 2014-06-23 23:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: Blue Swirl, Mark Cave-Ayland, Richard Henderson

The address_mask() and asi_address_mask() functions are only used in
TARGET_SPARC64 configs, so guard with ifdefs to avoid warnings about
unused functions in 32-bit builds.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target-sparc/ldst_helper.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/target-sparc/ldst_helper.c b/target-sparc/ldst_helper.c
index 03bd9f9..f4be811 100644
--- a/target-sparc/ldst_helper.c
+++ b/target-sparc/ldst_helper.c
@@ -250,6 +250,7 @@ static void replace_tlb_1bit_lru(SparcTLBEntry *tlb,
 
 #endif
 
+#if defined(TARGET_SPARC64) || defined(CONFIG_USER_ONLY)
 static inline target_ulong address_mask(CPUSPARCState *env1, target_ulong addr)
 {
 #ifdef TARGET_SPARC64
@@ -259,6 +260,7 @@ static inline target_ulong address_mask(CPUSPARCState *env1, target_ulong addr)
 #endif
     return addr;
 }
+#endif
 
 /* returns true if access using this ASI is to have address translated by MMU
    otherwise access is to raw physical address */
@@ -287,6 +289,7 @@ static inline int is_translating_asi(int asi)
 #endif
 }
 
+#ifdef TARGET_SPARC64
 static inline target_ulong asi_address_mask(CPUSPARCState *env,
                                             int asi, target_ulong addr)
 {
@@ -296,6 +299,7 @@ static inline target_ulong asi_address_mask(CPUSPARCState *env,
         return addr;
     }
 }
+#endif
 
 void helper_check_align(CPUSPARCState *env, target_ulong addr, uint32_t align)
 {
-- 
2.0.0

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

* [Qemu-devel] [PATCH 3/3] target-sparc: is_translating_asi() is TARGET_SPARC64 only
  2014-06-23 23:01 [Qemu-devel] [PATCH 0/3] target-sparc: fixed unused function warnings Peter Maydell
                   ` (2 preceding siblings ...)
  2014-06-23 23:01 ` [Qemu-devel] [PATCH 2/3] target-sparc: address_mask(), asi_address_mask() are TARGET_SPARC64 only Peter Maydell
@ 2014-06-23 23:01 ` Peter Maydell
  2014-06-24  4:24 ` [Qemu-devel] [PATCH 0/3] target-sparc: fixed unused function warnings Richard Henderson
  4 siblings, 0 replies; 7+ messages in thread
From: Peter Maydell @ 2014-06-23 23:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: Blue Swirl, Mark Cave-Ayland, Richard Henderson

Move the is_translating_asi() inside the TARGET_SPARC64 ifdef (and remove
the unimplemented 32-bit codepath), as it is only called from TARGET_SPARC64
code. This fixes a clang 3.4 unused-function warning.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target-sparc/ldst_helper.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/target-sparc/ldst_helper.c b/target-sparc/ldst_helper.c
index f4be811..e0aee86 100644
--- a/target-sparc/ldst_helper.c
+++ b/target-sparc/ldst_helper.c
@@ -262,11 +262,12 @@ static inline target_ulong address_mask(CPUSPARCState *env1, target_ulong addr)
 }
 #endif
 
+#ifdef TARGET_SPARC64
 /* returns true if access using this ASI is to have address translated by MMU
    otherwise access is to raw physical address */
+/* TODO: check sparc32 bits */
 static inline int is_translating_asi(int asi)
 {
-#ifdef TARGET_SPARC64
     /* Ultrasparc IIi translating asi
        - note this list is defined by cpu implementation
     */
@@ -283,13 +284,8 @@ static inline int is_translating_asi(int asi)
     default:
         return 0;
     }
-#else
-    /* TODO: check sparc32 bits */
-    return 0;
-#endif
 }
 
-#ifdef TARGET_SPARC64
 static inline target_ulong asi_address_mask(CPUSPARCState *env,
                                             int asi, target_ulong addr)
 {
-- 
2.0.0

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

* Re: [Qemu-devel] [PATCH 0/3] target-sparc: fixed unused function warnings
  2014-06-23 23:01 [Qemu-devel] [PATCH 0/3] target-sparc: fixed unused function warnings Peter Maydell
                   ` (3 preceding siblings ...)
  2014-06-23 23:01 ` [Qemu-devel] [PATCH 3/3] target-sparc: is_translating_asi() is " Peter Maydell
@ 2014-06-24  4:24 ` Richard Henderson
  2014-06-24  8:33   ` Peter Maydell
  4 siblings, 1 reply; 7+ messages in thread
From: Richard Henderson @ 2014-06-24  4:24 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: Blue Swirl, Mark Cave-Ayland

On 06/23/2014 04:01 PM, Peter Maydell wrote:
> These patchsets fix clang 3.4 warnings about unused static inline
> functions (clang now warns about these if they're defined in a
> .c file but then not used; gcc doesn't). The first patch just
> removes two totally unused functions; the second two patches
> use ifdeffery to avoid defining the functions in non-TARGET_SPARC64
> builds.

I think I would be happier if you changed the functions to not be marked as
"inline".  I think that there's a large body of code that marks things inline
exactly to prevent unused warnings with gcc.  If we're going to play with the
ifdeffery, we might as well just let any compiler warn if its unused.


r~

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

* Re: [Qemu-devel] [PATCH 0/3] target-sparc: fixed unused function warnings
  2014-06-24  4:24 ` [Qemu-devel] [PATCH 0/3] target-sparc: fixed unused function warnings Richard Henderson
@ 2014-06-24  8:33   ` Peter Maydell
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Maydell @ 2014-06-24  8:33 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Blue Swirl, Mark Cave-Ayland, QEMU Developers

On 24 June 2014 05:24, Richard Henderson <rth@twiddle.net> wrote:
> I think I would be happier if you changed the functions to not be marked as
> "inline".  I think that there's a large body of code that marks things inline
> exactly to prevent unused warnings with gcc.  If we're going to play with the
> ifdeffery, we might as well just let any compiler warn if its unused.

Makes sense.

thanks
-- PMM

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

end of thread, other threads:[~2014-06-24  8:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-23 23:01 [Qemu-devel] [PATCH 0/3] target-sparc: fixed unused function warnings Peter Maydell
2014-06-23 23:01 ` Peter Maydell
2014-06-23 23:01 ` [Qemu-devel] [PATCH 1/3] target-sparc: Remove unused gen_op_subi_cc and gen_op_addi_cc Peter Maydell
2014-06-23 23:01 ` [Qemu-devel] [PATCH 2/3] target-sparc: address_mask(), asi_address_mask() are TARGET_SPARC64 only Peter Maydell
2014-06-23 23:01 ` [Qemu-devel] [PATCH 3/3] target-sparc: is_translating_asi() is " Peter Maydell
2014-06-24  4:24 ` [Qemu-devel] [PATCH 0/3] target-sparc: fixed unused function warnings Richard Henderson
2014-06-24  8:33   ` Peter Maydell

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).