fprintf: Print zero sized flat arrays as [], not [0]
To match the case when we really have just one dimension, so the --flat-arrays should show for zero sized arrays, [], not [0]: Noticed with btfdiff. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
f909f13dd7
commit
ea583dac52
|
@ -232,8 +232,12 @@ static size_t array_type__fprintf(const struct tag *tag,
|
||||||
flat_dimensions = 1;
|
flat_dimensions = 1;
|
||||||
printed += fprintf(fp, " __attribute__ ((__vector_size__ (%llu)))",
|
printed += fprintf(fp, " __attribute__ ((__vector_size__ (%llu)))",
|
||||||
flat_dimensions * tag__size(type, cu));
|
flat_dimensions * tag__size(type, cu));
|
||||||
} else if (conf->flat_arrays)
|
} else if (conf->flat_arrays) {
|
||||||
printed += fprintf(fp, "[%llu]", flat_dimensions);
|
if (flat_dimensions != 0)
|
||||||
|
printed += fprintf(fp, "[%llu]", flat_dimensions);
|
||||||
|
else
|
||||||
|
printed += fprintf(fp, "[]");
|
||||||
|
}
|
||||||
|
|
||||||
return printed;
|
return printed;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue