flex-array: fix location for nesting of flexible members
PATCH 1/1 flex-array: fix location for nesting of flexible members
The warning about the nesting of flexible array members is given with the location of the outer struct or union but that is not very interesting. What is needed is the location of the member causing this nesting.
So, fix the warning message to use the member's location.
Signed-off-by Luc Van Oostenryck <[email protected]>
--- symbol.c | 2 +- validation/flex-array-nested.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
symbol.c +1 -1
@@ -200,7 +200,7 @@ static struct symbol * examine_struct_union_type(struct symbol *sym, int advanceif (has_flexible_array (member)) info.has_flex_array =1 ;if (has_flexible_array (member) && Wflexible_array_nested) -warning (sym->pos,"nested flexible arrays" ); +warning (member->pos,"nested flexible arrays" );fn (member, &info); }END_FOR_EACH_PTR (member);
validation/flex-array-nested.c +2 -2
@@ -23,7 +23,7 @@ static int foo(struct s *s, union u *u)* check-command: sparse -Wflexible-array-nested $file * * check-error-start -flex-array-nested.c:6:8: warning: nested flexible arrays -flex-array-nested.c:10:7: warning: nested flexible arrays +flex-array-nested.c:7:18: warning: nested flexible arrays +flex-array-nested.c:11:18: warning: nested flexible arrays * check-error-end */
Signature · 1 line
2.28.0