qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] target/ppc: Rename variables to avoid local variable shadowing in VUPKPX
@ 2023-09-23  7:12 Cédric Le Goater
  2023-09-23  8:25 ` Michael Tokarev
  0 siblings, 1 reply; 5+ messages in thread
From: Cédric Le Goater @ 2023-09-23  7:12 UTC (permalink / raw)
  To: qemu-ppc, qemu-devel
  Cc: Daniel Henrique Barboza, Nicholas Piggin, Markus Armbruster,
	Cédric Le Goater

and fix such warnings :

  ../target/ppc/int_helper.c: In function ‘helper_vupklpx’:
  ../target/ppc/int_helper.c:2025:21: warning: declaration of ‘r’ shadows a parameter [-Wshadow=local]
   2025 |             uint8_t r = (e >> 10) & 0x1f;                               \
        |                     ^
  ../target/ppc/int_helper.c:2033:1: note: in expansion of macro ‘VUPKPX’
   2033 | VUPKPX(lpx, UPKLO)
        | ^~~~~~
  ../target/ppc/int_helper.c:2017:41: note: shadowed declaration is here
   2017 |     void helper_vupk##suffix(ppc_avr_t *r, ppc_avr_t *b)                \
        |                              ~~~~~~~~~~~^
  ../target/ppc/int_helper.c:2033:1: note: in expansion of macro ‘VUPKPX’
   2033 | VUPKPX(lpx, UPKLO)
        | ^~~~~~

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 target/ppc/int_helper.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c
index 6fd00684a5b9..8719ac6e6265 100644
--- a/target/ppc/int_helper.c
+++ b/target/ppc/int_helper.c
@@ -2022,11 +2022,11 @@ void helper_vsum4ubs(CPUPPCState *env, ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)
         for (i = 0; i < ARRAY_SIZE(r->u32); i++) {                      \
             uint16_t e = b->u16[hi ? i : i + 4];                        \
             uint8_t a = (e >> 15) ? 0xff : 0;                           \
-            uint8_t r = (e >> 10) & 0x1f;                               \
+            uint8_t _r = (e >> 10) & 0x1f;                              \
             uint8_t g = (e >> 5) & 0x1f;                                \
-            uint8_t b = e & 0x1f;                                       \
+            uint8_t _b = e & 0x1f;                                      \
                                                                         \
-            result.u32[i] = (a << 24) | (r << 16) | (g << 8) | b;       \
+            result.u32[i] = (a << 24) | (_r << 16) | (g << 8) | _b;     \
         }                                                               \
         *r = result;                                                    \
     }
-- 
2.41.0



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

* Re: [PATCH] target/ppc: Rename variables to avoid local variable shadowing in VUPKPX
  2023-09-23  7:12 [PATCH] target/ppc: Rename variables to avoid local variable shadowing in VUPKPX Cédric Le Goater
@ 2023-09-23  8:25 ` Michael Tokarev
  2023-09-23 15:59   ` Cédric Le Goater
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Tokarev @ 2023-09-23  8:25 UTC (permalink / raw)
  To: Cédric Le Goater, qemu-ppc, qemu-devel
  Cc: Daniel Henrique Barboza, Nicholas Piggin, Markus Armbruster

23.09.2023 10:12, Cédric Le Goater:

> --- a/target/ppc/int_helper.c
> +++ b/target/ppc/int_helper.c
> @@ -2022,11 +2022,11 @@ void helper_vsum4ubs(CPUPPCState *env, ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)
>           for (i = 0; i < ARRAY_SIZE(r->u32); i++) {                      \
>               uint16_t e = b->u16[hi ? i : i + 4];                        \
>               uint8_t a = (e >> 15) ? 0xff : 0;                           \
> -            uint8_t r = (e >> 10) & 0x1f;                               \
> +            uint8_t _r = (e >> 10) & 0x1f;                              \
>               uint8_t g = (e >> 5) & 0x1f;                                \
> -            uint8_t b = e & 0x1f;                                       \
> +            uint8_t _b = e & 0x1f;                                      \

I'd suggest to rename all of them here to have the same pattern.  Maybe.. :)

/mjt


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

* Re: [PATCH] target/ppc: Rename variables to avoid local variable shadowing in VUPKPX
  2023-09-23  8:25 ` Michael Tokarev
@ 2023-09-23 15:59   ` Cédric Le Goater
  2023-09-29  8:00     ` Markus Armbruster
  0 siblings, 1 reply; 5+ messages in thread
From: Cédric Le Goater @ 2023-09-23 15:59 UTC (permalink / raw)
  To: Michael Tokarev, qemu-ppc, qemu-devel
  Cc: Daniel Henrique Barboza, Nicholas Piggin, Markus Armbruster

