mirror of git://gcc.gnu.org/git/gcc.git
cxx11.cc (main): Add new tests.
* testsuite/libstdc++-prettyprinters/cxx11.cc (main): Add new tests. * python/libstdcxx/v6/printers.py (Tr1HashtableIterator.__init__): Rewrite. (Tr1HashtableIterator.update): Remove. (Tr1HashtableIterator.next): Rewrite. From-SVN: r184233
This commit is contained in:
parent
7a07ae5284
commit
d25b1e3a80
|
@ -1,3 +1,12 @@
|
|||
2012-02-14 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
* testsuite/libstdc++-prettyprinters/cxx11.cc (main): Add new
|
||||
tests.
|
||||
* python/libstdcxx/v6/printers.py (Tr1HashtableIterator.__init__):
|
||||
Rewrite.
|
||||
(Tr1HashtableIterator.update): Remove.
|
||||
(Tr1HashtableIterator.next): Rewrite.
|
||||
|
||||
2012-02-13 Benjamin Kosnik <bkoz@redhat.com>
|
||||
|
||||
* testsuite/20_util/shared_ptr/cons/43820_neg.cc: Adjust line numbers.
|
||||
|
|
|
@ -610,38 +610,18 @@ class StdStringPrinter:
|
|||
|
||||
class Tr1HashtableIterator:
|
||||
def __init__ (self, hash):
|
||||
self.count = 0
|
||||
self.n_buckets = hash['_M_element_count']
|
||||
if self.n_buckets == 0:
|
||||
self.node = False
|
||||
else:
|
||||
self.bucket = hash['_M_buckets']
|
||||
self.node = self.bucket[0]
|
||||
self.update ()
|
||||
self.node = hash['_M_before_begin']['_M_nxt']
|
||||
self.node_type = find_type(hash.type, '_Node').pointer()
|
||||
|
||||
def __iter__ (self):
|
||||
return self
|
||||
|
||||
def update (self):
|
||||
# If we advanced off the end of the chain, move to the next
|
||||
# bucket.
|
||||
while self.node == 0:
|
||||
self.bucket = self.bucket + 1
|
||||
self.node = self.bucket[0]
|
||||
|
||||
# If we advanced off the end of the bucket array, then
|
||||
# we're done.
|
||||
if self.count == self.n_buckets:
|
||||
self.node = False
|
||||
else:
|
||||
self.count = self.count + 1
|
||||
|
||||
def next (self):
|
||||
if not self.node:
|
||||
if self.node == 0:
|
||||
raise StopIteration
|
||||
result = self.node.dereference()['_M_v']
|
||||
self.node = self.node.dereference()['_M_next']
|
||||
self.update ()
|
||||
node = self.node.cast(self.node_type)
|
||||
result = node.dereference()['_M_v']
|
||||
self.node = node.dereference()['_M_nxt']
|
||||
return result
|
||||
|
||||
class Tr1UnorderedSetPrinter:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// { dg-do run }
|
||||
// { dg-options "-std=gnu++11 -g" }
|
||||
|
||||
// Copyright (C) 2011 Free Software Foundation, Inc.
|
||||
// Copyright (C) 2011, 2012 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
|
@ -68,6 +68,24 @@ main()
|
|||
std::unordered_multiset<int> eums;
|
||||
// { dg-final { note-test eums "std::unordered_multiset with 0 elements" } }
|
||||
|
||||
std::unordered_map<int, std::string> uom;
|
||||
uom[5] = "three";
|
||||
uom[3] = "seven";
|
||||
// { dg-final { note-test uom {std::unordered_map with 2 elements = {[3] = "seven", [5] = "three"}} } }
|
||||
|
||||
std::unordered_multimap<int, std::string> uomm;
|
||||
uomm.insert(std::pair<int, std::string> (5, "three"));
|
||||
uomm.insert(std::pair<int, std::string> (5, "seven"));
|
||||
// { dg-final { note-test uomm {std::unordered_multimap with 2 elements = {[5] = "seven", [5] = "three"}} } }
|
||||
|
||||
std::unordered_set<int> uos;
|
||||
uos.insert(5);
|
||||
// { dg-final { note-test uos {std::unordered_set with 1 elements = {[0] = 5}} } }
|
||||
|
||||
std::unordered_multiset<int> uoms;
|
||||
uoms.insert(5);
|
||||
// { dg-final { note-test uoms {std::unordered_multiset with 1 elements = {[0] = 5}} } }
|
||||
|
||||
placeholder(""); // Mark SPOT
|
||||
use(efl);
|
||||
use(fl);
|
||||
|
|
Loading…
Reference in New Issue