Blame SOURCES/gcc48-pr53477.patch

56d343
2013-08-20  Phil Muldoon  <pmuldoon@redhat.com>
56d343
56d343
	PR libstdc++/53477
56d343
	http://sourceware.org/bugzilla/show_bug.cgi?id=15195
56d343
56d343
	* python/libstdcxx/v6/printers.py (Printer.__call__): If a value
56d343
	is a reference, fetch referenced value.
56d343
	(RxPrinter.invoke): Ditto.
56d343
	* testsuite/libstdc++-prettyprinters/cxx11.cc (main): Add -O0
56d343
	flag. Add referenced value tests.
56d343
56d343
--- libstdc++-v3/python/libstdcxx/v6/printers.py	(revision 201887)
56d343
+++ libstdc++-v3/python/libstdcxx/v6/printers.py	(revision 201888)
56d343
@@ -786,6 +786,11 @@ class RxPrinter(object):
56d343
     def invoke(self, value):
56d343
         if not self.enabled:
56d343
             return None
56d343
+
56d343
+        if value.type.code == gdb.TYPE_CODE_REF:
56d343
+            if hasattr(gdb.Value,"referenced_value"):
56d343
+                value = value.referenced_value()
56d343
+
56d343
         return self.function(self.name, value)
56d343
 
56d343
 # A pretty-printer that conforms to the "PrettyPrinter" protocol from
56d343
@@ -841,6 +846,11 @@ class Printer(object):
56d343
             return None
56d343
 
56d343
         basename = match.group(1)
56d343
+
56d343
+        if val.type.code == gdb.TYPE_CODE_REF:
56d343
+            if hasattr(gdb.Value,"referenced_value"):
56d343
+                val = val.referenced_value()
56d343
+
56d343
         if basename in self.lookup:
56d343
             return self.lookup[basename].invoke(val)
56d343
 
56d343
--- libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx11.cc	(revision 201887)
56d343
+++ libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx11.cc	(revision 201888)
56d343
@@ -1,5 +1,5 @@
56d343
 // { dg-do run }
56d343
-// { dg-options "-std=gnu++11 -g" }
56d343
+// { dg-options "-std=gnu++11 -g -O0" }
56d343
 
56d343
 // Copyright (C) 2011-2013 Free Software Foundation, Inc.
56d343
 //
56d343
@@ -24,6 +24,8 @@
56d343
 #include <string>
56d343
 #include <iostream>
56d343
 
56d343
+typedef std::tuple<int, int> ExTuple;
56d343
+
56d343
 template<class T>
56d343
 void
56d343
 placeholder(const T &s)
56d343
@@ -62,43 +64,75 @@ main()
56d343
   std::forward_list<int> efl;
56d343
 // { dg-final { note-test efl "empty std::forward_list" } }
56d343
 
56d343
+  std::forward_list<int> &refl = efl;
56d343
+// { dg-final { note-test refl "empty std::forward_list" } }
56d343
+
56d343
   std::forward_list<int> fl;
56d343
   fl.push_front(2);
56d343
   fl.push_front(1);
56d343
 // { dg-final { note-test fl {std::forward_list = {[0] = 1, [1] = 2}} } }
56d343
 
56d343
+  std::forward_list<int> &rfl = fl;
56d343
+// { dg-final { note-test rfl {std::forward_list = {[0] = 1, [1] = 2}} } }
56d343
+
56d343
   std::unordered_map<int, std::string> eum;
56d343
 // { dg-final { note-test eum "std::unordered_map with 0 elements" } }
56d343
+  std::unordered_map<int, std::string> &reum = eum;
56d343
+// { dg-final { note-test reum "std::unordered_map with 0 elements" } }
56d343
+
56d343
   std::unordered_multimap<int, std::string> eumm;
56d343
 // { dg-final { note-test eumm "std::unordered_multimap with 0 elements" } }
56d343
+  std::unordered_multimap<int, std::string> &reumm = eumm;
56d343
+// { dg-final { note-test reumm "std::unordered_multimap with 0 elements" } }
56d343
+
56d343
   std::unordered_set<int> eus;
56d343
 // { dg-final { note-test eus "std::unordered_set with 0 elements" } }
56d343
+  std::unordered_set<int> &reus = eus;
56d343
+// { dg-final { note-test reus "std::unordered_set with 0 elements" } }
56d343
+
56d343
   std::unordered_multiset<int> eums;
56d343
 // { dg-final { note-test eums "std::unordered_multiset with 0 elements" } }
56d343
+  std::unordered_multiset<int> &reums = eums;
56d343
+// { dg-final { note-test reums "std::unordered_multiset with 0 elements" } }
56d343
 
56d343
   std::unordered_map<int, std::string> uom;
56d343
   uom[5] = "three";
56d343
   uom[3] = "seven";
56d343
 // { dg-final { note-test uom {std::unordered_map with 2 elements = {[3] = "seven", [5] = "three"}} } }
56d343
 
56d343
+  std::unordered_map<int, std::string> &ruom = uom;
56d343
+// { dg-final { note-test ruom {std::unordered_map with 2 elements = {[3] = "seven", [5] = "three"}} } }
56d343
+
56d343
   std::unordered_multimap<int, std::string> uomm;
56d343
   uomm.insert(std::pair<int, std::string> (5, "three"));
56d343
   uomm.insert(std::pair<int, std::string> (5, "seven"));
56d343
 // { dg-final { note-test uomm {std::unordered_multimap with 2 elements = {[5] = "seven", [5] = "three"}} } }
56d343
+  std::unordered_multimap<int, std::string> &ruomm = uomm;
56d343
+// { dg-final { note-test ruomm {std::unordered_multimap with 2 elements = {[5] = "seven", [5] = "three"}} } }
56d343
 
56d343
   std::unordered_set<int> uos;
56d343
   uos.insert(5);
56d343
 // { dg-final { note-test uos {std::unordered_set with 1 elements = {[0] = 5}} } }
56d343
+  std::unordered_set<int> &ruos = uos;
56d343
+// { dg-final { note-test ruos {std::unordered_set with 1 elements = {[0] = 5}} } }
56d343
 
56d343
   std::unordered_multiset<int> uoms;
56d343
   uoms.insert(5);
56d343
 // { dg-final { note-test uoms {std::unordered_multiset with 1 elements = {[0] = 5}} } }
56d343
+  std::unordered_multiset<int> &ruoms = uoms;
56d343
+// { dg-final { note-test ruoms {std::unordered_multiset with 1 elements = {[0] = 5}} } }
56d343
 
56d343
   std::unique_ptr<datum> uptr (new datum);
56d343
   uptr->s = "hi bob";
56d343
   uptr->i = 23;
56d343
 // { dg-final { regexp-test uptr {std::unique_ptr.datum. containing 0x.*} } }
56d343
+  std::unique_ptr<datum> &ruptr = uptr;
56d343
+// { dg-final { regexp-test ruptr {std::unique_ptr.datum. containing 0x.*} } }
56d343
 
56d343
+  ExTuple tpl(6,7);
56d343
+// { dg-final { note-test tpl {std::tuple containing = {[1] = 6, [2] = 7}} } }  
56d343
+  ExTuple &rtpl = tpl;
56d343
+// { dg-final { note-test rtpl {std::tuple containing = {[1] = 6, [2] = 7}} } }   
56d343
   placeholder(""); // Mark SPOT
56d343
   use(efl);
56d343
   use(fl);