Blame SOURCES/gcc48-pr53477.patch

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