Skip to contentSkip to conversation

Avoid clang prior initialization error when listing MTRR flags

PATCH Superseded Marcin Cieslak 3 participants 9 messages Sep 13, 2014 – Sep 24, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Avoid clang prior initialization error when listing MTRR flags

Clang 3.4 complains when compiling range of designated range initializers:

gmake[6]: Entering directory `/home/saper/sw/xen/xen/arch/x86/cpu/mtrr'
clang -O1 -fno-omit-frame-pointer -m64 -g -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -I/home/saper/sw/xen/xen/include -I/home/saper/sw/xen/xen/include/asm-x86/mach-generic -I/home/saper/sw/xen/xen/include/asm-x86/mach-default -msoft-float -fno-stack-protector -fno-exceptions -Wnested-externs -DHAVE_GAS_VMX -DHAVE_GAS_EPT -DHAVE_GAS_FSGSBASE -mno-red-zone -mno-sse -fpic -fno-asynchronous-unwind-tables -DGCC_HAS_VISIBILITY_ATTRIBUTE -fno-builtin -fno-common -Werror -Wredundant-decls -Wno-pointer-arith -pipe -g -D__XEN__ -include /home/saper/sw/xen/xen/include/xen/config.h -nostdinc -Wno-parentheses -Wno-format -Wno-unused-value -Wno-unused-function -Wno-ignored-attributes -DVERBOSE -DHAS_ACPI -DHAS_GDBSX -DHAS_PASSTHROUGH -DHAS_PCI -DHAS_IOPORT
S -fno-omit-frame-pointer -DCONFIG_FRAME_POINTER -MMD -MF .generic.o.d -c generic.c -o generic.o
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] = "?",
                                             ^~~

generic.c:96:32: error: initializer overrides prior initialization of this subobject [-Werror,-Winitializer-overrides]
[MTRR_TYPE_WRCOMB] = "write-combining",
^~~~~~~~~~~~~~~~~
generic.c:94:32: note: previous initialization is here

                [0 ... MTRR_NUM_TYPES - 1] = "?",
                                             ^~~

generic.c:97:32: error: initializer overrides prior initialization of this subobject [-Werror,-Winitializer-overrides]
[MTRR_TYPE_WRTHROUGH] = "write-through",
^~~~~~~~~~~~~~~
generic.c:94:32: note: previous initialization is here

                [0 ... MTRR_NUM_TYPES - 1] = "?",
                                             ^~~

generic.c:98:32: error: initializer overrides prior initialization of this subobject [-Werror,-Winitializer-overrides]
[MTRR_TYPE_WRPROT] = "write-protect",
^~~~~~~~~~~~~~~
generic.c:94:32: note: previous initialization is here

                [0 ... MTRR_NUM_TYPES - 1] = "?",
                                             ^~~

generic.c:99:32: error: initializer overrides prior initialization of this subobject [-Werror,-Winitializer-overrides]
[MTRR_TYPE_WRBACK] = "write-back",
^~~~~~~~~~~~
generic.c:94:32: note: previous initialization is here

                [0 ... MTRR_NUM_TYPES - 1] = "?",
                                             ^~~

and

gmake[5]: Entering directory `/home/saper/sw/xen/xen/arch/x86/mm'
clang -O1 -fno-omit-frame-pointer -m64 -g -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -I/home/saper/sw/xen/xen/include -I/home/saper/sw/xen/xen/include/asm-x86/mach-generic -I/home/saper/sw/xen/xen/include/asm-x86/mach-default -msoft-float -fno-stack-protector -fno-exceptions -Wnested-externs -DHAVE_GAS_VMX -DHAVE_GAS_EPT -DHAVE_GAS_FSGSBASE -mno-red-zone -mno-sse -fpic -fno-asynchronous-unwind-tables -DGCC_HAS_VISIBILITY_ATTRIBUTE -fno-builtin -fno-common -Werror -Wredundant-decls -Wno-pointer-arith -pipe -g -D__XEN__ -include /home/saper/sw/xen/xen/include/xen/config.h -nostdinc -Wno-parentheses -Wno-format -Wno-unused-value -Wno-unused-function -Wno-ignored-attributes -DVERBOSE -DHAS_ACPI -DHAS_GDBSX -DHAS_PASSTHROUGH -DHAS_PCI -DHAS_IOPORT
S -fno-omit-frame-pointer -DCONFIG_FRAME_POINTER -MMD -MF .p2m-ept.o.d -c p2m-ept.c -o p2m-ept.o
p2m-ept.c:1100:38: error: initializer overrides prior initialization of this subobject [-Werror,-Winitializer-overrides]
[MTRR_TYPE_UNCACHABLE] = "UC",
^~~~
p2m-ept.c:1099:21: note: previous initialization is here

        [0 ... 7] = "?",
                    ^~~

