summaryrefslogtreecommitdiff
path: root/usr.bin/ctfconv
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2018-01-31 14:47:14 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2018-01-31 14:47:14 +0000
commit68e1bc2a68b5e363054b7e12881394f0f96e77ac (patch)
tree5726bd22ca1f60832352c022ab9bc3d86d9bec01 /usr.bin/ctfconv
parentcf588e93fe6bb5d56dce60ab4e4bbba1d0b76f0c (diff)
Consider integer/float size during base type comparisons.
Regression introduced when I added support for merging forward declarations with their corresponding types because they do not have a size.
Diffstat (limited to 'usr.bin/ctfconv')
-rw-r--r--usr.bin/ctfconv/parse.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.bin/ctfconv/parse.c b/usr.bin/ctfconv/parse.c
index 0d25bb3890b..7b839330d0f 100644
--- a/usr.bin/ctfconv/parse.c
+++ b/usr.bin/ctfconv/parse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.c,v 1.10 2017/10/31 10:08:51 mpi Exp $ */
+/* $OpenBSD: parse.c,v 1.11 2018/01/31 14:47:13 mpi Exp $ */
/*
* Copyright (c) 2016-2017 Martin Pieuchot
@@ -324,6 +324,11 @@ it_cmp(struct itype *a, struct itype *b)
if ((diff = (a->it_type - b->it_type)) != 0)
return diff;
+ /* Basic types need to have the same size. */
+ if ((a->it_type == CTF_K_INTEGER || a->it_type == CTF_K_FLOAT) &&
+ (diff = (a->it_size - b->it_size) != 0))
+ return diff;
+
/* Match by name */
if (!(a->it_flags & ITF_ANON) && !(b->it_flags & ITF_ANON))
return strcmp(it_name(a), it_name(b));