diff mbox series

[3/6] hw/display/vga: Clean up global variable shadowing

Message ID 20231009094747.54240-4-philmd@linaro.org
State New
Headers show
Series hw: Clean up global variables shadowing | expand

Commit Message

Philippe Mathieu-Daudé Oct. 9, 2023, 9:47 a.m. UTC
Fix:

  hw/display/vga.c:2307:29: error: declaration shadows a variable in the global scope [-Werror,-Wshadow]
                MemoryRegion *address_space_io, bool init_vga_ports)
                            ^
  include/exec/address-spaces.h:35:21: note: previous declaration is here
  extern AddressSpace address_space_io;
                      ^

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/display/vga_int.h | 2 +-
 hw/display/vga.c     | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

Ani Sinha Oct. 9, 2023, 2:11 p.m. UTC | #1
> On 09-Oct-2023, at 3:17 PM, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
> 
> Fix:
> 
>  hw/display/vga.c:2307:29: error: declaration shadows a variable in the global scope [-Werror,-Wshadow]
>                MemoryRegion *address_space_io, bool init_vga_ports)
>                            ^
>  include/exec/address-spaces.h:35:21: note: previous declaration is here
>  extern AddressSpace address_space_io;
>                      ^
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> hw/display/vga_int.h | 2 +-
> hw/display/vga.c     | 6 +++---
> 2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/display/vga_int.h b/hw/display/vga_int.h
> index 7cf0d11201..94949d8a0c 100644
> --- a/hw/display/vga_int.h
> +++ b/hw/display/vga_int.h
> @@ -157,7 +157,7 @@ static inline int c6_to_8(int v)
> }
> 
> bool vga_common_init(VGACommonState *s, Object *obj, Error **errp);
> -void vga_init(VGACommonState *s, Object *obj, MemoryRegion *address_space,
> +void vga_init(VGACommonState *s, Object *obj, MemoryRegion *io,
>               MemoryRegion *address_space_io, bool init_vga_ports);

Ok here you are replacing *address_space with *io but …

> MemoryRegion *vga_init_io(VGACommonState *s, Object *obj,
>                           const MemoryRegionPortio **vga_ports,
> diff --git a/hw/display/vga.c b/hw/display/vga.c
> index 37557c3442..bb4cd240ec 100644
> --- a/hw/display/vga.c
> +++ b/hw/display/vga.c
> @@ -2304,7 +2304,7 @@ MemoryRegion *vga_init_io(VGACommonState *s, Object *obj,
> }
> 
> void vga_init(VGACommonState *s, Object *obj, MemoryRegion *address_space,
> -              MemoryRegion *address_space_io, bool init_vga_ports)
> +              MemoryRegion *io, bool init_vga_ports)

Here you replace *address_space_io with *io? This does not look right.

> {
>     MemoryRegion *vga_io_memory;
>     const MemoryRegionPortio *vga_ports, *vbe_ports;
> @@ -2324,10 +2324,10 @@ void vga_init(VGACommonState *s, Object *obj, MemoryRegion *address_space,
>     if (init_vga_ports) {
>         portio_list_init(&s->vga_port_list, obj, vga_ports, s, "vga");
>         portio_list_set_flush_coalesced(&s->vga_port_list);
> -        portio_list_add(&s->vga_port_list, address_space_io, 0x3b0);
> +        portio_list_add(&s->vga_port_list, io, 0x3b0);
>     }
>     if (vbe_ports) {
>         portio_list_init(&s->vbe_port_list, obj, vbe_ports, s, "vbe");
> -        portio_list_add(&s->vbe_port_list, address_space_io, 0x1ce);
> +        portio_list_add(&s->vbe_port_list, io, 0x1ce);
>     }
> }
> -- 
> 2.41.0
>
Philippe Mathieu-Daudé Oct. 9, 2023, 3:43 p.m. UTC | #2
On 9/10/23 16:11, Ani Sinha wrote:
> 
> 
>> On 09-Oct-2023, at 3:17 PM, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>>
>> Fix:
>>
>>   hw/display/vga.c:2307:29: error: declaration shadows a variable in the global scope [-Werror,-Wshadow]
>>                 MemoryRegion *address_space_io, bool init_vga_ports)
>>                             ^
>>   include/exec/address-spaces.h:35:21: note: previous declaration is here
>>   extern AddressSpace address_space_io;
>>                       ^
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>> hw/display/vga_int.h | 2 +-
>> hw/display/vga.c     | 6 +++---
>> 2 files changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/hw/display/vga_int.h b/hw/display/vga_int.h
>> index 7cf0d11201..94949d8a0c 100644
>> --- a/hw/display/vga_int.h
>> +++ b/hw/display/vga_int.h
>> @@ -157,7 +157,7 @@ static inline int c6_to_8(int v)
>> }
>>
>> bool vga_common_init(VGACommonState *s, Object *obj, Error **errp);
>> -void vga_init(VGACommonState *s, Object *obj, MemoryRegion *address_space,
>> +void vga_init(VGACommonState *s, Object *obj, MemoryRegion *io,
>>                MemoryRegion *address_space_io, bool init_vga_ports);
> 
> Ok here you are replacing *address_space with *io but …
> 
>> MemoryRegion *vga_init_io(VGACommonState *s, Object *obj,
>>                            const MemoryRegionPortio **vga_ports,
>> diff --git a/hw/display/vga.c b/hw/display/vga.c
>> index 37557c3442..bb4cd240ec 100644
>> --- a/hw/display/vga.c
>> +++ b/hw/display/vga.c
>> @@ -2304,7 +2304,7 @@ MemoryRegion *vga_init_io(VGACommonState *s, Object *obj,
>> }
>>
>> void vga_init(VGACommonState *s, Object *obj, MemoryRegion *address_space,
>> -              MemoryRegion *address_space_io, bool init_vga_ports)
>> +              MemoryRegion *io, bool init_vga_ports)
> 
> Here you replace *address_space_io with *io? This does not look right.

Yeah this is totally wrong, sorry...
diff mbox series

Patch

diff --git a/hw/display/vga_int.h b/hw/display/vga_int.h
index 7cf0d11201..94949d8a0c 100644
--- a/hw/display/vga_int.h
+++ b/hw/display/vga_int.h
@@ -157,7 +157,7 @@  static inline int c6_to_8(int v)
 }
 
 bool vga_common_init(VGACommonState *s, Object *obj, Error **errp);
