fprintf: Fix alignment of class members that are structs/enums/unions

E.g. look at that 'completion' member in this struct:

   struct cpu_stop_done {
          atomic_t                   nr_todo;              /*     0     4 */
          int                        ret;                  /*     4     4 */
  -       struct completion  completion;                   /*     8    32 */
  +       struct completion          completion;           /*     8    32 */

          /* size: 40, cachelines: 1, members: 3 */
          /* last cacheline: 40 bytes */

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2019-11-19 11:48:36 -03:00
parent be37b64aef
commit 56547f133a
1 changed files with 6 additions and 3 deletions

View File

@ -678,7 +678,6 @@ static size_t type__fprintf(struct tag *type, const struct cu *cu,
if (tag__is_struct(type) || tag__is_union(type) ||
tag__is_enumeration(type)) {
inner_struct:
tconf.type_spacing -= 8;
tconf.prefix = NULL;
tconf.suffix = name;
tconf.emit_stats = 0;
@ -711,6 +710,7 @@ next_type:
tconf.rel_offset = 1;
name = namebfptr;
type = ptype;
tconf.type_spacing -= 8;
goto inner_struct;
}
}
@ -757,18 +757,21 @@ print_default:
if (!tconf.suppress_comments)
class__find_holes(cclass);
tconf.type_spacing -= 8;
printed += __class__fprintf(cclass, cu, &tconf, fp);
}
break;
case DW_TAG_union_type:
ctype = tag__type(type);
if (type__name(ctype, cu) != NULL && !expand_types)
if (type__name(ctype, cu) != NULL && !expand_types) {
printed += fprintf(fp, "union %-*s %s",
tconf.type_spacing - 6,
type__name(ctype, cu), name);
else
} else {
tconf.type_spacing -= 8;
printed += union__fprintf(ctype, cu, &tconf, fp);
}
break;
case DW_TAG_enumeration_type:
ctype = tag__type(type);