|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2] 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.
Signed-off-by: Marcin Cieslak <saper@xxxxxxxxxx>
---
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
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |