Commit Graph

8003 Commits

Author SHA1 Message Date
Caroline Tice
2077db1be5 Commit the vtable verification feature.
Commit the vtable verification feature.  This feature is designed to
detect, at run time, if/when the vtable pointer in a C++ object has
been corrupted, before allowing virtual calls through that pointer. 
If pointer corruption is detected, execution of the program is halted.

libstdc++-v3 ChangeLog:
2013-08-06  Caroline Tice  <cmtice@google.com>

        * fragment.am: Add XTEMPLATE_FLAGS.
        * configure.ac: Add definitions for --enable-vtable-verify.
        * acinclude.m4:  Add --enable-vtable-verify and
        --disable-vtable-verify; define --enable-vtable-verify; define
        VTV_CXXFLAGS, VTV_PCH_CXXFLAGS and VTV_CXXLINKFLAGS.
        * config/abi/pre/gnu.ver: Export symbols for vtable verification.
        * libsupc++/Makefile.am: Define vtv_sources and add it to
        libsupc___la_SOURCES and libsupc__convenience_la_SOURCES.
        * libsupc++/vtv_stubs.cc: New file.
        * include/Makefile.am: Add VTV_PCH_CXXFLAGS to PCHFLAGS.
        * src/Makefile.am: Add VTV_CXXFLAGS to AM_CXXFLAGS; add
        VTV_CXXLINKFLAGS to CXXLINK.
        * src/c++98/Makefile.am: Comment out XTEMPLATE_FLAGS; add VTV_CXXFLAGS
        to AM_CXXFLAGS; add VTV_CXXXLINKFLAGS to CXXLINK.
        * src/C++11/Makefile.am: Ditto.
        * doc/xml/manual/configure.xml: Add entry for --enable-vtable-verify.
        * scripts/testsuite_flags.in: Add cxxvtvflags to Usage; cause
        cxxvtvflags to use VTV_CXXFLAGS and VTV_CXXLINKFLAGS.
        * testsuite/lib/libstdc++.exp: Add cxxvtvflags; add code to locate
        libvtv if --enable-vtable-verify was used; set cxxvtvflags; add
        cxxvtvflags to cxx_final.
        * testsuite/18_support/bad_exception/23591_thread-1.c: Add
        -fvtable-verify=none to compiler flags.
        * testsuite/17_intro/freestanding.cc: Add -fvtable-verify=none
        to compiler flags.
        * configure: Regenerated.
        * Makefile.in: Regenerated.
        * python/Makefile.in: Regenerated.
        * include/Makefile.in: Regenerated.
        * libsupc++/Makefile.in: Regenerated.
        * config.h.in: Regenerated.
        * po/Makefile.in: Regenerated.
        * src/Makefile.in: Regenerated.
        * src/c++98/Makefile.in: Regenerated.
        * src/c++11/Makefile.in: Regenerated.
        * doc/Makefile.in: Regenerated.
        * testsuite/Makefile.in: Regenerated.

top level ChangeLog:
2013-08-06  Caroline Tice  <cmtice@google.com>

        * configure.ac: Add target-libvtv to target_libraries; disable libvtv
        on non-linux systems; add target-libvtv to noconfigdirs; add
        libsupc++/.libs to C++ library search paths.
        * configure: Regenerated.
        * Makefile.def: Add libvtv to target_modules; make libvtv depend on
        libstdc++ and libgcc.
        * Makefile.in: Regenerated.

include/ChangeLog:
2013-08-06  Caroline Tice  <cmtice@google.com>

        * vtv-change-permission.h: New file.

contrib/ChangeLog:
2013-08-06  Caroline Tice4  <cmtice@google.com>

        * gcc_update: Add libvtv files.

libgcc/ChangeLog:
2013-08-06  Caroline Tice  <cmtice@google.com>

        config.host (extra_parts): Add vtv_start.o, vtv_end.o
        vtv_start_preinit.o and vtv_end_preinit.o.
        configure.ac: Add code to check/set enable_vtable_verify.
        Makefile.in: Add rules to build vtv_*.o, if enable_vtable_verify is
        true.
        vtv_start_preinit.c: New file.
        vtv_end_preinit.c: New file.
        vtv_start.c: New file.
        vtv_end.c: New file.
        configure: Regenerated.

gcc/ChangeLog:
2013-08-06  Caroline Tice  <cmtice@google.com>

        * gcc.c (VTABLE_VERIFICATION_SPEC): New definition.
        (LINK_COMMAND_SPEC): Add VTABLE_VERIFICATION_SPEC.
        * tree-pass.h: Add pass_vtable_verify.
        * varasm.c (assemble_variable): Add code to properly set the comdat
        section and name for the .vtable_map_vars section.
        (assemble_vtyv_preinit_initializer): New function.
        (default_sectin_type_flags):  Make sure .vtable_map_vars section has
        LINK_ONCE flag.
        * output.h: Add function decl for assemble_vtv_preinit_initializer.
        * vtable-verify.c: New file.
        * vtable-verify.h: New file.
        * flag-types.h (enum vtv_priority): Defintions for flag_vtable_verify
        initialiation levels.
        * timevar.def (TV_VTABLE_VERIFICATION): New definition.
        * passes.def: Insert pass_vtable_verify.
        * aclocal.m4: Reorder includes.
        * doc/invoke.texi: Add documentation for the flags -fvtable-verify=,
	-fvtv-debug and -fvtv-counts.
        * config/gnu-user.h (GNU_USER_TARGET_STARTFILE_SPEC): Add vtv_start*.o,
as appropriate, if -fvtable-verify=... is used.
        (GNU_USER_TARGET_ENDFILE_SPEC): Add vtv_end*.o as appropriate, if
        -fvtable-verify=... is used.
        * Makefile.in (OBJS):  Add vtable-verify.o to list.
        (vtable-verify.o): Add new build rule.
        (GTFILES): Add vtable-verify.c to list.
        * common.opt (fvtable-verify=): New flag.
        (vtv_priority): Values for fvtable-verify= flag.
        (fvtv-counts): New flag.
