From 46d825c59cd6d5df4784b99dc0fcb878c2b7c24f Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Mon, 16 Nov 2015 21:32:26 +0000 Subject: [PATCH] re PR libstdc++/67440 (pretty-printing of a const set fails) PR libstdc++/67440 * python/libstdcxx/v6/printers.py (find_type): Handle "const" in type name. * testsuite/libstdc++-prettyprinters/debug.cc: Add test for const set. * testsuite/libstdc++-prettyprinters/simple.cc: Ditto. * testsuite/libstdc++-prettyprinters/simple11.cc: Ditto. From-SVN: r230437 --- libstdc++-v3/ChangeLog | 10 ++++++++++ libstdc++-v3/python/libstdcxx/v6/printers.py | 4 +++- .../testsuite/libstdc++-prettyprinters/debug.cc | 4 ++++ .../testsuite/libstdc++-prettyprinters/simple.cc | 4 ++++ .../testsuite/libstdc++-prettyprinters/simple11.cc | 4 ++++ 5 files changed, 25 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index fcef0355336..9ef08908c01 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,13 @@ +2015-11-16 Doug Evans + + PR libstdc++/67440 + * python/libstdcxx/v6/printers.py (find_type): Handle "const" in + type name. + * testsuite/libstdc++-prettyprinters/debug.cc: Add test for + const set. + * testsuite/libstdc++-prettyprinters/simple.cc: Ditto. + * testsuite/libstdc++-prettyprinters/simple11.cc: Ditto. + 2015-11-15 Jonathan Wakely PR libstdc++/68353 diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py b/libstdc++-v3/python/libstdcxx/v6/printers.py index 12e732e4a76..14f786a0742 100644 --- a/libstdc++-v3/python/libstdcxx/v6/printers.py +++ b/libstdc++-v3/python/libstdcxx/v6/printers.py @@ -85,7 +85,9 @@ except ImportError: def find_type(orig, name): typ = orig.strip_typedefs() while True: - search = str(typ) + '::' + name + # Use typ.name here instead of str(typ) to discard any const,etc. + # qualifiers. PR 67440. + search = typ.name + '::' + name try: return gdb.lookup_type(search) except RuntimeError: diff --git a/libstdc++-v3/testsuite/libstdc++-prettyprinters/debug.cc b/libstdc++-v3/testsuite/libstdc++-prettyprinters/debug.cc index c62ef61ebfe..8d40f174fd9 100644 --- a/libstdc++-v3/testsuite/libstdc++-prettyprinters/debug.cc +++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/debug.cc @@ -70,6 +70,10 @@ main() std::map::iterator mpiter = mp.begin(); // { dg-final { note-test mpiter {{first = "zardoz", second = 23}} } } + // PR 67440 + const std::set const_intset = {2, 3}; +// { dg-final { note-test const_intset {std::__debug::set with 2 elements = {[0] = 2, [1] = 3}} } } + std::set sp; sp.insert("clownfish"); sp.insert("barrel"); diff --git a/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc b/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc index ad3c2561296..68c4d83f42c 100644 --- a/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc +++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple.cc @@ -73,6 +73,10 @@ main() std::map::iterator mpiter = mp.begin(); // { dg-final { note-test mpiter {{first = "zardoz", second = 23}} } } + // PR 67440 + const std::set const_intset = {2, 3}; +// { dg-final { note-test const_intset {std::set with 2 elements = {[0] = 2, [1] = 3}} } } + std::set sp; sp.insert("clownfish"); sp.insert("barrel"); diff --git a/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple11.cc b/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple11.cc index ba36a6abef4..5f7e9a6a7af 100644 --- a/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple11.cc +++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/simple11.cc @@ -73,6 +73,10 @@ main() std::map::iterator mpiter = mp.begin(); // { dg-final { note-test mpiter {{first = "zardoz", second = 23}} } } + // PR 67440 + const std::set const_intset = {2, 3}; +// { dg-final { note-test const_intset {std::set with 2 elements = {[0] = 2, [1] = 3}} } } + std::set sp; sp.insert("clownfish"); sp.insert("barrel"); -- 2.30.2