diff options
author | Jonathan Wakely <jwakely.gcc@gmail.com> | 2012-10-28 13:20:31 +0000 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2012-10-28 13:20:31 +0000 |
commit | 937b190d7556fce8670decf9a06aeee5d111c144 (patch) | |
tree | 07aa5871475d9ac99e00cee5af64f9a5ac9ed086 /libstdc++-v3 | |
parent | bf3f651054fdf0fdd672ffe344b0886e74f20098 (diff) | |
download | gcc-937b190d7556fce8670decf9a06aeee5d111c144.tar.gz |
re PR libstdc++/55041 (prettyprinting/shared_ptr & cxx11 fails on some platforms)
PR libstdc++/55041
* python/libstdcxx/v6/printers.py (Tr1UnorderedMapPrinter): Update
to handle hashtable as member of unordered_map not base class.
(Tr1UnorderedSetPrinter): Likewise.
From-SVN: r192894
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 7 | ||||
-rw-r--r-- | libstdc++-v3/python/libstdcxx/v6/printers.py | 18 |
2 files changed, 21 insertions, 4 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index fa0ce759d61..d60078a6c9e 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2012-10-28 Jonathan Wakely <jwakely.gcc@gmail.com> + + PR libstdc++/55041 + * python/libstdcxx/v6/printers.py (Tr1UnorderedMapPrinter): Update + to handle hashtable as member of unordered_map not base class. + (Tr1UnorderedSetPrinter): Likewise. + 2012-10-27 François Dumont <fdumont@gcc.gnu.org> * include/bits/unordered_map.h (unordered_map<>): Prefer diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py b/libstdc++-v3/python/libstdcxx/v6/printers.py index 0eac413bf4a..07a5ee62f35 100644 --- a/libstdc++-v3/python/libstdcxx/v6/printers.py +++ b/libstdc++-v3/python/libstdcxx/v6/printers.py @@ -633,8 +633,13 @@ class Tr1UnorderedSetPrinter: self.typename = typename self.val = val + def hashtable (self): + if self.typename.startswith('std::tr1'): + return self.val + return self.val['_M_h'] + def to_string (self): - return '%s with %d elements' % (self.typename, self.val['_M_element_count']) + return '%s with %d elements' % (self.typename, self.hashtable()['_M_element_count']) @staticmethod def format_count (i): @@ -642,7 +647,7 @@ class Tr1UnorderedSetPrinter: def children (self): counter = itertools.imap (self.format_count, itertools.count()) - return itertools.izip (counter, Tr1HashtableIterator (self.val)) + return itertools.izip (counter, Tr1HashtableIterator (self.hashtable())) class Tr1UnorderedMapPrinter: "Print a tr1::unordered_map" @@ -651,8 +656,13 @@ class Tr1UnorderedMapPrinter: self.typename = typename self.val = val + def hashtable (self): + if self.typename.startswith('std::tr1'): + return self.val + return self.val['_M_h'] + def to_string (self): - return '%s with %d elements' % (self.typename, self.val['_M_element_count']) + return '%s with %d elements' % (self.typename, self.hashtable()['_M_element_count']) @staticmethod def flatten (list): @@ -671,7 +681,7 @@ class Tr1UnorderedMapPrinter: def children (self): counter = itertools.imap (self.format_count, itertools.count()) # Map over the hash table and flatten the result. - data = self.flatten (itertools.imap (self.format_one, Tr1HashtableIterator (self.val))) + data = self.flatten (itertools.imap (self.format_one, Tr1HashtableIterator (self.hashtable()))) # Zip the two iterators together. return itertools.izip (counter, data) |