(fvtv-debug): New flag.
        * tree.h (save_vtable_map_decl): New extern function decl.


gcc/cp/ChangeLog:
2013-08-06  Caroline Tice  <cmtice@google.com>

        * Make-lang.in (*CXX_AND_OBJCXX_OBJS):  Add vtable-class-hierarchy.o to
        list.
        (vtable-class-hierarchy.o): Add build rule.
        * cp-tree.h (vtv_start_verification_constructor_init_function): New
        extern function decl.
        (vtv_finish_verification_constructor_init_function): New extern
        function decl.
        (build_vtbl_address): New extern function decl.
        (get_mangled_vtable_map_var_name): New extern function decl.
        (vtv_compute_class_hierarchy_transitive_closure): New extern function
        decl.
        (vtv_generate_init_routine): New extern function decl.
        (vtv_save_class_info): New extern function decl.
        (vtv_recover_class_info): New extern function decl.
        (vtv_build_vtable_verify_fndecl): New extern function decl.
        * class.c (finish_struct_1): Add call to vtv_save_class_info if
        flag_vtable_verify is true.
        * config-lang.in: Add vtable-class-hierarchy.c to gtfiles list.
        * vtable-class-hierarchy.c: New file.
        * mangle.c (get_mangled_vtable_map_var_name):  New function.
        * decl2.c (start_objects): Update function comment.
        (cp_write_global_declarations): Call vtv_recover_class_info,
        vtv_compute_class_hierarchy_transitive_closure and
        vtv_build_vtable_verify_fndecl, before calling
        finalize_compilation_unit, and call vtv_generate_init_rount after, IFF
        flag_vtable_verify is true.
        (vtv_start_verification_constructor_init_function): New function.
        (vtv_finish_verification_constructor_init_function): New function.
        * init.c (build_vtbl_address): Remove static qualifier from function.

libvtv/ChangeLog:
2013-08-06  Caroline Tice  <cmtice@google.com>

        Initial check-in of new vtable verification feature.
        * configure.ac : New file.
        * acinclude.m4 : New file.
        * Makefile.am : New file.
        * aclocal.m4 : New file.
        * configure.tgt : New file.
        * configure: New file (generated).
        * Makefile.in: New file (generated).
        * vtv_set.h : New file.
        * vtv_utils.cc : New file.
        * vtv_utils.h : New file.
        * vtv_malloc.cc : New file.
        * vtv_rts.cc : New file.
        * vtv_malloc.h : New file.
        * vtv_rts.h : New file.
        * vtv_fail.cc : New file.
        * vtv_fail.h : New file.
        * vtv_map.h : New file.
        * scripts/run-testsuite.sh : New file.
        * scripts/sum-vtv-counts.c : New file.
        * testsuite/parts-test-main.h : New file.
        * testusite/dataentry.cc : New file.
        * testsuite/temp_deriv.cc : New file.
        * testsuite/register_pair.cc : New file.
        * testsuite/virtual_inheritance.cc : New file.
        * testsuite/field-test.cc : New file.
        * testsuite/nested_vcall_test.cc : New file.
        * testsuite/template-list-iostream.cc : New file.
        * testsuite/register_pair_inserts.cc : New file.
        * testsuite/register_pair_inserts_mt.cc : New file.
        * testsuite/event.list : New file.
        * testsuite/parts-test-extra-parts-views.cc : New file.
        * testsuite/parts-test-extra-parts-views.h : New file.
        * testsuite/environment-fail-32.s : New file.
        * testsuite/parts-test-extra-parts.h : New file.
        * testsuite/temp_deriv2.cc : New file.
        * testsuite/dlopen_mt.cc : New file.
        * testsuite/event.h : New file.
        * testsuite/template-list.cc : New file.
        * testsuite/replace-fail.cc : New file.
        * testsuite/Makefile.am : New file.
        * testsuite/Makefile.in: New file (generated).
        * testsuite/mempool_negative.c : New file.
        * testsuite/parts-test-main.cc : New file.
        * testsuite/event-private.cc : New file.
        * testsuite/thunk.cc : New file.
        * testsuite/event-defintiions.cc : New file.
        * testsuite/event-private.h : New file.
        * testsuite/parts-test.list : New file.
        * testusite/register_pair_mt.cc : New file.
        * testsuite/povray-derived.cc : New file.
        * testsuite/event-main.cc : New file.
        * testsuite/environment.cc : New file.
        * testsuite/template-list2.cc : New file.
        * testsuite/thunk_vtable_map_attack.cc : New file.
        * testsuite/parts-test-extra-parts.cc : New file.
        * testsuite/environment-fail-64.s : New file.
        * testsuite/dlopen.cc : New file.
        * testsuite/so.cc : New file.
        * testsuite/temp_deriv3.cc : New file.
        * testsuite/const_vtable.cc : New file.
        * testsuite/mempool_positive.c : New file.
        * testsuite/dup_name.cc : New file.

From-SVN: r201555
2013-08-06 20:38:59 -07:00
Paolo Carlini
6ffd1096cf 2013-08-06 Paolo Carlini <paolo.carlini@oracle.com>
Revert the last commit.

From-SVN: r201525
2013-08-06 11:11:07 +00:00
François Dumont
a3d4b3d7db hashtable_policy.h (_Hashtable_alloc): New.
2013-08-06  François Dumont  <fdumont@gcc.gnu.org>

	* include/bits/hashtable_policy.h (_Hashtable_alloc): New.
	(_ReuseOrAllocNode, _AllocNode): Adapt to use latter rather than
	_Hashtable.
	(_Before_begin<>): Remove.
	* include/bits/hashtable.h (_Hashtable): Inherit from
	_Hashtable_alloc and adapt. Restore _M_before_begin field.
	* python/libstdcxx/v6/printers.py (StdHashtableIterator): Adapt
	access to hashtable before begin.
	* testsuite/23_containers/unordered_set/
	not_default_constructible_hash_neg.cc: Adapt dg-error line number.
	* testsuite/23_containers/unordered_set/instantiation_neg.cc:
	Likewise.

