public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: dwz@sourceware.org, jakub@redhat.com, mark@klomp.org
Subject: [committed][testsuite] Fix odr tests with clang
Date: Tue, 16 Feb 2021 12:11:22 +0100	[thread overview]
Message-ID: <20210216111120.GA19100@delia> (raw)

Hi,

When running the testsuite with clang, I run into:
...
$ make check CC=clang CXX=clang++
  ...
FAIL: testsuite/dwz.tests/odr-def-decl.sh
FAIL: testsuite/dwz.tests/odr-loc.sh
FAIL: testsuite/dwz.tests/odr-struct-ns.sh
FAIL: testsuite/dwz.tests/odr-struct.sh
...

The problem is that clang emits less DIEs.  For this bit from odr-loc.cc:
...
struct bbb;
struct ccc {
  int member_three;
};

struct aaa
{
  struct bbb *member_one;
  struct ccc *member_two;
};

struct aaa var1;
...
it ignores the definition of struct ccc, and therefore only has a
DW_AT_declaration DIE for ccc.

Fix this by adding variables for the type definitions that are ignored by
clang.

Committed to trunk.

Thanks,
- Tom

[testsuite] Fix odr tests with clang

2021-02-16  Tom de Vries  <tdevries@suse.de>

	* testsuite/dwz.tests/def2.c (foo): New function.  Allocate ao_ref.
	* testsuite/dwz.tests/odr-def-decl.sh: Update expected counts.
	* testsuite/dwz.tests/odr-2.cc: Add var.
	* testsuite/dwz.tests/odr-loc-2.cc: Same.
	* testsuite/dwz.tests/odr-loc.cc:  Same.
	* testsuite/dwz.tests/odr.cc: Same.

---
 testsuite/dwz.tests/def2.c          | 6 ++++++
 testsuite/dwz.tests/odr-2.cc        | 2 ++
 testsuite/dwz.tests/odr-def-decl.sh | 4 ++--
 testsuite/dwz.tests/odr-loc-2.cc    | 1 +
 testsuite/dwz.tests/odr-loc.cc      | 1 +
 testsuite/dwz.tests/odr.cc          | 2 ++
 6 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/testsuite/dwz.tests/def2.c b/testsuite/dwz.tests/def2.c
index c1eacf3..794933f 100644
--- a/testsuite/dwz.tests/def2.c
+++ b/testsuite/dwz.tests/def2.c
@@ -1,3 +1,9 @@
 #include "def.h"
 
 ao_ref *p2;
+
+void
+foo (void)
+{
+  p2 = new ao_ref;
+}
diff --git a/testsuite/dwz.tests/odr-2.cc b/testsuite/dwz.tests/odr-2.cc
index fd033da..8b3dcd2 100644
--- a/testsuite/dwz.tests/odr-2.cc
+++ b/testsuite/dwz.tests/odr-2.cc
@@ -13,6 +13,8 @@ namespace ns {
 
 #if NAMESPACE
 KIND ns::aaa var2;
+KIND ns::bbb var4;
 #else
 KIND aaa var2;
+KIND bbb var4;
 #endif
diff --git a/testsuite/dwz.tests/odr-def-decl.sh b/testsuite/dwz.tests/odr-def-decl.sh
index 943f05e..8905e52 100644
--- a/testsuite/dwz.tests/odr-def-decl.sh
+++ b/testsuite/dwz.tests/odr-def-decl.sh
@@ -7,13 +7,13 @@ cp $execs/def-decl 1
 verify-dwarf.sh 1
 
 cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*ao_ref" || true)
-[ $cnt -eq 4 ]
+[ $cnt -eq 5 ]
 
 $execs/dwz-for-test --odr 1 --devel-ignore-size
 
 verify-dwarf.sh 1
 
 cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*ao_ref" || true)
-[ $cnt -eq 3 ]
+[ $cnt -eq 2 ]
 
 rm -f 1
diff --git a/testsuite/dwz.tests/odr-loc-2.cc b/testsuite/dwz.tests/odr-loc-2.cc
index 39ef5cf..7cf832b 100644
--- a/testsuite/dwz.tests/odr-loc-2.cc
+++ b/testsuite/dwz.tests/odr-loc-2.cc
@@ -11,3 +11,4 @@ struct aaa
 };
 
 struct aaa var2;
+struct bbb var4;
diff --git a/testsuite/dwz.tests/odr-loc.cc b/testsuite/dwz.tests/odr-loc.cc
index 10efd75..953fd66 100644
--- a/testsuite/dwz.tests/odr-loc.cc
+++ b/testsuite/dwz.tests/odr-loc.cc
@@ -10,6 +10,7 @@ struct aaa
 };
 
 struct aaa var1;
+struct ccc var3;
 
 int
 main (void)
diff --git a/testsuite/dwz.tests/odr.cc b/testsuite/dwz.tests/odr.cc
index 3f9255b..9505cb3 100644
--- a/testsuite/dwz.tests/odr.cc
+++ b/testsuite/dwz.tests/odr.cc
@@ -13,8 +13,10 @@ namespace ns {
 
 #if NAMESPACE
 KIND ns::aaa var1;
+KIND ns::ccc var3;
 #else
 KIND aaa var1;
+KIND ccc var3;
 #endif
 
 int

                 reply	other threads:[~2021-02-16 11:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210216111120.GA19100@delia \
    --to=tdevries@suse.de \
    --cc=dwz@sourceware.org \
    --cc=jakub@redhat.com \
    --cc=mark@klomp.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).