From 963f5dc7a30624e95d72fb7f87b8892651164e46 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Fri, 31 Dec 2021 12:55:01 -0500 Subject: [PATCH] ctfconvert: Handle arrays of empty structs Members with such a type will legitimately have a size of zero, so don't emit a warning. PR: 260818 Reviewed by: bz MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33700 --- cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c b/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c index 32c993e1e524..2d686e53fed1 100644 --- a/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c +++ b/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c @@ -1123,8 +1123,16 @@ die_sou_resolve(tdesc_t *tdp, tdesc_t **tdpp __unused, void *private) */ if (mt->t_members == NULL) continue; - if (mt->t_type == ARRAY && mt->t_ardef->ad_nelems == 0) - continue; + if (mt->t_type == ARRAY) { + if (mt->t_ardef->ad_nelems == 0) + continue; + mt = tdesc_basetype(mt->t_ardef->ad_contents); + if ((mt->t_flags & TDESC_F_RESOLVED) != 0 && + (mt->t_type == STRUCT || + mt->t_type == UNION) && + mt->t_members == NULL) + continue; + } if ((mt->t_flags & TDESC_F_RESOLVED) != 0 && (mt->t_type == STRUCT || mt->t_type == UNION)) continue;