From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31799 invoked by alias); 21 May 2014 14:04:15 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 31790 invoked by uid 89); 21 May 2014 14:04:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.1 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 21 May 2014 14:04:12 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s4LE4BaP030822 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 21 May 2014 10:04:11 -0400 Received: from [10.36.116.92] (ovpn-116-92.ams2.redhat.com [10.36.116.92]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s4LE4AXT017378; Wed, 21 May 2014 10:04:10 -0400 Subject: Re: [PATCH] implement support for "enum class" From: Mark Wielaard To: Tom Tromey Cc: gdb-patches@sourceware.org In-Reply-To: <87vbuugrj7.fsf@fleche.redhat.com> References: <1395951111-8189-1-git-send-email-tromey@redhat.com> <1396005664.3824.70.camel@bordewijk.wildebeest.org> <87y4zrhtj0.fsf@fleche.redhat.com> <1396250182.31641.40.camel@bordewijk.wildebeest.org> <87vbuugrj7.fsf@fleche.redhat.com> Content-Type: multipart/mixed; boundary="=-ikuax70uW2AuJH6hmfSP" Date: Wed, 21 May 2014 14:04:00 -0000 Message-ID: <1400681049.9184.9.camel@bordewijk.wildebeest.org> Mime-Version: 1.0 X-SW-Source: 2014-05/txt/msg00480.txt.bz2 --=-ikuax70uW2AuJH6hmfSP Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Content-length: 1532 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 --=-ikuax70uW2AuJH6hmfSP Content-Disposition: inline; filename*0=0001-gdb-testsuite-Handle-underlying-type-in-gdb.cp-var-t.pat; filename*1=ch Content-Type: text/x-patch; name="0001-gdb-testsuite-Handle-underlying-type-in-gdb.cp-var-t.patch"; charset="UTF-8" Content-Transfer-Encoding: 7bit Content-length: 2366 >From 0458987f529e6451a83aa10c5107ae4b9fa7fa50 Mon Sep 17 00:00:00 2001 From: Mark Wielaard 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 + + * gdb.cp/var-tag.exp (do_global_tests): Handle underlying type. + 2014-05-20 Pedro Alves * 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" "= {}" 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 --=-ikuax70uW2AuJH6hmfSP--