(few more) Steps towards enabling -Wshadow [3 more]
cover (few more) Steps towards enabling -Wshadow [3 more]
Just missed while posting v2 eh :/
(https://lore.kernel.org/qemu-devel/[email protected]/)
Philippe Mathieu-Daudé (3):
hw/core/machine: Clean up local variable shadowing hw/intc/openpic: Clean up local variable shadowing tests/qtest/pflash: Clean up local variable shadowing
hw/core/machine.c | 2 -- hw/intc/openpic.c | 7 ++----- tests/qtest/pflash-cfi02-test.c | 2 +- 3 files changed, 3 insertions(+), 8 deletions(-)
Signature · 1 line
2.41.0
PATCH 1/3 hw/core/machine: Clean up local variable shadowing
Fix:
hw/core/machine.c: In function ‘machine_initfn’:
hw/core/machine.c:1081:17: warning: declaration of ‘obj’ shadows a parameter [-Wshadow=compatible-local]
1081 | Object *obj = OBJECT(ms);
| ^~~
hw/core/machine.c:1065:36: note: shadowed declaration is here
1065 | static void machine_initfn(Object *obj)
| ~~~~~~~~^~~
--- hw/core/machine.c | 2 -- 1 file changed, 2 deletions(-)
hw/core/machine.c +0 -2
@@ -1078,8 +1078,6 @@ static void machine_initfn(Object *obj) ms->maxram_size = mc->default_ram_size;if (mc->nvdimm_supported) { -Object *obj =OBJECT (ms); - ms->nvdimms_state =g_new0 (NVDIMMState,1 );object_property_add_bool (obj,"nvdimm" , machine_get_nvdimm, machine_set_nvdimm);
Signature · 1 line
2.41.0
Re: [PATCH 1/3] hw/core/machine: Clean up local variable shadowing
Quoted 9 lines · Philippe Mathieu-Daudé
Fix:
hw/core/machine.c: In function ‘machine_initfn’:
hw/core/machine.c:1081:17: warning: declaration of ‘obj’ shadows a parameter [-Wshadow=compatible-local]
1081 | Object *obj = OBJECT(ms);
| ^~~
hw/core/machine.c:1065:36: note: shadowed declaration is here
1065 | static voidmachine_initfn(Object *obj)
Quoted 4 lines
| ~~~~~~~~^~~Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
thanks
-- PMM
PATCH 2/3 hw/intc/openpic: Clean up local variable shadowing
In reply to Philippe Mathieu-DaudéFix:
hw/intc/openpic.c: In function ‘openpic_gbl_write’:
hw/intc/openpic.c:614:17: warning: declaration of ‘idx’ shadows a previous local [-Wshadow=compatible-local]
614 | int idx;
| ^~~
hw/intc/openpic.c:568:9: note: shadowed declaration is here
568 | int idx;
| ^~~--- hw/intc/openpic.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
hw/intc/openpic.c +2 -5
@@ -610,11 +610,8 @@ static void openpic_gbl_write(void *opaque, hwaddr addr, uint64_t val,case 0x10B0 :case 0x10C0 :case 0x10D0 : - { -int idx; - idx = (addr -0x10A0 ) >>4 ; -write_IRQreg_ivpr (opp, opp->irq_ipi0 + idx, val); - } + idx = (addr -0x10A0 ) >>4 ; +write_IRQreg_ivpr (opp, opp->irq_ipi0 + idx, val);break ;case 0x10E0 :/* SPVE */ opp->spve = val & opp->vector_mask;
Signature · 1 line
2.41.0
Re: [PATCH 2/3] hw/intc/openpic: Clean up local variable shadowing
Quoted 5 lines · Philippe Mathieu-Daudé
Fix:
hw/intc/openpic.c: In function ‘openpic_gbl_write’:
hw/intc/openpic.c:614:17: warning: declaration of ‘idx’ shadows a previous local [-Wshadow=compatible-local]
Quoted 8 lines
614 | int idx; | ^~~ hw/intc/openpic.c:568:9: note: shadowed declaration is here 568 | int idx; | ^~~Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
thanks
-- PMM
PATCH 3/3 tests/qtest/pflash: Clean up local variable shadowing
In reply to Philippe Mathieu-DaudéFix:
tests/qtest/pflash-cfi02-test.c: In function ‘test_geometry’:
tests/qtest/pflash-cfi02-test.c:409:22: warning: declaration of ‘byte_addr’ shadows a previous local [-Wshadow=compatible-local]
409 | uint64_t byte_addr = (uint64_t)i * c->sector_len[region];
| ^~~~~~~~~
tests/qtest/pflash-cfi02-test.c:342:14: note: shadowed declaration is here
342 | uint64_t byte_addr = 0;
| ^~~~~~~~~--- tests/qtest/pflash-cfi02-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qtest/pflash-cfi02-test.c +1 -1
@@ -406,7 +406,7 @@ static void test_geometry(const void *opaque)for (int region =0 ; region < nb_erase_regions; ++region) {for (uint32_t i =0 ; i < c->nb_blocs[region]; ++i) { -uint64_t byte_addr = (uint64_t )i * c->sector_len[region]; + byte_addr = (uint64_t )i * c->sector_len[region]; g_assert_cmphex(flash_read(c, byte_addr), ==, bank_mask(c)); } }
Signature · 1 line
2.41.0
Re: [PATCH 3/3] tests/qtest/pflash: Clean up local variable shadowing
Quoted 5 lines · Philippe Mathieu-Daudé
Fix:
tests/qtest/pflash-cfi02-test.c: In function ‘test_geometry’:
tests/qtest/pflash-cfi02-test.c:409:22: warning: declaration of ‘byte_addr’ shadows a previous local [-Wshadow=compatible-local]
Quoted 8 lines
409 | uint64_t byte_addr = (uint64_t)i * c->sector_len[region]; | ^~~~~~~~~ tests/qtest/pflash-cfi02-test.c:342:14: note: shadowed declaration is here 342 | uint64_t byte_addr = 0; | ^~~~~~~~~Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
thanks
-- PMM
Quoted 2 lines · Philippe Mathieu-Daudé
Just missed while posting v2 eh :/
(https://lore.kernel.org/qemu-devel/[email protected]/)
PATCH 3 has become commit 82fdcd3e140c8d4c63f177ece554f90f2bccdf68.
Remainder queued. Thanks!