Fix a new warning on Cygwin
authorJon Turney <jon.turney@dronecode.org.uk>
Sat, 21 May 2022 10:18:55 +0000 (11:18 +0100)
committerJon Turney <jon.turney@dronecode.org.uk>
Thu, 2 Jun 2022 09:39:49 +0000 (10:39 +0100)
> ../../gdb/windows-nat.c: In function ‘windows_solib* windows_make_so(const char*, LPVOID)’:
> ../../gdb/windows-nat.c:714:12: error: declaration of ‘char name [512]’ shadows a parameter [-Werror=shadow=compatible-local]
>   714 |       char name[SO_NAME_MAX_PATH_SIZE];
>       |            ^~~~
> ../../gdb/windows-nat.c:655:30: note: shadowed declaration is here
>   655 | windows_make_so (const char *name, LPVOID load_addr)
>       |                  ~~~~~~~~~~~~^~~~

gdb/windows-nat.c

index b98848bbc70a97b37994114e84096eff0f7b0065..8631a1b45698e34aea3b1783512dc97116e579c9 100644 (file)
@@ -711,10 +711,10 @@ windows_make_so (const char *name, LPVOID load_addr)
 #else
   if (buf[0])
     {
-      char name[SO_NAME_MAX_PATH_SIZE];
-      cygwin_conv_path (CCP_WIN_W_TO_POSIX, buf, name,
+      char cname[SO_NAME_MAX_PATH_SIZE];
+      cygwin_conv_path (CCP_WIN_W_TO_POSIX, buf, cname,
                        SO_NAME_MAX_PATH_SIZE);
-      so->name = name;
+      so->name = cname;
     }
   else
     {