@@ -87,6 +87,7 @@ struct struct_union_info {
unsigned long max_align;
unsigned long bit_size;
int align_size;
+ char has_flex_array;
struct symbol *flex_array;
};
@@ -206,6 +207,11 @@ static struct symbol * examine_struct_union_type(struct symbol *sym, int advance
bit_align = bytes_to_bits(sym->ctype.alignment)-1;
bit_size = (bit_size + bit_align) & ~bit_align;
}
+ if (info.flex_array) {
+ info.has_flex_array = 1;
+ }
+ if (info.has_flex_array)
+ sym->has_flex_array = 1;
sym->bit_size = bit_size;
return sym;
}
@@ -185,6 +185,7 @@ struct symbol {
examined:1,
expanding:1,
evaluated:1,
+ has_flex_array:1,
string:1,
designated_init:1,
forced_arg:1,
Structures containing a flexible array must not be nested. So, as a preparatory step, detect structures or union containing a flexible array, possibly recursively and mark the corresponding type with a dedicated flag. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> --- symbol.c | 6 ++++++ symbol.h | 1 + 2 files changed, 7 insertions(+)