p2m-ept.c:1101:38: error: initializer overrides prior initialization of this subobject [-Werror,-Winitializer-overrides]
[MTRR_TYPE_WRCOMB] = "WC",
^~~~
p2m-ept.c:1099:21: note: previous initialization is here

        [0 ... 7] = "?",
                    ^~~

p2m-ept.c:1102:38: error: initializer overrides prior initialization of this subobject [-Werror,-Winitializer-overrides]
[MTRR_TYPE_WRTHROUGH] = "WT",
^~~~
p2m-ept.c:1099:21: note: previous initialization is here

        [0 ... 7] = "?",
                    ^~~

p2m-ept.c:1103:38: error: initializer overrides prior initialization of this subobject [-Werror,-Winitializer-overrides]
[MTRR_TYPE_WRPROT] = "WP",
^~~~
p2m-ept.c:1099:21: note: previous initialization is here

        [0 ... 7] = "?",
                    ^~~

p2m-ept.c:1104:38: error: initializer overrides prior initialization of this subobject [-Werror,-Winitializer-overrides]
[MTRR_TYPE_WRBACK] = "WB",
^~~~
p2m-ept.c:1099:21: note: previous initialization is here

        [0 ... 7] = "?",
                    ^~~
p2m-ept.c:1105:38: error: initializer overrides prior initialization of this subobject [-Werror,-Winitializer-overrides]
        [MTRR_NUM_TYPES]           = "??"
                                     ^~~~
p2m-ept.c:1099:21: note: previous initialization is here
        [0 ... 7] = "?",
                    ^~~

6 errors generated.

---
 xen/arch/x86/cpu/mtrr/generic.c | 3 ++-
 xen/arch/x86/mm/p2m-ept.c       | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