From-SVN: r201522
2013-08-06 08:38:58 +00:00
Tim Shen
399eeef978 Implement bracket expression.
2013-08-03  Tim Shen  <timshen91@gmail.com>

	Implement bracket expression.
	* include/bits/regex.h: Remove constexpr from "|=", etc.
	* include/bits/regex_compiler.h: Parse bracket expression.
	* include/bits/regex_nfa.h: _Comparator and _BracketMatcher(old
	_RangeMatcher).
	* include/bits/regex_nfa.tcc: Implement them.
	* testsuite/28_regex/algorithms/regex_match/extended/53622.cc:
	from regex_search to regex_match.
	* testsuite/28_regex/algorithms/regex_match/extended/
	cstring_bracket_01.cc: New.

From-SVN: r201465
2013-08-03 14:32:54 +00:00
Paolo Carlini
257e6ab3df functions.h (__foreign_iterator_aux4): Initialize __l and __ge.
2013-08-02  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/debug/functions.h (__foreign_iterator_aux4):
	Initialize __l and __ge.

From-SVN: r201428
2013-08-02 08:12:20 +00:00
Paolo Carlini
7dec245a8c functions.h (__foreign_iterator_aux4): Initialize __l and __ge.
2013-08-02  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/debug/functions.h (__foreign_iterator_aux4):
	Initialize __l and __ge.

From-SVN: r201426
2013-08-02 07:53:01 +00:00
Paolo Carlini
a1a0abac54 re PR libstdc++/58049 (libstdc++ bootstrap failure for fix to PR libstdc++/57779)
2013-08-02  Paolo Carlini  <paolo.carlini@oracle.com>

	PR libstdc++/58049
	* include/debug/functions.h: Include <bits/move.h>; minor formatting
	changes.
	(__foreign_iterator_aux4): Declare __l and __ge constexpr.
	* include/debug/safe_iterator.h (_Safe_iterator<>::operator->):
	Use __addressof.
	* include/debug/safe_local_iterator.h (_Safe_local_iterator<>::
	operator->): Likewise.

From-SVN: r201424
2013-08-02 07:34:55 +00:00
François Dumont
5720787ada re PR libstdc++/57779 (vector insert fails to diagnose iterators pointing into *this in debug mode)
2013-08-01  François Dumont  <fdumont@gcc.gnu.org>

	PR libstdc++/57779
	* include/debug/formatter.h (_Debug_msg_id): Add
	__msg_insert_itself_range entry.
	* include/debug/functions.h (_Insert_range_from_self_is_safe<>):
	New, indicate container types supporting self range insertion in
	GNU implementation.
	(__foreign_iterator): New, check if an iterator points to a given
	sequence.
	* include/debug/macros.h (__glibcxx_check_insert_range): Add check
	using __foreign_iterator.
	(__gibcxx_check_insert_range_after): Likewise.
	* include/debug/string (_Insert_range_from_self_is_safe<>):
	Partially specialized to mark __gnu_debug::basic_string<> as
	supporting self range insert.
	* include/debug/list (_Insert_range_from_self_is_safe<>):
	Partially specialized to mark std::list as supporting self range
	insert if _GLIBCXX_DEBUG_PEDANTIC is not defined.
	* include/debug/forward_list (_Insert_range_from_self_is_safe<>):
	Likewise.
	* src/c++11/debug.cc (_S_debug_messages): Add
	__msg_insert_itself_range_entry message.
	(_Error_formatter::_Parameter::_M_print_description): Display
	iterator sequence address rather than sequence address when the
	parameter type is an iterator.
	(_Error_formatter::_M_print_word): Enhance behavior when
	displaying a word with an appended '\n'.
	* testsuite/util/debug/checks.h (check_insert4<>): New.
	* testsuite/23_containers/deque/debug/insert5_neg.cc: New.
	* testsuite/23_containers/vector/debug/insert5_neg.cc: Likewise.
	* testsuite/23_containers/vector/debug/insert6_neg.cc: Likewise.
	* testsuite/23_containers/vector/debug/57779_neg.cc: Likewise.
	* testsuite/23_containers/list/debug/insert5_neg.cc: Likewise.
	* testsuite/23_containers/forward_list/debug/insert_after4_neg.cc:
	Likewise.

From-SVN: r201416
2013-08-01 19:54:46 +00:00
Fabien Chêne
fb23b69e14 re PR c++/54537 (undiagnosed using-declaration conflicting with used function)
gcc/cp/
        PR c++/54537
        * cp-tree.h: Check OVL_USED with OVERLOAD_CHECK.
        * name-lookup.c (do_nonmember_using_decl): Make sure we have an
	OVERLOAD before calling OVL_USED. Call diagnose_name_conflict
	instead of issuing an error without mentioning the conflicting
	declaration.

libstdc++-v3/
        PR c++/54537
	* include/tr1/cmath: Remove pow(double,double) overload, remove a
	duplicated comment about DR 550. Add a comment to explain the
	issue.
	* testsuite/tr1/8_c_compatibility/cmath/pow_cmath.cc: New.

gcc/testsuite/
        PR c++/54537
        * g++.dg/overload/using3.C: New.
	* g++.dg/overload/using2.C: Adjust.
	* g++.dg/lookup/using9.C: Likewise.

Co-Authored-By: Peter Bergner <bergner@vnet.ibm.com>

