[PATCH 4/5] linux-user/syscall.c: clean up local variable shadowing in TARGET_NR_getcpu

Laurent Vivier posted 5 patches 2 years, 4 months ago
Maintainers: Laurent Vivier <laurent@vivier.eu>
[PATCH 4/5] linux-user/syscall.c: clean up local variable shadowing in TARGET_NR_getcpu
Posted by Laurent Vivier 2 years, 4 months ago
Fix following warnings:

.../linux-user/syscall.c: In function 'do_syscall1':
.../linux-user/syscall.c:11180:22: warning: declaration of 'cpu' shadows a previous local [-Wshadow=local]
11180 |             unsigned cpu, node;
      |                      ^~~
.../linux-user/syscall.c:8963:15: note: shadowed declaration is here
 8963 |     CPUState *cpu = env_cpu(cpu_env);
      |               ^~~

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 linux-user/syscall.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index c81e8d344486..6139c00ddceb 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -11177,14 +11177,14 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
         }
     case TARGET_NR_getcpu:
         {
-            unsigned cpu, node;
-            ret = get_errno(sys_getcpu(arg1 ? &cpu : NULL,
+            unsigned cpuid, node;
+            ret = get_errno(sys_getcpu(arg1 ? &cpuid : NULL,
                                        arg2 ? &node : NULL,
                                        NULL));
             if (is_error(ret)) {
                 return ret;
             }
-            if (arg1 && put_user_u32(cpu, arg1)) {
+            if (arg1 && put_user_u32(cpuid, arg1)) {
                 return -TARGET_EFAULT;
             }
             if (arg2 && put_user_u32(node, arg2)) {
-- 
2.41.0
Re: [PATCH 4/5] linux-user/syscall.c: clean up local variable shadowing in TARGET_NR_getcpu
Posted by Thomas Huth 2 years, 4 months ago
On 25/09/2023 17.10, Laurent Vivier wrote:
> Fix following warnings:
> 
> .../linux-user/syscall.c: In function 'do_syscall1':
> .../linux-user/syscall.c:11180:22: warning: declaration of 'cpu' shadows a previous local [-Wshadow=local]
> 11180 |             unsigned cpu, node;
>        |                      ^~~
> .../linux-user/syscall.c:8963:15: note: shadowed declaration is here
>   8963 |     CPUState *cpu = env_cpu(cpu_env);
>        |               ^~~
> 
> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> ---
>   linux-user/syscall.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)


Reviewed-by: Thomas Huth <thuth@redhat.com>