qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-arm] [PATCH] pxa2xx: Fix warnings from cgcc


From: Peter Maydell
Subject: Re: [Qemu-arm] [PATCH] pxa2xx: Fix warnings from cgcc
Date: Thu, 24 Mar 2016 16:53:59 +0000

On 24 March 2016 at 16:39, Stefan Weil <address@hidden> wrote:
> Signed-off-by: Stefan Weil <address@hidden>
> ---
>
> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]