diff mbox

[Xen-devel,01/34] xen: clang: Disable initializer-overrides warning

Message ID 1395766541-23979-2-git-send-email-julien.grall@linaro.org
State Deferred, archived
Headers show

Commit Message

Julien Grall March 25, 2014, 4:55 p.m. UTC
The commit 819c084 "x86/MTRR: optionally print boot time state" introduces use
of the pattern of initializing an array with a range-based default entry.
On clang it results as a compilation failure:
generic.c:95:32: error: initializer overrides prior initialization of this subobject [-Werror,-Winitializer-overrides]
                [MTRR_TYPE_UNCACHABLE]     = "uncachable",
                                             ^~~~~~~~~~~~
generic.c:94:32: note: previous initialization is here
                [0 ... MTRR_NUM_TYPES - 1] = "?",
                                             ^~~
Signed-off-by: Julien Grall <julien.grall@linaro.org>
Cc: Keir Fraser <keir@xen.org>
Cc: Jan Beulich <jbeulich@suse.com>
---
 xen/Rules.mk |    2 ++
 1 file changed, 2 insertions(+)

Comments

Jan Beulich March 26, 2014, 11:51 a.m. UTC | #1
>>> On 25.03.14 at 17:55, <julien.grall@linaro.org> wrote:
> --- a/xen/Rules.mk
> +++ b/xen/Rules.mk
> @@ -68,6 +68,8 @@ ifneq ($(max_phys_irqs),)
>  CFLAGS-y                += -DMAX_PHYS_IRQS=$(max_phys_irqs)
>  endif
>  
> +CFLAGS-$(clang)         += -Wno-initializer-overrides

And this is supported by all clang versions we permit to be used, i.e.
doesn't need to be done conditionally?

Jan
Julien Grall March 26, 2014, 3 p.m. UTC | #2
Hi Jan,

On 03/26/2014 11:51 AM, Jan Beulich wrote:
>>>> On 25.03.14 at 17:55, <julien.grall@linaro.org> wrote:
>> --- a/xen/Rules.mk
>> +++ b/xen/Rules.mk
>> @@ -68,6 +68,8 @@ ifneq ($(max_phys_irqs),)
>>  CFLAGS-y                += -DMAX_PHYS_IRQS=$(max_phys_irqs)
>>  endif
>>  
>> +CFLAGS-$(clang)         += -Wno-initializer-overrides
> 
> And this is supported by all clang versions we permit to be used, i.e.
> doesn't need to be done conditionally?

I've tried to compile with clang 3.0-3.5 (used by Debian wheezy).

In another dimension can we really say we are supporting clang when most
of the time it's not possible to compile Xen with it? For instance,
building Xen 4.4 with Clang doesn't work.

I think we might need to have a build test for clang.

Regards,
Tim Deegan March 26, 2014, 3:09 p.m. UTC | #3
At 15:00 +0000 on 26 Mar (1395842446), Julien Grall wrote:
> Hi Jan,
> 
> On 03/26/2014 11:51 AM, Jan Beulich wrote:
> >>>> On 25.03.14 at 17:55, <julien.grall@linaro.org> wrote:
> >> --- a/xen/Rules.mk
> >> +++ b/xen/Rules.mk
> >> @@ -68,6 +68,8 @@ ifneq ($(max_phys_irqs),)
> >>  CFLAGS-y                += -DMAX_PHYS_IRQS=$(max_phys_irqs)
> >>  endif
> >>  
> >> +CFLAGS-$(clang)         += -Wno-initializer-overrides
> > 
> > And this is supported by all clang versions we permit to be used, i.e.
> > doesn't need to be done conditionally?
> 
> I've tried to compile with clang 3.0-3.5 (used by Debian wheezy).
> 
> In another dimension can we really say we are supporting clang when most
> of the time it's not possible to compile Xen with it? For instance,
> building Xen 4.4 with Clang doesn't work.
> I think we might need to have a build test for clang.

Most of the breakage seems to come with newer versions of clang,
rather than newer versions of Xen.  Still, a clang build test would be
a good idea.

Cheers,

Tim.
Julien Grall March 26, 2014, 3:11 p.m. UTC | #4
On 03/26/2014 03:09 PM, Tim Deegan wrote:
> At 15:00 +0000 on 26 Mar (1395842446), Julien Grall wrote:
>> Hi Jan,
>>
>> On 03/26/2014 11:51 AM, Jan Beulich wrote:
>>>>>> On 25.03.14 at 17:55, <julien.grall@linaro.org> wrote:
>>>> --- a/xen/Rules.mk
>>>> +++ b/xen/Rules.mk
>>>> @@ -68,6 +68,8 @@ ifneq ($(max_phys_irqs),)
>>>>  CFLAGS-y                += -DMAX_PHYS_IRQS=$(max_phys_irqs)
>>>>  endif
>>>>  
>>>> +CFLAGS-$(clang)         += -Wno-initializer-overrides
>>>
>>> And this is supported by all clang versions we permit to be used, i.e.
>>> doesn't need to be done conditionally?
>>
>> I've tried to compile with clang 3.0-3.5 (used by Debian wheezy).
>>
>> In another dimension can we really say we are supporting clang when most
>> of the time it's not possible to compile Xen with it? For instance,
>> building Xen 4.4 with Clang doesn't work.
>> I think we might need to have a build test for clang.
> 
> Most of the breakage seems to come with newer versions of clang,
> rather than newer versions of Xen.  Still, a clang build test would be
> a good idea.

I was unable to build Xen 4.4 (and onwards) with clang 3.0 which is not new.
diff mbox

Patch

diff --git a/xen/Rules.mk b/xen/Rules.mk
index 42c713f..18fbd62 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -68,6 +68,8 @@  ifneq ($(max_phys_irqs),)
 CFLAGS-y                += -DMAX_PHYS_IRQS=$(max_phys_irqs)
 endif
 
+CFLAGS-$(clang)         += -Wno-initializer-overrides
+
 AFLAGS-y                += -D__ASSEMBLY__ -include $(BASEDIR)/include/xen/config.h
 
 # Clang's built-in assembler can't handle .code16/.code32/.code64 yet