From patchwork Sat Sep 20 21:21:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Wielaard X-Patchwork-Id: 391571 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 ozlabs.org (Postfix) with ESMTPS id 2518C14012A for ; Sun, 21 Sep 2014 07:21:49 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; q=dns; s=default; b=GcfBPILP1Uq3 bRMXcsGC4tm3FbZyH5SX8VsliNl9TW1ClitTPs3YlsnPwOjkbGnsq99Kdxn5FtEi tIPDZECnhzlpVCXoi4T0MvU1dfrU1ElzQIXOOHB67u9BaPn4OJKAPnt7kbREcuAQ E4Ow4zTpypq9m+r3DycvID/VVXrRUCU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; s=default; bh=Y9MALmYEJehASDYlYf in4RIAsEo=; b=UVWb9rXpaxIt20jsSbM3Sg9wZUNtzYNdsdK6vwvlt0I/C+F+GF BC+4ffBZqLg7027+l3f/weJt6n+eHNRw2zjT1LQFaBJj682wFb3canjnDbuZoBcd 59C4NVYWqwJexICEJrIoK5fqjOkk1p4nA3H8LH6xQP2ZJOqBhDPujTdKY= Received: (qmail 18935 invoked by alias); 20 Sep 2014 21:21:41 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 18923 invoked by uid 89); 20 Sep 2014 21:21:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, SPF_PASS autolearn=ham version=3.3.2 X-HELO: gnu.wildebeest.org Received: from wildebeest.demon.nl (HELO gnu.wildebeest.org) (212.238.236.112) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Sat, 20 Sep 2014 21:21:38 +0000 From: Mark Wielaard To: gcc-patches@gcc.gnu.org Cc: jakub@redhat.com, tom@tromey.com, Mark Wielaard Subject: [PATCH] gcc-gdb-test.exp: Handle old GDB "short int" and "long int" types. Date: Sat, 20 Sep 2014 23:21:25 +0200 Message-Id: <1411248085-1901-1-git-send-email-mjw@redhat.com> X-Spam-Score: -2.9 (--) Old GDB might show short and long as short int and long int. This made gcc.dg/guality/const-volatile.c ans restrict.c fail on older GDBs. According to the patch that changed this in newer versions of GDB this was a bug: https://sourceware.org/ml/gdb-patches/2012-09/msg00455.html The patch transforms the types "short int" and "long int" coming from GDB to plain "short" and "long". And a variant has been added to the const-volatile.c testcase to make sure short and long long are handled correctly now with older GDB. Tested against GDB 7.7.1 and 7.4.50. gcc/testsuite/ChangeLog * lib/gcc-gdb-test.exp (gdb-test): Transform gdb types "short int" and "long int" to plain "short" and "long". * gcc.dg/guality/const-volatile.c (struct bar): New struct containing short and long long fields. (bar): New variable to test the type. --- gcc/testsuite/gcc.dg/guality/const-volatile.c | 11 +++++++++++ gcc/testsuite/lib/gcc-gdb-test.exp | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/gcc/testsuite/gcc.dg/guality/const-volatile.c b/gcc/testsuite/gcc.dg/guality/const-volatile.c index 86460e4..eb45ae5 100644 --- a/gcc/testsuite/gcc.dg/guality/const-volatile.c +++ b/gcc/testsuite/gcc.dg/guality/const-volatile.c @@ -28,6 +28,16 @@ struct foo const signed char csc; }; +struct bar +{ + short s; + const short cs; + volatile short vs; + const volatile short cvs; + volatile long long vll; +}; + +struct bar bar __attribute__((used)); struct foo foo; const struct foo cfoo; volatile struct foo vfoo; @@ -72,6 +82,7 @@ main (int argc, char **argv) /* { dg-final { gdb-test 50 "type:cvip" "int * const volatile" } } */ +/* { dg-final { gdb-test 50 "type:bar" "struct bar { short s; const short cs; volatile short vs; const volatile short cvs; volatile long long vll; }" } } */ /* { dg-final { gdb-test 50 "type:foo" "struct foo { const long cli; const signed char csc; }" } } */ /* { dg-final { gdb-test 50 "type:cfoo" "const struct foo { const long cli; const signed char csc; }" } } */ /* { dg-final { gdb-test 50 "type:vfoo" "volatile struct foo { const long cli; const signed char csc; }" } } */ diff --git a/gcc/testsuite/lib/gcc-gdb-test.exp b/gcc/testsuite/lib/gcc-gdb-test.exp index c729793..f43263d 100644 --- a/gcc/testsuite/lib/gcc-gdb-test.exp +++ b/gcc/testsuite/lib/gcc-gdb-test.exp @@ -111,6 +111,10 @@ proc gdb-test { args } { # Squash all extra whitespace/newlines that gdb might use for # "pretty printing" into one so result is just one line. regsub -all {[\n\r\t ]+} $type " " type + # Old gdb might output "long int" instead of just "long" + # and "short int" instead of just "short". Canonicalize. + regsub -all {\mlong int\M} $type "long" type + regsub -all {\mshort int\M} $type "short" type set expected [lindex $args 2] if { $type == $expected } { pass "$testname"