From-SVN: r201414
2013-08-01 14:24:37 -05:00
Tim Shen
95c7d82816 Thompson matcher refactored.
2013-07-31  Tim Shen  <timshen91@gmail.com>

	Thompson matcher refactored. Fix grouping problem.
	* include/bits/regex.h: Use a dispatcher _M_get_matcher().
	* include/bits/regex_compiler.h: Tweak for auto switching.
	* include/bits/regex_grep_matcher.h: Class structure.
	* include/bits/regex_grep_matcher.tcc: _BFSMatcher(Thompson
	matcher) refactoring.
	* include/bits/regex_nfa.h: Change _Results's interfaces.
	* include/std/regex: Includes <map> and <queue>.
	* testsuite/28_regex/algorithms/regex_match/extended/53622.cc:
	For both matchers.
	* testsuite/28_regex/algorithms/regex_match/extended/57173.cc:
	For both matchers.
	* testsuite/28_regex/algorithms/regex_match/extended/
	string_dispatch_01.cc: New.

From-SVN: r201391
2013-07-31 22:36:11 +00:00
Paolo Carlini
4333e4dcf7 re PR libstdc++/56627 (class hash instead of struct hash)
2013-07-31  Paolo Carlini  <paolo.carlini@oracle.com>

	PR libstdc++/56627
	* include/bits/stl_bvector.h: Use friend struct hash intead of
	friend class hash to work around useless warnings produced by
	some compilers.
	* include/std/bitset: Likewise.

From-SVN: r201377
2013-07-31 14:36:13 +00:00
Paolo Carlini
a781834e44 functexcept.cc: Do not include the whole <regex>.
2013-07-31  Paolo Carlini  <paolo.carlini@oracle.com>

	* src/c++11/functexcept.cc: Do not include the whole <regex>.
	* src/c++11/regex.cc: Likewise.

From-SVN: r201369
2013-07-31 12:36:37 +00:00
Tim Shen
1151053225 Revert last commit.
From-SVN: r201360
2013-07-31 03:36:37 +00:00
Tim Shen
abf1719efe Thompson matcher refactored.
2013-07-31  Tim Shen  <timshen91@gmail.com>

	Thompson matcher refactored. Fix grouping problem.
	* include/bits/regex.h: Use a dispatcher _M_get_matcher().
	* include/bits/regex_compiler.h: Tweak for auto switching.
	* include/bits/regex_grep_matcher.h: Class structure.
	* include/bits/regex_grep_matcher.tcc: _BFSMatcher(Thompson
	matcher) refactoring.
	* include/bits/regex_nfa.h: Change _Results's interfaces.
	* include/std/regex: Includes <map> and <queue>.
	* testsuite/28_regex/algorithms/regex_match/extended/53622.cc:
	For both matchers.
	* testsuite/28_regex/algorithms/regex_match/extended/57173.cc:
	For both matchers.
	* testsuite/28_regex/algorithms/regex_match/extended/
	string_dispatch_01.cc: New.

From-SVN: r201358
2013-07-31 00:20:06 +00:00
Paolo Carlini
9a92fa8b66 2013-07-30 Paolo Carlini <paolo.carlini@oracle.com>
Revert last commit.

From-SVN: r201349
2013-07-30 18:16:33 +00:00
Paolo Carlini
5034aa2102 2013-07-30 Paolo Carlini <paolo.carlini@oracle.com>
Revert last commit.

From-SVN: r201348
2013-07-30 18:13:15 +00:00
Tim Shen
a6dc77bc3d Thompson matcher refactored.
2013-07-30  Tim Shen  <timshen91@gmail.com>

	Thompson matcher refactored. Fix grouping problem.
	* include/bits/regex.h: Use a dispatcher _M_get_matcher().
	* include/bits/regex_compiler.h: Tweak for auto switching.
	* include/bits/regex_grep_matcher.h: Class structure.
	* include/bits/regex_grep_matcher.tcc: _BFSMatcher(Thompson
	matcher) refactoring.
	* include/bits/regex_nfa.h: Change _Results's interfaces.
	* include/std/regex: Includes <map> and <queue>.
	* testsuite/28_regex/algorithms/regex_match/extended/53622.cc:
	For both matchers.
	* testsuite/28_regex/algorithms/regex_match/extended/57173.cc:
	For both matchers.
	* testsuite/28_regex/algorithms/regex_match/extended/string_dispatch_01.cc:
	New.

From-SVN: r201334
2013-07-30 12:02:55 +00:00
Nathan Froyd
272827e446 atomic (compare_exchange_weak, [...]): Add call to __cmpexch_failure_order.
libstdc++-v3/
	* include/std/atomic (compare_exchange_weak, compare_exchange_strong):
	Add call to __cmpexch_failure_order.
	* testsuite/util/testsuite_common_types.h
	(compare_exchange_order_lowering): New generator.
	* testsuite/29_atomics/atomic/requirements/compare_exchange_lowering.cc:
	New test.

From-SVN: r201315
2013-07-29 17:13:05 +00:00
Tim Shen
b698d310d8 Fix incorrect ChangeLog entry.
From-SVN: r201292
2013-07-28 10:23:43 +00:00
Paolo Carlini
4e30cb71f9 complex (pow(const complex<>&, int)): Enable in C++11 mode too.
2013-07-25  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/std/complex (pow(const complex<>&, int)): Enable in
	C++11 mode too.
	* testsuite/26_numerics/complex/dr844.cc: Adjust.
	* doc/xml/manual/intro.xml: Update.

From-SVN: r201253
2013-07-25 21:24:07 +00:00
Tim Shen
105164bb90 Add documents and comments.
2013-07-25  Tim Shen  <timshen91@gmail.com>

	Add documents and comments.
	* include/bits/regex.h: Documents and comments.
	* include/bits/regex_grep_matcher.h: Likewise.
	* include/bits/regex_grep_matcher.tcc: Likewise.
	* testsuite/28_regex/iterators/regex_iterator/char/string_position_01.cc:
	New.

