Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/cddl/osnet/dist/tools/ctf/cvt Merge r274564 from Fr...



details:   https://anonhg.NetBSD.org/src/rev/fb946637244c
branches:  trunk
changeset: 343899:fb946637244c
user:      joerg <joerg%NetBSD.org@localhost>
date:      Tue Mar 01 14:52:14 2016 +0000

description:
Merge r274564 from FreeBSD:
Fix a couple of bugs around the handling of structs and unions of size zero.
These would cause ctfconvert(1) to return an error when attempting to
resolve valid C types.

diffstat:

 external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (32 lines):

diff -r c1377eae7ba5 -r fb946637244c external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c
--- a/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c    Tue Mar 01 12:39:35 2016 +0000
+++ b/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c    Tue Mar 01 14:52:14 2016 +0000
@@ -782,7 +782,8 @@
        debug(3, "trying to resolve array %d (cont %d)\n", tdp->t_id,
            tdp->t_ardef->ad_contents->t_id);
 
-       if ((sz = tdesc_size(tdp->t_ardef->ad_contents)) == 0) {
+       if ((sz = tdesc_size(tdp->t_ardef->ad_contents)) == 0 &&
+           (tdp->t_ardef->ad_contents->t_flags & TDESC_F_RESOLVED) == 0) {
                debug(3, "unable to resolve array %s (%d) contents %d\n",
                    tdesc_name(tdp), tdp->t_id,
                    tdp->t_ardef->ad_contents->t_id);
@@ -1164,12 +1165,17 @@
 
                        /*
                         * For empty members, or GCC/C99 flexible array
-                        * members, a size of 0 is correct.
+                        * members, a size of 0 is correct. Structs and unions
+                        * consisting of flexible array members will also have
+                        * size 0.
                         */
                        if (mt->t_members == NULL)
                                continue;
                        if (mt->t_type == ARRAY && mt->t_ardef->ad_nelems == 0)
                                continue;
+                       if ((mt->t_flags & TDESC_F_RESOLVED) != 0 &&
+                           (mt->t_type == STRUCT || mt->t_type == UNION))
+                               continue;
 
                        if (mt->t_type == STRUCT && 
                                mt->t_members != NULL &&



Home | Main Index | Thread Index | Old Index