2005-01-17 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/19433
* include/bits/stl_tree.h (_Rb_tree<>::insert_unique(iterator,
const _Val&), _Rb_tree<>::insert_equal(iterator, const _Val&)):
Obtain amortized constant complexity if t is inserted right after
p - not before p - as per Table 69.
* testsuite/performance/23_containers/set_insert_from_sorted.cc: New.
* testsuite/23_containers/multiset/insert/2.cc: New.
* testsuite/23_containers/set/insert/1.cc: Likewise.
* testsuite/performance/23_containers/set_create_from_sorted.cc:
Simplify.
* include/bits/stl_tree.h: Add a few missing std:: qualifications.
From-SVN: r93761
2004-11-18 Paolo Carlini <pcarlini@suse.de>
DR 434. bitset::to_string() hard to use [Ready]
* include/std/std_bitset.h (to_string): Add three overloads, taking
fewer template arguments.
* docs/html/ext/howto.html: Add an entry for DR 434.
* testsuite/23_containers/bitset/to_string/1.cc: New.
From-SVN: r90854
gcc/cp:
* decl.c (grokfndecl): If ::main is found not to return int,
correct it after issuing a diagnostic.
(grokdeclarator): If the incoming type was error_mark_node, do
not complain about declaring something with no type.
(start_function): Change check for ::main not returning int to
an assertion, as grokfndecl now catches this when the user did it.
* init.c (perform_member_init, sort_mem_initializers)
(emit_mem_initializers): Make most diagnostics be issued on
the line of current_function_decl, not whatever the current
input line is.
* parser.c (cp_lexer_peek_token_emit_debug_info): Surround
definition and declaration with #ifdef ENABLE_CHECKING.
Avoid unnecessary use of fprintf.
(cp_lexer_print_token, cp_lexer_debug_stream): Adjust stub
definitions to avoid warnings.
(cp_lexer_new_main): Add assertion that first token is not a
padding token.
(cp_lexer_new_from_token_array): Fold into ...
(cp_lexer_new_from_tokens): ... here. Add assertion that
first token is not a padding token.
(cp_lexer_set_source_position_from_token): Move nearer to callers.
Remove unused lexer argument.
(cp_lexer_peek_token): Just print debugging report (if enabled)
and return lexer->next_token.
(cp_lexer_skip_purged_tokens): Delete.
(cp_lexer_next_token_is, cp_lexer_next_token_is_not): Make
inline, simplify bodies.
(cp_lexer_peek_nth_token): Add debugging report a la
cp_lexer_peek_token.
(cp_lexer_consume_token): Correct commentary. Advance over
purged tokens here. Set current source position here, from
token to be returned. Avoid unnecessary use of fprintf.
(cp_lexer_purge_token): Advance next_token pointer over this and
subsequent purged tokens.
(cp_parser_error): Adjust source position to that of the
peeked token.
(cp_parser_push_lexer_for_tokens, cp_parser_pop_lexer): New functions.
(cp_parser_string_literal): Remove some excessive cleverness.
(cp_parser_enum_specifier): Call start_enum before consuming
the opening brace.
(cp_parser_member_declaration): Make the "extra semicolon"
diagnostic consistently-worded with the other place this is
diagnosed. Explicitly set the diagnostic location to the
location of the offending semicolon.
(cp_parser_enclosed_template_argument_list): Use %</%> quoting
in diagnostics. Do not use cp_parser_require. Set location
of diagnostics about improper use of '>>' to location of
offending token.
(cp_parser_late_parsing_for_member):
Use cp_parser_push_lexer_for_tokens and cp_parser_pop_lexer.
(cp_parser_late_parsing_default_args): Likewise. Manually
move some logic outside the loop.
gcc/testsuite:
* g++.dg/ext/complit1.C
* g++.dg/other/error2.C
* g++.dg/other/nontype-1.C
* g++.dg/parse/crash11.C
* g++.dg/parse/crash12.C
* g++.dg/parse/error15.C
* g++.dg/parse/error4.C
* g++.dg/parse/tmpl-outside1.C
* g++.dg/parse/too-many-tmpl-args1.C
* g++.dg/template/dependent-expr3.C
* g++.dg/template/error10.C
* g++.dg/template/instantiate1.C
* g++.dg/template/vtable2.C
* g++.dg/warn/Wshadow-1.C
* g++.dg/warn/weak1.C
* g++.old-deja/g++.brendan/crash16.C
* g++.old-deja/g++.brendan/crash18.C
* g++.old-deja/g++.brendan/crash48.C
* g++.old-deja/g++.brendan/crash49.C
* g++.old-deja/g++.brendan/crash55.C
* g++.old-deja/g++.brendan/crash56.C
* g++.old-deja/g++.brendan/crash8.C
* g++.old-deja/g++.brendan/enum11.C
* g++.old-deja/g++.brendan/enum8.C
* g++.old-deja/g++.brendan/enum9.C
* g++.old-deja/g++.brendan/friend3.C
* g++.old-deja/g++.brendan/misc14.C
* g++.old-deja/g++.bugs/900402_02.C
* g++.old-deja/g++.bugs/900404_03.C
* g++.old-deja/g++.bugs/900404_04.C
* g++.old-deja/g++.bugs/900428_03.C
* g++.old-deja/g++.jason/crash4.C
* g++.old-deja/g++.jason/overload21.C
* g++.old-deja/g++.jason/redecl1.C
* g++.old-deja/g++.jason/report.C
* g++.old-deja/g++.jason/rfg10.C
* g++.old-deja/g++.jason/template30.C
* g++.old-deja/g++.law/arm12.C
* g++.old-deja/g++.law/ctors5.C
* g++.old-deja/g++.law/cvt20.C
* g++.old-deja/g++.law/init10.C
* g++.old-deja/g++.law/init8.C
* g++.old-deja/g++.law/visibility17.C
* g++.old-deja/g++.law/visibility7.C
* g++.old-deja/g++.mike/net8.C
* g++.old-deja/g++.mike/p646.C
* g++.old-deja/g++.mike/p700.C
* g++.old-deja/g++.mike/p701.C
* g++.old-deja/g++.mike/p811.C
* g++.old-deja/g++.ns/template13.C
* g++.old-deja/g++.other/array3.C
* g++.old-deja/g++.other/crash25.C
* g++.old-deja/g++.other/dtor3.C
* g++.old-deja/g++.other/dtor4.C
* g++.old-deja/g++.other/main1.C
* g++.old-deja/g++.other/warn7.C
* g++.old-deja/g++.pt/crash11.C
* g++.old-deja/g++.pt/crash36.C
* g++.old-deja/g++.pt/spec22.C
* g++.old-deja/g++.pt/spec9.C
* g++.old-deja/g++.pt/ttp52.C
* g++.old-deja/g++.robertl/eb103.C
* g++.old-deja/g++.robertl/eb121.C
* g++.old-deja/g++.robertl/eb22.C
* g++.old-deja/g++.robertl/eb8.C:
Update locations and/or regexps of dg-error markers.
Remove markers for some bogus messages that are no longer issued.
libstdc++-v3:
* testsuite/20_util/memory/auto_ptr/assign_neg.cc
* testsuite/23_containers/map/operators/1_neg.cc
* testsuite/23_containers/set/operators/1_neg.cc:
Update locations and/or regexps of dg-error markers.
From-SVN: r87985
* include/bits/stl_construct.h (_Destroy): New three-argument
overload that takes an allocator argument. Another inline
three-argument overload that takes std::allocator and dispatches
to the two-argument version.
* include/bits/stl_uninitialized.h (__uninitialized_fill_n_aux):
Change return type to void to match uninitialized_fill_n.
(__uninitialized_copy_a_): New function. Like uninitialized_copy
except that it takes an allocator and uses it for construct and
destroy. If the allocator is std::allocator, dispatches to
uninitialized_copy.
(__uninitialized_fill_a): Likewise.
(__uninitialized_fill_n_a): Likewise.
(__uninitialized_copy_copy): Give it an allocator argument.
(__uninitialized_fill_copy): Likewise.
(__uninitialized_copy_fill): Likewise.
* include/bits/deque.tcc: Use new forms defined in stl_construct.h
and stl_uninitialized.h. Replace use of single-argument _Construct
and _Destroy with use of allocator's construct and destroy methods.
* include/bits/list.tcc: Likewise.
* include/bits/stl_deque.h: Likewise.
* include/bits/stl_list.h: Likewise.
* include/bits/stl_tree.h: Likewise.
* include/bits/stl_vector.h: Likewise.
* include/bits/vector.tcc: Likewise.
* include/ext/hashtable.h: Use rebind so that allocator_type
has correct type for a container's allocator. Replace use of
single-argument _Construct and _Destroy with use of allocator's
construct and destroy methods.
* include/ext/memory (__uninitialized_copy_n_a): New function.
Like uninitialized_copy_n except that it takes an extra parameter,
an allocator, and uses it for construct and destroy operations.
* include/ext/rope: Use new forms defined in stl_construct.h,
stl_uninitialized.h, and ext/memory. Replace use of single-argument
_Construct and _Destroy with allocator construct and destroy methods.
* include/ext/ropeimpl.h: Likewise.
* include/ext/slist.h: Likewise.
* testsuite/testsuite_allocator.h (check_construct_destroy): New.
* testsuite/testsuite_allocator.cc (check_construct_destroy): New.
* testsuite/23_containers/deque/check_construct_destroy.cc: New.
* testsuite/23_containers/list/check_construct_destroy.cc: New.
* testsuite/23_containers/set/check_construct_destroy.cc: New.
* testsuite/23_containers/vector/check_construct_destroy.cc: New.
* testsuite/ext/hash_check_construct_destroy.cc: New.
* testsuite/ext/slist_check_construct_destroy.cc: New.
From-SVN: r85265
2004-07-05 Jonathan Wakely <redi@gcc.gnu.org>
* testsuite/23_containers/{set,multiset}/14340.cc: Fix typos in
instantiation of set and multiset (functor param given as int).
From-SVN: r84112
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/stl_list.h: Created a _List_impl class and made it
derive from the allocator, instead of the list deriving from the
allocator class, which was not conformant. Changed all references
from this->_M_node to this->_M_impl._M_node * bits/list.tcc: Same
as above (changed all references to the concerned variables).
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/stl_deque.h: Created a _Deque_impl class and made
it derive from the allocator, instead of the deque deriving from
the allocator class, which was not conformant. Changed all
references to the _M_start, _M_finish, _M_map, and _M_map_size to
_M_impl.*.
(_Deque_base<_Tp,_Alloc>::~_Deque_base()): Added this->
qualification in 2 places where it was missing.
(_Deque_base<_Tp,_Alloc>::_M_initialize_map(size_t)): Same as
above.
* include/bits/deque.tcc: Same as above (changed all references to
the concerned variables).
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/stl_vector.h: Created a _Vector_impl class and made
it derive from the allocator, instead of the _Vector_base class,
deriving from the allocator which was not conformant. Changed all
references to the _M_start, _M_finish, and _M_end_of_storage to
_M_impl.*.
* include/bits/vector.tcc: Same as above (changed all references
to the concerned variables).
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* testsuite/23_containers/deque/cons/clear_allocator.cc: New.
* testsuite/23_containers/list/cons/clear_allocator.cc: New.
* testsuite/23_containers/vector/cons/clear_allocator.cc: New.
From-SVN: r79957
2004-01-07 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_list.h:
* include/bits/list.tc:
* src/list.cc:
Performance enhancements for destructor, push_front(),
push_back(), pop_front(), pop_back(), sort()
Eliminated static_casts where possible.
Moved code out of header files into new src/list.cc
implementation file for library where possible.
Remove inheritance from iterator class and create separate
classes for non-constant and constant iterators.
* include/bits/stl_tree.h (_Rb_tree class):
* src/tree.cc:
Only erase contents in destructor.
Eliminate unnecessary initialization in assignment operator.
Optimize for the nominal case by not checking whether
container is empty in clear().
Re-order test in _M_insert() to improve performance.
Move initialization of new node's left & right pointers to
src/tree.cc to where new node's colour is initialized
and to reduce the amount of inline code.
Use _M_leftmost() and _M_end() to improve readability where
appropriate.
Create separate classes for non-constant and constant
iterators to clarify code, avoid extra template parameters and
casting away constness.
2004-01-07 Benjamin Kosnik <bkoz@redhat.com>
* src/Makefile.am (sources): Add list.cc, tree.cc.
* src/stl_tree.cc: Move to...
* src/tree.cc: ...here.
* src/list.cc: Add.
* config/linker-map.gnu: Tweaks.
* testsuite/23_containers/map/operators/1_neg.cc: Add excess errors.
* testsuite/23_containers/set/operators/1_neg.cc: Add excess errors.
* bits/stl_vector.h: Column wrap comments.
From-SVN: r75515
2003-12-04 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/12653
* include/std/std_bitset.h (operator>>): Implement resolution
of DR 303 [WP]: use widen('0') and widen('1').
* docs/html/ext/howto.html: Add an entry for DR 303.
* include/std/std_bitset.h (operator>>): Implement the common
requirements of formatted input functions (27.6.1.2.1).
* include/std/std_bitset.h (operator>>): Set the failbit when
nothing was extracted and _Nb != 0.
* testsuite/23_containers/bitset/input/1.cc: New.
From-SVN: r74276
2003-11-13 Douglas Gregor <gregod@cs.rpi.edu>
* docs/html/debug.html: Users are allowed to specialize in
namespace __gnu_debug, unlike in the Apple version of the debug
mode. Clear up a confusing double-negative. Note that
std::basic_string does provide extra debugging capabilities, but
not safe iterators.
* include/bits/basic_string.tcc: Make sure there's never an
ambiguity when calling __is_null_pointer.
* include/debug/deque: (deque::erase) Properly handle invalidation
when erasing at the end of the deque.
* include/debug/vector: (vector::swap): Swap _M_guaranteed_capacity.
(vector::clear): Set the guaranteed capacity to 0.
* testsuite/23_containers/deque/invalidation/4.cc: (test04): Test
iterator invalidation when erasing at the end of the deque.
From-SVN: r73564
2003-07-24 Nathan Myers <ncm-nospam@cantrip.org>
* testsuite/23_containers/map_operators.cc: Conform to
container requirement as value must be Assignable.
From-SVN: r69746
2002-12-26 Phil Edwards <pme@gcc.gnu.org>
* include/std/std_bitset.h (_Base_bitset::_M_do_left_shift,
_Base_bitset::_M_do_right_shift): Expect a non-zero shift.
(bitset::operator<<=, bitset::operator>>=): When shifting more bits
than are in the bitset, zero memory rather than segfault.
(operator>>(basic_istream,bitset): Only call setstate once, after
all work has been done.
* testsuite/23_containers/bitset_members.cc (test03): New test.
* testsuite/23_containers/bitset_shift.cc (test02): New test.
From-SVN: r60533
* testsuite/23_containers/vector_capacity.cc (test03): Move ...
* testsuite/23_containers/vector_resize.cc: ...here as a new file.
Pass in -lmalloc for irix6.
* testsuite/27_io/ios_base_storage.cc: Pass in -lmalloc for irix6.
From-SVN: r60276
2002-11-25 Stephen M. Webb <stephen@bregmasoft.com>
* testsuite/testsuite_allocator.h: New file.
* testsuite/testsuite_allocator.cc: New file.
* testsuite/Makefile.am: Added testsuite_allocator to test library.
* testsuite/testsuite_hooks.h: Added more detailed tracker objects
gnu_copy_constructor, gnu_assignment_operator, and gnu_destructor.
* testsuite/testsuite_hooks.cc: Added new static objects definitions.
* testsuite/23_containers/vector_capacity.cc: Added reserve() tests.
* testsuite/23_containers/vector_ctor.cc: Added a plethora of tests.
* testsuite/23_containers/deque_ctor.cc: Added a slew of new tests.
From-SVN: r59484
2002-11-15 Benjamin Kosnik <bkoz@redhat.com>
Gabriel Dos Reis <gdr@integrable-solutions.net>
PR libstdc++/8230
* include/bits/stl_alloc.h: Use builtin_expect for the most
obvious limit checks.
(__default_alloc_template::allocate): Check for null, throw
bad_alloc.
* include/bits/vector.tcc: Formatting tweaks.
* include/bits/stl_vector.h: Same.
* testsuite/20_util/allocator_members.cc (test02): Add.
* testsuite/23_containers/vector_capacity.cc (test03): Add.
Co-Authored-By: Gabriel Dos Reis <gdr@integrable-solutions.net>
From-SVN: r59169
2002-07-07 Paolo Carlini <pcarlini@unitus.it>
PR libstdc++/7186
* include/bits/stl_deque.h (_Deque_iterator::operator-):
Make non-member, as already happens for the comparison
operators in accord with DR179 (Ready).
* testsuite/23_containers/deque_operators.cc: Add test02.
From-SVN: r55301
2002-05-31 Marcus Meissner <meissner@suse.de>
* include/bits/stl_bvector.h: Use UL suffix for unsigned longs.
* testsuite/23_containers/vector_bool.cc (test02): New test.
From-SVN: r54128
2002-05-28 Phil Edwards <pme@gcc.gnu.org>
* testsuite/Makefile.am (noinst_LIBRARIES): New target. Pull in
CXX/INCLUDES.
* testsuite/Makefile.in: Regenerate.
* testsuite/testsuite_hooks.h (gnu_copy_tracker): Move from
list_modifiers.cc and rename from 'T'. Move code bodies...
* testsuite/testsuite_hooks.cc: ...to here. New file.
* testsuite/23_containers/list_modifiers.cc: Move 'T' class out.
* testsuite/lib/libstdc++-v3-dg.exp (libstdc++-v3_target_compile):
Add libv3test.a to link options.
From-SVN: r53977
2002-05-24 Phil Edwards <pme@gcc.gnu.org>
libstdc++/6282
* include/std/std_bitset.h (_Base_biteset<0>): New specialization.
(operator>>): If nothing was extracted, don't fail in the
zero-length case.
* testsuite/23_containers/bitset_ctor.cc (test02): New test.
From-SVN: r53844