Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Gary Benson <gbenson@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH v2] Enable gdb.cp/ambiguous.exp with GCC and clang
Date: Mon, 17 Aug 2020 14:24:24 +0100	[thread overview]
Message-ID: <1597670664-14171-1-git-send-email-gbenson@redhat.com> (raw)
In-Reply-To: <ad222ebd-921d-3659-d77c-717035e67caa@palves.net>

Pedro Alves wrote:
> On 7/27/20 2:09 PM, Gary Benson via Gdb-patches wrote:
> > Furthermore, gdb.cp/ambiguous.exp has been disabled when using GCC
> > since 1998.
> 
> Curious you reference the year, do you know it because you found the
> commit that disabled it?

Yes :)

> > -if { [test_compiler_info gcc-*] } then { continue }
> > +# GCCs prior to 10.1 do not support -Wno-inaccessible-base.
> > +if { [test_compiler_info {gcc-[0-9]-*}]
> > +     || [test_compiler_info {gcc-10-0-*}] } {
> 
> Given the first release of GCC 10 is 10.1...

Ah, I didn't know that.

> ...do we really need the second check?

No :)  I've removed it.

> > +    unsupported "compiler does not support -Wno-inaccessible-base"
> 
> How about instead of bailing out, use "-Wno-inaccessible-base"
> with GCC >= 10, and use "-w" with older GCCs?

Sure.  How about this?

--
gdb.cp/ambiguous.exp failed to build using clang with the following
error:

 gdb compile failed, /gdbtest/src/gdb/testsuite/gdb.cp/ambiguous.cc:70:36:
   warning: direct base 'A1' is inaccessible due to ambiguity:
     class JVA1 -> class KV -> class A1
     class JVA1 -> class A1 [-Winaccessible-base]
 class JVA1 : public KV, public LV, public A1 {
                                   ^~~~~~~~~

This commit builds this testcase with -Wno-inaccessible-base when
using clang, to avoid this failure.

Furthermore, gdb.cp/ambiguous.exp has been disabled when using GCC
since 1998.  This commit enables this testcase, building with
-Wno-inaccessible-base when using GCC >= 10.1, and -w otherwise.

gdb/testsuite/ChangeLog:

	* gdb.cp/ambiguous.exp: Enable test when compiling with GCC.
	Add additional_flags=-Wno-inaccessible-base when compiling
	with GCC >= 10.1 or clang.  Add additional_flags=-w when
	compiling with GCC < 10.
---
 gdb/testsuite/ChangeLog            |  7 +++++++
 gdb/testsuite/gdb.cp/ambiguous.exp | 12 ++++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.cp/ambiguous.exp b/gdb/testsuite/gdb.cp/ambiguous.exp
index fffe20a..17fb29f 100644
--- a/gdb/testsuite/gdb.cp/ambiguous.exp
+++ b/gdb/testsuite/gdb.cp/ambiguous.exp
@@ -30,12 +30,20 @@ if { [skip_cplus_tests] } { continue }
 standard_testfile .cc
 
 if [get_compiler_info "c++"] {
+    unsupported "couldn't find a valid c++ compiler"
     return -1
 }
 
-if { [test_compiler_info gcc-*] } then { continue }
+set additional_flags ""
+if {[test_compiler_info {gcc-[0-9]-*}]} {
+    # GCCs prior to 10.1 do not support -Wno-inaccessible-base.
+    set additional_flags "additional_flags=-w"
+} elseif {[test_compiler_info gcc*] || [test_compiler_info clang*]} {
+    set additional_flags "additional_flags=-Wno-inaccessible-base"
+}
 
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
+     [list debug c++ $additional_flags]]} {
     return -1
 }
 
-- 
1.8.3.1



  reply	other threads:[~2020-08-17 13:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-27 13:09 [PATCH] Enable gdb.cp/ambiguous.exp with GCC >= 10.1 " Gary Benson
2020-08-07 15:27 ` Pedro Alves
2020-08-17 13:24   ` Gary Benson [this message]
2020-08-17 14:00     ` [PATCH v2] Enable gdb.cp/ambiguous.exp with GCC " Pedro Alves
2020-08-17 14:57       ` Gary Benson
2020-08-25 14:21       ` Gary Benson
2020-08-26 17:13         ` Luis Machado
2020-08-27 10:39           ` Gary Benson
2020-08-27 11:20             ` Pedro Alves
2020-08-27 11:25               ` Luis Machado
2020-08-27 15:07               ` Gary Benson
2020-08-27 15:47                 ` Pedro Alves
2020-08-27 16:18                   ` Gary Benson
2020-08-27 18:04                     ` Pedro Alves
2020-09-11 13:59                       ` Tom de Vries

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=1597670664-14171-1-git-send-email-gbenson@redhat.com \
    --to=gbenson@redhat.com \
    --cc=gdb-patches@sourceware.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