From: Mark Wielaard <mjw@redhat.com>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] implement support for "enum class"
Date: Wed, 21 May 2014 14:04:00 -0000 [thread overview]
Message-ID: <1400681049.9184.9.camel@bordewijk.wildebeest.org> (raw)
In-Reply-To: <87vbuugrj7.fsf@fleche.redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1532 bytes --]
Hi Tom,
On Mon, 2014-03-31 at 12:19 -0600, Tom Tromey wrote:
> Mark> I am also not sure what the right thing to do is here. But I think it
> Mark> makes sense to make printing it depend on the language used and always
> Mark> print it when the language supports "derived enums" whether the user
> Mark> explicitly defined it or it was guessed by the compiler. It is an valid
> Mark> expression in any case and the GDB user might appreciate the extra info
> Mark> (in the case of C++).
>
> I went this route.
>
> Here's a new patch, this one regtested on x86-64 Fedora 20 against both
> the system compiler and a GCC with your enum patches applied. I had to
> update gdb.cp/classes.exp and I added a new test as well.
The gcc patch is almost in... (I hope). While testing it I found one
more testcase that should get the same treatment as gdb.cp/classes.exp
to optionally accept a underlying type in the case of C++.
With the gcc patch you'll get the following 9 failures otherwise:
FAIL: gdb.cp/var-tag.exp: before start: c++: ptype E
FAIL: gdb.cp/var-tag.exp: before start: c++: ptype ee
FAIL: gdb.cp/var-tag.exp: before start: c++: ptype EE
FAIL: gdb.cp/var-tag.exp: in main: c++: ptype E
FAIL: gdb.cp/var-tag.exp: in main: c++: ptype ee
FAIL: gdb.cp/var-tag.exp: in main: c++: ptype EE
FAIL: gdb.cp/var-tag.exp: in C::f: c++: ptype E
FAIL: gdb.cp/var-tag.exp: in C::f: c++: ptype ee
FAIL: gdb.cp/var-tag.exp: in C::f: c++: ptype EE
With the testsuite tweak all these PASS.
Does this look OK to check in?
Thanks,
Mark
[-- Attachment #2: 0001-gdb-testsuite-Handle-underlying-type-in-gdb.cp-var-t.patch --]
[-- Type: text/x-patch, Size: 2365 bytes --]
From 0458987f529e6451a83aa10c5107ae4b9fa7fa50 Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mjw@redhat.com>
Date: Wed, 21 May 2014 16:00:05 +0200
Subject: [PATCH] gdb/testsuite: Handle underlying type in gdb.cp/var-tag.exp.
* gdb.cp/var-tag.exp (do_global_tests): Handle underlying type.
---
gdb/testsuite/ChangeLog | 4 ++++
gdb/testsuite/gdb.cp/var-tag.exp | 12 +++++++++---
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index be0bdf3..1afc9d5 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2014-05-21 Mark Wielaard <mjw@redhat.com>
+
+ * gdb.cp/var-tag.exp (do_global_tests): Handle underlying type.
+
2014-05-20 Pedro Alves <palves@redhat.com>
* gdb.base/compare-sections.c: New file.
diff --git a/gdb/testsuite/gdb.cp/var-tag.exp b/gdb/testsuite/gdb.cp/var-tag.exp
index 7869fa2..9e46282 100644
--- a/gdb/testsuite/gdb.cp/var-tag.exp
+++ b/gdb/testsuite/gdb.cp/var-tag.exp
@@ -26,19 +26,25 @@ if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} {
}
proc do_global_tests {lang} {
+ if {$lang == "c++"} {
+ set opt_underlying "(: unsigned int )?"
+ } else {
+ set opt_underlying ""
+ }
+
if {$lang == "c"} {
set invalid_print "No symbol \"%s\" in current context."
set ptypefmt $invalid_print
} else {
set invalid_print "Attempt to use a type name as an expression"
- set ptypefmt "type = (class|enum|union|struct) %s {.*}"
+ set ptypefmt "type = (class|enum|union|struct) %s $opt_underlying{.*}"
}
with_test_prefix $lang {
gdb_test_no_output "set language $lang"
gdb_test "ptype C" "type = class C {.*}"
gdb_test "print E" "= a"
- gdb_test "ptype E" "type = enum E {.*}"
+ gdb_test "ptype E" "type = enum E $opt_underlying{.*}"
gdb_test "print S" "= {<No data fields>}"
gdb_test "ptype S" "type = struct S {.*}"
gdb_test "print U" "= {.*}"
@@ -52,7 +58,7 @@ proc do_global_tests {lang} {
gdb_test "print SS" [format $invalid_print "SS"]
gdb_test "ptype SS" [format $ptypefmt "SS"]
gdb_test "print ee" "= .*"
- gdb_test "ptype ee" "type = enum EE {.*}"
+ gdb_test "ptype ee" "type = enum EE $opt_underlying{.*}"
gdb_test "print EE" [format $invalid_print "EE"]
gdb_test "ptype EE" [format $ptypefmt "EE"]
gdb_test "print uu" "= {.*}"
--
1.7.1
next prev parent reply other threads:[~2014-05-21 14:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-27 20:12 Tom Tromey
2014-03-28 11:21 ` Mark Wielaard
2014-03-31 4:38 ` Tom Tromey
2014-03-31 7:16 ` Mark Wielaard
2014-03-31 18:19 ` Tom Tromey
2014-04-14 18:07 ` Tom Tromey
2014-05-21 14:04 ` Mark Wielaard [this message]
2014-05-21 14:25 ` Tom Tromey
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=1400681049.9184.9.camel@bordewijk.wildebeest.org \
--to=mjw@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=tromey@redhat.com \
/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