Skip to contentSkip to conversation

pxa2xx: Fix warnings from cgcc

PATCH In review Stefan Weil 2 participants 2 messages Mar 24, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pxa2xx: Fix warnings from cgcc

---

This patch is rather old, but it still can be applied. It avoids duplicate definitions for some array indices (which are allowed by gcc, but cgcc complains).

 hw/arm/pxa2xx_pic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/arm/pxa2xx_pic.c +1 -1
index 8a39b1c..a8a68e8 100644
@@ -204,7 +204,6 @@ static void pxa2xx_pic_mem_write(void *opaque, hwaddr offset,
 
 /* Interrupt Controller Coprocessor Space Register Mapping */
 static const int pxa2xx_cp_reg_map[0x10] = {
-    [0x0 ... 0xf] = -1,
     [0x0] = ICIP,
     [0x1] = ICMR,
     [0x2] = ICLR,
@@ -216,6 +215,7 @@ static const int pxa2xx_cp_reg_map[0x10] = {
     [0x8] = ICLR2,
     [0x9] = ICFP2,
     [0xa] = ICPR2,
+    [0xb ... 0xf] = -1,
 };
 
 static uint64_t pxa2xx_pic_cp_read(CPUARMState *env, const ARMCPRegInfo *ri)
Signature · 1 line
2.1.4
#1 lore raw
Quoted 23 lines · Stefan Weil

---

This patch is rather old, but it still can be applied. It avoids duplicate definitions for some array indices (which are allowed by gcc, but cgcc complains).

 hw/arm/pxa2xx_pic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/arm/pxa2xx_pic.c +0 -1
index 8a39b1c..a8a68e8 100644
@@ -204,7 +204,6 @@ static void pxa2xx_pic_mem_write(void *opaque, hwaddr offset,
 
 /* Interrupt Controller Coprocessor Space Register Mapping */
 static const int pxa2xx_cp_reg_map[0x10] = {
-    [0x0 ... 0xf] = -1,
     [0x0] = ICIP,
     [0x1] = ICMR,
     [0x2] = ICLR,

hw/arm/pxa2xx_pic.c static const int pxa2xx_cp_reg_map[0x10] = { · line 219

Quoted 5 lines
hw/arm/pxa2xx_pic.c +1 -0
@@ -216,6 +215,7 @@ static const int pxa2xx_cp_reg_map[0x10] = {
     [0x8] = ICLR2,
     [0x9] = ICFP2,
     [0xa] = ICPR2,
+    [0xb ... 0xf] = -1,
 };

This is more bug-prone than the current code, because now if we add or remove an entry in the array we have to change the final line. The point of [ 0x0 ... 0xf ] is to specify a default value for the array.

We use -Wno-initializer-overrides to silence a clang warning about this, because we want to be able to use this "set the default" idiom.

thanks
-- PMM