Patchwork [v3] libstdc++/48362 - pretty printer for std::tuple<> with no elements

login
register
mail settings
Submitter Jonathan Wakely
Date Dec. 22, 2011, 1:27 p.m.
Message ID <CAH6eHdRQvapz0npOrk-GK1w-QsZnXKoUn3rxNEBGUEOADcOa0g@mail.gmail.com>
Download mbox | patch
Permalink /patch/132845/
State New
Headers show

Comments

Jonathan Wakely - Dec. 22, 2011, 1:27 p.m.
On 22 December 2011 12:44, Jonathan Wakely wrote:
>        PR libstdc++/48362
>        * python/libstdcxx/v6/printers.py (StdTuplePrinter): Handle empty
>        tuples.
>
> There might be a neater way to fix this, but this does the job.
>
> Committed to trunk.

I forgot we can test the pretty printers now, so here's a new test.

        PR libstdc++/48362
        * testsuite/libstdc++-prettyprinters/48362.cc: New.

Tested with "make check RUNTESTFLAGS=prettyprinters.exp" and committed to trunk.

Patch

Index: testsuite/libstdc++-prettyprinters/48362.cc
===================================================================
--- testsuite/libstdc++-prettyprinters/48362.cc	(revision 0)
+++ testsuite/libstdc++-prettyprinters/48362.cc	(revision 0)
@@ -0,0 +1,36 @@ 
+// { dg-do run }
+// { dg-options "-g -std=gnu++11 -O0" }
+
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <tuple>
+#include <string>
+
+int
+main()
+{
+  std::tuple<> t1;
+// { dg-final { note-test t1 {empty std::tuple} } }
+
+  std::tuple<std::string, int, std::tuple<>> t2{ "Johnny", 5, {} };
+// { dg-final { note-test t2 {std::tuple containing = {[1] = "Johnny", [2] = 5, [3] = {<std::tuple<>> = empty std::tuple, <No data fields>}}} } }
+
+  return 0; // Mark SPOT
+}
+
+// { dg-final { gdb-test SPOT } }