From-SVN: r201244
2013-07-25 14:59:43 +00:00
Paolo Carlini
484b502a41 re PR libstdc++/57976 (Missing time_get<>::get() functions)
2013-07-24  Paolo Carlini  <paolo.carlini@oracle.com>

	PR libstdc++/57976
	* doc/xml/manual/status_cxx2011.xml: Note missing time_get::get and
	time_get::do_get.

From-SVN: r201234
2013-07-25 00:46:46 +00:00
Paolo Carlini
821f6f1b31 random.h (random_device): Avoid using the FILE type.
2013-07-24  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/bits/random.h (random_device): Avoid using the FILE type.
	* include/std/random: Do not include <cstdio>.
	* src/c++11/random.cc: ... include it here.
	(random_device::_M_init, random_device::_M_fini,
	random_device::_M_getval): Cast back and forth void* and FILE*.

From-SVN: r201215
2013-07-24 15:42:06 +00:00
Tim Shen
37c74e2816 Reimplment matcher using Depth-first search(backtracking).
2013-07-24  Tim Shen  <timshen91@gmail.com>

	Reimplment matcher using Depth-first search(backtracking).
	PR libstdc++/53622
	PR libstdc++/57173
	* include/bits/regex.h: regex_match() and regex_search().
	* include/bits/regex_cursor.h: Fix _M_set_pos().
	* include/bits/regex_grep_matcher.h: add _M_dfs_match().
	* include/bits/regex_grep_matcher.tcc: Implement it.
	* testsuite/28_regex/algorithms/regex_match/extended/string_group_01.cc:
	New.
	* testsuite/28_regex/algorithms/regex_match/extended/string_group_02.cc:
	New.
	* testsuite/28_regex/algorithms/regex_search/basic/string_01.cc:
	Remove xfail.

From-SVN: r201213
2013-07-24 14:39:54 +00:00
Tim Shen
407a0fa3a4 Implement regex_iterator and regex_token_iterator.
2013-07-23  Tim Shen  <timshen91@gmail.com>

	Implement regex_iterator and regex_token_iterator.
	* include/bits/regex.h: regex_iterator and regex_token_iterator.
	* testsuite/28_regex/iterators/regex_iterator/char/string_01.cc:
	New.
	* testsuite/28_regex/iterators/regex_iterator/wchar_t/string_01.cc:
	New.
	* testsuite/28_regex/iterators/regex_token_iterator/char/string_01.cc:
	New.
	* testsuite/28_regex/iterators/regex_token_iterator/wchar_t/string_01.cc:
	New.

From-SVN: r201169
2013-07-23 12:31:51 +00:00
Paolo Carlini
3c68decc48 random: Add back <cstdio> include.
2013-07-23  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/std/random: Add back <cstdio> include.
	* src/c++11/random.cc: Don't include <cstdio> here.

From-SVN: r201160
2013-07-23 09:39:01 +00:00
Jason Merrill
16a1d8fe29 re PR libstdc++/57914 (Memory leak in __cxa_thread_atexit when using thread_local)
PR libstdc++/57914
	* libsupc++/atexit_thread.cc (run): Delete cleanup elts.

From-SVN: r201146
2013-07-22 15:43:27 -04:00
Paolo Carlini
94e7477f0c re PR libstdc++/57920 ([c++11] Linux: std::random_device reads too much from /dev/urandom)
2013-07-22  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/57920
	* src/c++11/random.cc (random_device::_M_getval): If possible, use
	read instead of std::fread.
	* include/std/random: Do not include <cstdio> unnecessarily.

From-SVN: r201133
2013-07-22 15:22:52 +00:00
Jonathan Wakely
b2b0bf396e Remove stray blank line.
From-SVN: r201117
2013-07-22 08:57:53 +01:00
Tim Shen
603c431f90 Partially implement regex_search.
2013-07-21  Tim Shen  <timshen91@gmail.com>

	Partially implement regex_search.
	* include/bits/regex.h: regex_search.
	* include/bits/regex_grep_matcher.h: _M_search_from_first.
	* include/bits/regex_grep_matcher.tcc: Implement it.
	* testsuite/28_regex/algorithms/regex_search/basic/string_01.cc: New.

From-SVN: r201113
2013-07-21 23:34:02 +00:00
Jonathan Wakely
3429db0fb0 re PR libstdc++/54352 (relaxed data race rules for ~condition_variable_any)
PR libstdc++/54352
	* include/std/condition_variable (condition_variable_any): Move into
	inline namespace _V2 and replace mutex member with shared_ptr<mutex>.
	* src/c++11/condition_variable.cc (condition_variable_any): Move
	definitions to ...
	* src/c++11/compatibility-condvar.cc (condition_variable_any): Here.
	* src/Makefile.am: Add new source file.
	* src/Makefile.in: Regenerate.

From-SVN: r201112
2013-07-21 20:21:03 +01:00
Mike Stump
d76e725e47 Fix.
From-SVN: r201103
2013-07-21 16:52:00 +00:00
Tim Shen
b3ebe3d0e0 Implement class regex_traits.
2013-07-09  Tim Shen  <timshen91@gmail.com>

	Implement class regex_traits.
	* include/bits/regex.h: Implement lookup_classname and
	lookup_collatename; modify isctype; partially implement
	transform_primary.
	* testsuite/28_regex/traits/char/isctype.cc: Add more test cases.
	* testsuite/28_regex/traits/char/lookup_classname.cc: Likewise.
	* testsuite/28_regex/traits/char/lookup_collatename.cc: Likewise.
	* testsuite/28_regex/traits/char/transform_primary.cc: Likewise.
	* testsuite/28_regex/traits/wchar_t/isctype.cc: New.
	* testsuite/28_regex/traits/wchar_t/lookup_classname.cc: New.
	* testsuite/28_regex/traits/wchar_t/lookup_collatename.cc: New.
	* testsuite/28_regex/traits/wchar_t/transform_primary.cc: New.