xen/arch/x86/cpu/mtrr/generic.c +2 -1
index 493830b..2512083 100644
@@ -91,9 +91,10 @@ static const char *__init mtrr_attrib_to_str(mtrr_type x)
 {
 	static const char __initconst strings[MTRR_NUM_TYPES][16] =
 	{
-		[0 ... MTRR_NUM_TYPES - 1] = "?",
 		[MTRR_TYPE_UNCACHABLE]     = "uncachable",
 		[MTRR_TYPE_WRCOMB]         = "write-combining",
+		[2]                        = "?",
+		[3]                        = "?",
 		[MTRR_TYPE_WRTHROUGH]      = "write-through",
 		[MTRR_TYPE_WRPROT]         = "write-protect",
 		[MTRR_TYPE_WRBACK]         = "write-back",
xen/arch/x86/mm/p2m-ept.c +2 -1
index 15c6e83..50d1529 100644
@@ -1096,9 +1096,10 @@ static void ept_dump_p2m_table(unsigned char key)
     struct p2m_domain *p2m;
     struct ept_data *ept;
     static const char memory_types[8][2] = {
-        [0 ... 7] = "?",
         [MTRR_TYPE_UNCACHABLE]     = "UC",
         [MTRR_TYPE_WRCOMB]         = "WC",
+        [2]                        = "??",
+        [3]                        = "??",
         [MTRR_TYPE_WRTHROUGH]      = "WT",
         [MTRR_TYPE_WRPROT]         = "WP",
         [MTRR_TYPE_WRBACK]         = "WB",
Signature · 1 line
2.0.2
#1 lore raw
Quoted 111 lines
Quoted 1 line
Quoted 1 line · On 13.09.14 at 18:57, <[email protected]> wrote:

Clang 3.4 complains when compiling range of designated range initializers:

gmake[6]: Entering directory `/home/saper/sw/xen/xen/arch/x86/cpu/mtrr' clang -O1 -fno-omit-frame-pointer -m64 -g -fno-strict-aliasing -std=gnu99 -Wall

(quoted diff) +0 -8
-Wstrict-prototypes -Wdeclaration-after-statement   
-I/home/saper/sw/xen/xen/include  
-I/home/saper/sw/xen/xen/include/asm-x86/mach-generic 
-I/home/saper/sw/xen/xen/include/asm-x86/mach-default -msoft-float 
-fno-stack-protector -fno-exceptions -Wnested-externs -DHAVE_GAS_VMX 
-DHAVE_GAS_EPT -DHAVE_GAS_FSGSBASE -mno-red-zone -mno-sse -fpic 
-fno-asynchronous-unwind-tables -DGCC_HAS_VISIBILITY_ATTRIBUTE -fno-builtin 
-fno-common -Werror -Wredundant-decls -Wno-pointer-arith -pipe -g -D__XEN__ -include 

/home/saper/sw/xen/xen/include/xen/config.h -nostdinc -Wno-parentheses -Wno-format

(quoted diff) +0 -3
-Wno-unused-value -Wno-unused-function -Wno-ignored-attributes -DVERBOSE -DHAS_ACPI 
-DHAS_GDBSX -DHAS_PASSTHROUGH -DHAS_PCI -DHAS_IOPORTS -fno-omit-frame-pointer 
-DCONFIG_FRAME_POINTER -MMD -MF .generic.o.d -c generic.c -o generic.o

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] = "?",
                                             ^~~

generic.c:96:32: error: initializer overrides prior initialization of this subobject [-Werror,-Winitializer-overrides]
[MTRR_TYPE_WRCOMB] = "write-combining",
^~~~~~~~~~~~~~~~~
generic.c:94:32: note: previous initialization is here

                [0 ... MTRR_NUM_TYPES - 1] = "?",
                                             ^~~

generic.c:97:32: error: initializer overrides prior initialization of this subobject [-Werror,-Winitializer-overrides]
[MTRR_TYPE_WRTHROUGH] = "write-through",
^~~~~~~~~~~~~~~
generic.c:94:32: note: previous initialization is here

                [0 ... MTRR_NUM_TYPES - 1] = "?",
                                             ^~~

generic.c:98:32: error: initializer overrides prior initialization of this subobject [-Werror,-Winitializer-overrides]
[MTRR_TYPE_WRPROT] = "write-protect",
^~~~~~~~~~~~~~~
generic.c:94:32: note: previous initialization is here

                [0 ... MTRR_NUM_TYPES - 1] = "?",
                                             ^~~

generic.c:99:32: error: initializer overrides prior initialization of this subobject [-Werror,-Winitializer-overrides]
[MTRR_TYPE_WRBACK] = "write-back",
^~~~~~~~~~~~
generic.c:94:32: note: previous initialization is here

                [0 ... MTRR_NUM_TYPES - 1] = "?",
                                             ^~~

and

gmake[5]: Entering directory `/home/saper/sw/xen/xen/arch/x86/mm' clang -O1 -fno-omit-frame-pointer -m64 -g -fno-strict-aliasing -std=gnu99 -Wall

(quoted diff) +0 -8
-Wstrict-prototypes -Wdeclaration-after-statement   
-I/home/saper/sw/xen/xen/include  
-I/home/saper/sw/xen/xen/include/asm-x86/mach-generic 
-I/home/saper/sw/xen/xen/include/asm-x86/mach-default -msoft-float 
-fno-stack-protector -fno-exceptions -Wnested-externs -DHAVE_GAS_VMX 
-DHAVE_GAS_EPT -DHAVE_GAS_FSGSBASE -mno-red-zone -mno-sse -fpic 
-fno-asynchronous-unwind-tables -DGCC_HAS_VISIBILITY_ATTRIBUTE -fno-builtin 
-fno-common -Werror -Wredundant-decls -Wno-pointer-arith -pipe -g -D__XEN__ -include 

/home/saper/sw/xen/xen/include/xen/config.h -nostdinc -Wno-parentheses -Wno-format

(quoted diff) +0 -3
-Wno-unused-value -Wno-unused-function -Wno-ignored-attributes -DVERBOSE -DHAS_ACPI 
-DHAS_GDBSX -DHAS_PASSTHROUGH -DHAS_PCI -DHAS_IOPORTS -fno-omit-frame-pointer 
-DCONFIG_FRAME_POINTER -MMD -MF .p2m-ept.o.d -c p2m-ept.c -o p2m-ept.o

p2m-ept.c:1100:38: error: initializer overrides prior initialization of this subobject [-Werror,-Winitializer-overrides]
[MTRR_TYPE_UNCACHABLE] = "UC",
^~~~
p2m-ept.c:1099:21: note: previous initialization is here

        [0 ... 7] = "?",
                    ^~~

p2m-ept.c:1101:38: error: initializer overrides prior initialization of this subobject [-Werror,-Winitializer-overrides]
[MTRR_TYPE_WRCOMB] = "WC",
^~~~
p2m-ept.c:1099:21: note: previous initialization is here

        [0 ... 7] = "?",
                    ^~~

p2m-ept.c:1102:38: error: initializer overrides prior initialization of this subobject [-Werror,-Winitializer-overrides]
[MTRR_TYPE_WRTHROUGH] = "WT",
^~~~
p2m-ept.c:1099:21: note: previous initialization is here

        [0 ... 7] = "?",
                    ^~~

p2m-ept.c:1103:38: error: initializer overrides prior initialization of this subobject [-Werror,-Winitializer-overrides]
[MTRR_TYPE_WRPROT] = "WP",
^~~~
p2m-ept.c:1099:21: note: previous initialization is here

        [0 ... 7] = "?",
                    ^~~

p2m-ept.c:1104:38: error: initializer overrides prior initialization of this subobject [-Werror,-Winitializer-overrides]
[MTRR_TYPE_WRBACK] = "WB",
^~~~
p2m-ept.c:1099:21: note: previous initialization is here

        [0 ... 7] = "?",
                    ^~~
p2m-ept.c:1105:38: error: initializer overrides prior initialization of this 
subobject [-Werror,-Winitializer-overrides]
        [MTRR_NUM_TYPES]           = "??"
                                     ^~~~
p2m-ept.c:1099:21: note: previous initialization is here
        [0 ... 7] = "?",
                    ^~~
Quoted 3 lines

6 errors generated.

Apart from the description above being excessive (quoting just one of the error messages would completely suffice), I'm NAKing this because it was intentionally coded the way it is. What I would suggest instead is to enforce -Wno-initializer-overrides.

Quoted 19 lines
xen/arch/x86/cpu/mtrr/generic.c +2 -1
@@ -91,9 +91,10 @@ static const char *__init mtrr_attrib_to_str(mtrr_type x)
 {
 	static const char __initconst strings[MTRR_NUM_TYPES][16] =
 	{
-		[0 ... MTRR_NUM_TYPES - 1] = "?",
 		[MTRR_TYPE_UNCACHABLE]     = "uncachable",
 		[MTRR_TYPE_WRCOMB]         = "write-combining",
+		[2]                        = "?",
+		[3]                        = "?",
 		[MTRR_TYPE_WRTHROUGH]      = "write-through",
 		[MTRR_TYPE_WRPROT]         = "write-protect",
 		[MTRR_TYPE_WRBACK]         = "write-back",
xen/arch/x86/mm/p2m-ept.c +0 -0
index 15c6e83..50d1529 100644

xen/arch/x86/mm/p2m-ept.c static void ept_dump_p2m_table(unsigned char key) · line 1102

Quoted 8 lines
xen/arch/x86/mm/p2m-ept.c +2 -1
@@ -1096,9 +1096,10 @@ static void ept_dump_p2m_table(unsigned char key)
     struct p2m_domain *p2m;
     struct ept_data *ept;
     static const char memory_types[8][2] = {
-        [0 ... 7] = "?",
         [MTRR_TYPE_UNCACHABLE]     = "UC",
         [MTRR_TYPE_WRCOMB]         = "WC",
+        [2]                        = "??",
+        [3]                        = "??",

And as a side note - this change is more than just elimination of the compiler warning.

Jan

#2 lore raw
Quoted 2 lines · Jan Beulich
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 13.09.14 at 18:57, <[email protected]> wrote:

generic.c:97:32: error: initializer overrides prior initialization of this

[...]

Quoted 4 lines

Apart from the description above being excessive (quoting just one of the error messages would completely suffice), I'm NAKing this because it was intentionally coded the way it is. What I would suggest instead is to enforce -Wno-initializer-overrides.

Thanks for reviewing this! I will try to improve in the future.

Quoted 3 lines

And as a side note - this change is more than just elimination of the compiler warning.

Good question how to avoid it. Do you prefer to spell out all cases or to use -Wno-initializer-overrides? Which initializer should compilers use?

//Marcin

#3 lore raw
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 15.09.14 at 12:59, <[email protected]> wrote:
Quoted 2 lines · Jan Beulich

And as a side note - this change is more than just elimination of the compiler warning.

Good question how to avoid it. Do you prefer to spell out all cases or to use -Wno-initializer-overrides? Which initializer should compilers use?

With the context zapped the issue isn't clearly visible anymore, but I think you didn't get my point: You changed "?" to "??".

Jan

#4 lore raw

PATCH v2 1/1 Avoid clang prior initialization error when listing MTRR

Thanks for your insight, Jan. What about the following patch? Uninitialized entries in the enum-to-int array will automatically fallback to zero. Also "?<digit>" functionality is preserved this time.

//Marcin

#5 lore raw

PATCH v2 1/1 Avoid clang prior initialization error when listing MTRR flags

Clang 3.4 complains when compiling range of designated range initializers:

generic.c:95:32: error: initializer overrides prior initialization of this subobject [-Werror,-Winitializer-overrides]
[MTRR_TYPE_UNCACHABLE] = "uncachable",
^~~~~~~~~~~~
6 errors generated.

---
 xen/arch/x86/cpu/mtrr/generic.c | 20 ++++++++++++--------
 xen/arch/x86/mm/p2m-ept.c       | 22 ++++++++++++----------
 2 files changed, 24 insertions(+), 18 deletions(-)
xen/arch/x86/cpu/mtrr/generic.c +12 -8
index 493830b..217e1b0 100644
@@ -89,17 +89,21 @@ boolean_param("mtrr.show", mtrr_show);
 
 static const char *__init mtrr_attrib_to_str(mtrr_type x)
 {
-	static const char __initconst strings[MTRR_NUM_TYPES][16] =
+	static const char __initconst strings[][16] = {
+		"?", "uncachable", "write-combining",
+		"write-through", "write-protect", "write-back"
+	};
+			
+	static const int __initconst strings_map[MTRR_NUM_TYPES] =
 	{
-		[0 ... MTRR_NUM_TYPES - 1] = "?",
-		[MTRR_TYPE_UNCACHABLE]     = "uncachable",
-		[MTRR_TYPE_WRCOMB]         = "write-combining",
-		[MTRR_TYPE_WRTHROUGH]      = "write-through",
-		[MTRR_TYPE_WRPROT]         = "write-protect",
-		[MTRR_TYPE_WRBACK]         = "write-back",
+		[MTRR_TYPE_UNCACHABLE]     = 1,
+		[MTRR_TYPE_WRCOMB]         = 2,
+		[MTRR_TYPE_WRTHROUGH]      = 3,
+		[MTRR_TYPE_WRPROT]         = 4,
+		[MTRR_TYPE_WRBACK]         = 5
 	};
 
-	return x < MTRR_NUM_TYPES ? strings[x] : "?";
+	return x < MTRR_NUM_TYPES ? strings[strings_map[x]] : "?";
 }
 
 static unsigned int __initdata last_fixed_start;
xen/arch/x86/mm/p2m-ept.c +12 -10
index 15c6e83..d7efee7 100644
@@ -1095,14 +1095,16 @@ static void ept_dump_p2m_table(unsigned char key)
     unsigned long record_counter = 0;
     struct p2m_domain *p2m;
     struct ept_data *ept;
-    static const char memory_types[8][2] = {
-        [0 ... 7] = "?",
-        [MTRR_TYPE_UNCACHABLE]     = "UC",
-        [MTRR_TYPE_WRCOMB]         = "WC",
-        [MTRR_TYPE_WRTHROUGH]      = "WT",
-        [MTRR_TYPE_WRPROT]         = "WP",
-        [MTRR_TYPE_WRBACK]         = "WB",
-        [MTRR_NUM_TYPES]           = "??"
+    static const char memory_types[][2] = {
+	"?", "??", "UC", "WC", "WT", "WP", "WB"
+    };
+    static const int memory_types_map[MTRR_NUM_TYPES + 1] = {
+        [MTRR_TYPE_UNCACHABLE]     = 2,
+        [MTRR_TYPE_WRCOMB]         = 3,
+        [MTRR_TYPE_WRTHROUGH]      = 4,
+        [MTRR_TYPE_WRPROT]         = 5,
+        [MTRR_TYPE_WRBACK]         = 6,
+        [MTRR_NUM_TYPES]           = 1
     };
 
     for_each_domain(d)
@@ -1143,8 +1145,8 @@ static void ept_dump_p2m_table(unsigned char key)
                            ept_entry->r ? 'r' : ' ',
                            ept_entry->w ? 'w' : ' ',
                            ept_entry->x ? 'x' : ' ',
-                           memory_types[ept_entry->emt][0],
-                           memory_types[ept_entry->emt][1]
+                           memory_types[memory_types_map[ept_entry->emt]][0],
+                           memory_types[memory_types_map[ept_entry->emt]][1]
                            ?: ept_entry->emt + '0',
                            c ?: ept_entry->ipat ? '!' : ' ');
 
Signature · 1 line
2.0.2
#6 lore raw
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 24.09.14 at 11:49, <[email protected]> wrote:

Clang 3.4 complains when compiling range of designated range initializers:

generic.c:95:32: error: initializer overrides prior initialization of this subobject [-Werror,-Winitializer-overrides]
[MTRR_TYPE_UNCACHABLE] = "uncachable",
^~~~~~~~~~~~
6 errors generated.

Introducing a second lookup level for dealing with a bogus compiler warning is definitely not the route we want to go. As said before - a patch to turn off that warning would be fine, but I don't think any other one would be.

Jan

#7 lore raw

Hi,

Quoted 10 lines · Jan Beulich
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 24.09.14 at 11:49, <[email protected]> wrote:

Clang 3.4 complains when compiling range of designated range initializers:

generic.c:95:32: error: initializer overrides prior initialization of this subobject [-Werror,-Winitializer-overrides]
[MTRR_TYPE_UNCACHABLE] = "uncachable",
^~~~~~~~~~~~
6 errors generated.

Quoted 6 lines
Quoted 1 line

Introducing a second lookup level for dealing with a bogus compiler warning is definitely not the route we want to go. As said before - a patch to turn off that warning would be fine, but I don't think any other one would be.

I have sent a patch to disable initializer-overrides warning few months ago. See https://patches.linaro.org/27060/.

I haven't had time to rework my clang series. It may be interesting to give a look at it and made the change request. IIRC, most of the patches were already acked/reviewed.

http://lists.xenproject.org/archives/html/xen-devel/2014-03/msg03239.html

Regards,

Signature · 1 line
Julien Grall
#8 lore raw
Quoted 19 lines · Julien Grall

Hi,

Quoted 16 lines · Jan Beulich
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 24.09.14 at 11:49, <[email protected]> wrote:

Clang 3.4 complains when compiling range of designated range initializers:

generic.c:95:32: error: initializer overrides prior initialization of this subobject [-Werror,-Winitializer-overrides]
[MTRR_TYPE_UNCACHABLE] = "uncachable",
^~~~~~~~~~~~
6 errors generated.

Introducing a second lookup level for dealing with a bogus compiler warning is definitely not the route we want to go. As said before - a patch to turn off that warning would be fine, but I don't think any other one would be.

Not sure the warning is bogus: are initializers guaranteed to be done in order? On my amd64 box this change adds exacly one CPU instruction (movslq (%rcx,%rax,4),%rcx)

Quoted 8 lines

I have sent a patch to disable initializer-overrides warning few months ago. See https://patches.linaro.org/27060/.

I haven't had time to rework my clang series. It may be interesting to give a look at it and made the change request. IIRC, most of the patches were already acked/reviewed.

http://lists.xenproject.org/archives/html/xen-devel/2014-03/msg03239.html

Thanks Julien, will have a look at it.

Right now I need ca. 10 patches to compile Xen with clang 3.5+ (r203994) on FreeBSD/amd64 for amd64.

Some patches are identical as yours (yajl_gen_status, libxl_get_scheduler and so on...)

//Marcin