[linux-yocto] [PATCH 09/12] include/linux/property.h: fix build issues with gcc-4.4.4
weifeng.voon at intel.com
weifeng.voon at intel.com
Tue Mar 22 02:21:25 PDT 2016
From: Andrew Morton <akpm at linux-foundation.org>
gcc-4.4.4 has problems with initialization of anonymous unions:
drivers/mfd/intel-lpss-acpi.c:30: error: unknown field 'value' specified in initializer
work around this by crafting the initializers in a manner which the
compiler can handle.
Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki at intel.com>
(cherry picked from commit d76eebfa175e86383324ad2bbaf472866950398b)
Signed-off-by: Voon, Weifeng <weifeng.voon at intel.com>
---
include/linux/property.h | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/include/linux/property.h b/include/linux/property.h
index 329d58a..e0f27bd 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -169,12 +169,19 @@ struct property_entry {
};
};
+/*
+ * Note: the below four initializers for the anonymous union are carefully
+ * crafted to avoid gcc-4.4.4's problems with initialization of anon unions
+ * and structs.
+ */
+
#define PROPERTY_ENTRY_INTEGER_ARRAY(_name_, _type_, _val_) \
{ \
.name = _name_, \
.length = ARRAY_SIZE(_val_) * sizeof(_type_), \
.is_array = true, \
- .pointer._type_##_data = _val_, \
+ .is_string = false, \
+ { .pointer = { _type_##_data = _val_ } }, \
}
#define PROPERTY_ENTRY_U8_ARRAY(_name_, _val_) \
@@ -192,14 +199,15 @@ struct property_entry {
.length = ARRAY_SIZE(_val_) * sizeof(const char *), \
.is_array = true, \
.is_string = true, \
- .pointer.str = _val_, \
+ { .pointer = { .str = _val_ } }, \
}
#define PROPERTY_ENTRY_INTEGER(_name_, _type_, _val_) \
{ \
.name = _name_, \
.length = sizeof(_type_), \
- .value._type_##_data = _val_, \
+ .is_string = false, \
+ { .value = { ._type_##_data = _val_ } }, \
}
#define PROPERTY_ENTRY_U8(_name_, _val_) \
@@ -216,7 +224,7 @@ struct property_entry {
.name = _name_, \
.length = sizeof(_val_), \
.is_string = true, \
- .value.str = _val_, \
+ { .value = {.str = _val_} }, \
}
#define PROPERTY_ENTRY_BOOL(_name_) \
--
1.9.1
More information about the linux-yocto
mailing list