From-SVN: r200818
2013-07-09 13:41:10 +00:00
Edward Smith-Rowland
c8dfadf8f3 Add links to the C++14 library implementation status page.
From-SVN: r200749
2013-07-08 02:13:30 +00:00
Edward Smith-Rowland
af8bc8f324 Add links to the C++14 librarry implementation status page.
From-SVN: r200748
2013-07-08 02:06:45 +00:00
Paolo Carlini
110374e494 const_iterator.cc: Tweak, avoid potential undefined behavior.
2013-07-05  Paolo Carlini  <paolo.carlini@oracle.com>

	* testsuite/23_containers/deque/modifiers/insert/const_iterator.cc:
	Tweak, avoid potential undefined behavior.
	* testsuite/23_containers/list/modifiers/insert/const_iterator.cc:
	Likewise.
	* testsuite/23_containers/vector/bool/modifiers/insert/
	const_iterator.cc: Likewise.
	* testsuite/23_containers/vector/modifiers/insert/const_iterator.cc:
	Likewise.

From-SVN: r200725
2013-07-05 22:22:26 +00:00
François Dumont
b3abc9d822 hashtable_policy.h (_ReuseOrAllocNode): Use forward pattern.
2013-07-05  François Dumont  <fdumont@gcc.gnu.org>

	* include/bits/hashtable_policy.h (_ReuseOrAllocNode): Use forward
	pattern.
	(_MoveReuseOrAllocNode): Remove.
	(_Insert_base): Take a functor defining how the node is generated.
	* include/bits/hashtable.h: Adapt.
	(operator=(initializer_list<value_type>)): Reuse node if any.
	* testsuite/23_containers/unordered_set/instantiation_neg.cc:
	Adjust dg-error line number.
	* testsuite/23_containers/unordered_set/
	not_default_constructible_hash_neg.cc: Likewise.

From-SVN: r200724
2013-07-05 21:21:07 +00:00
Paolo Carlini
8b30e1668e const_iterator.cc: Tweak, avoid potential undefined behavior.
2013-07-05  Paolo Carlini  <paolo.carlini@oracle.com>

	* testsuite/23_containers/deque/modifiers/insert/const_iterator.cc:
	Tweak, avoid potential undefined behavior.
	* testsuite/23_containers/list/modifiers/insert/const_iterator.cc:
	Likewise.
	* testsuite/23_containers/vector/bool/modifiers/insert/
	const_iterator.cc: Likewise.
	* testsuite/23_containers/vector/modifiers/insert/const_iterator.cc:
	Likewise.

From-SVN: r200703
2013-07-05 10:32:20 +00:00
Veres Lajos
1d77bc548a codecvt_members.cc: Fix typo.
2013-07-04  Veres Lajos  <vlajos@gmail.com>
	    Jonathan Wakely  <jwakely.gcc@gmail.com>

	* config/locale/generic/codecvt_members.cc: Fix typo.
	* configure.host: Likewise.
	* doc/html/manual/policy_data_structures_design.html: Likewise.
	* doc/xml/manual/policy_data_structures.xml: Likewise.
	* include/bits/hashtable.h: Likewise.
	* include/bits/random.h: Likewise.
	* include/profile/impl/profiler_trace.h: Likewise.
	* testsuite/23_containers/deque/cons/2.cc: Likewise.
	* testsuite/23_containers/deque/debug/shrink_to_fit.cc: Likewise.
	* testsuite/ext/pb_ds/example/basic_multimap.cc: Likewise.
	* testsuite/performance/23_containers/insert_erase/41975.cc: Likewise.

Co-Authored-By: Jonathan Wakely <jwakely.gcc@gmail.com>

From-SVN: r200681
2013-07-04 22:07:44 +01:00
François Dumont
b1eb497f61 Add missing ChangeLog entry.
From-SVN: r200680
2013-07-04 21:02:25 +00:00
Ray Chason
b727d9c4be re PR libstdc++/57808 (operators == and != for regex_token_iterator need to be const)
2013-07-04  Ray Chason  <chasonr@newsguy.com>
	    Paolo Carlini  <paolo.carlini@oracle.com>

	PR libstdc++/57808
	* include/bits/regex.h (regex_token_iterator<>::operator==,
	regex_token_iterator<>::operator!=, regex_token_iterator<>::operator*,
	regex_token_iterator<>::operator->): Declare const.

Co-Authored-By: Paolo Carlini <paolo.carlini@oracle.com>

From-SVN: r200662
2013-07-04 08:23:44 +00:00
Paolo Carlini
019fdb7923 stl_list.h (list<>::insert(iterator, size_type, const value_type&), [...]): Adjust C++11 signatures to take const_iterator(s).
2013-07-01  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/bits/stl_list.h (list<>::insert(iterator,
	size_type, const value_type&), list<>::insert(iterator,
	initializer_list<>), list<>::insert(iterator, _InputIterator,
	_InputIterator), list<>::splice(iterator, list&&),
	list<>::splice(iterator, list&), list<>::splice(iterator, list&&,
	iterator), list<>::splice(iterator, list&, iterator),
	list<>::splice(iterator, list&&, iterator, iterator),
	list<>::splice(iterator, list&, iterator, iterator)): Adjust C++11
	signatures to take const_iterator(s).
	* include/bits/list.tcc (list<>::insert(const_iterator, size_type,
	const value_type&), list<>::insert(const_iterator, _InputIterator,
	_InputIterator)): Define.
	* include/ext/vstring.h (__versa_string<>::insert(iterator,
	size_type, _CharT), __versa_string<>::insert(iterator,
	_InputIterator, _InputIterator), __versa_string<>::insert(iterator,
	std::initializer_list<>), __versa_string<>::replace(iterator,
	iterator, _InputIterator, _InputIterator), __versa_string<>::
	replace(iterator, iterator, std::initializer_list<>)): Adjust C++11
	signatures to take const_iterator(s).
	(__versa_string<>::_M_replace_dispatch): Take const_iterators.
	* include/ext/vstring.tcc: Likewise.
	* include/debug/list: Adjust.
	* include/profile/list: Likewise.
	* testsuite/23_containers/list/operations/splice/const_iterator.cc:
	New.
	* testsuite/23_containers/list/modifiers/insert/const_iterator.cc:
	Extend.
	* testsuite/ext/vstring/modifiers/insert/char/const_iterator.cc:
	Likewise.
	* testsuite/ext/vstring/modifiers/insert/wchar_t/const_iterator.cc:
	Likewise.
	* testsuite/ext/vstring/modifiers/replace/char/const_iterator.cc:
	Likewise.
	* testsuite/ext/vstring/modifiers/replace/wchar_t/const_iterator.cc:
	Likewise.

	* testsuite/23_containers/list/requirements/dr438/assign_neg.cc:
	Adjust dg-error line number.
	* testsuite/23_containers/list/requirements/dr438/
	constructor_1_neg.cc: Likewise.
	* testsuite/23_containers/list/requirements/dr438/
	constructor_2_neg.cc: Likewise.
	* testsuite/23_containers/list/requirements/dr438/insert_neg.cc:
	Likewise.