-void vga_init(VGACommonState *s, Object *obj, MemoryRegion *address_space,
+void vga_init(VGACommonState *s, Object *obj, MemoryRegion *io,
               MemoryRegion *address_space_io, bool init_vga_ports);
 MemoryRegion *vga_init_io(VGACommonState *s, Object *obj,
                           const MemoryRegionPortio **vga_ports,
diff --git a/hw/display/vga.c b/hw/display/vga.c
index 37557c3442..bb4cd240ec 100644
--- a/hw/display/vga.c
+++ b/hw/display/vga.c
@@ -2304,7 +2304,7 @@  MemoryRegion *vga_init_io(VGACommonState *s, Object *obj,
 }
 
 void vga_init(VGACommonState *s, Object *obj, MemoryRegion *address_space,
-              MemoryRegion *address_space_io, bool init_vga_ports)
+              MemoryRegion *io, bool init_vga_ports)
 {
     MemoryRegion *vga_io_memory;
     const MemoryRegionPortio *vga_ports, *vbe_ports;
@@ -2324,10 +2324,10 @@  void vga_init(VGACommonState *s, Object *obj, MemoryRegion *address_space,
     if (init_vga_ports) {
         portio_list_init(&s->vga_port_list, obj, vga_ports, s, "vga");
         portio_list_set_flush_coalesced(&s->vga_port_list);
-        portio_list_add(&s->vga_port_list, address_space_io, 0x3b0);
+        portio_list_add(&s->vga_port_list, io, 0x3b0);
     }
     if (vbe_ports) {
         portio_list_init(&s->vbe_port_list, obj, vbe_ports, s, "vbe");
-        portio_list_add(&s->vbe_port_list, address_space_io, 0x1ce);
+        portio_list_add(&s->vbe_port_list, io, 0x1ce);
     }
 }