qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] pxa2xx: Fix warnings from cgcc
@ 2016-03-24 16:39 Stefan Weil
  2016-03-24 16:53 ` Peter Maydell
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Weil @ 2016-03-24 16:39 UTC (permalink / raw)
  To: QEMU Developer, QEMU Trivial; +Cc: Peter Maydell, qemu-arm, Stefan Weil

Signed-off-by: Stefan Weil <sw@weilnetz.de>
---

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(-)

diff --git a/hw/arm/pxa2xx_pic.c b/hw/arm/pxa2xx_pic.c
index 8a39b1c..a8a68e8 100644
--- a/hw/arm/pxa2xx_pic.c
+++ b/hw/arm/pxa2xx_pic.c
@@ -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)
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] pxa2xx: Fix warnings from cgcc
  2016-03-24 16:39 [Qemu-devel] [PATCH] pxa2xx: Fix warnings from cgcc Stefan Weil
@ 2016-03-24 16:53 ` Peter Maydell
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Maydell @ 2016-03-24 16:53 UTC (permalink / raw)
  To: Stefan Weil; +Cc: QEMU Trivial, qemu-arm, QEMU Developer

On 24 March 2016 at 16:39, Stefan Weil <sw@weilnetz.de> wrote:
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
>
> 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(-)
>
> diff --git a/hw/arm/pxa2xx_pic.c b/hw/arm/pxa2xx_pic.c
> index 8a39b1c..a8a68e8 100644
> --- a/hw/arm/pxa2xx_pic.c
> +++ b/hw/arm/pxa2xx_pic.c
> @@ -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,
>  };

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-03-24 16:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-24 16:39 [Qemu-devel] [PATCH] pxa2xx: Fix warnings from cgcc Stefan Weil
2016-03-24 16:53 ` Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).