From-SVN: r200580
2013-07-01 16:17:46 +00:00
Paolo Carlini
06eed9f588 stl_deque.h (deque<>::insert(iterator, size_type, const value_type&), [...]): Adjust C++11 signatures to take a const_iterator.
2013-06-30  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/bits/stl_deque.h (deque<>::insert(iterator,
	size_type, const value_type&), deque<>::insert(iterator,
	initializer_list<>), deque<>::insert(iterator, _InputIterator,
	_InputIterator)): Adjust C++11 signatures to take a const_iterator.
	* include/bits/stl_vector.h: Likewise.
	* include/bits/stl_bvector.h: Likewise.
	* include/debug/deque: Adjust.
	* include/debug/vector: Likewise.
	* include/profile/deque: Likewise.
	* include/profile/vector: Likewise.
	* testsuite/23_containers/deque/modifiers/insert/const_iterator.cc:
	Extend.
	* testsuite/23_containers/vector/bool/modifiers/insert/
	const_iterator.cc: Likewise.
	* testsuite/23_containers/vector/modifiers/insert/const_iterator.cc:
	Likewise.

	* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc:
	Adjust dg-error line number.
	* testsuite/23_containers/deque/requirements/dr438/
	constructor_1_neg.cc: Likewise.
	* testsuite/23_containers/deque/requirements/dr438/
	constructor_2_neg.cc: Likewise.
	* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc:
	Likewise.
	* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc:
	Likewise.
	* testsuite/23_containers/vector/requirements/dr438/
	constructor_1_neg.cc: Likewise.
	* testsuite/23_containers/vector/requirements/dr438/
	constructor_2_neg.cc: Likewise.
	* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc:
	Likewise.

