* [Qemu-devel] [PATCH 11/12] ppc: avoid write only variables
@ 2010-10-08 21:25 Blue Swirl
2010-10-08 21:32 ` [Qemu-devel] " Alexander Graf
0 siblings, 1 reply; 3+ messages in thread
From: Blue Swirl @ 2010-10-08 21:25 UTC (permalink / raw)
To: qemu-devel, Alexander Graf
Compiling with GCC 4.6.0 20100925 produced warnings:
/src/qemu/target-ppc/op_helper.c: In function 'helper_icbi':
/src/qemu/target-ppc/op_helper.c:351:14: error: variable 'tmp' set but
not used [-Werror=unused-but-set-variable]
/src/qemu/target-ppc/op_helper.c: In function 'do_6xx_tlb':
/src/qemu/target-ppc/op_helper.c:3805:28: error: variable 'EPN' set
but not used [-Werror=unused-but-set-variable]
/src/qemu/target-ppc/op_helper.c: In function 'do_74xx_tlb':
/src/qemu/target-ppc/op_helper.c:3838:28: error: variable 'EPN' set
but not used [-Werror=unused-but-set-variable]
Fix by adding a dummy cast so that the variable is not unused. Delete tmp.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
target-ppc/op_helper.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/target-ppc/op_helper.c b/target-ppc/op_helper.c
index 45f1655..13502ae 100644
--- a/target-ppc/op_helper.c
+++ b/target-ppc/op_helper.c
@@ -348,15 +348,13 @@ void helper_dcbz_970(target_ulong addr)
void helper_icbi(target_ulong addr)
{
- uint32_t tmp;
-
addr &= ~(env->dcache_line_size - 1);
/* Invalidate one cache line :
* PowerPC specification says this is to be treated like a load
* (not a fetch) by the MMU. To be sure it will be so,
* do the load "by hand".
*/
- tmp = ldl(addr);
+ ldl(addr);
tb_invalidate_page_range(addr, addr + env->icache_line_size);
}
@@ -3802,7 +3800,8 @@ void helper_tlbie (target_ulong addr)
/* PowerPC 602/603 software TLB load instructions helpers */
static void do_6xx_tlb (target_ulong new_EPN, int is_code)
{
- target_ulong RPN, CMP, EPN;
+ target_ulong RPN, CMP;
+ target_ulong EPN;
int way;
RPN = env->spr[SPR_RPA];
@@ -3814,6 +3813,7 @@ static void do_6xx_tlb (target_ulong new_EPN, int is_code)
EPN = env->spr[SPR_DMISS];
}
way = (env->spr[SPR_SRR1] >> 17) & 1;
+ (void)EPN; /* avoid a compiler warning */
LOG_SWTLB("%s: EPN " TARGET_FMT_lx " " TARGET_FMT_lx " PTE0 " TARGET_FMT_lx
" PTE1 " TARGET_FMT_lx " way %d\n", __func__, new_EPN, EPN, CMP,
RPN, way);
@@ -3835,13 +3835,15 @@ void helper_6xx_tlbi (target_ulong EPN)
/* PowerPC 74xx software TLB load instructions helpers */
static void do_74xx_tlb (target_ulong new_EPN, int is_code)
{
- target_ulong RPN, CMP, EPN;
+ target_ulong RPN, CMP;
+ target_ulong EPN;
int way;
RPN = env->spr[SPR_PTELO];
CMP = env->spr[SPR_PTEHI];
EPN = env->spr[SPR_TLBMISS] & ~0x3;
way = env->spr[SPR_TLBMISS] & 0x3;
+ (void)EPN; /* avoid a compiler warning */
LOG_SWTLB("%s: EPN " TARGET_FMT_lx " " TARGET_FMT_lx " PTE0 " TARGET_FMT_lx
" PTE1 " TARGET_FMT_lx " way %d\n", __func__, new_EPN, EPN, CMP,
RPN, way);
--
1.6.2.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Qemu-devel] Re: [PATCH 11/12] ppc: avoid write only variables
2010-10-08 21:25 [Qemu-devel] [PATCH 11/12] ppc: avoid write only variables Blue Swirl
@ 2010-10-08 21:32 ` Alexander Graf
2010-10-09 8:05 ` Blue Swirl
0 siblings, 1 reply; 3+ messages in thread
From: Alexander Graf @ 2010-10-08 21:32 UTC (permalink / raw)
To: Blue Swirl; +Cc: qemu-devel
On 08.10.2010, at 23:25, Blue Swirl wrote:
> Compiling with GCC 4.6.0 20100925 produced warnings:
> /src/qemu/target-ppc/op_helper.c: In function 'helper_icbi':
> /src/qemu/target-ppc/op_helper.c:351:14: error: variable 'tmp' set but
> not used [-Werror=unused-but-set-variable]
> /src/qemu/target-ppc/op_helper.c: In function 'do_6xx_tlb':
> /src/qemu/target-ppc/op_helper.c:3805:28: error: variable 'EPN' set
> but not used [-Werror=unused-but-set-variable]
> /src/qemu/target-ppc/op_helper.c: In function 'do_74xx_tlb':
> /src/qemu/target-ppc/op_helper.c:3838:28: error: variable 'EPN' set
> but not used [-Werror=unused-but-set-variable]
>
> Fix by adding a dummy cast so that the variable is not unused. Delete tmp.
>
> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
> ---
> target-ppc/op_helper.c | 12 +++++++-----
> 1 files changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/target-ppc/op_helper.c b/target-ppc/op_helper.c
> index 45f1655..13502ae 100644
> --- a/target-ppc/op_helper.c
> +++ b/target-ppc/op_helper.c
> @@ -348,15 +348,13 @@ void helper_dcbz_970(target_ulong addr)
>
> void helper_icbi(target_ulong addr)
> {
> - uint32_t tmp;
> -
> addr &= ~(env->dcache_line_size - 1);
> /* Invalidate one cache line :
> * PowerPC specification says this is to be treated like a load
> * (not a fetch) by the MMU. To be sure it will be so,
> * do the load "by hand".
> */
> - tmp = ldl(addr);
> + ldl(addr);
> tb_invalidate_page_range(addr, addr + env->icache_line_size);
> }
>
> @@ -3802,7 +3800,8 @@ void helper_tlbie (target_ulong addr)
> /* PowerPC 602/603 software TLB load instructions helpers */
> static void do_6xx_tlb (target_ulong new_EPN, int is_code)
> {
> - target_ulong RPN, CMP, EPN;
> + target_ulong RPN, CMP;
> + target_ulong EPN;
That one's no longer necessary then, right?
> int way;
>
> RPN = env->spr[SPR_RPA];
> @@ -3814,6 +3813,7 @@ static void do_6xx_tlb (target_ulong new_EPN, int is_code)
> EPN = env->spr[SPR_DMISS];
> }
> way = (env->spr[SPR_SRR1] >> 17) & 1;
> + (void)EPN; /* avoid a compiler warning */
> LOG_SWTLB("%s: EPN " TARGET_FMT_lx " " TARGET_FMT_lx " PTE0 " TARGET_FMT_lx
> " PTE1 " TARGET_FMT_lx " way %d\n", __func__, new_EPN, EPN, CMP,
> RPN, way);
> @@ -3835,13 +3835,15 @@ void helper_6xx_tlbi (target_ulong EPN)
> /* PowerPC 74xx software TLB load instructions helpers */
> static void do_74xx_tlb (target_ulong new_EPN, int is_code)
> {
> - target_ulong RPN, CMP, EPN;
> + target_ulong RPN, CMP;
> + target_ulong EPN;
Same here.
Alex
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Qemu-devel] Re: [PATCH 11/12] ppc: avoid write only variables
2010-10-08 21:32 ` [Qemu-devel] " Alexander Graf
@ 2010-10-09 8:05 ` Blue Swirl
0 siblings, 0 replies; 3+ messages in thread
From: Blue Swirl @ 2010-10-09 8:05 UTC (permalink / raw)
To: Alexander Graf; +Cc: qemu-devel
On Fri, Oct 8, 2010 at 9:32 PM, Alexander Graf <agraf@suse.de> wrote:
>
> On 08.10.2010, at 23:25, Blue Swirl wrote:
>
>> Compiling with GCC 4.6.0 20100925 produced warnings:
>> /src/qemu/target-ppc/op_helper.c: In function 'helper_icbi':
>> /src/qemu/target-ppc/op_helper.c:351:14: error: variable 'tmp' set but
>> not used [-Werror=unused-but-set-variable]
>> /src/qemu/target-ppc/op_helper.c: In function 'do_6xx_tlb':
>> /src/qemu/target-ppc/op_helper.c:3805:28: error: variable 'EPN' set
>> but not used [-Werror=unused-but-set-variable]
>> /src/qemu/target-ppc/op_helper.c: In function 'do_74xx_tlb':
>> /src/qemu/target-ppc/op_helper.c:3838:28: error: variable 'EPN' set
>> but not used [-Werror=unused-but-set-variable]
>>
>> Fix by adding a dummy cast so that the variable is not unused. Delete tmp.
>>
>> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
>> ---
>> target-ppc/op_helper.c | 12 +++++++-----
>> 1 files changed, 7 insertions(+), 5 deletions(-)
>>
>> diff --git a/target-ppc/op_helper.c b/target-ppc/op_helper.c
>> index 45f1655..13502ae 100644
>> --- a/target-ppc/op_helper.c
>> +++ b/target-ppc/op_helper.c
>> @@ -348,15 +348,13 @@ void helper_dcbz_970(target_ulong addr)
>>
>> void helper_icbi(target_ulong addr)
>> {
>> - uint32_t tmp;
>> -
>> addr &= ~(env->dcache_line_size - 1);
>> /* Invalidate one cache line :
>> * PowerPC specification says this is to be treated like a load
>> * (not a fetch) by the MMU. To be sure it will be so,
>> * do the load "by hand".
>> */
>> - tmp = ldl(addr);
>> + ldl(addr);
>> tb_invalidate_page_range(addr, addr + env->icache_line_size);
>> }
>>
>> @@ -3802,7 +3800,8 @@ void helper_tlbie (target_ulong addr)
>> /* PowerPC 602/603 software TLB load instructions helpers */
>> static void do_6xx_tlb (target_ulong new_EPN, int is_code)
>> {
>> - target_ulong RPN, CMP, EPN;
>> + target_ulong RPN, CMP;
>> + target_ulong EPN;
>
> That one's no longer necessary then, right?
>
>> int way;
>>
>> RPN = env->spr[SPR_RPA];
>> @@ -3814,6 +3813,7 @@ static void do_6xx_tlb (target_ulong new_EPN, int is_code)
>> EPN = env->spr[SPR_DMISS];
>> }
>> way = (env->spr[SPR_SRR1] >> 17) & 1;
>> + (void)EPN; /* avoid a compiler warning */
>> LOG_SWTLB("%s: EPN " TARGET_FMT_lx " " TARGET_FMT_lx " PTE0 " TARGET_FMT_lx
>> " PTE1 " TARGET_FMT_lx " way %d\n", __func__, new_EPN, EPN, CMP,
>> RPN, way);
>> @@ -3835,13 +3835,15 @@ void helper_6xx_tlbi (target_ulong EPN)
>> /* PowerPC 74xx software TLB load instructions helpers */
>> static void do_74xx_tlb (target_ulong new_EPN, int is_code)
>> {
>> - target_ulong RPN, CMP, EPN;
>> + target_ulong RPN, CMP;
>> + target_ulong EPN;
>
> Same here.
Right, I'll remove both.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-10-09 8:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-08 21:25 [Qemu-devel] [PATCH 11/12] ppc: avoid write only variables Blue Swirl
2010-10-08 21:32 ` [Qemu-devel] " Alexander Graf
2010-10-09 8:05 ` Blue Swirl
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).