Blame SOURCES/gcc48-pr53477.patch

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