From-SVN: r200571
2013-06-30 16:24:30 +00:00
Paolo Carlini
e8f24c86b8 *: Move inside testsuite/21_strings/basic_string/operations/data/.
2013-06-27  Paolo Carlini  <paolo.carlini@oracle.com>

	* testsuite/21_strings/basic_string/operations/*: Move inside
	testsuite/21_strings/basic_string/operations/data/.
	* testsuite/21_strings/basic_string/compare/*: Move inside
	testsuite/21_strings/basic_string/operations/.
	* testsuite/21_strings/basic_string/find/*: Likewise.
	* testsuite/21_strings/basic_string/rfind/*: Likewise.
	* testsuite/21_strings/basic_string/substr/*: Likewise.

From-SVN: r200570
2013-06-30 14:48:37 +00:00
François Dumont
41349aec29 hashtable_policy.h (_Insert_base): Consider hint in insert methods.
2013-06-29  François Dumont  <fdumont@gcc.gnu.org>

	* include/bits/hashtable_policy.h (_Insert_base): Consider hint in
	insert methods.
	* include/bits/hashtable.h: Likewise.
	* testsuite/23_containers/unordered_multimap/insert/hint.cc: New.
	* testsuite/performance/23_containers/insert/unordered_multiset_hint.cc:
	New.
	* testsuite/23_containers/unordered_set/instantiation_neg.cc:
	Adjust dg-error line number.
	* testsuite/23_containers/unordered_set/
	not_default_constructible_hash_neg.cc: Likewise.
	* doc/xml/manual/containers.xml: Document hinting in unordered
	containers.

From-SVN: r200564
2013-06-29 07:55:12 +00:00
Paolo Carlini
7d9800e39a *: Move inside testsuite/21_strings/basic_string/operations/data/.
2013-06-27  Paolo Carlini  <paolo.carlini@oracle.com>

	* testsuite/21_strings/basic_string/operations/*: Move inside
	testsuite/21_strings/basic_string/operations/data/.
	* testsuite/21_strings/basic_string/compare/*: Move inside
	testsuite/21_strings/basic_string/operations/.
	* testsuite/21_strings/basic_string/find/*: Likewise.
	* testsuite/21_strings/basic_string/rfind/*: Likewise.
	* testsuite/21_strings/basic_string/substr/*: Likewise.

From-SVN: r200537
2013-06-28 16:01:08 +00:00
Paolo Carlini
17ee10dbec *: Move inside testsuite/21_strings/basic_string/modifiers/.
2013-06-27  Paolo Carlini  <paolo.carlini@oracle.com>

	* testsuite/21_strings/basic_string/append/*: Move inside
	testsuite/21_strings/basic_string/modifiers/.
	* testsuite/21_strings/basic_string/assign/*: Likewise.
	* testsuite/21_strings/basic_string/insert/*: Likewise.
	* testsuite/21_strings/basic_string/replace/*: Likewise.
	* testsuite/21_strings/basic_string/modifiers/pop_back/char/
	pop_back.cc: Rename to 1.cc.
	* testsuite/21_strings/basic_string/modifiers/pop_back/wchar_t/
	pop_back.cc: Likewise.
	* testsuite/ext/vstring/assign/*: Move inside
	testsuite/ext/vstring/modifiers/.

From-SVN: r200465
2013-06-27 12:15:34 +00:00
Paolo Carlini
7b61c5a9cb stl_deque.h (deque<>::insert(iterator, const value_type&), [...]): Adjust C++11 signatures to take a const_iterator.
2013-06-27  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/bits/stl_deque.h (deque<>::insert(iterator,
	const value_type&), deque<>::insert(iterator, value_type&&),
	deque<>::emplace(iterator, _Args&&...)): Adjust C++11 signatures to
	take a const_iterator.
	(deque<>::erase): Simplify.
	* include/bits/stl_list.h: Likewise.
	(_List_iterator<>::_M_const_cast): Add.
	* include/bits/stl_vector.h: Likewise.
	* include/bits/stl_bvector.h: Likewise.
	(_Bit_iterator::_M_const_cast): Add.
	* include/bits/deque.tcc: Adjust definitions.
	* include/bits/list.tcc: Likewise.
	* include/bits/vector.tcc: Likewise.
	* include/bits/stl_iterator.h (__normal_iterator<>::_M_const_cast):
	Define trivial version in C++98 mode.
	* include/ext/vstring.h (__versa_string<>::insert(iterator, _CharT),
	__versa_string<>::replace(iterator, iterator, const __versa_string&),
	__versa_string<>::replace(iterator, iterator, const _CharT*,
	size_type), __versa_string<>::replace(iterator, iterator,
	const _CharT*), __versa_string<>::replace(iterator, iterator,
	size_type, _CharT)): Adjust C++11 signatures to take a pair of
	const_iterators.
	* include/debug/deque: Adjust.
	* include/debug/list: Likewise.
	* include/debug/vector: Likewise.
	* include/profile/deque: Likewise.
	* include/profile/list: Likewise.
	* include/profile/vector: Likewise.
	(vector<>::emplace): Add.
	* testsuite/util/exception/safety.h: Update.
	* testsuite/23_containers/deque/modifiers/emplace/const_iterator.cc:
	New.
	* testsuite/23_containers/deque/modifiers/insert/const_iterator.cc:
	Likewise.
	* testsuite/23_containers/list/modifiers/emplace/const_iterator.cc:
	Likewise.
	* testsuite/23_containers/list/modifiers/insert/const_iterator.cc:
	Likewise.
	* testsuite/23_containers/vector/bool/modifiers/insert/
	const_iterator.cc: Likewise.
	* testsuite/23_containers/vector/modifiers/emplace/const_iterator.cc:
	Likewise.
	* testsuite/23_containers/vector/modifiers/insert/const_iterator.cc:
	Likewise.
	* testsuite/ext/vstring/modifiers/insert/char/const_iterator.cc:
	Likewise.
	* testsuite/ext/vstring/modifiers/insert/wchar_t/const_iterator.cc:
	Likewise.
	* testsuite/ext/vstring/modifiers/replace/char/const_iterator.cc:
	Likewise.
	* testsuite/ext/vstring/modifiers/replace/wchar_t/const_iterator.cc:
	Likewise.

	* testsuite/ext/vstring/modifiers/char/54577.cc: Move to testsuite/
	ext/vstring/modifiers/erase/char/.
	* testsuite/ext/vstring/modifiers/wchar_t/54577.cc: Move to testsuite/
	ext/vstring/modifiers/wchar_t/.
	* testsuite/ext/vstring/modifiers/char/pop_back.cc: Move to testsuite/
	ext/vstring/modifiers/pop_back/char/.
	* testsuite/ext/vstring/modifiers/wchar_t/pop_back.cc: Move to
	testsuite/ext/vstring/modifiers/pop_back/wchar_t/.

	* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc:
	Adjust dg-error line number.
	* testsuite/23_containers/deque/requirements/dr438/
	constructor_1_neg.cc: Likewise.
	* testsuite/23_containers/deque/requirements/dr438/
	constructor_2_neg.cc: Likewise.
	* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc:
	Likewise.
	* testsuite/23_containers/list/requirements/dr438/assign_neg.cc:
	Likewise.
	* testsuite/23_containers/list/requirements/dr438/
	constructor_1_neg.cc: Likewise.
	* testsuite/23_containers/list/requirements/dr438/
	constructor_2_neg.cc: Likewise.
	* testsuite/23_containers/list/requirements/dr438/insert_neg.cc:
	Likewise.
	* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc:
	Likewise.
	* testsuite/23_containers/vector/requirements/dr438/
	constructor_1_neg.cc: Likewise.
	* testsuite/23_containers/vector/requirements/dr438/
	constructor_2_neg.cc: Likewise.
	* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc:
	Likewise.

From-SVN: r200458
2013-06-27 09:51:21 +00:00
Jason Merrill
46812ec24c typeck2.c (store_init_value): Diagnose a non-constant initializer for in-class static.
* typeck2.c (store_init_value): Diagnose a non-constant
	initializer for in-class static.

From-SVN: r200450
2013-06-26 22:35:46 -04:00
Paolo Carlini
a9826e56fa abi_tag.cc: Avoid spurious fails with check-debug.
2013-06-25  Paolo Carlini  <paolo.carlini@oracle.com>

	* testsuite/23_containers/map/modifiers/erase/abi_tag.cc: Avoid
	spurious fails with check-debug.
	* testsuite/23_containers/multimap/modifiers/erase/abi_tag.cc:
	Likewise.
	* testsuite/23_containers/set/modifiers/erase/abi_tag.cc: Likewise.
	* testsuite/23_containers/multiset/modifiers/erase/abi_tag.cc:
	Likewise.

From-SVN: r200438
2013-06-26 22:48:06 +00:00