On 9/23/23 10:25, Michael Tokarev wrote:
> 23.09.2023 10:12, Cédric Le Goater:
> 
>> --- a/target/ppc/int_helper.c
>> +++ b/target/ppc/int_helper.c
>> @@ -2022,11 +2022,11 @@ void helper_vsum4ubs(CPUPPCState *env, ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)
>>           for (i = 0; i < ARRAY_SIZE(r->u32); i++) {                      \
>>               uint16_t e = b->u16[hi ? i : i + 4];                        \
>>               uint8_t a = (e >> 15) ? 0xff : 0;                           \
>> -            uint8_t r = (e >> 10) & 0x1f;                               \
>> +            uint8_t _r = (e >> 10) & 0x1f;                              \
>>               uint8_t g = (e >> 5) & 0x1f;                                \
>> -            uint8_t b = e & 0x1f;                                       \
>> +            uint8_t _b = e & 0x1f;                                      \
> 
> I'd suggest to rename all of them here to have the same pattern.  Maybe.. :)

or maybe use the field names from the ISA : VRT,VRA,VRB ?

C.





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

* Re: [PATCH] target/ppc: Rename variables to avoid local variable shadowing in VUPKPX
  2023-09-23 15:59   ` Cédric Le Goater
@ 2023-09-29  8:00     ` Markus Armbruster
  2023-09-29  8:28       ` Cédric Le Goater
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Armbruster @ 2023-09-29  8:00 UTC (permalink / raw)
  To: Cédric Le Goater
  Cc: Michael Tokarev, qemu-ppc, qemu-devel, Daniel Henrique Barboza,
	Nicholas Piggin

Cédric Le Goater <clg@kaod.org> writes:

> On 9/23/23 10:25, Michael Tokarev wrote:
>> 23.09.2023 10:12, Cédric Le Goater:
>> 
>>> --- a/target/ppc/int_helper.c
>>> +++ b/target/ppc/int_helper.c
>>> @@ -2022,11 +2022,11 @@ void helper_vsum4ubs(CPUPPCState *env, ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)
>>>           for (i = 0; i < ARRAY_SIZE(r->u32); i++) {                      \
>>>               uint16_t e = b->u16[hi ? i : i + 4];                        \
>>>               uint8_t a = (e >> 15) ? 0xff : 0;                           \
>>> -            uint8_t r = (e >> 10) & 0x1f;                               \
>>> +            uint8_t _r = (e >> 10) & 0x1f;                              \
>>>               uint8_t g = (e >> 5) & 0x1f;                                \
>>> -            uint8_t b = e & 0x1f;                                       \
>>> +            uint8_t _b = e & 0x1f;                                      \
>> I'd suggest to rename all of them here to have the same pattern.  Maybe.. :)
>
> or maybe use the field names from the ISA : VRT,VRA,VRB ?

Should I expect a respin?

If not, anyone ready to give an R-by as is?

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

* Re: [PATCH] target/ppc: Rename variables to avoid local variable shadowing in VUPKPX
  2023-09-29  8:00     ` Markus Armbruster
@ 2023-09-29  8:28       ` Cédric Le Goater
  0 siblings, 0 replies; 5+ messages in thread
From: Cédric Le Goater @ 2023-09-29  8:28 UTC (permalink / raw)
  To: Markus Armbruster
  Cc: Michael Tokarev, qemu-ppc, qemu-devel, Daniel Henrique Barboza,
	Nicholas Piggin

On 9/29/23 10:00, Markus Armbruster wrote:
> Cédric Le Goater <clg@kaod.org> writes:
> 
>> On 9/23/23 10:25, Michael Tokarev wrote:
>>> 23.09.2023 10:12, Cédric Le Goater:
>>>
>>>> --- a/target/ppc/int_helper.c
>>>> +++ b/target/ppc/int_helper.c
>>>> @@ -2022,11 +2022,11 @@ void helper_vsum4ubs(CPUPPCState *env, ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)
>>>>            for (i = 0; i < ARRAY_SIZE(r->u32); i++) {                      \
>>>>                uint16_t e = b->u16[hi ? i : i + 4];                        \
>>>>                uint8_t a = (e >> 15) ? 0xff : 0;                           \
>>>> -            uint8_t r = (e >> 10) & 0x1f;                               \
>>>> +            uint8_t _r = (e >> 10) & 0x1f;                              \
>>>>                uint8_t g = (e >> 5) & 0x1f;                                \
>>>> -            uint8_t b = e & 0x1f;                                       \
>>>> +            uint8_t _b = e & 0x1f;                                      \
>>> I'd suggest to rename all of them here to have the same pattern.  Maybe.. :)
>>
>> or maybe use the field names from the ISA : VRT,VRA,VRB ?
> 
> Should I expect a respin?
> 
> If not, anyone ready to give an R-by as is?

This one I can respin. I agree with Michael that some consistency is
preferable. Preparing a v2 full of '_'.

Thanks,

C.




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

end of thread, other threads:[~2023-09-29  8:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-23  7:12 [PATCH] target/ppc: Rename variables to avoid local variable shadowing in VUPKPX Cédric Le Goater
2023-09-23  8:25 ` Michael Tokarev
2023-09-23 15:59   ` Cédric Le Goater
2023-09-29  8:00     ` Markus Armbruster
2023-09-29  8:28       ` Cédric Le Goater

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