On Wed, Apr 11, 2018 at 01:30:53PM -0700, Randy Dunlap wrote: > From: Randy Dunlap <rdunlap@xxxxxxxxxxxxx> > with help from Linus. (many moons ago) > > sparse addition to print all compound/composite global data symbols > with their sizes and alignment. Hi, I gave it some real testing now. All is good, just a few last details. > > +static void list_compound_symbols(struct symbol_list *list) > +{ > + struct symbol *sym, *base; > + > + /* Only show arrays, structures, unions */ > + FOR_EACH_PTR(list, sym) { > + /* Only show symbols that have a non-zero size */ > + if (!sym->bit_size) This test should be changed to if (sym->bit_size <= 0) because VLA have -1 in this field and: - I don't think you're interested in VLA here; - the call to show_typename(sym) here under will then throws an "error: bad constant expression" (but that could or should be fixed in show_typename() itself). > + if (is_func_type(sym)) > + continue; > + if (is_float_type(sym) || is_scalar_type(sym)) > + continue; These two tests can be removed because they are now redundant with ... > + switch (base->type) { > + case SYM_STRUCT: case SYM_UNION: case SYM_ARRAY: > + break; > + default: > + continue; > + } this one since only structs, unions & arrays will 'survive' the test and so functions, floats or integer (and whatever other types) are automatically rejected. It's what I meant in the previous review. > + check_symbols(res); > + > + if (dbg_compound) > + list_compound_symbols(res); > } END_FOR_EACH_PTR_NOTAG(file); One thing that I think would be good to do is to change slighty this list_compound_symbols() to not take a list of symbols but just a single symbol and then do the if (dbg_compound) list_compound_symbol(sym); inside check_symbols() which already loops through the symbol list. Cheers, -- Luc -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html