From patchwork Wed May 21 14:04:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Wielaard X-Patchwork-Id: 1053 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx21.g.dreamhost.com (peon2454.g.dreamhost.com [208.113.200.127]) by wilcox.dreamhost.com (Postfix) with ESMTP id 9AB77360079 for ; Wed, 21 May 2014 07:04:19 -0700 (PDT) Received: by homiemail-mx21.g.dreamhost.com (Postfix, from userid 14314964) id 88911195082D; Wed, 21 May 2014 07:04:17 -0700 (PDT) X-Original-To: gdb@patchwork.siddhesh.in Delivered-To: x14314964@homiemail-mx21.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx21.g.dreamhost.com (Postfix) with ESMTPS id 3CF03150EC19 for ; Wed, 21 May 2014 07:04:16 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:from:to:cc:in-reply-to:references :content-type:date:message-id:mime-version; q=dns; s=default; b= Q/ATbw/4AA0zq51/CDfHpC2lu8MQjVXJUSGRgh7RvrcQrbuhfDc+PkU/kQ1MuqC9 yDK1me54i4hYfbohxrAjmtJXjRwQHGag5J8V6oLRTtquWJXjf5bwA7hHkQm4lJEZ 8Vy8SZ3CUIfleHkofZ3ruQu+oZorVE4vkCC0Bvv9760= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:from:to:cc:in-reply-to:references :content-type:date:message-id:mime-version; s=default; bh=Xf6wXk xSAhl6vTPkYtUDZK9XwDQ=; b=cLHFo4787nxHIQsX4j+P8v1pSm83aeupxXanef TAhuMQ+M+ozw7eUnWQBPIGbKRVF6Cz6XOye/BIQg6ZJP33a5FxQJ845Vytx9ca1a 0HIh9PrNoM1IhH09+KpN8j5qiw1Fgsm6b2unGNi7f5dK/nMMHAafkzOXMszIcFML GSgmo= 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-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@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> Date: Wed, 21 May 2014 16:04:09 +0200 Message-ID: <1400681049.9184.9.camel@bordewijk.wildebeest.org> Mime-Version: 1.0 X-DH-Original-To: gdb@patchwork.siddhesh.in 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 >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