From: Marcin Cieslak <saper@saper.info>
To: xen-devel@lists.xenproject.org
Cc: Marcin Cieslak <saper@saper.info>, JBeulich@suse.com
Subject: [PATCH] Avoid clang prior initialization error when listing MTRR flags
Date: Sat, 13 Sep 2014 16:57:52 +0000 [thread overview]
Message-ID: <1410627472-88435-1-git-send-email-saper@saper.info> (raw)
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
next reply other threads:[~2014-09-13 16:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-13 16:57 Marcin Cieslak [this message]
2014-09-15 9:51 ` [PATCH] Avoid clang prior initialization error when listing MTRR flags 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1410627472-88435-1-git-send-email-saper@saper.info \
--to=saper@saper.info \
--cc=JBeulich@suse.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).