Blame SOURCES/gcc48-pr53477.patch

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