* [PATCH] Avoid clang prior initialization error when listing MTRR flags
@ 2014-09-13 16:57 Marcin Cieslak
2014-09-15 9:51 ` Jan Beulich
0 siblings, 1 reply; 9+ messages in thread
From: Marcin Cieslak @ 2014-09-13 16:57 UTC (permalink / raw)
To: xen-devel; +Cc: Marcin Cieslak, JBeulich
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.
Signed-off-by: Marcin Cieslak <saper@saper.info>
---
xen/arch/x86/cpu/mtrr/generic.c | 3 ++-
xen/arch/x86/mm/p2m-ept.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/xen/arch/x86/cpu/mtrr/generic.c b/xen/arch/x86/cpu/mtrr/generic.c
index 493830b..2512083 100644
--- a/xen/arch/x86/cpu/mtrr/generic.c
+++ b/xen/arch/x86/cpu/mtrr/generic.c
@@ -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",
diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index 15c6e83..50d1529 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -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",
--
2.0.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] Avoid clang prior initialization error when listing MTRR flags
2014-09-13 16:57 [PATCH] Avoid clang prior initialization error when listing MTRR flags Marcin Cieslak
@ 2014-09-15 9:51 ` Jan Beulich
2014-09-15 10:59 ` Marcin Cieslak
0 siblings, 1 reply; 9+ messages in thread
From: Jan Beulich @ 2014-09-15 9:51 UTC (permalink / raw)
To: Marcin Cieslak; +Cc: xen-devel
>>> On 13.09.14 at 18:57, <saper@saper.info> 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
> -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_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
> -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_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] = "?",
> ^~~
> 6 errors generated.
>
> Signed-off-by: Marcin Cieslak <saper@saper.info>
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.
> --- a/xen/arch/x86/cpu/mtrr/generic.c
> +++ b/xen/arch/x86/cpu/mtrr/generic.c
> @@ -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",
> diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
> index 15c6e83..50d1529 100644
> --- a/xen/arch/x86/mm/p2m-ept.c
> +++ b/xen/arch/x86/mm/p2m-ept.c
> @@ -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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Avoid clang prior initialization error when listing MTRR flags
2014-09-15 9:51 ` Jan Beulich
@ 2014-09-15 10:59 ` Marcin Cieslak
2014-09-15 11:22 ` Jan Beulich
0 siblings, 1 reply; 9+ messages in thread
From: Marcin Cieslak @ 2014-09-15 10:59 UTC (permalink / raw)
To: Jan Beulich; +Cc: xen-devel
On Mon, 15 Sep 2014, Jan Beulich wrote:
>>>> On 13.09.14 at 18:57, <saper@saper.info> wrote:
>> generic.c:97:32: error: initializer overrides prior initialization of this
[...]
> 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.
>
> 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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Avoid clang prior initialization error when listing MTRR flags
2014-09-15 10:59 ` Marcin Cieslak
@ 2014-09-15 11:22 ` Jan Beulich
2014-09-24 9:49 ` [PATCH v2] Avoid clang prior initialization error when listing MTRR Marcin Cieslak
0 siblings, 1 reply; 9+ messages in thread
From: Jan Beulich @ 2014-09-15 11:22 UTC (permalink / raw)
To: Marcin Cieslak; +Cc: xen-devel
>>> On 15.09.14 at 12:59, <saper@saper.info> wrote:
> On Mon, 15 Sep 2014, Jan Beulich wrote:
>> 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
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2] Avoid clang prior initialization error when listing MTRR
2014-09-15 11:22 ` Jan Beulich
@ 2014-09-24 9:49 ` Marcin Cieslak
2014-09-24 9:49 ` [PATCH v2] Avoid clang prior initialization error when listing MTRR flags Marcin Cieslak
0 siblings, 1 reply; 9+ messages in thread
From: Marcin Cieslak @ 2014-09-24 9:49 UTC (permalink / raw)
To: xen-devel; +Cc: JBeulich
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2] Avoid clang prior initialization error when listing MTRR flags
2014-09-24 9:49 ` [PATCH v2] Avoid clang prior initialization error when listing MTRR Marcin Cieslak
@ 2014-09-24 9:49 ` Marcin Cieslak
2014-09-24 12:17 ` Jan Beulich
0 siblings, 1 reply; 9+ messages in thread
From: Marcin Cieslak @ 2014-09-24 9:49 UTC (permalink / raw)
To: xen-devel; +Cc: Marcin Cieslak, JBeulich
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.
Signed-off-by: Marcin Cieslak <saper@saper.info>
---
xen/arch/x86/cpu/mtrr/generic.c | 20 ++++++++++++--------
xen/arch/x86/mm/p2m-ept.c | 22 ++++++++++++----------
2 files changed, 24 insertions(+), 18 deletions(-)
diff --git a/xen/arch/x86/cpu/mtrr/generic.c b/xen/arch/x86/cpu/mtrr/generic.c
index 493830b..217e1b0 100644
--- a/xen/arch/x86/cpu/mtrr/generic.c
+++ b/xen/arch/x86/cpu/mtrr/generic.c
@@ -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;
diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index 15c6e83..d7efee7 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -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 ? '!' : ' ');
--
2.0.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2] Avoid clang prior initialization error when listing MTRR flags
2014-09-24 9:49 ` [PATCH v2] Avoid clang prior initialization error when listing MTRR flags Marcin Cieslak
@ 2014-09-24 12:17 ` Jan Beulich
2014-09-24 12:31 ` Julien Grall
0 siblings, 1 reply; 9+ messages in thread
From: Jan Beulich @ 2014-09-24 12:17 UTC (permalink / raw)
To: Marcin Cieslak; +Cc: xen-devel
>>> On 24.09.14 at 11:49, <saper@saper.info> 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.
>
> Signed-off-by: Marcin Cieslak <saper@saper.info>
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] Avoid clang prior initialization error when listing MTRR flags
2014-09-24 12:17 ` Jan Beulich
@ 2014-09-24 12:31 ` Julien Grall
2014-09-24 13:02 ` Marcin Cieslak
0 siblings, 1 reply; 9+ messages in thread
From: Julien Grall @ 2014-09-24 12:31 UTC (permalink / raw)
To: Jan Beulich, Marcin Cieslak; +Cc: xen-devel, Ian Campbell
Hi,
On 09/24/2014 01:17 PM, Jan Beulich wrote:
>>>> On 24.09.14 at 11:49, <saper@saper.info> 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.
>>
>> Signed-off-by: Marcin Cieslak <saper@saper.info>
>
> 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,
--
Julien Grall
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] Avoid clang prior initialization error when listing MTRR flags
2014-09-24 12:31 ` Julien Grall
@ 2014-09-24 13:02 ` Marcin Cieslak
0 siblings, 0 replies; 9+ messages in thread
From: Marcin Cieslak @ 2014-09-24 13:02 UTC (permalink / raw)
To: Julien Grall; +Cc: xen-devel, Ian Campbell, Jan Beulich
On Wed, 24 Sep 2014, Julien Grall wrote:
> Hi,
>
> On 09/24/2014 01:17 PM, Jan Beulich wrote:
>>>>> On 24.09.14 at 11:49, <saper@saper.info> 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.
>>>
>>> Signed-off-by: Marcin Cieslak <saper@saper.info>
>>
>> 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)
> 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
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2014-09-24 13:02 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-13 16:57 [PATCH] Avoid clang prior initialization error when listing MTRR flags Marcin Cieslak
2014-09-15 9:51 ` Jan Beulich
2014-09-15 10:59 ` Marcin Cieslak
2014-09-15 11:22 ` Jan Beulich
2014-09-24 9:49 ` [PATCH v2] Avoid clang prior initialization error when listing MTRR Marcin Cieslak
2014-09-24 9:49 ` [PATCH v2] Avoid clang prior initialization error when listing MTRR flags Marcin Cieslak
2014-09-24 12:17 ` Jan Beulich
2014-09-24 12:31 ` Julien Grall
2014-09-24 13:02 ` Marcin Cieslak
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.