public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@polymtl.ca>
Subject: [pushed] Fix double space expected in cp_test_ptype_class
Date: Sun, 25 Feb 2018 20:16:00 -0000	[thread overview]
Message-ID: <20180225201616.30525-1-simon.marchi@polymtl.ca> (raw)

I noticed some failures of some buildbot slaves, e.g.:

FAIL: gdb.cp/nested-types.exp: ptype S10 (limit = 1) // wrong nested type enum definition: enum S10::E10 {S10::A10, S10::B10, S10::C10};

The issue is that they have an older gcc (not c++11 by default?) that
doesn't emit the enum underlying type information.  When the
enum type is printed by ptype, it looks like this:

  enum S10::E10 {S10::A10, S10::B10, S10::C10};

instead of this on older gccs:

  enum S10::E10 : unsigned int {S10::A10, S10::B10, S10::C10};

The regex that matches this is in cp_test_ptype_class, and is

  enum $nested_name (: (unsigned )?int)? \{

If the "unsigned int" portion is not present, then it requires the
string to have two spaces between the enum name and opening bracket.
The fix is simply to move the trailing space inside the ? group.

gdb/testsuite/ChangeLog:

	* lib/cp-support.exp (cp_test_ptype_class): Move space inside
	parentheses.
---
 gdb/testsuite/ChangeLog          | 5 +++++
 gdb/testsuite/lib/cp-support.exp | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index e1bd8df424..9659e37f0c 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2018-02-25  Simon Marchi  <simon.marchi@polymtl.ca>
+
+	* lib/cp-support.exp (cp_test_ptype_class): Move space inside
+	parentheses.
+
 2018-02-23  Maciej W. Rozycki  <macro@mips.com>
 
 	* lib/cp-support.exp (cp_test_ptype_class): Fix a typo in the
diff --git a/gdb/testsuite/lib/cp-support.exp b/gdb/testsuite/lib/cp-support.exp
index 66b58d5f60..58c21a9161 100644
--- a/gdb/testsuite/lib/cp-support.exp
+++ b/gdb/testsuite/lib/cp-support.exp
@@ -564,7 +564,7 @@ proc cp_test_ptype_class { in_exp in_testname in_key in_tag in_class_table
 	    switch $nested_key {
 		enum {
 		    set expected_result \
-			"enum $nested_name (: (unsigned )?int)? \{"
+			"enum $nested_name (: (unsigned )?int )?\{"
 		    foreach c $nested_children {
 			append expected_result "$c, "
 		    }
-- 
2.16.1

                 reply	other threads:[~2018-02-25 20:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20180225201616.30525-1-simon.marchi@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).