Commit Graph

4242 Commits

Author SHA1 Message Date
Jonathan Wakely c718ff4183 Clean up temporary files created by std::filesystem testsuite
* testsuite/27_io/filesystem/operations/canonical.cc: Remove
	directory created by test.
	* testsuite/27_io/filesystem/operations/symlink_status.cc: Remove
	symlink created by test.

From-SVN: r266535
2018-11-27 23:35:17 +00:00
François Dumont 010211394d re PR libstdc++/88199 (memory leak on unordered container move assignment)
2018-11-27  François Dumont  <fdumont@gcc.gnu.org>

	PR libstdc++/88199
	* include/bits/hashtable.h (_Hashtable<>::_M_assign_elements): New.
	(_Hashtable<>::operator=(const _Hashtable&)): Use latter.
	(_Hashtable<>::_M_move_assign(_Hashtable&&, false_type)): Likewise.
	* testsuite/23_containers/unordered_set/allocator/move_assign.cc
	(test03): New.

From-SVN: r266528
2018-11-27 21:21:51 +00:00
Jonathan Wakely f4d3e3cca5 Only use __float128 in test if available
* testsuite/26_numerics/complex/requirements/more_constexpr.cc: Fix
	failure on targets without __float128.

From-SVN: r266450
2018-11-26 11:12:11 +00:00
Edward Smith-Rowland e987fb1ebe Implement P0415 More constexpr for std::complex.
2018-11-23  Edward Smith-Rowland  <3dw4rd@verizon.net>

	Implement P0415 More constexpr for std::complex.
	* include/std/complex (conj(complex<Tp>), norm(complex<Tp>)): Constexpr;
	(real(Tp), imag(Tp)): Constexpr;
	(operator@=(Tp), operator@=(complex<Tp>)): Constexpr;
	(operator@(Tp,complex<Tp>), operator@(complex<Tp>,Tp)
	operator@(complex<Tp>,complex<Tp>)): Constexpr.
	* testsuite/26_numerics/complex/comparison_operators/
	more_constexpr.cc: New test.
	* testsuite/26_numerics/complex/operators/more_constexpr.cc: New test.
	* testsuite/26_numerics/complex/requirements/
	more_constexpr.cc: New test.
	* testsuite/26_numerics/complex/value_operations/
	more_constexpr.cc: New test.
	* testsuite/26_numerics/headers/complex/synopsis.cc:
	Add _GLIBCXX20_CONSTEXPR to applicable operators; Add missing proj().
	* testsuite/26_numerics/headers/complex/synopsis.cc:
	Add _GLIBCXX20_CONSTEXPR to relevant decls.

From-SVN: r266416
2018-11-23 18:17:04 +00:00
Martin Sebor 14a9206d0c PR libstdc++/65229 fix pretty printer for std::bitset<0>
2018-11-23  Martin Sebor  <msebor@redhat.com>
	    Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/65229
	* python/libstdcxx/v6/printers.py (StdBitsetPrinter): Handle
	exception thrown for std::bitset<0>.
	* testsuite/libstdc++-prettyprinters/simple.cc: Test std::bitset<0>.

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

From-SVN: r266409
2018-11-23 16:12:03 +00:00
Jonathan Wakely 11aa881f98 PR libstdc++/87308 adjust regex used in std::any pretty printer
The pretty printer for std::any fails when the contained value is a
locally-defined type, because the name in the debuginfo has
cv-qualifiers and ptr-declarators in different positions. The unexpected
format confuses the printer. This makes the printer's regex handle
either format.

This isn't a complete fix because looking up the contained type fails
when there are two types with the same name (defined in different local
scopes). This applies to all closure types defined in a given function,
as they all appear as "func()::lambda" in the debuginfo names.

	PR libstdc++/87308 (partial)
	* python/libstdcxx/v6/printers.py (StdExpAnyPrinter): Adjust regex to
	work around PR 88166.
	* testsuite/libstdc++-prettyprinters/cxx17.cc: Test std::any
	containing a local type.

From-SVN: r266408
2018-11-23 15:48:56 +00:00
Jakub Jelinek e1389417f9 re PR c++/87386 (Error message for static_assert show wrong range)
PR c++/87386
	* parser.c (cp_parser_primary_expression): Use
	id_expression.get_location () instead of id_expr_token->location.
	Adjust the range from id_expr_token->location to
	id_expressio.get_finish ().
	(cp_parser_operator_function_id): Pass location of the operator
	token down to cp_parser_operator.
	(cp_parser_operator): Add start_loc argument, always construct a
	location with caret at start_loc and range from start_loc to the
	finish of the last token.
gcc/testsuite/
	* g++.dg/diagnostic/pr87386.C: New test.
	* g++.dg/parse/error17.C: Adjust expected diagnostics.
libstdc++-v3/
	* testsuite/20_util/scoped_allocator/69293_neg.cc: Adjust expected
	line.
	* testsuite/20_util/uses_allocator/cons_neg.cc: Likewise.
	* testsuite/20_util/uses_allocator/69293_neg.cc: Likewise.
	* testsuite/experimental/propagate_const/requirements2.cc: Likewise.
	* testsuite/experimental/propagate_const/requirements3.cc: Likewise.
	* testsuite/experimental/propagate_const/requirements4.cc: Likewise.
	* testsuite/experimental/propagate_const/requirements5.cc: Likewise.

From-SVN: r266359
2018-11-21 23:41:07 +01:00
Ville Voutilainen 47df7e197b Housekeeping for the effective targets of optional's tests.
* testsuite/20_util/optional/77288.cc: Adjust.
* testsuite/20_util/optional/84601.cc: Likewise.
* testsuite/20_util/optional/assignment/1.cc: Likewise.
* testsuite/20_util/optional/assignment/2.cc: Likewise.
* testsuite/20_util/optional/assignment/3.cc: Likewise.
* testsuite/20_util/optional/assignment/4.cc: Likewise.
* testsuite/20_util/optional/assignment/5.cc: Likewise.
* testsuite/20_util/optional/assignment/6.cc: Likewise.
* testsuite/20_util/optional/assignment/7.cc: Likewise.
* testsuite/20_util/optional/assignment/8.cc: Likewise.
* testsuite/20_util/optional/cons/77727.cc: Likewise.
* testsuite/20_util/optional/cons/copy.cc: Likewise.
* testsuite/20_util/optional/cons/deduction.cc: Likewise.
* testsuite/20_util/optional/cons/default.cc: Likewise.
* testsuite/20_util/optional/cons/move.cc: Likewise.
* testsuite/20_util/optional/cons/trivial.cc: Likewise.
* testsuite/20_util/optional/cons/value.cc: Likewise.
* testsuite/20_util/optional/cons/value_neg.cc: Likewise.
* testsuite/20_util/optional/constexpr/cons/default.cc: Likewise.
* testsuite/20_util/optional/constexpr/cons/value.cc: Likewise.
* testsuite/20_util/optional/constexpr/in_place.cc: Likewise.
* testsuite/20_util/optional/constexpr/nullopt.cc: Likewise.
* testsuite/20_util/optional/constexpr/observers/1.cc: Likewise.
* testsuite/20_util/optional/constexpr/observers/4.cc: Likewise.
* testsuite/20_util/optional/constexpr/observers/5.cc: Likewise.
* testsuite/20_util/optional/constexpr/relops/1.cc: Likewise.
* testsuite/20_util/optional/constexpr/relops/2.cc: Likewise.
* testsuite/20_util/optional/constexpr/relops/3.cc: Likewise.
* testsuite/20_util/optional/constexpr/relops/4.cc: Likewise.
* testsuite/20_util/optional/constexpr/relops/5.cc: Likewise.
* testsuite/20_util/optional/constexpr/relops/6.cc: Likewise.
* testsuite/20_util/optional/in_place.cc: Likewise.
* testsuite/20_util/optional/make_optional.cc: Likewise.
* testsuite/20_util/optional/nullopt.cc: Likewise.
* testsuite/20_util/optional/observers/1.cc: Likewise.
* testsuite/20_util/optional/observers/2.cc: Likewise.
* testsuite/20_util/optional/observers/3.cc: Likewise.
* testsuite/20_util/optional/observers/4.cc: Likewise.
* testsuite/20_util/optional/observers/5.cc: Likewise.
* testsuite/20_util/optional/observers/6.cc: Likewise.
* testsuite/20_util/optional/relops/1.cc: Likewise.
* testsuite/20_util/optional/relops/2.cc: Likewise.
* testsuite/20_util/optional/relops/3.cc: Likewise.
* testsuite/20_util/optional/relops/4.cc: Likewise.
* testsuite/20_util/optional/relops/5.cc: Likewise.
* testsuite/20_util/optional/relops/6.cc: Likewise.
* testsuite/20_util/optional/relops/7.cc: Likewise.
* testsuite/20_util/optional/requirements.cc: Likewise.
* testsuite/20_util/optional/swap/1.cc: Likewise.
* testsuite/20_util/optional/swap/2.cc: Likewise.
* testsuite/20_util/optional/typedefs.cc: Likewise.

From-SVN: r266310
2018-11-20 12:42:28 +02:00
Ville Voutilainen 4fea820523 re PR libstdc++/87855 (std::optional<T> only copy-constructible if T is trivially copy-constructible)
PR libstdc++/87855

Also implement P0602R4 (variant and optional
should propagate copy/move triviality) for std::optional.
* include/std/optional (_Optional_payload): Change
the main constraints to check constructibility in
addition to assignability.
(operator=): Make constexpr.
(_M_reset): Likewise.
(_M_construct): Likewise.
(operator->): Likewise.
* testsuite/20_util/optional/assignment/8.cc: Adjust.
* testsuite/20_util/optional/assignment/9.cc: New.

From-SVN: r266278
2018-11-19 17:05:18 +02:00
Jonathan Wakely d86b600d89 PR libstdc++/88084 - Implement LWG 2777
* include/std/string_view (basic_string_view::copy): Use traits to
	copy.
	* testsuite/21_strings/basic_string_view/operations/copy/char/2.cc:
	New test.
	* testsuite/21_strings/basic_string_view/operations/copy/wchar_t/2.cc:
	New test.

From-SVN: r266269
2018-11-19 10:53:59 +00:00
Michele Pezzutti bee39274cb PR libstdc++/83566 - cyl_bessel_j returns wrong result for x>1000
2018-11-16  Michele Pezzutti <mpezz@tiscali.it>
	    Edward Smith-Rowland  <3dw4rd@verizon.net>

	PR libstdc++/83566 - cyl_bessel_j returns wrong result for x>1000
	for high orders.
	* include/tr1/bessel_function.tcc: Perform no fewer than nu/2 iterations
	of the asymptotic series (nu is the Bessel order).
	* testsuite/tr1/5_numerical_facilities/special_functions/
	09_cyl_bessel_j/check_value.cc: Add tests at nu=100, 1000<=x<=2000.
	* testsuite/tr1/5_numerical_facilities/special_functions/	
	11_cyl_neumann/check_value.cc: Ditto.
	* testsuite/special_functions/08_cyl_bessel_j/check_value.cc: Ditto.
	* testsuite/special_functions/10_cyl_neumann/check_value.cc: Ditto.


Co-Authored-By: Edward Smith-Rowland <3dw4rd@verizon.net>

From-SVN: r266252
2018-11-18 18:32:26 +00:00
Jonathan Wakely c5be64810c Implement std::pmr::synchronized_pool_resource
Define the thread-safe pool resource, using a shared_mutex to allow
multiple threads to concurrently allocate from thread-specific pools.

Define new weak symbols for the pthread_rwlock_t functions, to avoid
making libstdc++.so depend on libpthread.so

When the necessary Gthread support is absent only define the
feature-test macro to 1, rather than 201603. This is intended to imply
incomplete support, because everything except synchronized_pool_resource
works.

	Implement std::pmr::synchronized_pool_resource
	* config/abi/pre/gnu.ver: Add new symbols.
	* include/std/memory_resource [_GLIBCXX_HAS_GTHREADS]
	(__cpp_lib_memory_resource): Define to expected value, 201603.
	(synchronized_pool_resource): New class.
	[!_GLIBCXX_HAS_GTHREADS] (__cpp_lib_memory_resource): Define to 1.
	* include/std/shared_mutex (__glibcxx_rwlock_rdlock)
	(__glibcxx_rwlock_tryrdlock, __glibcxx_rwlock_wrlock)
	(__glibcxx_rwlock_trywrlock, __glibcxx_rwlock_unlock)
	(__glibcxx_rwlock_destroy, __glibcxx_rwlock_init)
	(__glibcxx_rwlock_timedrdlock, __glibcxx_rwlock_timedwrlock): Define
	weak symbols for POSIX rwlock functions.
	(__shared_mutex_pthread): Use weak symbols.
	* include/std/version (__cpp_lib_memory_resource): Define.
	* src/c++17/memory_resource.cc [_GLIBCXX_HAS_GTHREADS]
	(synchronized_pool_resource::_TPools): New class.
	(destroy_TPools): New function for pthread_key_create destructor.
	(synchronized_pool_resource::synchronized_pool_resource)
	(synchronized_pool_resource::~synchronized_pool_resource)
	(synchronized_pool_resource::release)
	(synchronized_pool_resource::do_allocate)
	(synchronized_pool_resource::do_deallocate): Define public members.
	(synchronized_pool_resource::_M_thread_specific_pools)
	(synchronized_pool_resource::_M_alloc_tpools)
	(synchronized_pool_resource::_M_alloc_shared_tpools): Define private
	members.
	* testsuite/20_util/synchronized_pool_resource/allocate.cc: New test.
	* testsuite/20_util/synchronized_pool_resource/cons.cc: New test.
	* testsuite/20_util/synchronized_pool_resource/is_equal.cc: New test.
	* testsuite/20_util/synchronized_pool_resource/multithreaded.cc: New
	test.
	* testsuite/20_util/synchronized_pool_resource/release.cc: New test.
	* testsuite/performance/20_util/memory_resource/pools.cc: Add
	multithreaded tests using pmr::synchronized_pool_resource.

From-SVN: r266242
2018-11-17 23:35:44 +00:00
Renlin Li ac28df7e53 [Patch][libstdc++.exp] Update the usage of cached result.
This patch replaces the usage of cached results with a global dictionary.

Additionally, check_v3_target_namedlocale is updated to check on every variant.
Originally, it is only checked once.


gcc/libstdc++-v3/:
2018-11-16  Renlin Li  <renlin.li@arm.com>
	    Tejas Belagod  <tejas.belagod@arm.com>

	testsuite/lib/libstdc++.exp (check_v3_target_prop_cached): New proc.
	(check_v3_target): Use check_v3_target_prop_cached.


Co-Authored-By: Tejas Belagod <tejas.belagod@arm.com>

From-SVN: r266209
2018-11-16 14:36:40 +00:00
Jonathan Wakely a15032ee7b Optimize pool resource allocation
A recent change caused a performance regression. This restores the
previous performance and adds a performance test.

	* scripts/check_performance: Allow tests to choose a -std flag.
	* src/c++17/memory_resource.cc (bitset::get_first_unset()): Use local
	variables of the right types. Call update_next_word() unconditionally.
	* testsuite/20_util/unsynchronized_pool_resource/cons.cc: New test.
	* testsuite/performance/20_util/memory_resource/pools.cc: New test.
	* testsuite/util/testsuite_performance.h (time_counter): Allow
	timer to be restarted.

From-SVN: r266164
2018-11-15 00:04:19 +00:00
Jonathan Wakely aeb2b1f7fb Fix test that does undefined shifts greater than width of size_t
* testsuite/20_util/unsynchronized_pool_resource/allocate.cc: Fix
	test for 32-bit targets. Test additional allocation sizes.

From-SVN: r266163
2018-11-15 00:04:12 +00:00
Jonathan Wakely 78ef03b7c3 Add missing dir to create_testsuite_files script
* scripts/create_testsuite_files: Add special_functions to the list
	of directories to search. Add comment referring to conformance.exp.
	* testsuite/libstdc++-dg/conformance.exp: Add comment referring
	to create_testsuite_files.

From-SVN: r266146
2018-11-14 14:25:00 +00:00
Jonathan Wakely f2e005857e Improve handling of pool_options::largest_required_pool_block
Make the munge_options function round the largest_required_pool_block
value to a multiple of the smallest pool size (currently 8 bytes) to
avoid pools with odd sizes.

Ensure there is a pool large enough for blocks of the requested size.
Previously when largest_required_pool_block was exactly equal to one of
the pool_sizes[] values there would be no pool of that size. This patch
increases _M_npools by one, so there is a pool at least as large as the
requested value. It also reduces the size of the largest pool to be no
larger than needed.

	* src/c++17/memory_resource.cc (munge_options): Round up value of
	largest_required_pool_block to multiple of smallest pool size. Round
	excessively large values down to largest pool size.
	(select_num_pools): Increase number of pools by one unless it exactly
	matches requested largest_required_pool_block.
	(__pool_resource::_M_alloc_pools()): Make largest pool size equal
	largest_required_pool_block.
	* testsuite/20_util/unsynchronized_pool_resource/options.cc: Check
	that pool_options::largest_required_pool_block is set appropriately.

From-SVN: r266089
2018-11-13 22:57:53 +00:00
Jonathan Wakely d3306a84a6 Fix incorrect assertion when deallocating big block
Since a big_block rounds up the size to a multiple of big_block::min it
is wrong to assert that the supplied number of bytes equals the
big_block's size(). Add big_block::alloc_size(size_t) to calculate the
allocated size consistently, and add comments to the code.

	* src/c++17/memory_resource.cc (big_block): Improve comments.
	(big_block::all_ones): Remove.
	(big_block::big_block(size_t, size_t)): Use alloc_size.
	(big_block::size()): Add comment, replace all_ones with equivalent
	expression.
	(big_block::align()): Shift value of correct type.
	(big_block::alloc_size(size_t)): New function to round up size.
	(__pool_resource::allocate(size_t, size_t)): Add comment.
	(__pool_resource::deallocate(void*, size_t, size_t)): Likewise. Fix
	incorrect assertion by using big_block::alloc_size(size_t).
	* testsuite/20_util/unsynchronized_pool_resource/allocate.cc: Add
	more tests for unpooled allocations.

From-SVN: r266088
2018-11-13 22:57:48 +00:00
Jonathan Wakely 6bdd58f73a Fix overflows in std::pmr::unsynchonized_pool_resource
* src/c++17/memory_resource.cc (bitset::full()): Handle edge case
	for _M_next_word maximum value.
	(bitset::get_first_unset(), bitset::set(size_type)): Use
	update_next_word() to update _M_next_word.
	(bitset::update_next_word()): New function, avoiding wraparound of
	unsigned _M_next_word member.
	(bitset::max_word_index()): New function.
	(chunk::chunk(void*, uint32_t, void*, size_t)): Add assertion.
	(chunk::max_bytes_per_chunk()): New function.
	(pool::replenish(memory_resource*, const pool_options&)): Prevent
	_M_blocks_per_chunk from exceeding max_blocks_per_chunk or from
	causing chunk::max_bytes_per_chunk() to be exceeded.
	* testsuite/20_util/unsynchronized_pool_resource/allocate-max-chunks.cc:
	New test.

From-SVN: r266087
2018-11-13 22:57:44 +00:00
Jonathan Wakely 3d18dc9db0 Implement P0318R1 unwrap_ref_decay and unwrap_reference
Implement P0318R1 unwrap_ref_decay and unwrap_reference
	* include/std/type_traits (unwrap_reference, unwrap_reference_t)
	(unwrap_ref_decay, unwrap_ref_decay_t): New traits and aliases.
	* testsuite/20_util/unwrap_reference/1.cc: New test.
	* testsuite/20_util/unwrap_reference/2.cc: New test.

From-SVN: r266010
2018-11-11 05:17:03 +00:00
Jonathan Wakely 37b736f6bd Implement P1007R3 std::assume_aligned
Implement P1007R3 std::assume_aligned
	* include/std/memory (assume_aligned): Implement for C++17.
	* testsuite/20_util/assume_aligned/1.cc: New test.
	* testsuite/20_util/assume_aligned/2_neg.cc: New test.
	* testsuite/20_util/assume_aligned/3.cc: New test.

From-SVN: r266009
2018-11-11 05:16:51 +00:00
Jonathan Wakely 852a971c26 Implement std::pmr::unsynchronized_pool_resource
Implement std::pmr::unsynchronized_pool_resource
	* config/abi/pre/gnu.ver: Add new symbols.
	* include/std/memory_resource (std::pmr::__pool_resource): New class.
	(std::pmr::unsynchronized_pool_resource): New class.
	* src/c++17/Makefile.am: Add -fimplicit-templates to flags for
	memory_resource.cc
	* src/c++17/Makefile.in: Regenerate.
	* src/c++17/memory_resource.cc (bitset, chunk, big_block): New
	internal classes.
	(__pool_resource::_Pool): Define new class.
	(munge_options, pool_index, select_num_pools): New internal functions.
	(__pool_resource::__pool_resource, __pool_resource::~__pool_resource)
	(__pool_resource::allocate, __pool_resource::deallocate)
	(__pool_resource::_M_alloc_pools): Define member functions.
	(unsynchronized_pool_resource::unsynchronized_pool_resource)
	(unsynchronized_pool_resource::~unsynchronized_pool_resource)
	(unsynchronized_pool_resource::release)
	(unsynchronized_pool_resource::_M_find_pool)
	(unsynchronized_pool_resource::do_allocate)
	(unsynchronized_pool_resource::do_deallocate): Define member
	functions.
	* testsuite/20_util/unsynchronized_pool_resource/allocate.cc: New
	test.
	* testsuite/20_util/unsynchronized_pool_resource/is_equal.cc: New
	test.
	* testsuite/20_util/unsynchronized_pool_resource/options.cc: New
	test.
	* testsuite/20_util/unsynchronized_pool_resource/release.cc: New
	test.

From-SVN: r265853
2018-11-06 21:35:27 +00:00
Joseph Myers 22e0527251 Update GCC to autoconf 2.69, automake 1.15.1 (PR bootstrap/82856).
This patch updates GCC to use autoconf 2.69 and automake 1.15.1.
(That's not the latest automake version, but it's the one used by
binutils-gdb, with which consistency is desirable, and in any case
seems a useful incremental update that should make a future update to
1.16.1 easier.)

The changes are generally similar to the binutils-gdb ones, and are
copied from there where shared files and directories are involved
(there are some further changes to such shared directories, however,
which I'd expect to apply to binutils-gdb once this patch is in GCC).
Largely, obsolete AC_PREREQ calls are removed, while many
AC_LANG_SOURCE calls are added to avoid warnings from aclocal and
autoconf.  Multilib support is no longer included in core automake,
meaning that multilib.am needs copying from automake's contrib
directory into the GCC source tree.  Autoconf 2.69 has Go support, so
local copies of that support are removed.  I hope the D support will
soon be submitted to upstream autoconf so the local copy of that can
be removed in a future update.  Changes to how automake generates
runtest calls mean quotes are removed from RUNTEST definitions in five
lib*/testsuite/Makefile.am files (libatomic, libgomp, libitm,
libphobos, libvtv; some others have RUNTEST definitions without
quotes, which are still OK); libgo and libphobos also get
-Wno-override added to AM_INIT_AUTOMAKE so those overrides of RUNTEST
do not generate automake warnings.

Note that the regeneration did not include regeneration of
fixincludes/config.h.in (attempting such regeneration resulted in all
the USED_FOR_TARGET conditionals disappearing; and I don't see
anything in the fixincludes/ directory that would result in such
conditionals being generated, unlike in the gcc/ directory).  Also
note that libvtv/testsuite/other-tests/Makefile.in was not
regenerated; that directory is not listed as a subdirectory for which
Makefile.in gets regenerated by calling "automake" in libvtv/, so I'm
not sure how it's meant to be regenerated.

While I mostly fixed warnings should running aclocal / automake /
autoconf, there were various such warnings from automake in the
libgfortran, libgo, libgomp, liboffloadmic, libsanitizer, libphobos
directories that I did not fix, preferring to leave those to the
relevant subsystem maintainers.  Specifically, most of those warnings
were of the following form (example from libgfortran):

Makefile.am:48: warning: source file 'caf/single.c' is in a subdirectory,
Makefile.am:48: but option 'subdir-objects' is disabled
automake: warning: possible forward-incompatibility.
automake: At least a source file is in a subdirectory, but the 'subdir-objects'
automake: automake option hasn't been enabled.  For now, the corresponding output
automake: object file(s) will be placed in the top-level directory.  However,
automake: this behaviour will change in future Automake versions: they
will
automake: unconditionally cause object files to be placed in the same subdirectory
automake: of the corresponding sources.
automake: You are advised to start using 'subdir-objects' option throughout your
automake: project, to avoid future incompatibilities.

I think it's best for the relevant maintainers to add subdir-objects
and do any other associated Makefile.am changes needed.  In some cases
the paths in the warnings involved ../; I don't know if that adds any
extra complications to the use of subdir-objects.

I've tested this with native, cross and Canadian cross builds.  The
risk of any OS-specific issues should I hope be rather lower than if a
libtool upgrade were included (we *should* do such an upgrade at some
point, but it's more complicated - it involves identifying all our
local libtool changes to see if any aren't included in the upstream
version we update to, and reverting an upstream libtool patch that's
inappropriate for use in GCC); I think it would be better to get this
update into GCC so that people can test in different configurations
and we can fix any issues found, rather than to try to get more and
more testing done before it goes in.

top level:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* multilib.am: New file.  From automake.

	Merge from binutils-gdb:
	2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>

	* libtool.m4: Use AC_LANG_SOURCE.
	* configure.ac: Remove AC_PREREQ, use AC_LANG_SOURCE.
	* ar-lib: New file.
	* test-driver: New file.
	* configure: Re-generate.

config:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* math.m4, tls.m4: Use AC_LANG_SOURCE.

	Merge from binutils-gdb:
	2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>

	* override.m4 (_GCC_AUTOCONF_VERSION): Bump from 2.64 to 2.69.

fixincludes:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.
	* aclocal.m4, configure: Regenerate.

gcc:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.  Use single
	line for second argument of AC_DEFINE_UNQUOTED.
	* doc/install.texi (Tools/packages necessary for modifying GCC):
	Update to autoconf 2.69 and automake 1.15.1.
	* aclocal.m4, config.in, configure: Regenerate.

gnattools:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.
	* configure: Regenerate.

gotools:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* config/go.m4: Remove file.
	* Makefile.am (ACLOCAL_AMFLAGS): Do not use -I ./config.
	* configure.ac:  Remove AC_PREREQ.  Do not include config/go.m4.
	* Makefile.in, aclocal.m4, configure: Regenerate.

intl:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	Merge from binutils-gdb:
	2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>

	* configure.ac: Add AC_USE_SYSTEM_EXTENSIONS, remove AC_PREREQ.
	* configure: Re-generate.
	* config.h.in: Re-generate.
	* aclocal.m4: Re-generate.

libada:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.
	* configure: Regenerate.

libatomic:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* acinclude.m4: Use AC_LANG_SOURCE.
	* configure.ac: Remove AC_PREREQ.
	* testsuite/Makefile.am (RUNTEST): Remove quotes.
	* Makefile.in, aclocal.m4, configure, testsuite/Makefile.in:
	Regenerate.

libbacktrace:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.
	* Makefile.in, aclocal.m4, config.h.in, configure: Regenerate.

libcc1:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.
	* Makefile.in, aclocal.m4, configure: Regenerate.

libcpp:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.
	* aclocal.m4, config.in, configure: Regenerate.

libdecnumber:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	Merge from binutils-gdb:
	2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>

	* configure.ac: Remove AC_PREREQ.
	* configure: Re-generate.
	* aclocal.m4.

libffi:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	(AUTOMAKE_OPTIONS): Add info-in-builddir.
	(CLEANFILES): Remove doc/libffi.info.
	* configure.ac: Remove AC_PREREQ.
	* Makefile.in, aclocal.m4, configure, fficonfig.h.in,
	include/Makefile.in, man/Makefile.in, testsuite/Makefile.in:
	Regenerate.

libgcc:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.
	* configure: Regenerate.

libgfortran:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* configure.ac: Remove AC_PREREQ.
	* Makefile.in, aclocal.m4, config.h.in, configure: Regenerate.

libgo [logically part of this change but omitted from the commit]:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* config/go.m4: Remove file.
	* config/libtool.m4: Use AC_LANG_SOURCE.
	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.  Use
	-Wno-override in AM_INIT_AUTOMAKE call.
	* Makefile.in, aclocal.m4, configure, testsuite/Makefile.in:
	Regenerate.

libgomp:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am
	(AUTOMAKE_OPTIONS): Add info-in-builddir.
	(CLEANFILES): Remove libgomp.info.
	* configure.ac: Remove AC_PREREQ.
	* testsuite/Makefile.am (RUNTEST): Remove quotes.
	* Makefile.in, aclocal.m4, configure, testsuite/Makefile.in:
	Regenerate.

libhsail-rt:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.
	* Makefile.in, aclocal.m4, configure: Regenerate.

libiberty:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	Merge from binutils-gdb:
	2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>

	* configure.ac: Remove AC_PREREQ.
	* configure: Re-generate.
	* config.in: Re-generate.

libitm:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	(AUTOMAKE_OPTIONS): Add info-in-builddir.
	(CLEANFILES): Remove libitm.info.
	* configure.ac: Remove AC_PREREQ.
	* testsuite/Makefile.am (RUNTEST): Remove quotes.
	* Makefile.in, aclocal.m4, configure, testsuite/Makefile.in:
	Regenerate.

libobjc:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.
	* aclocal.m4, config.h.in, configure: Regenerate.

liboffloadmic:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* configure.ac: Remove AC_PREREQ.
	* plugin/Makefile.am: Include multilib.am.
	* plugin/configure.ac: Remove AC_PREREQ.
	* Makefile.in, aclocal.m4, configure, plugin/Makefile.in,
	plugin/aclocal.m4, plugin/configure: Regenerate.

libphobos:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* configure.ac: Remove AC_PREREQ.  Use -Wno-override in
	AM_INIT_AUTOMAKE call.
	* m4/autoconf.m4: Add extra argument to AC_LANG_DEFINE call.
	* m4/druntime/os.m4: Use AC_LANG_SOURCE.
	* testsuite/Makefile.am (RUNTEST): Remove quotes.
	* Makefile.in, aclocal.m4, configure, libdruntime/Makefile.in,
	src/Makefile.in, testsuite/Makefile.in: Regenerate.

libquadmath:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	(AUTOMAKE_OPTIONS): Remove 1.8.  Add info-in-builddir.
	(all-local): Define outside conditional code.
	(CLEANFILES): Remove libquadmath.info.
	* configure.ac: Remove AC_PREREQ.
	* Makefile.in, aclocal.m4, config.h.in, configure: Regenerate.

libsanitizer:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.
	* Makefile.in, aclocal.m4, asan/Makefile.in, configure,
	interception/Makefile.in, libbacktrace/Makefile.in,
	lsan/Makefile.in, sanitizer_common/Makefile.in, tsan/Makefile.in,
	ubsan/Makefile.in: Regenerate.

libssp:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	(AUTOMAKE_OPTIONS): Remove 1.9.5.
	* configure.ac: Remove AC_PREREQ.  Quote argument to
	AC_RUN_IFELSE.
	* Makefile.in, aclocal.m4, configure: Regenerate.

libstdc++-v3:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* configure.ac: Remove AC_PREREQ.
	* Makefile.in, aclocal.m4, configure, doc/Makefile.in,
	include/Makefile.in, libsupc++/Makefile.in, po/Makefile.in,
	python/Makefile.in, src/Makefile.in, src/c++11/Makefile.in,
	src/c++17/Makefile.in, src/c++98/Makefile.in,
	src/filesystem/Makefile.in, testsuite/Makefile.in: Regenerate.

libvtv:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* configure.ac: Remove AC_PREREQ.
	* testsuite/Makefile.am (RUNTEST): Remove quotes.
	* Makefile.in, aclocal.m4, configure, testsuite/Makefile.in:
	Regenerate.

lto-plugin:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.
	* Makefile.in, aclocal.m4, config.h.in, configure: Regenerate.

zlib:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.

	Merge from binutils-gdb:
	2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>

	* configure.ac: Modernize AC_INIT call, remove AC_PREREQ.
	* Makefile.am (AUTOMAKE_OPTIONS): Remove 1.8, cygnus, add foreign.
	* Makefile.in: Re-generate.
	* aclocal.m4: Re-generate.
	* configure: Re-generate.

From-SVN: r265695
2018-10-31 17:03:16 +00:00
Jonathan Wakely d5e33619bf More testing for std::pair layout change
* testsuite/20_util/pair/87822.cc: Test deeper nesting.

From-SVN: r265680
2018-10-31 12:58:45 +00:00
Jonathan Wakely 0db78d0a5e PR libstdc++/87822 fix layout change for nested std::pair
The introduction of the empty __pair_base base class for PR 86751
changed the layout of std::pair<std::pair<...>, ...>. The outer pair and
its first member both have a base class of the same type, which cannot
exist at the same address. This causes the first member to be at a
non-zero offset.

The solution is to make the base class depend on the template
parameters, so that each pair type has a different base class type,
which allows the base classes of the outer pair and its first member to
have the same address.

	PR libstdc++/87822
	* include/bits/stl_pair.h (__pair_base): Change to class template.
	(pair): Make base class type depend on template parameters.
	* testsuite/20_util/pair/87822.cc: New test.

From-SVN: r265678
2018-10-31 12:29:02 +00:00
Marek Polacek b5ff4f5c0d Implement P0892R2, explicit(bool).
* c-cppbuiltin.c (c_cpp_builtins): Define __cpp_explicit_bool.

	* call.c (add_template_candidate_real): Return if the declaration is
	explicit and we're only looking for non-converting constructor.
	* cp-tree.h (lang_decl_fn): Add has_dependent_explicit_spec_p bit.
	(DECL_HAS_DEPENDENT_EXPLICIT_SPEC_P): New macro.
	(cp_decl_specifier_seq): Add explicit_specifier field.
	(build_explicit_specifier, store_explicit_specifier): Declare.
	* decl.c (grokdeclarator): Call store_explicit_specifier.
	(build_explicit_specifier): New function.
	* parser.c (cp_parser_function_specifier_opt) <case RID_EXPLICIT>:
	Parse C++20 explicit(bool).
	* pt.c (store_explicit_specifier, lookup_explicit_specifier): New.
	(tsubst_function_decl): Handle explicit(dependent-expr).

	* g++.dg/cpp2a/explicit1.C: New test.
	* g++.dg/cpp2a/explicit10.C: New test.
	* g++.dg/cpp2a/explicit11.C: New test.
	* g++.dg/cpp2a/explicit12.C: New test.
	* g++.dg/cpp2a/explicit13.C: New test.
	* g++.dg/cpp2a/explicit2.C: New test.
	* g++.dg/cpp2a/explicit3.C: New test.
	* g++.dg/cpp2a/explicit4.C: New test.
	* g++.dg/cpp2a/explicit5.C: New test.
	* g++.dg/cpp2a/explicit6.C: New test.
	* g++.dg/cpp2a/explicit7.C: New test.
	* g++.dg/cpp2a/explicit8.C: New test.
	* g++.dg/cpp2a/explicit9.C: New test.

	* testsuite/20_util/any/cons/explicit.cc: Adjust dg-error.
	* testsuite/20_util/pair/cons/explicit_construct.cc: Likewise.
	* testsuite/20_util/tuple/cons/explicit_construct.cc: Likewise.

From-SVN: r265641
2018-10-30 19:59:41 +00:00
Jonathan Wakely 0321d9fac6 PR libstdc++/87809 avoid invalid expressions in exception specifications
If the allocator isn't default constructible then checking if the
default constructor throws in an exception specification makes the
declaration invalid. Use the type trait instead.

	PR libstdc++/87809
	* include/bits/forward_list.h (_Fwd_list_impl::_Fwd_list_impl()): Use
	trait in exception-specification instead of possibly invalid
	expression.
	* include/bits/stl_bvector.h (_Bvector_impl::_Bvector_impl()):
	Likewise.
	* include/bits/stl_list.h (_List_impl::_List_impl()): Likewise.
	* include/bits/stl_vector.h (_Vector_impl::_Vector_impl()): Likewise.
	* testsuite/23_containers/forward_list/cons/87809.cc: New test.
	* testsuite/23_containers/list/cons/87809.cc: New test.
	* testsuite/23_containers/vector/bool/cons/87809.cc: New test.
	* testsuite/23_containers/vector/cons/87809.cc: New test.

From-SVN: r265626
2018-10-30 14:49:43 +00:00
Jonathan Wakely c397f267f1 PR libstdc++/87784 fix dynamic_bitset::push_back
Previously the _M_Nb member was incremented before calling
_M_unchecked_set which meant that the bit being set was out of bounds.
It either set the wrong bit in an allocated word, or accessed beyond the
end of the allocated memory in the _M_w vector. The fix for the bug is
to update the _M_Nb member after using it as an index.

As an optimisation, when a new block needs to be appended the call to
_M_unchecked_set can be avoided by appending a block with the least
significant bit already set to the desired value.

	PR libstdc++/87784
	* include/tr2/dynamic_bitset (dynamic_bitset::push_back): When there
	are no unused bits in the last block, append a new block with the
	right value so the bit doesn't need to be set. Only increment size
	after setting the new bit, not before.
	* testsuite/tr2/dynamic_bitset/pr87784.cc: New test.

From-SVN: r265625
2018-10-30 14:49:32 +00:00
David Malcolm 7e2de6df10 C++: simplify output from suggest_alternatives_for
In the C++ FE, after emitting various errors about unrecognized names,
the parser can call
  suggest_alternatives_for
and/or
  suggest_alternative_in_explicit_scope.
These can issue zero or more suggestions for the unrecognized name,
or various other "note" diagnostics suggesting how to fix the problem.

For example, currently g++ emits:

t.cc:12:3: error: 'gtk_widget_showall' was not declared in this scope
12 |   gtk_widget_showall (w);
   |   ^~~~~~~~~~~~~~~~~~
t.cc:12:3: note: suggested alternative: 'gtk_widget_show_all'
12 |   gtk_widget_showall (w);
   |   ^~~~~~~~~~~~~~~~~~
   |   gtk_widget_show_all

This patch consolidates the common case when there is a single
candidate, so that the error can issue a fix-it hint directly.

This simplifies the above to:

t.cc:12:3: error: 'gtk_widget_showall' was not declared in this scope;
 did you mean 'gtk_widget_show_all'?
12 |   gtk_widget_showall (w);
   |   ^~~~~~~~~~~~~~~~~~
   |   gtk_widget_show_all

omitting the second "note" diagnostic.

Doing so requires changing the above "suggest_" functions so that
rather than being called after "error" and emitting a note directly,
they are called before the "error", and return a name_hint, which
can contain a suggestion and/or a deferred diagnostic.  The "single
candidate" case is handled via a suggestion, and the "multiple
candidates" case via a new subclass of deferred_diagnostic.

There was some complication due to the fact that we don't always have
enough location information to issue a fix-it hint.  Specifically,
for the case in qualified_name_lookup_error, the location is that of
the name, but the location of the qualifier prefix isn't reliably
available.  For some hints, e.g. spell-corrections, the replacement
is of the name, and for others, e.g. parent namespaces, it's for the
qualified name.  The patch addresses this by splitting this case out
into a new "suggest_alternatives_in_other_namespaces" function, for
which fix-it hints aren't issued.

Another complication is that of emitting a note when
  --param cxx-max-namespaces-for-diagnostic-help
is reached.  The patch emulates the existing behavior by emitting
the note from a deferred_diagnostic.  This potentially needs to
co-exist with another deferred_diagnostic, so it works as a decorator
around any other such deferred_diagnostic.  Doing so requires slightly
extending class name_hint.

On adding test coverage for the various cases, I discovered that
after emitting a "FOO is not a namespace-name" error, we also emit
a "expected namespace-name before" error.  The patch removes this
second error for the case where it's redundant, simplifying this case
from e.g.:

spellcheck-ns.C:10:24: error: 'inner_ms' is not a namespace-name
10 | using namespace outer::inner_ms;
   |                        ^~~~~~~~
spellcheck-ns.C:10:24: note: suggested alternative: 'inner_ns'
10 | using namespace outer::inner_ms;
   |                        ^~~~~~~~
   |                        inner_ns
spellcheck-ns.C:10:32: error: expected namespace-name before ';' token
10 | using namespace outer::inner_ms;
   |                                ^

to:

spellcheck-ns.C:10:24: error: 'inner_ms' is not a namespace-name;
 did you mean 'inner_ns'?
10 | using namespace outer::inner_ms;
   |                        ^~~~~~~~
   |                        inner_ns

include/ChangeLog:
	* unique-ptr.h (gnu::move): Generalize so it applies to all
	lvalue references, rather than just to unique_ptr values.

gcc/c-family/ChangeLog:
	* name-hint.h (name_hint::take_deferred): New member function.

gcc/c/ChangeLog:
	* c-decl.c (implicit_decl_warning): Update "is there a suggestion"
	logic for change to name_hint::operator bool.
	(undeclared_variable): Likewise.
	* c-parser.c (c_parser_declaration_or_fndef): Likewise.
	(c_parser_parameter_declaration): Likewise.

gcc/cp/ChangeLog:
	* cp-name-hint.h: New file.
	* cp-tree.h (expr_to_string): New decl.
	(suggest_alternatives_for): Move to cp-name-hint.h, changing
	return type from bool to name_hint.
	(suggest_alternative_in_explicit_scope): Likewise.
	* error.c: Define INCLUDE_UNIQUE_PTR.  Include "cp-name-hint.h".
	(expr_to_string): Make non-static.
	(qualified_name_lookup_error): For the non-"::" case, take
	responsibity for issuing any suggestion from
	suggest_alternative_in_explicit_scope, as it changes from
	returning a bool to returning a name_hint.  Replace fallback call
	to suggest_alternatives_for to a call to
	suggest_alternatives_in_other_namespaces, capturing the fact that
	we don't have enough location information to issue a fix-it hint
	for this case.  Update the error to support emitting a fix-it hint
	where appropriate.  For the "::" case, take responsibility for
	issuing any suggestion from suggest_alternatives_for, supporting
	emitting a fix-it hint.
	* lex.c: Define INCLUDE_UNIQUE_PTR.  Include "gcc-rich-location.h"
	and "cp-name-hint.h".
	(unqualified_name_lookup_error): Take responsibility for issuing
	any suggestion from suggest_alternatives_for, supporting emitting
	a fix-it hint.
	* name-lookup.c (class namespace_limit_reached): New subclass of
	deferred_diagnostic.
	(class show_candidate_location): Likewise.
	(class suggest_alternatives): Likewise.
	(class namespace_hints): New class.
	(suggest_alternatives_for): Convert return type from bool to
	name_hint, replacing all direct diagnostic emission by setting
	suggestions on the return value, or creating deferred diagnostics.
	Specifically, split out initial traversal of namespaces into
	namespace_hints' ctor, and maybe_decorate_with_limit, and move the
	rest of the implementation to
	namespace_hints::convert_candidates_to_name_hint and
	suggest_alternatives_for_1.
	(namespace_hints::namespace_hints): New ctor, adapted from
	suggest_alternatives_for's initial namespace traversal, storing
	location and name, and converting locals "candidates", "limited"
	and "limit" into members.
	(namespace_hints::convert_candidates_to_name_hint): New member
	function.
	(namespace_hints::maybe_decorate_with_limit): New member function.
	(suggest_alternatives_for_1): New function, based on second half
	of old implementation of suggest_alternatives_for, converting from
	immediate emission of suggestions to using name_hint.
	(suggest_alternatives_in_other_namespaces): New function.
	(maybe_suggest_missing_std_header): Convert from immediate
	emission of suggestions to using name_hint, moving emission
	implementation to...
	(class missing_std_header): New subclass of deferred_diagnostic.
	(maybe_suggest_missing_header): Convert return type from bool to
	name_hint.
	(suggest_alternative_in_explicit_scope): Convert from immediate
	emission of suggestions to using name_hint.
	* parser.c: Replace include of "c-family/name-hint.h" with
	"cp-name-hint.h".
	(cp_parser_diagnose_invalid_type_name): Update
	"is there a suggestion" logic for change to
	name_hint::operator bool.  Take responsibility for emitting
	fix-it hints from suggest_alternative_in_explicit_scope.
	(cp_parser_namespace_name): Take responsibility for emitting
	fix-it hints from suggest_alternative_in_explicit_scope.  Don't
	emit the "expected namespace-name" error if we've already emitted
	an "is not a namespace-name" error.

gcc/testsuite/ChangeLog:
	* c-c++-common/spellcheck-reserved.c: Update expected output for
	C++ for merger of "did you mean" suggestions into the error
	message.
	* g++.dg/ext/builtin3.C: Update expected output for merger of "did
	you mean" suggestion into the error.
	* g++.dg/lookup/error1.C: Likewise.
	* g++.dg/lookup/pr77549.C: Likewise.
	* g++.dg/lookup/pr80913.C: Likewise.
	* g++.dg/lookup/suggestions1.C: Likewise.
	* g++.dg/lookup/suggestions2.C: New test.
	* g++.dg/overload/koenig1.C: Update expected output as above.
	* g++.dg/spellcheck-identifiers-2.C: Likewise.
	* g++.dg/spellcheck-identifiers.C: Likewise.
	* g++.dg/spellcheck-ns.C: New test.
	* g++.dg/spellcheck-pr77829.C: Update expected output as above.
	* g++.dg/spellcheck-pr78656.C: Likewise.
	* g++.dg/spellcheck-pr79298.C: Likewise, adding
	-fdiagnostics-show-caret to options.
	* g++.dg/spellcheck-pr80177.C: Likewise.
	* g++.dg/spellcheck-single-vs-multiple.C: New test.
	* g++.dg/spellcheck-typenames.C: Update expected output as above.
	* g++.dg/template/static10.C: Likewise.
	* g++.old-deja/g++.mike/ns5.C: Likewise.
	* g++.old-deja/g++.mike/ns7.C: Likewise.
	* g++.old-deja/g++.ns/koenig5.C: Likewise.
	* g++.old-deja/g++.other/lineno5.C: Likewise.

libstdc++-v3/ChangeLog:
	* testsuite/17_intro/using_namespace_std_exp_neg.cc: Remove
	"expected namespace-name before" error.
	* testsuite/17_intro/using_namespace_std_tr1_neg.cc: Likewise.

From-SVN: r265610
2018-10-29 23:53:50 +00:00
François Dumont 881eaae688 48101_neg.cc: Remove dg-prune-output 'std' from regex pattern for versioned namespace...
2018-10-28  François Dumont  <fdumont@gcc.gnu.org>

	* testsuite/23_containers/deque/48101_neg.cc: Remove dg-prune-output
	'std' from regex pattern for versioned namespace compatibility.
	* testsuite/23_containers/vector/48101_neg.cc: Likewise.
	* testsuite/27_io/filesystem/path/io/dr2989.cc: Likewise.

From-SVN: r265575
2018-10-28 20:57:04 +00:00
Jonathan Wakely 71e093897c PR libstdc++/87749 fix (and optimize) string move construction
The move constructor for the SSO string uses assign(const basic_string&)
when either:

(1) the source string is "local" and so the contents of the small string
buffer need to be copied, or

(2) the allocator does not propagate and is_always_equal is false.

Case (1) is suboptimal, because the assign member is not noexcept and
the compiler isn't smart enough to see it won't actually throw in this
case. This causes extra code in the move assignment operator so that any
exception will be turned into a call to std::terminate. This can be
fixed by copying small strings inline instead of calling assign.

Case (2) is a bug, because the specific instances of the allocators
could be equal even if is_always_equal is false. This can result in an
unnecessary deep copy (and potentially-throwing allocation) when the
storage should be moved. This can be fixed by simply checking if the
allocators are equal.

	PR libstdc++/87749
	* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
	(basic_string::operator=(basic_string&&)): For short strings copy the
	buffer inline. Only fall back to using assign(const basic_string&) to
	do a deep copy when reallocation is needed.
	* testsuite/21_strings/basic_string/modifiers/assign/char/87749.cc:
	New test.
	* testsuite/21_strings/basic_string/modifiers/assign/char/
	move_assign_optim.cc: New test.
	* testsuite/21_strings/basic_string/modifiers/assign/wchar_t/87749.cc:
	New test.
	* testsuite/21_strings/basic_string/modifiers/assign/wchar_t/
	move_assign_optim.cc: New test.

From-SVN: r265493
2018-10-25 16:34:04 +01:00
Marc Glisse 0f317ef762 Relocation (= move+destroy)
2018-10-25  Marc Glisse  <marc.glisse@inria.fr>

	PR libstdc++/87106
	* include/bits/alloc_traits.h (_S_construct, _S_destroy, construct,
	destroy): Add noexcept specification.
	* include/bits/allocator.h (construct, destroy): Likewise.
	* include/ext/alloc_traits.h (construct, destroy): Likewise.
	* include/ext/malloc_allocator.h (construct, destroy): Likewise.
	* include/ext/new_allocator.h (construct, destroy): Likewise.
	* include/bits/stl_uninitialized.h (__relocate_object_a, __relocate_a,
	__relocate_a_1): New functions.
	(__is_trivially_relocatable): New class.
	* include/bits/stl_vector.h (__use_relocate): New static member.
	* include/bits/vector.tcc (reserve, _M_realloc_insert,
	_M_default_append): Use __relocate_a.
	(reserve, _M_assign_aux, _M_realloc_insert, _M_fill_insert,
	_M_default_append, _M_range_insert): Move _GLIBCXX_ASAN_ANNOTATE_REINIT
	after _Destroy.
	* testsuite/23_containers/vector/modifiers/push_back/49836.cc:
	Replace CopyConsOnlyType with DelAnyAssign.

From-SVN: r265485
2018-10-25 13:03:13 +00:00
Jonathan Wakely c3ba63c314 PR libstdc++/87704 fix unique_ptr(nullptr_t) constructors
Using a delegating constructor to implement these constructors means
that they instantiate the destructor, which requires the element_type to
be complete. In C++11 and C++14 they were specified to be delegating,
but that was changed as part of LWG 2801 so in C++17 they don't require
a complete type (as was intended all along).

	PR libstdc++/87704
	* include/bits/unique_ptr.h (unique_ptr::unique_ptr(nullptr_t)): Do
	not delegate to default constructor.
	(unique_ptr<T[], D>::unique_ptr(nullptr_t)): Likewise.
	* testsuite/20_util/unique_ptr/cons/incomplete.cc: New test.

From-SVN: r265423
2018-10-23 14:10:26 +01:00
François Dumont f65c0c735e testsuite_containers.h (forward_members_unordered<>::forward_members_unordered (const value_type&)): Add local_iterator pre and post increment checks.
2018-10-20  François Dumont  <fdumont@gcc.gnu.org>

	* testsuite/util/testsuite_containers.h
	(forward_members_unordered<>::forward_members_unordered
	(const value_type&)): Add local_iterator pre and post increment checks.
	* config/abi/pre/gnu.ver: Add GLIBCXX_3.4.26 new symbol.

From-SVN: r265344
2018-10-20 20:00:45 +00:00
Jonathan Wakely f324588755 Skip tests for GNU extensions when testing with strict mode
Tests for the implicit allocator rebinding extension will fail if the
extension is disabled, so skip them.

	* testsuite/23_containers/array/requirements/explicit_instantiation/
	3.cc: Skip test when compiled with a -std=c++NN strict mode.
	* testsuite/23_containers/deque/requirements/explicit_instantiation/
	3.cc: Likewise.
	* testsuite/23_containers/forward_list/requirements/
	explicit_instantiation/3.cc: Likewise.
	* testsuite/23_containers/list/requirements/explicit_instantiation/
	3.cc: Likewise.
	* testsuite/23_containers/map/requirements/explicit_instantiation/
	3.cc: Likewise.
	* testsuite/23_containers/multimap/requirements/explicit_instantiation/
	3.cc: Likewise.
	* testsuite/23_containers/multiset/requirements/explicit_instantiation/
	3.cc: Likewise.
	* testsuite/23_containers/set/requirements/explicit_instantiation/
	3.cc: Likewise.
	* testsuite/23_containers/unordered_map/requirements/
	explicit_instantiation/3.cc: Likewise.
	* testsuite/23_containers/unordered_multimap/requirements/
	explicit_instantiation/3.cc: Likewise.
	* testsuite/23_containers/unordered_multiset/requirements/
	explicit_instantiation/3.cc: Likewise.
	* testsuite/23_containers/unordered_set/requirements/
	explicit_instantiation/3.cc: Likewise.
	* testsuite/23_containers/vector/ext_pointer/explicit_instantiation/
	3.cc: Likewise.
	* testsuite/23_containers/vector/requirements/explicit_instantiation/
	3.cc: Likewise.

From-SVN: r265334
2018-10-19 22:50:15 +01:00
Jonathan Wakely 92bab15297 Fix testsuite failures due to extra errors in strict dialects
When __STRICT_ANSI__ is defined the incorrect allocators used in these
tests also trigger and additional static assertion. Prune those extra
errors so that the tests don't fail when built with strict dialects.

	* testsuite/23_containers/deque/48101_neg.cc: Prune additional errors
	printed when __STRICT_ANSI__ is defined.
	* testsuite/23_containers/forward_list/48101_neg.cc: Likewise.
	* testsuite/23_containers/list/48101_neg.cc: Likewise.
	* testsuite/23_containers/multiset/48101_neg.cc: Likewise.
	* testsuite/23_containers/set/48101_neg.cc: Likewise.
	* testsuite/23_containers/unordered_multiset/48101_neg.cc: Likewise.
	* testsuite/23_containers/unordered_set/48101_neg.cc: Likewise.
	* testsuite/23_containers/vector/48101_neg.cc: Likewise.

From-SVN: r265333
2018-10-19 22:50:03 +01:00
Jonathan Wakely f8f3939037 Conditionally disable tests of non-standard extensions
These tests include uses of the extension to allow allocators with the
wrong value_type in containers. Skip those parts of the tests when
__STRICT_ANIS__ is defined.

	* testsuite/23_containers/forward_list/requirements/
	explicit_instantiation/5.cc [__STRICT_ANSI__]: Don't test non-standard
	extension.
	* testsuite/23_containers/list/requirements/explicit_instantiation/
	5.cc [__STRICT_ANSI__]: Likewise.
	* testsuite/23_containers/map/requirements/explicit_instantiation/5.cc
	[__STRICT_ANSI__]: Likewise.
	* testsuite/23_containers/multimap/requirements/explicit_instantiation/
	5.cc [__STRICT_ANSI__]: Likewise.
	* testsuite/23_containers/multiset/requirements/explicit_instantiation/
	5.cc [__STRICT_ANSI__]: Likewise.
	* testsuite/23_containers/set/requirements/explicit_instantiation/5.cc
	[__STRICT_ANSI__]: Likewise.
	* testsuite/23_containers/unordered_map/requirements/debug_container.cc
	[__STRICT_ANSI__]: Likewise.
	* testsuite/23_containers/unordered_map/requirements/
	explicit_instantiation/5.cc [__STRICT_ANSI__]: Likewise.
	* testsuite/23_containers/unordered_multimap/requirements/
	explicit_instantiation/5.cc [__STRICT_ANSI__]: Likewise.
	* testsuite/23_containers/unordered_multiset/requirements/
	explicit_instantiation/5.cc [__STRICT_ANSI__]: Likewise.
	* testsuite/23_containers/unordered_set/requirements/
	explicit_instantiation/5.cc [__STRICT_ANSI__]: Likewise.

From-SVN: r265332
2018-10-19 22:49:49 +01:00
Jonathan Wakely 78ed0f80c3 Fix tests that use allocators with incorrect value types
As a GNU extension we allow containers to be instantiated with
allocators that use a different value type from the container, and
automatically rebind the allocator to the correct type. This extension
is disabled in strict modes (when __STRICT_ANSI__ is defined, i.e.
-std=c++NN dialects). These testcases unintentionally rely on the
extension and so fail for strict modes.

Tests which intentionally make use of the extension will still fail in
strict dialects, but will be addressed in a later change.

	* testsuite/20_util/scoped_allocator/1.cc: Use allocator with correct
	value type for the container.
	* testsuite/23_containers/forward_list/cons/14.cc: Likewise.
	* testsuite/23_containers/map/56613.cc: Likewise.
	* testsuite/23_containers/unordered_map/55043.cc: Likewise.
	* testsuite/23_containers/unordered_map/allocator/copy.cc: Likewise.
	* testsuite/23_containers/unordered_map/allocator/copy_assign.cc:
	Likewise.
	* testsuite/23_containers/unordered_map/allocator/minimal.cc:
	Likewise.
	* testsuite/23_containers/unordered_map/allocator/move.cc: Likewise.
	* testsuite/23_containers/unordered_map/allocator/move_assign.cc:
	Likewise.
	* testsuite/23_containers/unordered_map/allocator/noexcept.cc:
	Likewise.
	* testsuite/23_containers/unordered_map/cons/81891.cc: Likewise.
	* testsuite/23_containers/unordered_map/requirements/exception/
	basic.cc: Likewise.
	* testsuite/23_containers/unordered_map/requirements/exception/
	generation_prohibited.cc: Likewise.
	* testsuite/23_containers/unordered_map/requirements/exception/
	propagation_consistent.cc: Likewise.
	* testsuite/23_containers/unordered_multimap/55043.cc: Likewise.
	* testsuite/23_containers/unordered_multimap/allocator/copy.cc:
	Likewise.
	* testsuite/23_containers/unordered_multimap/allocator/copy_assign.cc:
	Likewise.
	* testsuite/23_containers/unordered_multimap/allocator/minimal.cc:
	Likewise.
	* testsuite/23_containers/unordered_multimap/allocator/move.cc:
	Likewise.
	* testsuite/23_containers/unordered_multimap/allocator/move_assign.cc:
	Likewise.
	* testsuite/23_containers/unordered_multimap/allocator/noexcept.cc:
	Likewise.
	* testsuite/23_containers/unordered_multimap/requirements/exception/
	basic.cc: Likewise.
	* testsuite/23_containers/unordered_multimap/requirements/exception/
	generation_prohibited.cc: Likewise.
	* testsuite/23_containers/unordered_multimap/requirements/exception/
	propagation_consistent.cc: Likewise.
	* testsuite/23_containers/unordered_multimap/requirements/
	explicit_instantiation/5.cc: Likewise.
	* testsuite/ext/malloc_allocator/sanity.cc: Likewise.

From-SVN: r265331
2018-10-19 22:49:40 +01:00
Jonathan Wakely e7f2d0bdb5 Disable tests that only pass for GNU dialects
The airy and hypergeometric functions are non-standard extensions and
are only defined for -std=gnu++NN dialects, not -std=c++NN ones.

	* ext/special_functions/airy_ai/check_nan.cc: Skip test for
	non-standard extension when a strict -std=c++NN dialect is used.
	* ext/special_functions/airy_ai/check_value.cc: Likewise.
	* ext/special_functions/airy_ai/compile.cc: Likewise.
	* ext/special_functions/airy_bi/check_nan.cc: Likewise.
	* ext/special_functions/airy_bi/check_value.cc: Likewise.
	* ext/special_functions/airy_bi/compile.cc: Likewise.
	* ext/special_functions/conf_hyperg/check_nan.cc: Likewise.
	* ext/special_functions/conf_hyperg/check_value.cc: Likewise.
	* ext/special_functions/conf_hyperg/compile.cc: Likewise.
	* ext/special_functions/hyperg/check_nan.cc: Likewise.
	* ext/special_functions/hyperg/check_value.cc: Likewise.
	* ext/special_functions/hyperg/compile.cc: Likewise.

From-SVN: r265330
2018-10-19 22:49:32 +01:00
Jonathan Wakely 88412b71ee Remove duplicate tests
These tests originally existed to check the containers in C++11 mode,
when the default was C++98 mode. Now that the default is C++14 (and we
run most tests for all modes) it serves no purpose to have two copies of
the tests when neither is explicitly using -std=gnu++98 anyway.

	* testsuite/23_containers/list/requirements/explicit_instantiation/
	5_c++0x.cc: Remove redundant test that is functionally identical to
	the 5.cc test.
	* testsuite/23_containers/map/requirements/explicit_instantiation/
	5_c++0x.cc: Likewise.
	* testsuite/23_containers/multimap/requirements/explicit_instantiation/
	5_c++0x.cc: Likewise.
	* testsuite/23_containers/multiset/requirements/explicit_instantiation/
	5_c++0x.cc: Likewise.
	* testsuite/23_containers/set/requirements/explicit_instantiation/
	5_c++0x.cc: Likewise.

From-SVN: r265329
2018-10-19 22:49:19 +01:00
Jonathan Wakely 30f7c08d96 Fix compilation error with _GLIBCXX_PARALLEL
* include/bits/regex_executor.tcc (_Backref_matcher::_M_apply): Use
	_GLIBCXX_STD_A to refer to normal mode algorithms.
	* testsuite/28_regex/headers/regex/parallel_mode.cc: New test.
	* testsuite/28_regex/headers/regex/std_c++0x_neg.cc: Remove empty
	whitespace.

From-SVN: r265314
2018-10-19 14:46:24 +01:00
Jonathan Wakely 955fe731e3 Fix tests that fail when built with different options
* testsuite/20_util/duration/cons/2.cc: Add -ffloat-store to fix
	failure when compiled without optimisation.
	* testsuite/ext/profile/mutex_extensions_neg.cc: Prune additional
	errors caused by C++17 std::pmr alias templates.

From-SVN: r265287
2018-10-18 21:04:55 +01:00
Jonathan Wakely fab2c75b73 PR libstdc++/87641 correctly initialize accumulator in valarray::sum()
Use the value of the first element as the initial value of the
__valarray_sum accumulator. Value-initialization might not create the
additive identity for the value type.

Make a similar change to __valarray_product even though it's only ever
used internally with a value_type of size_t.

	PR libstdc++/87641
	* include/bits/valarray_array.h (__valarray_sum): Use first element
	to initialize accumulator instead of value-initializing it.
	(__valarray_product<_Tp>): Move to ...
	* src/c++98/valarray.cc (__valarray_product<_Tp>): Here. Use first
	element to initialize accumulator.
	(__valarray_product(const valarray<size_t>&)): Remove const_cast made
	unnecessary by LWG 389.
	* testsuite/26_numerics/valarray/87641.cc: New test.

From-SVN: r265270
2018-10-18 16:38:50 +01:00
Ville Voutilainen 4026227f21 re PR libstdc++/87619 (sizeof(std::variant) can be reduced if its variant_size is UCHAR_MAX)
PR libstdc++/87619

* include/std/variant (__select_index): Fix an off-by-one.
* testsuite/20_util/variant/87619.cc: New.

From-SVN: r265247
2018-10-17 22:08:51 +03:00
Jonathan Wakely 436ea0e5d3 Rename namespace alias in test to avoid name collision
* testsuite/experimental/net/internet/address/v4/creation.cc: Do not
	declare ip in global namespace, to avoid collision with struct ip
	defined in <netinet/ip.h>.

From-SVN: r265205
2018-10-16 17:13:00 +01:00
Jonathan Wakely 7e8b87e901 Use effective target in Networking TS tests
* testsuite/experimental/net/headers.cc: Remove dg-options.
	* testsuite/experimental/net/buffer/arithmetic.cc: Replace dg-options
	with dg-do using effective target.
	* testsuite/experimental/net/buffer/const.cc: Likewise.
	* testsuite/experimental/net/buffer/creation.cc: Likewise.
	* testsuite/experimental/net/buffer/mutable.cc: Likewise.
	* testsuite/experimental/net/buffer/size.cc: Likewise.
	* testsuite/experimental/net/buffer/traits.cc: Likewise.
	* testsuite/experimental/net/execution_context/use_service.cc:
	Likewise.
	* testsuite/experimental/net/internet/address/v4/comparisons.cc:
	Likewise.
	* testsuite/experimental/net/internet/address/v4/cons.cc: Likewise.
	* testsuite/experimental/net/internet/address/v4/creation.cc:
	Likewise.
	* testsuite/experimental/net/internet/address/v4/members.cc: Likewise.
	* testsuite/experimental/net/internet/resolver/base.cc: Likewise.
	* testsuite/experimental/net/internet/resolver/ops/lookup.cc:
	Likewise.
	* testsuite/experimental/net/internet/resolver/ops/reverse.cc:
	Likewise.
	* testsuite/experimental/net/timer/waitable/cons.cc: Likewise.
	* testsuite/experimental/net/timer/waitable/dest.cc: Likewise.
	* testsuite/experimental/net/timer/waitable/ops.cc: Likewise.

From-SVN: r265200
2018-10-16 16:37:10 +01:00
Jonathan Wakely 5ae2c32a8a Define _GLIBCXX_USE_DEV_RANDOM as replacement for _GLIBCXX_USE_RANDOM_TR1
Define and use a new macro with a more descriptive name. Only use the
old macro in <tr1/random.h>.

	* acinclude.m4 (GLIBCXX_CHECK_RANDOM_TR1): Replace with ...
	(GLIBCXX_CHECK_DEV_RANDOM): New macro with more descriptive name.
	Define _GLIBCXX_USE_DEV_RANDOM as well as _GLIBCXX_USE_RANDOM_TR1.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Use GLIBCXX_CHECK_DEV_RANDOM instead of
	GLIBCXX_CHECK_RANDOM_TR1.
	crossconfig.m4: Likewise.
	* include/bits/random.h (random_device): Use _GLIBCXX_USE_DEV_RANDOM
	instead of _GLIBCXX_USE_RANDOM_TR1.
	* testsuite/26_numerics/random/random_device/cons/token.cc: Likewise.

From-SVN: r265197
2018-10-16 15:49:29 +01:00
Rainer Orth 630f2da967 Introduce dg-add-options net_ts
* testsuite/lib/dg-options.exp (add_options_for_net_ts): New proc.
	* testsuite/experimental/net/internet/address/v4/comparisons.cc:
	Add dg-add-options net_ts.
	* testsuite/experimental/net/internet/address/v4/cons.cc: Likewise.
	* testsuite/experimental/net/internet/address/v4/creation.cc: Likewise.
	* testsuite/experimental/net/internet/address/v4/members.cc: Likewise.
	* testsuite/experimental/net/internet/resolver/base.cc: Likewise.
	* testsuite/experimental/net/internet/resolver/ops/lookup.cc: Likewise.
	* testsuite/experimental/net/internet/resolver/ops/reverse.cc: Likewise.

From-SVN: r265192
2018-10-16 12:27:52 +00:00
Jonathan Wakely b57d432bdd Fix tests that fail when compiled without optimisation
* testsuite/20_util/duration/literals/range_neg.cc: Adjust pruned
	diagnostic to account for quotes around 'constexpr'.
	* testsuite/23_containers/deque/capacity/max_size.cc: Define static
	variable.
	* testsuite/23_containers/vector/capacity/max_size.cc: Likewise.

From-SVN: r265190
2018-10-16 13:06:05 +01:00
Jonathan Wakely d30096b45f PR libstdc++/87618 fix typos in linker script
PR libstdc++/87618
	* config/abi/pre/gnu.ver: Fix typos in patterns for basic_stringbuf.
	* testsuite/27_io/basic_stringbuf/cons/char/default.cc: Disable
	optimisation to check constructor definition can be linked to.
	* testsuite/27_io/basic_stringbuf/cons/wchar_t/default.cc: Likewise.

From-SVN: r265188
2018-10-16 12:14:37 +01:00
Jonathan Wakely b219eb0378 Adjust test to pass with latest glibc
Glibc changed the it_IT locales to use thousands separators,
invalidating this test. Use nl_NL instead, as Dutch only uses grouping
for money not numbers.

	* testsuite/22_locale/numpunct/members/char/3.cc: Adjust test to
	account for change to glibc it_IT localedata (glibc bz#10797).

From-SVN: r265165
2018-10-15 14:55:42 +01:00
Jonathan Wakely e5989e71ff Initial commit of Networking TS implementation
* include/Makefile.am: Add new headers.
	* include/Makefile.in: Regenerate.
	* include/experimental/bits/net.h: New header for common
	implementation details of Networking TS.
	* include/experimental/buffer: New header.
	* include/experimental/executor: New header.
	* include/experimental/internet: New header.
	* include/experimental/io_context: New header.
	* include/experimental/net: New header.
	* include/experimental/netfwd: New header.
	* include/experimental/socket: New header.
	* include/experimental/timer: New header.
	* testsuite/experimental/net/buffer/arithmetic.cc: New test.
	* testsuite/experimental/net/buffer/const.cc: New test.
	* testsuite/experimental/net/buffer/creation.cc: New test.
	* testsuite/experimental/net/buffer/mutable.cc: New test.
	* testsuite/experimental/net/buffer/size.cc: New test.
	* testsuite/experimental/net/buffer/traits.cc: New test.
	* testsuite/experimental/net/execution_context/use_service.cc: New
	test.
	* testsuite/experimental/net/headers.cc: New test.
	* testsuite/experimental/net/internet/address/v4/comparisons.cc: New
	test.
	* testsuite/experimental/net/internet/address/v4/cons.cc: New test.
	* testsuite/experimental/net/internet/address/v4/creation.cc: New
	test.
	* testsuite/experimental/net/internet/address/v4/members.cc: New
	test.
	* testsuite/experimental/net/internet/resolver/base.cc: New test.
	* testsuite/experimental/net/internet/resolver/ops/lookup.cc: New
	test.
	* testsuite/experimental/net/internet/resolver/ops/reverse.cc: New
	test.
	* testsuite/experimental/net/timer/waitable/cons.cc: New test.
	* testsuite/experimental/net/timer/waitable/dest.cc: New test.
	* testsuite/experimental/net/timer/waitable/ops.cc: New test.

From-SVN: r265080
2018-10-12 11:50:15 +01:00
Jonathan Wakely 49cb790a4c PR libstdc++/77691 increase allocation size to at least alignment
It's not safe to assume that malloc(n) returns memory aligned to more
than n, so when relying on the guaranteed alignment of malloc ensure
that the number of bytes allocated is at least as large as the
alignment.

	PR libstdc++/77691
	* include/experimental/memory_resource (__resource_adaptor_imp): Do
	not allocate sizes smaller than alignment when relying on guaranteed
	alignment.
	* testsuite/experimental/memory_resource/new_delete_resource.cc:
	Adjust expected number of bytes allocated for alignof(max_align_t).

From-SVN: r265068
2018-10-12 00:21:11 +01:00
Jonathan Wakely cfef4c324a PR libstdc++/80538 Only call sleep for non-zero values
Avoid a system call when no sleep is required. Sleep in a loop (actually
two loops) to handle interruption by signals.

	PR libstdc++/80538
	* src/c++11/thread.cc (this_thread::__sleep_for)
	[_GLIBCXX_HAVE_SLEEP]: Only call sleep for non-zero values.
	Loop while sleep call is interrupted and until steady_clock
	shows requested duration has elapsed.
	(!_GLIBCXX_HAVE_USLEEP]: Use the _GLIBCXX_HAVE_SLEEP code path, but
	avoiding the usleep call.
	* testsuite/30_threads/this_thread/60421.cc: Test repeated
	signal interruptions.

From-SVN: r265044
2018-10-11 17:37:23 +01:00
Jonathan Wakely c7790bdbd9 Make ext allocators support heterogeneous equality comparison
The Allocator requirements include the ability to compare different
specializations of the same allocator class template. This did not work
for __gnu_cxx::new_allocator and other extension allocators.  This patch
replaces the equality operators for those allocators with inline friends
that support heterogeneous comparisons.  (I'm not changing all ext
allocators because some are bit-rotted already).

Additionally, the equality operators for comparing two std::allocator
objects of the same type are now defined as inline friends. Those
overloads don't need to be declared at namespace scope, because they
aren't specified in the standard (but they're needed in this
implementation to avoid ambiguities caused by the extra overloads
defined for the base allocator type).

	* include/bits/allocator.h
	(operator==(const allocator<_Tp>&, const allocator<_Tp>))
	(operator!=(const allocator<_Tp>&, const allocator<_Tp>)): Replace
	with inline friends.
	* include/ext/debug_allocator.h (operator==, operator!=): Replace
	with inline friend functions that compare to rebound allocators.
	* include/ext/malloc_allocator.h (operator==, operator!=): Likewise.
	* include/ext/new_allocator.h (operator==, operator!=): Likewise.
	* testsuite/ext/debug_allocator/eq.cc: New test.
	* testsuite/ext/ext_pointer/alloc_eq.cc: New test.
	* testsuite/ext/malloc_allocator/eq.cc: New test.
	* testsuite/ext/new_allocator/eq.cc: New test.

From-SVN: r265036
2018-10-11 12:32:29 +01:00
Jonathan Wakely 422a9f7789 PR libstdc++/87544 limit max_size() to PTRDIFF_MAX / sizeof(T)
The C++17 standard requires the default implementation for
allocator_traits::max_size to return SIZE_MAX / sizeof(value_type).
That causes GCC to warn because the value could be larger than can
sensibly be passed to malloc. This patch changes the new_allocator and
malloc_allocator max_size() members to use PTRDIFF_MAX instead of
SIZE_MAX (and because they define it, the allocator_traits default isn't
used). This also changes vector::max_size to impose a sensible limit
using PTRDIFF_MAX for cases where the value from the allocator or
allocator_traits is not sensible.

	PR libstdc++/87544
	* include/bits/stl_vector.h (vector::_S_max_size): Limit size to
	PTRDIFF_MAX / sizeof(value_type).
	* include/ext/malloc_allocator.h (malloc_allocator::max_size):
	Likewise.
	* include/ext/new_allocator.h (new_allocator::max_size): Likewise.
	* testsuite/23_containers/vector/allocator/minimal.cc: Adjust
	expected value for max_size().
	* testsuite/23_containers/vector/capacity/87544.cc: New test.

From-SVN: r265021
2018-10-10 16:39:33 +01:00
Jonathan Wakely aca0dcde1f PR libstdc++/87538 Verify fix for std::experimental::not_fn
PR libstdc++/87538
	* testsuite/experimental/functional/87538.cc: New test.

From-SVN: r264922
2018-10-08 13:17:58 +01:00
Jonathan Wakely 606f6be67b PR libstdc++/87538 fix std::not_fn exception specifications
PR libstdc++/87538
	* include/std/functional (_Not_fn::operator()): Check value of
	__is_nothrow_invocable as well.
	* testsuite/20_util/function_objects/not_fn/87538.cc: New test.

From-SVN: r264921
2018-10-08 13:07:22 +01:00
Joseph Myers 1c02928295 Use -fno-show-column in libstdc++ installed testing.
<https://gcc.gnu.org/ml/libstdc++/2016-08/msg00006.html> arranged for
libstdc++ tests to use -fno-show-column by default, but only for
build-tree testing.  This patch adds it to the options used for
installed testing as well.

Tested with installed testing for a cross to x86_64-linux-gnu, where
it fixes various test failures.

	* testsuite/lib/libstdc++.exp (libstdc++_init): Use
	-fno-show-column in default cxxflags.

From-SVN: r264784
2018-10-02 13:46:32 +01:00
François Dumont 9b29794962 re PR libstdc++/87135 ([C++17] unordered containers violate iterator validity requirements)
2018-09-21  François Dumont  <fdumont@gcc.gnu.org>

	PR libstdc++/87135
	* src/c++11/hashtable_c++0x.cc (_Prime_rehash_policy::_M_next_bkt):
	Use __builtin_floor to compute _M_next_resize.
	* testsuite/23_containers/unordered_set/hash_policy/71181.cc: Adapt.
	* testsuite/23_containers/unordered_set/hash_policy/prime_rehash.cc:
	Adapt.

From-SVN: r264494
2018-09-21 20:39:07 +00:00
Jonathan Wakely ac51f07ad2 Un-split hypot<long double> tests
Remove the hypot-long-double.cc file that used dg-xfail-run-if and
simply use the lower tolerance for double if long double is not larger
than double.

	* testsuite/26_numerics/headers/cmath/hypot-long-double.cc: Remove.
	* testsuite/26_numerics/headers/cmath/hypot.cc: Restore test for
	long double unconditionally, but use lower tolerance when
	sizeof(long double) == sizeof(double).

From-SVN: r264483
2018-09-21 16:36:53 +01:00
Christophe Lyon eb3f731774 hypot-long-double.cc: Skip on arm*.
2018-09-20  Christophe Lyon  <christophe.lyon@linaro.org>

	* testsuite/26_numerics/headers/cmath/hypot-long-double.cc: Skip
	on arm*.

From-SVN: r264443
2018-09-20 19:09:31 +02:00
François Dumont a521e62615 re PR libstdc++/87135 ([C++17] unordered containers violate iterator validity requirements)
2018-09-18  François Dumont  <fdumont@gcc.gnu.org>

	PR libstdc++/87135
	* src/c++11/hashtable_c++0x.cc:
	(_Prime_rehash_policy::_M_next_bkt): Return a prime no smaller than
	requested size, but not necessarily greater.
	(_Prime_rehash_policy::_M_need_rehash): Rehash only if target size is
	strictly greater than next resize threshold.
	* testsuite/23_containers/unordered_map/modifiers/reserve.cc: Adapt test
	to validate that there is no rehash as long as number of insertion is
	lower or equal to the reserved number of elements.

From-SVN: r264413
2018-09-18 20:36:16 +00:00
Jonathan Wakely a12c16de52 Fix location of invocable check for unique_ptr deleter
The deleter only needs to be invocable when the unique_ptr destructor
and reset member function are instantiated. In other contexts it might
not be possible to pass unique_ptr<T, D>::pointer to the deleter, if
that requires a derived-to-base conversion from T* and T is incomplete.

	* include/bits/unique_ptr.h (__uniq_ptr_impl): Remove static assertion
	checking invocable condition.
	(unique_ptr::~unique_ptr, unique_ptr::reset): Restore static assertion
	here, where types must be complete. Pass pointer to deleter as an
	rvalue.
	* testsuite/20_util/unique_ptr/requirements/incomplete.cc: New test.

From-SVN: r264399
2018-09-18 17:05:36 +01:00
Jonathan Wakely 9e2d426c17 PR libstdc++/87278 restore support for std::make_shared<volatile T>()
PR libstdc++/87278
	* include/bits/shared_ptr.h (make_shared): Use remove_cv instead of
	remove_const.
	* testsuite/20_util/shared_ptr/creation/87278.cc: New test.

From-SVN: r264207
2018-09-11 12:50:39 +01:00
Jonathan Wakely 86fc6ec9f3 Implement LWG 2905 changes to constrain unique_ptr constructors
LWG DR 2905 says that is_constructible_v<unique_ptr<P, D>, P, D const &>
should be false when D is not copy constructible. This commit implements
the changes from the DR and simplifies the signatures as per
https://github.com/cplusplus/draft/issues/1530

	* include/bits/unique_ptr.h (__uniq_ptr_impl): Add assertions to
	check deleter type.
	(unique_ptr::unique_ptr(pointer, const deleter_type&)): Add copy
	constructible constraint.
	(unique_ptr::unique_ptr(pointer, deleter_type&&)): Disable for
	deleters of reference type and add move constructible constraint.
	(unique_ptr::unique_ptr(pointer, remove_reference_t<deleter_type>&&)):
	Disable for deleters of non-reference type. Define as deleted.
	(unique_ptr<T[], D>): Likewise.
	* testsuite/20_util/unique_ptr/assign/48635_neg.cc: Replace dg-error
	directives with unstable line numbers with dg-prune-output.
	* testsuite/20_util/unique_ptr/cons/cv_qual_neg.cc: Likewise.
	* testsuite/20_util/unique_ptr/cons/lwg2905.cc: New test.
	* testsuite/20_util/unique_ptr/specialized_algorithms/swap_cxx17.cc:
	Make deleter types invocable.

From-SVN: r264206
2018-09-11 11:55:49 +01:00
Jonathan Wakely d4baef5be8 PR libstdc++/78179 run long double tests separately
Split the long double testing into a separate file, so that we can XFAIL
targets where the long double precision doesn't meet the expected
tolerances. The float and double tests are still expefted to PASS for
all targets.

	PR libstdc++/78179
	* testsuite/26_numerics/headers/cmath/hypot-long-double.cc: New test
	that runs the long double part of hypot.cc.
	* testsuite/26_numerics/headers/cmath/hypot.cc: Disable long double
	tests unless TEST_HYPOT_LONG_DOUBLE is defined.

From-SVN: r264063
2018-09-03 15:54:28 +01:00
Jonathan Wakely 83a840a91f PR libstdc++/87194 fix range insertion into maps and sets
Since C++11 range insertion and construction of maps and sets from a
pair of iterators only requires that the iterator's value_type is
convertible to the container's value_type (previously it had to be the
same).

This fixes the implementation to meet that relaxed requirement, by
defining a pair of overloads that either insert or emplace, depending on
the iterator's value_type. Instead of adding yet another overload of
_M_insert_unique and _M_insert_equal, the overloads taking iterators are
renamed to _M_insert_range_unique and _M_insert_range_equal.

	PR libstdc++/87194
	* include/bits/stl_map.h
	(map::map(initializer_list<value_type>, const Compare&, const Alloc&))
	(map::map(initializer_list<value_type>, const Alloc&))
	(map::map(InputIterator, InputIterator, const Alloc&))
	(map::map(InputIterator, InputIterator))
	(map::map(InputIterator, InputIterator, const Compare&, const Alloc&))
	(map::insert(InputIterator, InputIterator)):
	Call _M_insert_range_unique instead of _M_insert_unique.
	* include/bits/stl_multimap.h
	(multimap::multimap(initializer_list<value_type>, const C&, const A&))
	(multimap::multimap(initializer_list<value_type>, const A&))
	(multimap::multimap(InputIterator, InputIterator, const A&))
	(multimap::multimap(InputIterator, InputIterator))
	(multimap::multimap(InputIterator, InputIterator, const C&, const A&))
	(multimap::insert(InputIterator, InputIterator)): Call
	_M_insert_range_equal instead of _M_insert_equal.
	* include/bits/stl_multiset.h
	(multiset::multiset(InputIterator, InputIterator))
	(multiset::multiset(InputIterator, InputIterator, const C&, const A&))
	(multiset::multiset(initializer_list<value_type>, const C&, const A&))
	(multiset::multiset(initializer_list<value_type>, const A&))
	(multiset::multiset(InputIterator, InputIterator, const A&))
	(multiset::insert(InputIterator, InputIterator)): Call
	_M_insert_range_equal instead of _M_insert_equal.
	* include/bits/stl_set.h
	(set::set(InputIterator, InputIterator))
	(set::set(InputIterator, InputIterator, const Compare&, const Alloc&))
	(set::set(initializer_list<value_type>, const Compare&, const Alloc&))
	(set::set(initializer_list<value_type>, const Alloc&))
	(set::set(InputIterator, InputIterator, const Alloc&))
	(set::insert(InputIterator, InputIterator)):
	Call _M_insert_range_unique instead of _M_insert_unique.
	* include/bits/stl_tree.h
	[__cplusplus >= 201103L] (_Rb_tree::__same_value_type): New alias
	template for SFINAE constraints.
	[__cplusplus >= 201103L] (_Rb_tree::_M_insert_range_unique): Pair of
	constrained overloads that either insert or emplace, depending on
	iterator's value_type.
	[__cplusplus >= 201103L] (_Rb_tree::_M_insert_range_equal): Likewise.
	[__cplusplus < 201103L] (_Rb_tree::_M_insert_range_unique)
	(_Rb_tree::_M_insert_range_equal): New functions replacing range
	versions of _M_insert_unique and _M_insert_equal.
	(_Rb_tree::_M_insert_unique(_InputIterator, _InputIterator))
	(_Rb_tree::_M_insert_equal(_InputIterator, _InputIterator)): Remove.
	* testsuite/23_containers/map/modifiers/insert/87194.cc: New test.
	* testsuite/23_containers/multimap/modifiers/insert/87194.cc: New test.
	* testsuite/23_containers/multiset/modifiers/insert/87194.cc: New test.
	* testsuite/23_containers/set/modifiers/insert/87194.cc: New test.

From-SVN: r264060
2018-09-03 15:25:25 +01:00
Jonathan Wakely bc62e155e4 PR libstdc++/78595 implement insertion into maps in terms of emplace
C++14 simplified the specification of the generic insert function
templates to be equivalent to calling emplace (or emplace_hint).
Defining them in terms of emplace takes care of the problems described
in PR 78595, ensuring a single conversion to value_type is done at the
right time.

	PR libstdc++/78595
	* include/bits/stl_map.h (map::insert(_Pair&&))
	(map::insert(const_iterator, _Pair&&)): Do emplace instead of insert.
	* include/bits/stl_multimap.h (multimap::insert(_Pair&&))
	(multimap::insert(const_iterator, _Pair&&)): Likewise.
	* include/bits/unordered_map.h (unordered_map::insert(_Pair&&))
	(unordered_map::insert(const_iterator, _Pair&&))
	(unordered_multimap::insert(_Pair&&))
	(unordered_multimap::insert(const_iterator, _Pair&&)): Likewise.
	* testsuite/23_containers/map/modifiers/insert/78595.cc: New test.
	* testsuite/23_containers/multimap/modifiers/insert/78595.cc: New test.
	* testsuite/23_containers/unordered_map/modifiers/78595.cc: New test.
	* testsuite/23_containers/unordered_multimap/modifiers/78595.cc: New
	test.

From-SVN: r264059
2018-09-03 15:25:12 +01:00
François Dumont b101633fa6 2018-09-02 François Dumont <fdumont@gcc.gnu.org>
* include/debug/safe_iterator.h
	(_Safe_iterator<_It, _Seq, _Cat>::_Self): New.
	(_Safe_iterator<_It, _Seq, std::random_access_iterator_tag>::_Self):
	New.
	(_Safe_iterator<_It, _Seq, std::random_access_iterator_tag>
	::_OtherSelf): New.
	(_GLIBCXX_DEBUG_VERIFY_OPERANDS, _GLIBCXX_DEBUG_VERIFY_EQ_OPERANDS)
	(_GLIBCXX_DEBUG_VERIFY_REL_OPERANDS)
	(_GLIBCXX_DEBUG_VERIFY_DIST_OPERANDS): Define macros.
	(_Safe_iterator<_It, _Seq, std::random_access_iterator_tag>
	::operator+(difference_type)): Use latters, inline as friend.
	(_Safe_iterator<_It, _Seq, std::random_access_iterator_tag>
	::operator-(difference_type)): Likewise.
	(operator==(const _Safe_iterator<>&, const _Safe_iterator<>&)):
	Likewise.
	(operator!=(const _Safe_iterator<>&, const _Safe_iterator<>&)):
	Likewise.
	(operator<(const _Safe_iterator<>&, const _Safe_iterator<>&)): Likewise.
	(operator<=(const _Safe_iterator<>&, const _Safe_iterator<>&)):
	Likewise.
	(operator>(const _Safe_iterator<>&, const _Safe_iterator<>&)): Likewise.
	(operator>=(const _Safe_iterator<>&, const _Safe_iterator<>&)):
	Likewise.
	(operator-(const _Safe_iterator<>&, const _Safe_iterator<>&)): Likewise.
	(operator+(difference_type, const _Safe_iterator<>&)): Likewise.
	(operator-(const _Safe_iterator<>&, difference_type)): Likewise.
	* include/debug/safe_iterator.tcc
	(_Safe_iterator<>::_M_can_advance(difference_type)): Take parameter by
	copy.
	* include/debug/safe_local_iterator.h
	(_Safe_local_iterator<_It, _Seq>::_Self): New.
	(_Safe_local_iterator<_It, _Seq>::_OtherSelf): New.
	(_GLIBCXX_DEBUG_VERIFY_OPERANDS): Define macro.
	(operator==(const _Safe_local_iterator<>&,
	const _Safe_local_iterator<>&)): Use latter, inline as friend.
	(operator!=(const _Safe_local_iterator<>&,
	const _Safe_local_iterator<>&)): Likewise.
	* testsuite/util/testsuite_containers.h: Include utility.
	(struct forward_members_unordered<_Tp, bool>): Remove 2nd template
	parameter.
	(forward_members_unordered<>::forward_members_unordered(value_type&)):
	Add using namespace std::rel_ops.
	Add iterator_concept_checks on local_iterator and const_local_iterator.
	Add asserts on comparison between const_local_iterator and
	local_iterator.
	(struct forward_members_unordered<_Tp, false>): Remove partial
	specialization.
	* testsuite/23_containers/forward_list/types/1.cc: New.
	* testsuite/23_containers/list/types/1.cc: New.

From-SVN: r264039
2018-09-02 10:20:57 +00:00
Sandra Loosemore 6cec3c81a7 10.cc: Add dg-require-fileio.
2018-08-31  Sandra Loosemore  <sandra@codesourcery.com>

	libstdc++-v3/

	* testsuite/21_strings/basic_string/inserters_extractors/wchar_t/10.cc:
	Add dg-require-fileio.
	* testsuite/21_strings/basic_string/inserters_extractors/wchar_t/11.cc:
	Likewise.
	* testsuite/21_strings/basic_string/inserters_extractors/wchar_t/5.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/inserters/wchar_t/2.cc:
	Likewise.
	* testsuite/25_algorithms/copy/streambuf_iterators/wchar_t/4.cc:
	Likewise.
	* testsuite/25_algorithms/find/istreambuf_iterators/wchar_t/2.cc:
	Likewise.
	* testsuite/27_io/basic_filebuf/close/wchar_t/12790-1.cc: Likewise.
	* testsuite/27_io/basic_filebuf/close/wchar_t/12790-2.cc: Likewise.
	* testsuite/27_io/basic_filebuf/close/wchar_t/12790-3.cc: Likewise.
	* testsuite/27_io/basic_filebuf/close/wchar_t/12790-4.cc: Likewise.
	* testsuite/27_io/basic_filebuf/seekoff/wchar_t/11543.cc: Likewise.
	* testsuite/27_io/basic_filebuf/seekoff/wchar_t/12790-1.cc:
	Likewise.
	* testsuite/27_io/basic_filebuf/seekoff/wchar_t/12790-2.cc:
	Likewise.
	* testsuite/27_io/basic_filebuf/seekoff/wchar_t/12790-3.cc:
	Likewise.
	* testsuite/27_io/basic_filebuf/seekoff/wchar_t/12790-4.cc:
	Likewise.
	* testsuite/27_io/basic_filebuf/seekpos/wchar_t/12790-1.cc:
	Likewise.
	* testsuite/27_io/basic_filebuf/seekpos/wchar_t/12790-2.cc:
	Likewise.
	* testsuite/27_io/basic_filebuf/seekpos/wchar_t/12790-4.cc:
	Likewise.
	* testsuite/27_io/basic_filebuf/underflow/wchar_t/2.cc: Likewise.
	* testsuite/27_io/basic_filebuf/underflow/wchar_t/3.cc: Likewise.
	* testsuite/27_io/basic_ifstream/cons/wchar_t/1.cc: Likewise.
	* testsuite/27_io/basic_ifstream/open/wchar_t/1.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_character/wchar_t/4.cc:
	Likewise.
	* testsuite/27_io/basic_istream/extractors_other/wchar_t/2.cc:
	Likewise.
	* testsuite/27_io/basic_istream/get/wchar_t/2.cc: Likewise.
	* testsuite/27_io/basic_istream/getline/wchar_t/5.cc: Likewise.
	* testsuite/27_io/basic_istream/ignore/wchar_t/2.cc: Likewise.
	* testsuite/27_io/basic_istream/ignore/wchar_t/3.cc: Likewise.
	* testsuite/27_io/basic_istream/seekg/wchar_t/sstream.cc: Likewise.
	* testsuite/27_io/basic_istream/tellg/wchar_t/sstream.cc: Likewise.
	* testsuite/27_io/basic_ofstream/cons/wchar_t/1.cc: Likewise.
	* testsuite/27_io/basic_ofstream/open/wchar_t/1.cc: Likewise.
	* testsuite/27_io/basic_ostream/inserters_other/wchar_t/1.cc:
	Likewise.
	* testsuite/27_io/objects/wchar_t/10.cc: Likewise.
	* testsuite/27_io/objects/wchar_t/12048-1.cc: Likewise.
	* testsuite/27_io/objects/wchar_t/12048-2.cc: Likewise.
	* testsuite/27_io/objects/wchar_t/12048-3.cc: Likewise.
	* testsuite/27_io/objects/wchar_t/12048-4.cc: Likewise.
	* testsuite/27_io/objects/wchar_t/12048-5.cc: Likewise.
	* testsuite/experimental/string_view/inserters/wchar_t/2.cc:
	Likewise.
	* testsuite/ext/stdio_sync_filebuf/wchar_t/1.cc: Likewise.

From-SVN: r264022
2018-08-31 15:09:47 -04:00
Sandra Loosemore 24ce3d9485 noexcept30.C: Make dependence on -fdelete-null-pointer-checks explicit.
2018-08-30  Sandra Loosemore  <sandra@codesourcery.com>

	gcc/testsuite/
	* g++.dg/cpp0x/noexcept30.C: Make dependence on
	-fdelete-null-pointer-checks explicit.
	* g++.dg/cpp1y/constexpr-82218.C: Likewise.
	* g++.dg/expr/pmf-3.C: Likewise.
	* g++.dg/ext/attr-returns-nonnull.C: Likewise.
	* g++.dg/tree-ssa/lifetime-dse1.C: Likewise.
	* g++.dg/tree-ssa/pr61034.C: Likewise.
	* gcc.dg/addr_equal-1.c: Likewise.
	* gcc.dg/ipa/pr85734.c: Likewise.
	* gcc.dg/ipa/propmalloc-1.c: Likewise.
	* gcc.dg/ipa/propmalloc-2.c: Likewise.
	* gcc.dg/ipa/propmalloc-3.c: Likewise.
	* gcc.dg/tree-ssa/pr78154.c: Likewise.
	* gcc.dg/tree-ssa/pr83648.c: Likewise.

	libstdc++-v3/
	* testsuite/experimental/propagate_const/observers/1.cc: Make
	dependence on -fdelete-null-pointer-checks explicit.

From-SVN: r264001
2018-08-30 17:27:44 -04:00
Jonathan Wakely 2fb17d2d90 Avoid undefined shifts in ceil2 operations
For values where the result cannot be represented the shift width would
be equal to the width of the type, which is undefined. Perform two
well-defined shifts instead of one possible undefined shift.

	* include/bits/hashtable_policy.h (__clp2): Fix calculation for LLP64
	targets where sizeof(size_t) > sizeof(long). Avoid undefined shifts
	of the number of bits in the type.
	* include/std/bit (__ceil2): Avoid undefined shifts.
	* testsuite/26_numerics/bit/bit.pow.two/ceil2.cc: Test values with
	the most signifiant bit set.

From-SVN: r263986
2018-08-30 16:07:35 +01:00
Jonathan Wakely 4a559e91b1 Fix __gnu_cxx::_Pointer_adapter for long long arithmetic
* include/ext/pointer.h (_Pointer_adapter): Define operators for
	pointer arithmetic using long long offsets.
	* testsuite/ext/ext_pointer/1.cc: Test pointer arithmetic using
	long long values.

From-SVN: r263976
2018-08-30 13:24:06 +01:00
Jonathan Wakely 9111b08384 PR libstdc++/31413 fix test failure on Debian systems
Debian uses a different D_FMT string for the zh_TW.UTF-8 locale, which
caused this test to fail. Try to detect the Debian format and adjust
the input being tested.

	PR libstdc++/31413
	* testsuite/22_locale/time_get/get_date/wchar_t/4.cc: Check D_FMT
	string for alternative format.

From-SVN: r263948
2018-08-29 11:05:55 +01:00
Jonathan Wakely dd35da2cbe PR libstdc++/87116 fix path::lexically_normal() handling of dot-dot
Previously the logic that turned "a/b/c/../.." into "a/" failed to
preserve an empty path at the end of the iteration sequence, as required
by the trailing slash. That meant the result didn't meet the class
invariants, and that "a/b/c/d/../../.." would remove four components
instead of the three that "../../.." should remove.

	PR libstdc++/87116
	* src/filesystem/std-path.cc (path::lexically_normal): When handling
	a dot-dot filename, preserve an empty final component in the iteration
	sequence.
	[_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Use preferred-separator for
	root-directory.
	* testsuite/27_io/filesystem/path/generation/normal.cc: Add new tests
	for more than two adjacent dot-dot filenames.
	[_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Replace slashes with
	preferred-separator in expected normalized strings.

From-SVN: r263922
2018-08-28 16:33:53 +01:00
Jonathan Wakely 9ca2ac699a Forward declare debug containers so std::pmr aliases work
Prior to this change, including a <debug/xxx> header when _GLIBCXX_DEBUG
is also defined would fail to compile in C++17 or later. The <debug/xxx>
header would include the standard <xxx> header which defined
std::pmr::xxx as an alias for std::xxx. But in Debug Mode std::xxx
refers to std::__debug::xxx which has not been defined yet (because it
is in <debug/xxx> after the inclusion of <xxx>).

This adds declarations of the debug containers before including the
non-Debug Mode <xxx> header, so that the std::pmr::xxx aliases work.

	* include/debug/deque (std::__debug::deque): Declare.
	* include/debug/forward_list (std::__debug::forward_list): Declare.
	* include/debug/list (std::__debug::list): Declare.
	* include/debug/map (std::__debug::map): Declare.
	* include/debug/set (std::__debug::set): Declare.
	* include/debug/unordered_map (std::__debug::unordered_map): Declare.
	* include/debug/unordered_set (std::__debug::unordered_set): Declare.
	* include/debug/vector (std::__debug::vector): Declare.
	* testsuite/23_containers/deque/types/pmr_typedefs_debug.cc: New test.
	* testsuite/23_containers/forward_list/pmr_typedefs_debug.cc: New
	test.
	* testsuite/23_containers/list/pmr_typedefs_debug.cc: New test.
	* testsuite/23_containers/map/pmr_typedefs_debug.cc: New test.
	* testsuite/23_containers/multimap/pmr_typedefs_debug.cc: New test.
	* testsuite/23_containers/multiset/pmr_typedefs_debug.cc: New test.
	* testsuite/23_containers/set/pmr_typedefs_debug.cc: New test.
	* testsuite/23_containers/unordered_map/pmr_typedefs_debug.cc: New
	test.
	* testsuite/23_containers/unordered_multimap/pmr_typedefs_debug.cc:
	New test.
	* testsuite/23_containers/unordered_multiset/pmr_typedefs_debug.cc:
	New test.
	* testsuite/23_containers/unordered_set/pmr_typedefs_debug.cc: New
	test.
	* testsuite/23_containers/vector/cons/destructible_debug_neg.cc:
	Adjust dg-error lineno.
	* testsuite/23_containers/vector/types/pmr_typedefs_debug.cc: New
	test.

From-SVN: r263839
2018-08-24 18:43:18 +01:00
Jonathan Wakely 763ef11bff Fix failure when -fno-rtti test is run in C++17 or later
* testsuite/util/testsuite_allocator.h (__gnu_test::memory_resource):
	Only define when RTTI is enabled.

From-SVN: r263820
2018-08-23 20:27:54 +01:00
Jonathan Wakely c07870270a Fix C++98 tests to not use C++11 features.
* testsuite/25_algorithms/partial_sort_copy/debug/irreflexive_neg.cc:
	Fix C++98 test to not use C++11 features.
	* testsuite/25_algorithms/fill_n/2.cc: Likewise.

From-SVN: r263815
2018-08-23 16:10:45 +01:00
Jonathan Wakely 3eb1eda1c8 Fix testsuite failures for __gnu_debug::string with old ABI
The __gnu_debug string (mostly) implements the C++11 API, but when it
wraps the old COW string many of the member functions in the base class
have the wrong parameter types or return types. This makes the
__gnu_debug::string type adapt itself to the base class API. This
actually makes the debug string slightly more conforming than the
underlying string type when using the old ABI.

	* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
	(basic_string::__const_iterator): Change access to protected.
	[!_GLIBCXX_USE_CXX11_ABI] (basic_string::__const_iterator): Define
	as typedef for iterator.
	* include/debug/string (__const_iterator): Use typedef from base.
	(insert(const_iterator, _CharT))
	(replace(const_iterator, const_iterator, const basic_string&))
	(replace(const_iterator, const_iterator, const _CharT*, size_type))
	(replace(const_iterator, const_iterator, const CharT*))
	(replace(const_iterator, const_iterator, size_type, _CharT))
	(replace(const_iterator, const_iterator, _InputIter, _InputIter))
	(replace(const_iterator, const_iterator, initializer_list<_CharT>)):
	Change const_iterator parameters to __const_iterator.
	(insert(iterator, size_type, _CharT)): Add C++98 overload.
	(insert(const_iterator, _InputIterator, _InputIterator)): Change
	const_iterator parameter to __const_iterator.
	[!_GLIBCXX_USE_CXX11_ABI]: Add workaround for incorrect return type
	of base's member function.
	(insert(const_iterator, size_type, _CharT)) [!_GLIBCXX_USE_CXX11_ABI]:
	Likewise.
	(insert(const_iterator, initializer_list<_CharT>))
	[!_GLIBCXX_USE_CXX11_ABI]: Likewise.
	* testsuite/21_strings/basic_string/init-list.cc: Remove effective
	target directive.

From-SVN: r263808
2018-08-23 11:51:52 +01:00
Jonathan Wakely 0aa2934aaa Remove C++14-isms from C++11 tests
* testsuite/20_util/reference_wrapper/lwg2993.cc: Fix C++11 test to
	not use C++14 feature.
	* testsuite/23_containers/list/68222_neg.cc: Likewise.

From-SVN: r263801
2018-08-23 09:26:22 +01:00
Jonathan Wakely 75224273c3 Skip tests that depend on the cxx11 std::string
* testsuite/21_strings/basic_string/init-list.cc:
	Require cxx11-abi.
	* testsuite/experimental/polymorphic_allocator/pmr_typedefs_match.cc:
	Likewise.
	* testsuite/experimental/polymorphic_allocator/pmr_typedefs_string.cc:
	Likewise.

From-SVN: r263800
2018-08-23 09:26:16 +01:00
Jonathan Wakely f73a5316b6 Fix tests that fail in C++98 mode
* testsuite/23_containers/deque/capacity/max_size.cc: Fix test for
	C++98 mode.
	* testsuite/23_containers/deque/modifiers/assign/1.cc: Likewise.
	* testsuite/23_containers/list/modifiers/assign/1.cc: Likewise.
	* testsuite/23_containers/vector/bool/modifiers/assign/1.cc: Likewise.
	* testsuite/23_containers/vector/capacity/max_size.cc: Likewise.
	* testsuite/23_containers/vector/modifiers/assign/1.cc: Likewise.

From-SVN: r263792
2018-08-23 00:43:43 +01:00
Jonathan Wakely 1bc7a28f94 PR libstdc++/87061 remove pmr type aliases for COW strings
The pmr aliases for basic_string and match_results are incompatible with
the gcc4-compatible ABI because the Copy-On-Write basic_string class
doesn't support C++11 allocators.

	PR libstdc++/87061
	* include/experimental/regex [!_GLIBCXX_USE_CXX11_ABI]
	(experimental::pmr::match_results, experimental::pmr::cmatch)
	(experimental::pmr::smatch, experimental::pmr::wcmatch)
	(experimental::pmr::wsmatch): Do not declare for gcc4-compatible ABI,
	because COW strings don't support C++11 allocator model.
	* include/experimental/string [!_GLIBCXX_USE_CXX11_ABI]
	(experimental::pmr::basic_string, experimental::pmr::string)
	(experimental::pmr::u16string, experimental::pmr::u32string)
	(experimental::pmr::wstring): Likewise.
	* include/std/regex [!_GLIBCXX_USE_CXX11_ABI] (pmr::match_results)
	(pmr::cmatch, pmr::smatch, pmr::wcmatch, pmr::wsmatch): Likewise.
	* include/std/string [!_GLIBCXX_USE_CXX11_ABI] (pmr::basic_string)
	(pmr::string, pmr::u16string, pmr::u32string, pmr::wstring): Likewise.
	* testsuite/21_strings/basic_string/types/pmr_typedefs.cc: Require
	cxx11-abi.
	* testsuite/28_regex/match_results/pmr_typedefs.cc: Likewise.

From-SVN: r263791
2018-08-22 23:54:33 +01:00
Jonathan Wakely af55b3af33 PR libstdc++/78448 limit vector::max_size and deque::max_size
The container requirements imply that max_size() can't exceed the
maximum value of the container's difference_type. Enforce this for
std::vector and std::deque, and add checks to ensure the container
doesn't grow larger than that.

	PR libstdc++/78448
	* include/bits/deque.tcc (deque::_M_range_initialize): Use
	_S_check_init_len to check size.
	(deque::_M_push_back_aux, deque::_M_push_front_aux): Throw length
	error if size would exceed max_size().
	* include/bits/stl_deque.h (_Deque_base::size_type): Remove typedef.
	(_Deque_base(_Deque_base&&, const allocator_type&, size_t)): Use
	size_t instead of size_type.
	(deq(size_type, const allocator_type&)
	(deq(size_type, const value_type&, const allocator_type&)
	(deque::_M_initialize_dispatch): Use _S_check_init_len to check size.
	(deque::max_size): Call _S_max_size.
	(deque::_S_check_init_len, deque::_S_max_size): New functions.
	* include/bits/stl_vector.h (vector(size_type, const allocator_type&))
	(vector(size_type, const value_type&, const allocator_type&))
	(vector::_M_initialize_dispatch, vector::_M_range_initialize): Use
	_S_check_init_len to check size.
	(vector::max_size): Call _S_max_size.
	(vector::_M_check_len): Prevent max from being expanded as a
	function-like macro.
	(vector::_S_check_init_len, vector::_S_max_size): New functions.
	* include/bits/vector.tcc (vector::_M_assign_aux): Use
	_S_check_init_len to check size.
	* testsuite/23_containers/deque/capacity/max_size.cc: New test.
	* testsuite/23_containers/vector/capacity/max_size.cc: New test.

From-SVN: r263789
2018-08-22 23:22:40 +01:00
François Dumont e9afbed0d6 re PR libstdc++/68222 (_Safe_iterator provides operators the wrapped iterator can't actually support)
2018-08-22  François Dumont  <fdumont@gcc.gnu.org>

	PR libstdc++/68222
	* include/debug/safe_iterator.h
	(_Safe_iterator<_It, _Sq, _Cat>): Add category template parameter.
	(_Safe_iterator<>::_Const_iterator): Remove.
	(_Safe_iterator<>::_IsConstant): New.
	(_Safe_iterator<>::_OtherIterator): New.
	(_Safe_iterator<_It, _Sq, _Cat>::_Safe_iterator<_MutIte>(
	const _Safe_iterator<_MutIte, _Sq, _Cat>&)): Add _IsConstant::__value in
	__gnu_cxx::__enable_if condition.
	(_Safe_iterator<_It, _Sq, _Cat>::_M_get_distance_to): New.
	(_Safe_iterator<_It, _Sq, _Cat>::_M_get_distance_from_begin): New.
	(_Safe_iterator<_It, _Sq, _Cat>::_M_get_distance_to_end): New.
	(_Safe_iterator<_It, _Sq, std::bidirectional_iterator_tag>): New.
	(_Safe_iterator<_It, _Sq, _Cat>::operator--()): Move...
	(_Safe_iterator<_It, _Sq, std::bidirectional_iterator_tag>
	::operator--()): ...here.
	(_Safe_iterator<_It, _Sq, _Cat>::operator--(int)): Move...
	(_Safe_iterator<_It, _Sq, std::bidirectional_iterator_tag>
	::operator--(int)): ...here.
	(_Safe_iterator<_It, _Sq, _Cat>::_M_decrementable()): Move...
	(_Safe_iterator<_It, _Sq, std::bidirectional_iterator_tag>
	::_M_decrementable()): ...here.
	(_Safe_iterator<_It, _Sq, std::random_access_iterator_tag>): New.
	(_Safe_iterator<_It, _Sq, _Cat>::operator[](const difference_type&)):
	Move...
	(_Safe_iterator<_It, _Sq, std::random_access_iterator_tag>
	::operator[](const difference_type&)): ...here.
	(_Safe_iterator<_It, _Sq, _Cat>::operator+=(const difference_type&)):
	Move...
	(_Safe_iterator<_It, _Sq, std::random_access_iterator_tag>
	::operator+=(const difference_type&)): ...here.
	(_Safe_iterator<_It, _Sq, _Cat>::operator+(const difference_type&)):
	Move...
	(_Safe_iterator<_It, _Sq, std::random_access_iterator_tag>
	::operator+(const difference_type&)): ...here.
	(_Safe_iterator<_It, _Sq, _Cat>::operator-=(const difference_type&)):
	Move...
	(_Safe_iterator<_It, _Sq, std::random_access_iterator_tag>
	::operator-=(const difference_type&)): ...here.
	(_Safe_iterator<_It, _Sq, _Cat>::operator-(const difference_type&)):
	Move...
	(_Safe_iterator<_It, _Sq, std::random_access_iterator_tag>
	::operator-(const difference_type&)): ...here.
	(operator<(const _Safe_iterator<>&, const _Safe_iterator<>&)):
	Constraint to random access iterators.
	(operator<=(const _Safe_iterator<>&, const _Safe_iterator<>&)):
	Likewise.
	(operator>(const _Safe_iterator<>&, const _Safe_iterator<>&)): Likewise.
	(operator>=(const _Safe_iterator<>&, const _Safe_iterator<>&)):
	Likewise.
	(operator-(const _Safe_iterator<>&, const _Safe_iterator<>&)): Likewise.
	(operator+(const difference_type&, const _Safe_iterator<>&)): Likewise.
	(__check_dereferenceable(const _Safe_iterator<>&)): Remove.
	(__get_distance): Remove.
	(__get_distance_from_begin): Remove.
	(__get_distance_to_end): Remove.
	(struct __is_safe_random_iterator<_Safe_iterator<>>): Remove partial
	specialization.
	(__base(const _Safe_iterator<>&, std::input_iterator_tag)): Remove.
	(__base(const _Safe_iterator<>&, std::random_access_iterator_tag)): Remove.
	(__base(const _Safe_iterator<>&)): Constraint to random access iterator.
	* include/debug/safe_iterator.tcc
	(_Safe_iterator<>::_M_get_distance_from_begin()): New.
	(_Safe_iterator<>::_M_get_distance_to_end()): New.
	(_Safe_iterator<>::_M_get_distance_to(const _Safe_iterator<>&)): New.
	(_Safe_iterator<_It, _Seq, std::random_access_iterator_tag>
	::_M_valid_range): New.
	* include/debug/safe_local_iterator.h
	(_Safe_local_iterator<>::_Const_local_iterator): Remove.
	(_Safe_local_iterator<>::_IsConstant): New.
	(_Safe_local_iterator<>::_OtherIterator): New.
	(_Safe_local_iterator<_It, _Cont>::_Safe_local_iterator<_MutIte, _Cont>(
	const _Safe_local_iterator<_MutIte, _Seq>&)): Add _IsConstant::__value
	in __gnu_cxx::__enable_if condition. If singular compare base iterator
	with _MutIte rather than _It.
	(_Safe_local_iterator<>::_S_constant): Make constexpr.
	(_Safe_local_iterator<>::_M_get_distance_to): New.
	(__check_dereferenceable(const _Safe_local_iterator<>&)): Remove.
	(__get_distance(const _Safe_local_iterator<>&,
	const _Safe_local_iterator<>&, std::input_iterator_tag)): Remove.
	(__valid_range(const _Safe_local_iterator<>&,
	const _Safe_local_iterator<>&)): New.
	* include/debug/safe_local_iterator.tcc
	(_Safe_local_iterator<>::_M_get_distance_to): New.
	* include/debug/deque (std::__debug::deque<>): Add
	::__gnu_debug::_Safe_iterator<> friend declaration.
	* include/debug/forward_list (std::__debug::forward_list<>): Likewise.
	* include/debug/list (std::__debug::list<>): Likewise.
	* include/debug/map.h (std::__debug::map<>): Likewise.
	* include/debug/multimap.h (std::__debug::multimap<>): Likewise.
	* include/debug/set.h (std::__debug::set<>): Likewise.
	* include/debug/multiset.h (std::__debug::multiset<>): Likewise.
	* include/debug/string (std::__debug::basic_string<>): Likewise.
	* include/debug/unordered_map (std::__debug::unordered_map<>): Likewise
	and add ::__gnu_debug::_Safe_local_iterator<> friend declaration.
	(std::__debug::unordered_multimap<>): Likewise.
	* include/debug/unordered_set (std::__debug::unordered_set<>): Likewise.
	(std::__debug::unordered_multiset<>): Likewise.
	* include/debug/formatter.h: Adapt.
	* include/debug/helper_functions.h
	(__gnu_debug::_Safe_local_iterator<>): Add declaration.
	(__get_distance<_Ite>(_Ite, _Ite, std::random_access_iterator_tag):
	Pass parameter by copy.
	(__get_distance<_Ite>(_Ite, _Ite, std::input_iterator_tag): Likewise.
	(__get_distance<_Ite>(_Ite, _Ite): Likewise.
	(__valid_range_aux<_Integral>): Pass _Integral by copy.
	(__valid_range<_InputIterator>): Pass _InputIterator by copy.
	(__valid_range<>(const _Safe_iterator<>&,
	const _Safe_iterator<>&, typename _Distance_traits<>::__type&)):
	Declare.
	(__valid_range(const _Safe_local_iterator<>&,
	const _Safe_local_iterator<>&, typename _Distance_traits<>::__type&)):
	Declare.
	(__valid_range<>(const _Safe_iterator<>&, const _Safe_iterator<>&)):
	Declare.
	(__valid_range(const _Safe_local_iterator<>&, const _Safe_local_iterator<>&)):
	Declare.
	(__can_advance): Adapt.
	(struct __is_safe_random_iterator<>): Remove.
	(struct _SIter_base<>): Remove.
	* include/debug/functions.h: Include <bits/stl_iterator.h>.
	(__check_dereferenceable): Remove.
	(__foreign_iterator_aux4, __foreign_iterator_aux3): Adapt.
	(__foreign_iterator_aux2, __foreign_iterator_aux): Adapt.
	(__foreign_iterator): Adapt.
	* include/debug/stl_iterator.h
	(__is_safe_random_iterator<std::reverse_iterator<>>): Remove.
	(__base(const std::reverse_iterator<_Safe_iterator<_It, _Sq>)):
	Constraint for random access iterators.
	(__niter_base): Adapt.
	* testsuite/util/testsuite_containers.h:
	Include <bits/boost_concept_check.h>.
	(iterator_concept_checks<_It, _Mutable, _Category>): New.
	(citerator<_Cont>::forward_members::forward_members()): Instantiate
	latter for container iterator and const_iterator.
	* testsuite/23_containers/list/68222_neg.cc: New.
	* testsuite/23_containers/vector/cons/destructible_debug_neg.cc: Adapt
	line number.
	* testsuite/23_containers/unordered_set/debug/debug_functions.cc:
	(test01): Remove.
	* testsuite/23_containers/vector/debug/debug_functions.cc (test01):
	Remove.

From-SVN: r263786
2018-08-22 18:51:25 +00:00
David Edelsohn bce17c392a * testsuite/18_support/new_nothrow.cc: XFAIL on AIX.
From-SVN: r263703
2018-08-21 10:03:16 -04:00
Jonathan Wakely 25d4036370 Remove redundant { dg-do run } directives in tests
These tests accidentally had two dg-do directives. Only the second one
is needed.

	* testsuite/26_numerics/bit/bitops.count/countl_one.cc: Remove
	redundant dg-do directive.
	* testsuite/26_numerics/bit/bitops.count/countl_zero.cc: Likewise.
	* testsuite/26_numerics/bit/bitops.count/countr_one.cc: Likewise.
	* testsuite/26_numerics/bit/bitops.count/countr_zero.cc: Likewise.
	* testsuite/26_numerics/bit/bitops.count/popcount.cc: Likewise.

From-SVN: r263695
2018-08-21 10:34:26 +01:00
Jonathan Wakely b655b8fc7e Refactor std::optional SFINAE constraints
* include/std/optional (_Optional_payload): Use variable templates
	for conditions in default template arguments and exception
	specifications.
	(optional): Likewise. Adjust indentation.
	(optional::__not_self, optional::__not_tag, optional::_Requires): New
	SFINAE helpers.
	(optional::optional): Use new helpers in constructor constraints.
	* include/std/type_traits (__or_v, __and_v): New variable templates.
	* testsuite/20_util/optional/cons/value_neg.cc: Change dg-error to
	dg-prune-output. Remove unused header.

From-SVN: r263657
2018-08-20 13:13:25 +01:00
François Dumont 6672e849b8 86658.cc: Use dg-options to define _GLIBCXX_DEBUG.
2018-08-18  François Dumont  <fdumont@gcc.gnu.org>

	* testsuite/25_algorithms/copy/86658.cc: Use dg-options to define
	_GLIBCXX_DEBUG.

From-SVN: r263647
2018-08-18 20:01:14 +00:00
Jonathan Wakely 478490f681 PR libstdc++/86963 Implement LWG 2729 constraints on tuple assignment
PR libstdc++/86963
	* include/std/tuple (__tuple_base): New class template with deleted
	copy assignment operator.
	(tuple, tuple<_T1, _T2>): Derive from __tuple_base<tuple> so that
	implicit copy/move assignment operator will be deleted/suppressed.
	(tuple::__assignable, tuple<_T1, _T2>::__assignable): New helper
	functions for SFINAE constraints on assignment operators.
	(tuple::__nothrow_assignable, tuple<_T1, _T2>::__nothrow_assignable):
	New helper functions for exception specifications.
	(tuple::operator=(const tuple&), tuple::operator=(tuple&&))
	(tuple<_T1, _T2>::operator=(const tuple&))
	(tuple<_T1, _T2>::operator=(tuple&&)): Change parameter types to
	__nonesuch_no_braces when the operator should be defined implicitly.
	Use __nothrow_assignable for exception specifications.
	(tuple::operator=(const tuple<_UElements...>&))
	(tuple::operator=(tuple<_UElements...>&&))
	(tuple<_T1, _T2>::operator=(const tuple<_U1, _U2>&))
	(tuple<_T1, _T2>::operator=(tuple<_U1, _U2>&&))
	(tuple<_T1, _T2>::operator=(const pair<_U1, _U2>&))
	(tuple<_T1, _T2>::operator=(pair<_U1, _U2>&&)): Constrain using
	__assignable and use __nothrow_assignable for exception
	specifications.
	* python/libstdcxx/v6/printers.py (is_specialization_of): Accept
	gdb.Type as first argument, instead of a string.
	(StdTuplePrinter._iterator._is_nonempty_tuple): New method to check
	tuple for expected structure.
	(StdTuplePrinter._iterator.__init__): Use _is_nonempty_tuple.
	* testsuite/20_util/tuple/dr2729.cc: New test.
	* testsuite/20_util/tuple/element_access/get_neg.cc: Change dg-error
	to dg-prune-output.

From-SVN: r263625
2018-08-17 18:52:49 +01:00
Jonathan Wakely b8eac4d064 Fix experimental::pmr typedefs and add tests
The typedefs in <experimental/regex> and <experimental/string> don't
need to be in the __cxx11 namespace, because they are only aliases and
so will have the same mangled name as the underlying types.

	* include/experimental/regex: Remove begin/end macros for namespace.
	* include/experimental/string: Likewise.
	* testsuite/experimental/polymorphic_allocator/pmr_typedefs_deque.cc:
	New test.
	* testsuite/experimental/polymorphic_allocator/
	pmr_typedefs_forward_list.cc: New test.
	* testsuite/experimental/polymorphic_allocator/pmr_typedefs_list.cc:
	New test.
	* testsuite/experimental/polymorphic_allocator/pmr_typedefs_map.cc:
	New test.
	* testsuite/experimental/polymorphic_allocator/pmr_typedefs_match.cc:
	New test.
	* testsuite/experimental/polymorphic_allocator/
	pmr_typedefs_multimap.cc: New test.
	* testsuite/experimental/polymorphic_allocator/
	pmr_typedefs_multiset.cc: New test.
	* testsuite/experimental/polymorphic_allocator/pmr_typedefs_set.cc:
	New test.
	* testsuite/experimental/polymorphic_allocator/pmr_typedefs_string.cc:
	New test.
	* testsuite/experimental/polymorphic_allocator/
	pmr_typedefs_unordered_map.cc: New test.
	* testsuite/experimental/polymorphic_allocator/
	pmr_typedefs_unordered_multimap.cc: New test.
	* testsuite/experimental/polymorphic_allocator/
	pmr_typedefs_unordered_multiset.cc: New test.
	* testsuite/experimental/polymorphic_allocator/
	pmr_typedefs_unordered_set.cc: New test.
	* testsuite/experimental/polymorphic_allocator/pmr_typedefs_vector.cc:
	New test.

From-SVN: r263568
2018-08-15 20:46:25 +01:00
Jonathan Wakely b479fbad24 Refactor uses-allocator construction
Remove duplicated logic in experimental::pmr::polymorphic_allocator by
calling the __uses_allocator_construct helper.

Fix bugs in std::pmr::polymorphic_allocator with incorrect SFINAE
constraint and incorrect argument order.

	* include/bits/uses_allocator.h (__uses_allocator_construct): Qualify
	calls to __uses_allocator_construct_impl and __use_alloc.
	* include/experimental/memory_resource
	(polymorphic_allocator::_M_construct): Remove.
	(polymorphic_allocator::construct): Call __uses_allocator_construct.
	Qualify calls to __use_alloc.
	* include/std/memory_resource (polymorphic_allocator::construct): Fix
	type in SFINAE constraint. Use constexpr if instead of tag dispatching
	to _S_construct overloads.
	(polymorphic_allocator::construct(pair<T1, T2>*, ...)): Fix order of
	arguments to _S_construct_p.
	(polymorphic_allocator::_S_construct): Remove.
	(polymorphic_allocator::_S_construct_p): Return allocators by value
	not by reference.
	* include/std/scoped_allocator (scoped_allocator_adaptor::construct):
	Qualify calls to __use_alloc.
	* testsuite/20_util/polymorphic_allocator/construct_pair.cc: New test,
	copied from testsuite/20_util/scoped_allocator/construct_pair.cc.
	* testsuite/experimental/polymorphic_allocator/1.cc: New test.
	* testsuite/experimental/polymorphic_allocator/construct_pair.cc:
	New test.

From-SVN: r263566
2018-08-15 20:20:02 +01:00
Jeremy Sawicki 3ffa55de60 Rope iterators: don't retain pointers when copied
Rope iterators sometimes contain pointers to an internal buffer
inside the iterator itself.  When such an iterator is copied, the
copy incorrectly retains pointers to the original.

This patch takes the simple approach of not copying the cached
information when the internal buffer is being used, instead
requiring it to be recomputed when the copied iterator is
dereferenced.  An alternative would be to adjust the pointers so
they refer to the buffer in the copy.

2018-08-14  Jeremy Sawicki  <jeremy-gcc@sawicki.us>

	* include/ext/rope (_Rope_iterator_base(const _Rope_iterator_base&))
	(_Rope_const_iterator::operator=(const _Rope_const_iterator&))
	(_Rope_iterator::operator=(const _Rope_iterator&)): Ensure
	copied/assigned rope iterators don't retain pointers to the iterator
	they were copied/assigned from.
	* testsuite/ext/rope/7.cc: New.

From-SVN: r263534
2018-08-14 12:23:50 +01:00
Jonathan Wakely 7997ede243 Add <bit> and <version> to freestanding headers
* include/Makefile.am: Install <bit> and <version> for freestanding.
	* include/Makefile.in: Regenerate.
	* testsuite/17_intro/freestanding.cc: Check for <bit> and <version>.

From-SVN: r263514
2018-08-13 19:54:34 +01:00
Jonathan Wakely b66e5a95c0 PR libstdc++/68210 adjust operator new and delete for LWG 206
Ensure that nothrow versions of new and delete call the ordinary
versions of new or delete, instead of calling malloc or free directly.

These files are all compiled with -std=gnu++14 so can use noexcept and
nullptr to make the code more readable.

	PR libstdc++/68210
	* doc/xml/manual/intro.xml: Document LWG 206 change.
	* libsupc++/del_op.cc: Replace _GLIBCXX_USE_NOEXCEPT with noexcept.
	* libsupc++/del_opa.cc: Likewise.
	* libsupc++/del_opant.cc: Likewise.
	* libsupc++/del_opnt.cc: Likewise. Call operator delete(ptr) instead
	of free(ptr).
	* libsupc++/del_ops.cc: Replace _GLIBCXX_USE_NOEXCEPT with noexcept.
	* libsupc++/del_opsa.cc: Likewise.
	* libsupc++/del_opva.cc: Likewise.
	* libsupc++/del_opvant.cc: Likewise.
	* libsupc++/del_opvnt.cc: Likewise. Call operator delete[](ptr)
	instead of operator delete(ptr).
	* libsupc++/del_opvs.cc: Replace _GLIBCXX_USE_NOEXCEPT with noexcept.
	* libsupc++/del_opvsa.cc: Likewise.
	* libsupc++/new_op.cc: Use __builtin_expect in check for zero size.
	* libsupc++/new_opa.cc: Use nullptr instead of literal 0.
	* libsupc++/new_opant.cc: Likewise. Replace _GLIBCXX_USE_NOEXCEPT
	with noexcept.
	* libsupc++/new_opnt.cc: Likewise. Call operator new(sz) instead of
	malloc(sz).
	* libsupc++/new_opvant.cc: Use nullptr and noexcept.
	* libsupc++/new_opvnt.cc: Likewise. Call operator new[](sz) instead of
	operator new(sz, nothrow).
	* testsuite/18_support/new_nothrow.cc: New test.

From-SVN: r263478
2018-08-10 21:20:27 +01:00
Jonathan Wakely 1fc9d0b0e4 Define aliases for containers using polymorphic_allocator
These aliases are placed in the top-level header, e.g. <vector> not
<bits/stl_vector.h>. This ensures that they refer to whichever of
std::vector or __debug::vector or __profile::vector is in use when the
header is included.

	* include/std/deque (std::pmr::deque): Declare alias.
	* include/std/forward_list (std::pmr::forward_list): Likewise.
	* include/std/list (std::pmr::list): Likewise.
	* include/std/map (std::pmr::map, std::pmr::multimap): Likewise.
	* include/std/regex (std::pmr::match_results, std::pmr::cmatch)
	(std::pmr::smatch, std::pmr::wcmatch, std::pmr::wsmatch): Likewise.
	* include/std/set (std::pmr::set, std::pmr::multiset): Likewise.
	* include/std/string (std::pmr::basic_string, std::pmr::string)
	(std::pmr::u16string, std::pmr::u32string, std::pmr::wstring):
	Likewise.
	* include/std/unordered_map (std::pmr::unordered_map)
	(std::pmr::unordered_multimap): Likewise.
	* include/std/unordered_set (std::pmr::unordered_set)
	(std::pmr::unordered_multiset): Likewise.
	* include/std/vector (std::pmr::vector): Likewise.
	* testsuite/21_strings/basic_string/types/pmr_typedefs.cc: New test.
	* testsuite/23_containers/deque/types/pmr_typedefs.cc: New test.
	* testsuite/23_containers/forward_list/pmr_typedefs.cc: New test.
	* testsuite/23_containers/list/pmr_typedefs.cc: New test.
	* testsuite/23_containers/map/pmr_typedefs.cc: New test.
	* testsuite/23_containers/multimap/pmr_typedefs.cc: New test.
	* testsuite/23_containers/multiset/pmr_typedefs.cc: New test.
	* testsuite/23_containers/set/pmr_typedefs.cc: New test.
	* testsuite/23_containers/unordered_map/pmr_typedefs.cc: New test.
	* testsuite/23_containers/unordered_multimap/pmr_typedefs.cc: New
	test.
	* testsuite/23_containers/unordered_multiset/pmr_typedefs.cc: New
	test.
	* testsuite/23_containers/unordered_set/pmr_typedefs.cc: New test.
	* testsuite/23_containers/vector/pmr_typedefs.cc: New test.
	* testsuite/28_regex/match_results/pmr_typedefs.cc: New test.

From-SVN: r263456
2018-08-10 00:25:53 +01:00
Jonathan Wakely d3f3c68099 PR libstdc++/86597 directory_entry observers should clear error_code
PR libstdc++/86597
	* include/bits/fs_dir.h (directory_entry::_M_file_type(error_code&)):
	Clear error_code when cached type is used.
	* testsuite/27_io/filesystem/directory_entry/86597.cc: New test.

From-SVN: r263397
2018-08-08 14:09:19 +01:00
Jonathan Wakely 0ec78a9369 PR libstdc++/86874 fix std::variant::swap regression
PR libstdc++/86874
	* include/std/variant (_Copy_ctor_base::_M_destructive_move): Define
	here instead of in _Move_assign_base.
	(_Copy_ctor_base<true, _Types...>::_M_destructive_move): Define.
	(_Copy_assign_base::operator=): Use _M_destructive_move when changing
	the contained value to another alternative.
	(_Move_assign_base::operator=): Likewise.
	(_Move_assign_base::_M_destructive_move): Remove.
	* testsuite/20_util/variant/86874.cc: New test.

From-SVN: r263365
2018-08-07 20:13:26 +01:00
Jonathan Wakely d7487e2ae8 Add workaround for non-unique errno values on AIX
* src/c++11/system_error.cc
	(system_error_category::default_error_condition): Add workaround for
	ENOTEMPTY and EEXIST having the same value on AIX.
	* testsuite/19_diagnostics/error_category/system_category.cc: Add
	extra testcases for EDOM, EILSEQ, ERANGE, EEXIST and ENOTEMPTY.

From-SVN: r263289
2018-08-03 13:53:34 +01:00
Mike Crowe 2f59343265 Report early wakeup of condition_variable::wait_until as no_timeout
As currently implemented, condition_variable always ultimately waits
against std::chrono::system_clock. This clock can be changed in arbitrary
ways by the user which may result in us waking up too early or too late
when measured against the caller-supplied clock.

We can't (yet) do much about waking up too late (PR 41861), but
if we wake up too early we must return cv_status::no_timeout to indicate a
spurious wakeup rather than incorrectly returning cv_status::timeout.

2018-08-01  Mike Crowe  <mac@mcrowe.com>

	* include/std/condition_variable (wait_until): Only report timeout
	if we really have timed out when measured against the
	caller-supplied clock.
	* testsuite/30_threads/condition_variable/members/2.cc: Add test
	case to confirm above behaviour.

From-SVN: r263224
2018-08-01 16:39:45 +01:00
Jonathan Wakely 5ecfbf82a4 PR libstdc++/60555 std::system_category() should recognise POSIX errno values
PR libstdc++/60555
	* src/c++11/system_error.cc
	(system_error_category::default_error_condition): New override to
	check for POSIX errno values.
	* testsuite/19_diagnostics/error_category/generic_category.cc: New
	* testsuite/19_diagnostics/error_category/system_category.cc: New
	test.

From-SVN: r263210
2018-08-01 14:57:05 +01:00
Jonathan Wakely e182158261 PR libstdc++/86751 default assignment operators for std::pair
The solution for PR 77537 causes ambiguities due to the extra copy
assignment operator taking a __nonesuch_no_braces parameter. By making
the base class non-assignable we don't need the extra deleted overload
in std::pair. The copy assignment operator will be implicitly deleted
(and the move assignment operator not declared) as needed. Without the
additional user-provided operator in std::pair the ambiguity is avoided.

	PR libstdc++/86751
	* include/bits/stl_pair.h (__pair_base): New class with deleted copy
	assignment operator.
	(pair): Derive from __pair_base.
	(pair::operator=): Remove deleted overload.
	* python/libstdcxx/v6/printers.py (StdPairPrinter): New pretty printer
	so that new base class isn't shown in GDB.
	* testsuite/20_util/pair/86751.cc: New test.
	* testsuite/20_util/pair/ref_assign.cc: New test.

From-SVN: r263185
2018-07-31 23:31:20 +01:00
Jonathan Wakely a64ede727f PR libstdc++/86734 make reverse_iterator::operator-> more robust
Implement the proposed resolution from LWG 1052, which also resolves
DR 2118 by avoiding taking the address in the first place.

	PR libstdc++/86734
	* include/bits/stl_iterator.h (reverse_iterator::operator->): Call
	_S_to_pointer (LWG 1052, LWG 2118).
	(reverse_iterator::_S_to_pointer): Define overloaded helper functions.
	* testsuite/24_iterators/reverse_iterator/dr1052.cc: New test.
	* testsuite/24_iterators/reverse_iterator/dr2188.cc: New test.

From-SVN: r263074
2018-07-30 18:13:05 +01:00
Jonathan Wakely 1b3b888d11 Add workaround for aligned_alloc bug on AIX
20_util/memory_resource/2.cc FAILs on AIX 7.2.0.0, because aligned_alloc
incorrectly requires the alignment to be a multiple of sizeof(void*).

This adds a workaround to the operator new overload taking an alignment
value, to increase the alignment (and size) if needed.

	* libsupc++/new_opa.cc (operator new(size_t, align_val_t)): Add
	workaround for aligned_alloc bug on AIX.
	* testsuite/18_support/new_aligned.cc: New test.

From-SVN: r263073
2018-07-30 18:12:44 +01:00
Marek Polacek ccfe77fa22 * 30_threads/condition_variable_any/cond.cc: New test.
From-SVN: r263022
2018-07-26 21:23:12 +00:00
Jonathan Wakely 49ba258864 Add missing dg-require-cstdint directives to tests
* testsuite/18_support/aligned_alloc/aligned_alloc.cc: Add
	dg-require-cstdint directive.
	* testsuite/20_util/allocator/overaligned.cc: Likewise.
	* testsuite/20_util/any/cons/aligned.cc: Likewise.
	* testsuite/20_util/monotonic_buffer_resource/allocate.cc: Likewise.
	* testsuite/20_util/monotonic_buffer_resource/deallocate.cc: Likewise.
	* testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc:
	Likewise.
	* testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc: Likewise.
	* testsuite/23_containers/list/modifiers/insert/25288.cc: Likewise.
	* testsuite/23_containers/set/allocator/move_assign.cc: Likewise.
	* testsuite/25_algorithms/make_heap/complexity.cc: Likewise.
	* testsuite/25_algorithms/pop_heap/complexity.cc: Require cstdint and
	random_device effective-target.
	* testsuite/25_algorithms/push_heap/complexity.cc: Likewise.
	* testsuite/25_algorithms/sample/1.cc: Require cstdint.
	* testsuite/25_algorithms/sample/2.cc: Likewise.
	* testsuite/25_algorithms/sort_heap/complexity.cc: Require cstdint
	and random_device.
	* testsuite/26_numerics/headers/random/types_std_c++0x.cc: Require
	cstdint.
	* testsuite/26_numerics/random/chi_squared_distribution/83833.cc:
	Likewise.
	* testsuite/26_numerics/random/discard_block_engine/requirements/
	constexpr_data.cc: Likewise.
	* testsuite/26_numerics/random/discard_block_engine/requirements/
	constexpr_functions.cc: Likewise.
	* testsuite/26_numerics/random/independent_bits_engine/requirements/
	constexpr_functions.cc: Likewise.
	* testsuite/26_numerics/random/linear_congruential_engine/requirements/
	constexpr_data.cc: Likewise.
	* testsuite/26_numerics/random/linear_congruential_engine/requirements/
	constexpr_functions.cc: Likewise.
	* testsuite/26_numerics/random/mersenne_twister_engine/requirements/
	constexpr_data.cc: Likewise.
	* testsuite/26_numerics/random/mersenne_twister_engine/requirements/
	constexpr_functions.cc: Likewise.
	* testsuite/26_numerics/random/pr60037-neg.cc: Likewise.
	* testsuite/26_numerics/random/seed_seq/cons/65631.cc: Likewise.
	* testsuite/26_numerics/random/shuffle_order_engine/requirements/
	constexpr_data.cc: Add dg-require-cstdint directive.
	* testsuite/26_numerics/random/shuffle_order_engine/requirements/
	constexpr_functions.cc: Likewise.
	* testsuite/26_numerics/random/subtract_with_carry_engine/requirements/
	constexpr_data.cc: Likewise.
	* testsuite/26_numerics/random/subtract_with_carry_engine/requirements/
	constexpr_functions.cc: Likewise.
	* testsuite/26_numerics/random/uniform_real_distribution/operators/
	64351.cc: Likewise.
	* testsuite/29_atomics/headers/atomic/types_std_c++0x.cc: Likewise.
	* testsuite/experimental/algorithm/sample-2.cc: Likewise.
	* testsuite/experimental/algorithm/sample.cc: Likewise.
	* testsuite/experimental/algorithm/search.cc: Likewise.
	* testsuite/experimental/algorithm/shuffle.cc: Likewise.
	* testsuite/experimental/any/cons/aligned.cc: Likewise.
	* testsuite/experimental/memory_resource/new_delete_resource.cc:
	Likewise.
	* testsuite/experimental/memory_resource/resource_adaptor.cc: Likewise.
	* testsuite/experimental/random/randint.cc: Likewise.
	* testsuite/experimental/source_location/1.cc: Likewise.
	* testsuite/ext/bitmap_allocator/overaligned.cc: Likewise.
	* testsuite/ext/malloc_allocator/overaligned.cc: Likewise.
	* testsuite/ext/mt_allocator/overaligned.cc: Likewise.
	* testsuite/ext/new_allocator/overaligned.cc: Likewise.
	* testsuite/ext/pb_ds/regression/hash_map_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/hash_set_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/list_update_map_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/list_update_set_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/priority_queue_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/tree_map_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/tree_set_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/trie_map_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/trie_set_rand.cc: Likewise.
	* testsuite/ext/pool_allocator/overaligned.cc: Likewise.
	* testsuite/ext/throw_allocator/check_allocate_max_size.cc: Likewise.
	* testsuite/ext/throw_allocator/check_deallocate_null.cc: Likewise.
	* testsuite/ext/throw_allocator/check_delete.cc: Likewise.
	* testsuite/ext/throw_allocator/check_new.cc: Likewise.
	* testsuite/ext/throw_allocator/deallocate_global.cc: Likewise.
	* testsuite/ext/throw_allocator/deallocate_local.cc: Likewise.
	* testsuite/ext/throw_allocator/explicit_instantiation.cc: Likewise.
	* testsuite/ext/throw_allocator/variadic_construct.cc: Likewise.
	* testsuite/tr1/8_c_compatibility/cinttypes/functions.cc: Likewise.

From-SVN: r263008
2018-07-26 15:03:28 +01:00
Jonathan Wakely 47114f2d02 Remove dg-require-cstdint directive from tests
Tests for components which are no longer dependent on
_GLIBCXX_USE_C99_STDINT_TR1 do not need to require <cstdint>.

	* testsuite/30_threads/recursive_mutex/cons/1.cc: Likewise.
	* testsuite/30_threads/recursive_mutex/cons/assign_neg.cc: Likewise.
	* testsuite/30_threads/recursive_mutex/cons/copy_neg.cc: Likewise.
	* testsuite/30_threads/recursive_mutex/dest/destructor_locked.cc:
	Likewise.
	* testsuite/30_threads/recursive_mutex/lock/1.cc: Likewise.
	* testsuite/30_threads/recursive_mutex/native_handle/1.cc: Likewise.
	* testsuite/30_threads/recursive_mutex/native_handle/typesizes.cc:
	Likewise.
	* testsuite/30_threads/recursive_mutex/requirements/standard_layout.cc:
	Likewise.
	* testsuite/30_threads/recursive_mutex/requirements/typedefs.cc:
	Likewise.
	* testsuite/30_threads/recursive_mutex/try_lock/1.cc: Likewise.
	* testsuite/30_threads/recursive_mutex/try_lock/2.cc: Likewise.
	* testsuite/30_threads/recursive_mutex/unlock/1.cc: Likewise.
	* testsuite/30_threads/recursive_mutex/unlock/2.cc: Likewise.
	* testsuite/30_threads/recursive_timed_mutex/cons/1.cc: Likewise.
	* testsuite/30_threads/recursive_timed_mutex/cons/assign_neg.cc:
	Likewise.
	* testsuite/30_threads/recursive_timed_mutex/cons/copy_neg.cc:
	Likewise.
	* testsuite/30_threads/recursive_timed_mutex/dest/
	destructor_locked.cc: Likewise.
	* testsuite/30_threads/recursive_timed_mutex/lock/1.cc: Likewise.
	* testsuite/30_threads/recursive_timed_mutex/lock/2.cc: Likewise.
	* testsuite/30_threads/recursive_timed_mutex/native_handle/1.cc:
	Likewise.
	* testsuite/30_threads/recursive_timed_mutex/native_handle/
	typesizes.cc: Likewise.
	* testsuite/30_threads/recursive_timed_mutex/requirements/typedefs.cc:
	Likewise.
	* testsuite/30_threads/recursive_timed_mutex/try_lock/1.cc:
	Likewise.
	* testsuite/30_threads/recursive_timed_mutex/try_lock/2.cc:
	Likewise.
	* testsuite/30_threads/recursive_timed_mutex/try_lock_for/1.cc:
	Likewise.
	* testsuite/30_threads/recursive_timed_mutex/try_lock_for/2.cc:
	Likewise.
	* testsuite/30_threads/recursive_timed_mutex/try_lock_for/3.cc:
	Likewise.
	* testsuite/30_threads/recursive_timed_mutex/try_lock_until/1.cc:
	Likewise.
	* testsuite/30_threads/recursive_timed_mutex/try_lock_until/2.cc:
	Likewise.
	* testsuite/30_threads/recursive_timed_mutex/unlock/1.cc: Likewise.
	* testsuite/30_threads/recursive_timed_mutex/unlock/2.cc: Likewise.
	* testsuite/30_threads/scoped_lock/cons/1.cc: Likewise.
	* testsuite/30_threads/scoped_lock/requirements/
	explicit_instantiation.cc: Likewise.
	* testsuite/30_threads/scoped_lock/requirements/typedefs.cc: Likewise.
	* testsuite/30_threads/shared_future/cons/assign.cc: Likewise.
	* testsuite/30_threads/shared_future/cons/constexpr.cc: Likewise.
	* testsuite/30_threads/shared_future/cons/copy.cc: Likewise.
	* testsuite/30_threads/shared_future/cons/default.cc: Likewise.
	* testsuite/30_threads/shared_future/cons/move.cc: Likewise.
	* testsuite/30_threads/shared_future/cons/move_assign.cc: Likewise.
	* testsuite/30_threads/shared_future/members/45133.cc: Likewise.
	* testsuite/30_threads/shared_future/members/get.cc: Likewise.
	* testsuite/30_threads/shared_future/members/get2.cc: Likewise.
	* testsuite/30_threads/shared_future/members/valid.cc: Likewise.
	* testsuite/30_threads/shared_future/members/wait.cc: Likewise.
	* testsuite/30_threads/shared_future/members/wait_for.cc: Likewise.
	* testsuite/30_threads/shared_future/members/wait_until.cc: Likewise.
	* testsuite/30_threads/shared_future/requirements/
	explicit_instantiation.cc: Likewise.
	* testsuite/30_threads/shared_lock/cons/1.cc: Likewise.
	* testsuite/30_threads/shared_lock/cons/2.cc: Likewise.
	* testsuite/30_threads/shared_lock/cons/3.cc: Likewise.
	* testsuite/30_threads/shared_lock/cons/4.cc: Likewise.
	* testsuite/30_threads/shared_lock/cons/5.cc: Likewise.
	* testsuite/30_threads/shared_lock/cons/6.cc: Likewise.
	* testsuite/30_threads/shared_lock/locking/1.cc: Likewise.
	* testsuite/30_threads/shared_lock/locking/2.cc: Likewise.
	* testsuite/30_threads/shared_lock/locking/3.cc: Likewise.
	* testsuite/30_threads/shared_lock/locking/4.cc: Likewise.
	* testsuite/30_threads/shared_lock/modifiers/1.cc: Likewise.
	* testsuite/30_threads/shared_lock/requirements/
	explicit_instantiation.cc: Likewise.
	* testsuite/30_threads/shared_lock/requirements/typedefs.cc: Likewise.
	* testsuite/30_threads/shared_mutex/cons/1.cc: Likewise.
	* testsuite/30_threads/shared_mutex/cons/assign_neg.cc: Likewise.
	* testsuite/30_threads/shared_mutex/cons/copy_neg.cc: Likewise.
	* testsuite/30_threads/shared_mutex/requirements/standard_layout.cc:
	Likewise.
	* testsuite/30_threads/shared_mutex/try_lock/1.cc: Likewise.
	* testsuite/30_threads/shared_mutex/try_lock/2.cc: Likewise.
	* testsuite/30_threads/shared_mutex/unlock/1.cc: Likewise.
	* testsuite/30_threads/shared_timed_mutex/cons/1.cc: Likewise.
	* testsuite/30_threads/shared_timed_mutex/cons/assign_neg.cc: Likewise.
	* testsuite/30_threads/shared_timed_mutex/cons/copy_neg.cc: Likewise.
	* testsuite/30_threads/shared_timed_mutex/requirements/
	standard_layout.cc: Likewise.
	* testsuite/30_threads/shared_timed_mutex/try_lock/1.cc: Likewise.
	* testsuite/30_threads/shared_timed_mutex/try_lock/2.cc: Likewise.
	* testsuite/30_threads/shared_timed_mutex/try_lock/3.cc: Likewise.
	* testsuite/30_threads/shared_timed_mutex/unlock/1.cc: Likewise.
	* testsuite/30_threads/this_thread/1.cc: Likewise.
	* testsuite/30_threads/this_thread/2.cc: Likewise.
	* testsuite/30_threads/this_thread/3.cc: Likewise.
	* testsuite/30_threads/this_thread/4.cc: Likewise.
	* testsuite/30_threads/this_thread/58038.cc: Likewise.
	* testsuite/30_threads/thread/70503.cc: Likewise.
	* testsuite/30_threads/thread/84532.cc: Likewise.
	* testsuite/30_threads/thread/adl.cc: Likewise.
	* testsuite/30_threads/thread/cons/1.cc: Likewise.
	* testsuite/30_threads/thread/cons/2.cc: Likewise.
	* testsuite/30_threads/thread/cons/3.cc: Likewise.
	* testsuite/30_threads/thread/cons/4.cc: Likewise.
	* testsuite/30_threads/thread/cons/49668.cc: Likewise.
	* testsuite/30_threads/thread/cons/5.cc: Likewise.
	* testsuite/30_threads/thread/cons/6.cc: Likewise.
	* testsuite/30_threads/thread/cons/7.cc: Likewise.
	* testsuite/30_threads/thread/cons/8.cc: Likewise.
	* testsuite/30_threads/thread/cons/84535.cc: Likewise.
	* testsuite/30_threads/thread/cons/9.cc: Likewise.
	* testsuite/30_threads/thread/cons/assign_neg.cc: Likewise.
	* testsuite/30_threads/thread/cons/copy_neg.cc: Likewise.
	* testsuite/30_threads/thread/cons/lwg2097.cc: Likewise.
	* testsuite/30_threads/thread/cons/moveable.cc: Likewise.
	* testsuite/30_threads/thread/cons/terminate.cc: Likewise.
	* testsuite/30_threads/thread/id/operators.cc: Likewise.
	* testsuite/30_threads/thread/members/1.cc: Likewise.
	* testsuite/30_threads/thread/members/2.cc: Likewise.
	* testsuite/30_threads/thread/members/3.cc: Likewise.
	* testsuite/30_threads/thread/members/4.cc: Likewise.
	* testsuite/30_threads/thread/members/5.cc: Likewise.
	* testsuite/30_threads/thread/members/hardware_concurrency.cc:
	Likewise.
	* testsuite/30_threads/thread/native_handle/cancel.cc: Likewise.
	* testsuite/30_threads/thread/swap/1.cc: Likewise.
	* testsuite/30_threads/timed_mutex/cons/1.cc: Likewise.
	* testsuite/30_threads/timed_mutex/cons/assign_neg.cc: Likewise.
	* testsuite/30_threads/timed_mutex/cons/copy_neg.cc: Likewise.
	* testsuite/30_threads/timed_mutex/dest/destructor_locked.cc: Likewise.
	* testsuite/30_threads/timed_mutex/lock/1.cc: Likewise.
	* testsuite/30_threads/timed_mutex/native_handle/1.cc: Likewise.
	* testsuite/30_threads/timed_mutex/native_handle/typesizes.cc:
	Likewise.
	* testsuite/30_threads/timed_mutex/requirements/
	standard_layout.cc: Likewise.
	* testsuite/30_threads/timed_mutex/requirements/typedefs.cc: Likewise.
	* testsuite/30_threads/timed_mutex/try_lock/1.cc: Likewise.
	* testsuite/30_threads/timed_mutex/try_lock/2.cc: Likewise.
	* testsuite/30_threads/timed_mutex/try_lock_for/1.cc: Likewise.
	* testsuite/30_threads/timed_mutex/try_lock_for/2.cc: Likewise.
	* testsuite/30_threads/timed_mutex/try_lock_for/3.cc: Likewise.
	* testsuite/30_threads/timed_mutex/try_lock_until/1.cc: Likewise.
	* testsuite/30_threads/timed_mutex/try_lock_until/2.cc: Likewise.
	* testsuite/30_threads/timed_mutex/try_lock_until/57641.cc: Likewise.
	* testsuite/30_threads/timed_mutex/unlock/1.cc: Likewise.
	* testsuite/30_threads/timed_mutex/unlock/2.cc: Likewise.
	* testsuite/30_threads/try_lock/1.cc: Likewise.
	* testsuite/30_threads/try_lock/2.cc: Likewise.
	* testsuite/30_threads/try_lock/3.cc: Likewise.
	* testsuite/30_threads/try_lock/4.cc: Likewise.
	* testsuite/30_threads/unique_lock/cons/1.cc: Likewise.
	* testsuite/30_threads/unique_lock/cons/2.cc: Likewise.
	* testsuite/30_threads/unique_lock/cons/3.cc: Likewise.
	* testsuite/30_threads/unique_lock/cons/4.cc: Likewise.
	* testsuite/30_threads/unique_lock/cons/5.cc: Likewise.
	* testsuite/30_threads/unique_lock/cons/6.cc: Likewise.
	* testsuite/30_threads/unique_lock/locking/1.cc: Likewise.
	* testsuite/30_threads/unique_lock/locking/2.cc: Likewise.
	* testsuite/30_threads/unique_lock/locking/3.cc: Likewise.
	* testsuite/30_threads/unique_lock/locking/4.cc: Likewise.
	* testsuite/30_threads/unique_lock/modifiers/1.cc: Likewise.
	* testsuite/30_threads/unique_lock/requirements/
	explicit_instantiation.cc: Likewise.
	* testsuite/30_threads/unique_lock/requirements/typedefs.cc: Likewise.

From-SVN: r263007
2018-07-26 15:03:01 +01:00
Jonathan Wakely c37f07c4d8 Remove dg-require-cstdint directive from tests
Tests for components which are no longer dependent on
_GLIBCXX_USE_C99_STDINT_TR1 do not need to require <cstdint>.

	* testsuite/30_threads/async/42819.cc: Remove dg-require-cstdint
	directive.
	* testsuite/30_threads/async/49668.cc: Likewise.
	* testsuite/30_threads/async/54297.cc: Likewise.
	* testsuite/30_threads/async/84532.cc: Likewise.
	* testsuite/30_threads/async/any.cc: Likewise.
	* testsuite/30_threads/async/async.cc: Likewise.
	* testsuite/30_threads/async/except.cc: Likewise.
	* testsuite/30_threads/async/forced_unwind.cc: Likewise.
	* testsuite/30_threads/async/launch.cc: Likewise.
	* testsuite/30_threads/async/lwg2021.cc: Likewise.
	* testsuite/30_threads/async/sync.cc: Likewise.
	* testsuite/30_threads/call_once/39909.cc: Likewise.
	* testsuite/30_threads/call_once/49668.cc: Likewise.
	* testsuite/30_threads/call_once/60497.cc: Likewise.
	* testsuite/30_threads/call_once/call_once1.cc: Likewise.
	* testsuite/30_threads/call_once/constexpr.cc: Likewise.
	* testsuite/30_threads/call_once/dr2442.cc: Likewise.
	* testsuite/30_threads/call_once/once_flag.cc: Likewise.
	* testsuite/30_threads/condition_variable/54185.cc: Likewise.
	* testsuite/30_threads/condition_variable/cons/1.cc: Likewise.
	* testsuite/30_threads/condition_variable/cons/assign_neg.cc:
	Likewise.
	* testsuite/30_threads/condition_variable/cons/copy_neg.cc: Likewise.
	* testsuite/30_threads/condition_variable/members/1.cc: Likewise.
	* testsuite/30_threads/condition_variable/members/2.cc: Likewise.
	* testsuite/30_threads/condition_variable/members/3.cc: Likewise.
	* testsuite/30_threads/condition_variable/members/53841.cc: Likewise.
	* testsuite/30_threads/condition_variable/members/68519.cc: Likewise.
	* testsuite/30_threads/condition_variable/native_handle/typesizes.cc:
	Likewise.
	* testsuite/30_threads/condition_variable/requirements/
	standard_layout.cc: Likewise.
	* testsuite/30_threads/condition_variable/requirements/typedefs.cc:
	* Likewise.
	* testsuite/30_threads/condition_variable_any/50862.cc: Likewise.
	* testsuite/30_threads/condition_variable_any/53830.cc: Likewise.
	* testsuite/30_threads/condition_variable_any/cons/1.cc: Likewise.
	* testsuite/30_threads/condition_variable_any/cons/assign_neg.cc:
	Likewise.
	* testsuite/30_threads/condition_variable_any/cons/copy_neg.cc:
	Likewise.
	* testsuite/30_threads/condition_variable_any/members/1.cc: Likewise.
	* testsuite/30_threads/condition_variable_any/members/2.cc: Likewise.
	* testsuite/30_threads/future/cons/assign_neg.cc: Likewise.
	* testsuite/30_threads/future/cons/constexpr.cc: Likewise.
	* testsuite/30_threads/future/cons/copy_neg.cc: Likewise.
	* testsuite/30_threads/future/cons/default.cc: Likewise.
	* testsuite/30_threads/future/cons/move.cc: Likewise.
	* testsuite/30_threads/future/cons/move_assign.cc: Likewise.
	* testsuite/30_threads/future/members/45133.cc: Likewise.
	* testsuite/30_threads/future/members/get.cc: Likewise.
	* testsuite/30_threads/future/members/get2.cc: Likewise.
	* testsuite/30_threads/future/members/share.cc: Likewise.
	* testsuite/30_threads/future/members/valid.cc: Likewise.
	* testsuite/30_threads/future/members/wait.cc: Likewise.
	* testsuite/30_threads/future/members/wait_for.cc: Likewise.
	* testsuite/30_threads/future/members/wait_until.cc: Likewise.
	* testsuite/30_threads/future/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/30_threads/headers/condition_variable/types_std_c++0x.cc:
	Likewise.
	* testsuite/30_threads/headers/future/types_std_c++0x.cc: Likewise.
	* testsuite/30_threads/headers/mutex/types_std_c++0x.cc: Likewise.
	* testsuite/30_threads/headers/thread/std_c++0x_neg.cc: Likewise.
	* testsuite/30_threads/headers/thread/types_std_c++0x.cc: Likewise.
	* testsuite/30_threads/lock/1.cc: Likewise.
	* testsuite/30_threads/lock/2.cc: Likewise.
	* testsuite/30_threads/lock/3.cc: Likewise.
	* testsuite/30_threads/lock/4.cc: Likewise.
	* testsuite/30_threads/lock_guard/cons/1.cc: Likewise.
	* testsuite/30_threads/lock_guard/requirements/
	explicit_instantiation.cc: Likewise.
	* testsuite/30_threads/lock_guard/requirements/typedefs.cc: Likewise.
	* testsuite/30_threads/mutex/cons/1.cc: Likewise.
	* testsuite/30_threads/mutex/cons/assign_neg.cc: Likewise.
	* testsuite/30_threads/mutex/cons/constexpr.cc: Likewise.
	* testsuite/30_threads/mutex/cons/copy_neg.cc: Likewise.
	* testsuite/30_threads/mutex/dest/destructor_locked.cc: Likewise.
	* testsuite/30_threads/mutex/lock/1.cc: Likewise.
	* testsuite/30_threads/mutex/native_handle/1.cc: Likewise.
	* testsuite/30_threads/mutex/native_handle/typesizes.cc: Likewise.
	* testsuite/30_threads/mutex/requirements/standard_layout.cc::
	Likewise.
	* testsuite/30_threads/mutex/requirements/typedefs.cc: Likewise.
	* testsuite/30_threads/mutex/try_lock/1.cc: Likewise.
	* testsuite/30_threads/mutex/try_lock/2.cc: Likewise.
	* testsuite/30_threads/mutex/unlock/1.cc: Likewise.
	* testsuite/30_threads/mutex/unlock/2.cc: Likewise.
	* testsuite/30_threads/once_flag/cons/constexpr.cc: Likewise.
	* testsuite/30_threads/packaged_task/49668.cc: Likewise.
	* testsuite/30_threads/packaged_task/60564.cc: Likewise.
	* testsuite/30_threads/packaged_task/cons/1.cc: Likewise.
	* testsuite/30_threads/packaged_task/cons/2.cc: Likewise.
	* testsuite/30_threads/packaged_task/cons/3.cc: Likewise.
	* testsuite/30_threads/packaged_task/cons/56492.cc: Likewise.
	* testsuite/30_threads/packaged_task/cons/alloc.cc: Likewise.
	* testsuite/30_threads/packaged_task/cons/alloc2.cc: Likewise.
	* testsuite/30_threads/packaged_task/cons/alloc_min.cc: Likewise.
	* testsuite/30_threads/packaged_task/cons/assign_neg.cc: Likewise.
	* testsuite/30_threads/packaged_task/cons/copy_neg.cc: Likewise.
	* testsuite/30_threads/packaged_task/cons/move.cc: Likewise.
	* testsuite/30_threads/packaged_task/cons/move_assign.cc: Likewise.
	* testsuite/30_threads/packaged_task/members/at_thread_exit.cc:
	Likewise.
	* testsuite/30_threads/packaged_task/members/get_future.cc: Likewise.
	* testsuite/30_threads/packaged_task/members/get_future2.cc: Likewise.
	* testsuite/30_threads/packaged_task/members/invoke.cc: Likewise.
	* testsuite/30_threads/packaged_task/members/invoke2.cc: Likewise.
	* testsuite/30_threads/packaged_task/members/invoke3.cc: Likewise.
	* testsuite/30_threads/packaged_task/members/invoke4.cc: Likewise.
	* testsuite/30_threads/packaged_task/members/invoke5.cc: Likewise.
	* testsuite/30_threads/packaged_task/members/reset.cc: Likewise.
	* testsuite/30_threads/packaged_task/members/reset2.cc: Likewise.
	* testsuite/30_threads/packaged_task/members/swap.cc: Likewise.
	* testsuite/30_threads/packaged_task/members/valid.cc: Likewise.
	* testsuite/30_threads/packaged_task/requirements/
	explicit_instantiation.cc: Likewise.
	* testsuite/30_threads/packaged_task/uses_allocator.cc: Likewise.
	* testsuite/30_threads/promise/60966.cc: Likewise.
	* testsuite/30_threads/promise/69106.cc: Likewise.
	* testsuite/30_threads/promise/cons/1.cc: Likewise.
	* testsuite/30_threads/promise/cons/alloc.cc: Likewise.
	* testsuite/30_threads/promise/cons/alloc2.cc: Likewise.
	* testsuite/30_threads/promise/cons/alloc_min.cc: Likewise.
	* testsuite/30_threads/promise/cons/assign_neg.cc: Likewise.
	* testsuite/30_threads/promise/cons/copy_neg.cc: Likewise.
	* testsuite/30_threads/promise/cons/move.cc: Likewise.
	* testsuite/30_threads/promise/cons/move_assign.cc: Likewise.
	* testsuite/30_threads/promise/members/at_thread_exit.cc: Likewise.
	* testsuite/30_threads/promise/members/at_thread_exit2.cc: Likewise.
	* testsuite/30_threads/promise/members/get_future.cc: Likewise.
	* testsuite/30_threads/promise/members/get_future2.cc: Likewise.
	* testsuite/30_threads/promise/members/set_exception.cc: Likewise.
	* testsuite/30_threads/promise/members/set_exception2.cc: Likewise.
	* testsuite/30_threads/promise/members/set_value.cc: Likewise.
	* testsuite/30_threads/promise/members/set_value2.cc: Likewise.
	* testsuite/30_threads/promise/members/set_value3.cc: Likewise.
	* testsuite/30_threads/promise/members/swap.cc: Likewise.
	* testsuite/30_threads/promise/requirements/explicit_instantiation.cc:
	* Likewise.
	* testsuite/30_threads/promise/uses_allocator.cc: Likewise.

From-SVN: r263006
2018-07-26 15:02:42 +01:00
Jonathan Wakely 2b69e93cd1 Remove dg-require-cstdint directive from tests
Tests for components which are no longer dependent on
_GLIBCXX_USE_C99_STDINT_TR1 do not need to require <cstdint>.

	* testsuite/18_support/numeric_limits/char16_32_t.cc: Qualify names
	from namespace std.
	* testsuite/20_util/align/2.cc: Remove dg-require-cstdint directive.
	* testsuite/20_util/duration/arithmetic/1.cc: Likewise.
	* testsuite/20_util/duration/arithmetic/2.cc: Likewise.
	* testsuite/20_util/duration/arithmetic/dr2020.cc: Likewise.
	* testsuite/20_util/duration/arithmetic/dr934-1.cc: Likewise.
	* testsuite/20_util/duration/arithmetic/dr934-2.cc: Likewise.
	* testsuite/20_util/duration/comparison_operators/1.cc: Likewise.
	* testsuite/20_util/duration/cons/1.cc: Likewise.
	* testsuite/20_util/duration/cons/1_neg.cc: Likewise.
	* testsuite/20_util/duration/cons/2.cc: Likewise.
	* testsuite/20_util/duration/cons/54025.cc: Likewise.
	* testsuite/20_util/duration/cons/dr974_neg.cc: Likewise.
	* testsuite/20_util/duration/requirements/explicit_instantiation/
	explicit_instantiation.cc: Likewise.
	* testsuite/20_util/duration/requirements/typedefs_neg1.cc: Likewise.
	* testsuite/20_util/duration/requirements/typedefs_neg2.cc: Likewise.
	* testsuite/20_util/duration/requirements/typedefs_neg3.cc: Likewise.
	* testsuite/20_util/make_signed/requirements/typedefs-4.cc: Likewise.
	* testsuite/20_util/ratio/comparisons/comp1.cc: Likewise.
	* testsuite/20_util/ratio/comparisons/comp2.cc: Likewise.
	* testsuite/20_util/ratio/comparisons/comp3.cc: Likewise.
	* testsuite/20_util/ratio/cons/cons1.cc: Likewise.
	* testsuite/20_util/ratio/operations/45866.cc: Likewise.
	* testsuite/20_util/ratio/operations/47913.cc: Likewise.
	* testsuite/20_util/ratio/operations/53840.cc: Likewise.
	* testsuite/20_util/ratio/operations/ops1.cc: Likewise.
	* testsuite/20_util/shared_ptr/atomic/3.cc: Likewise.
	* testsuite/20_util/system_clock/1.cc: Likewise.
	* testsuite/20_util/time_point/1.cc: Likewise.
	* testsuite/20_util/time_point/2.cc: Likewise.
	* testsuite/20_util/time_point/3.cc: Likewise.
	* testsuite/20_util/time_point/requirements/explicit_instantiation/
	explicit_instantiation.cc: Likewise.
	* testsuite/21_strings/basic_string/requirements/
	explicit_instantiation/char16_t/1.cc: Likewise.
	* testsuite/21_strings/basic_string/requirements/
	explicit_instantiation/char32_t/1.cc: Likewise.
	* testsuite/21_strings/basic_string_view/requirements/
	explicit_instantiation/char16_t/1.cc: Likewise.
	* testsuite/21_strings/basic_string_view/requirements/
	explicit_instantiation/char32_t/1.cc: Likewise.
	* testsuite/21_strings/char_traits/requirements/
	explicit_instantiation/char16_t/1.cc: Likewise.
	* testsuite/21_strings/char_traits/requirements/
	explicit_instantiation/char32_t/1.cc: Likewise.
	* testsuite/21_strings/headers/string/types_std_c++0x.cc: Likewise.
	* testsuite/22_locale/codecvt/char16_t.cc: Likewise.
	* testsuite/22_locale/codecvt/char32_t.cc: Likewise.
	* testsuite/22_locale/codecvt/codecvt_utf16/requirements/1.cc:
	Likewise.
	* testsuite/22_locale/codecvt/codecvt_utf8/requirements/1.cc:
	Likewise.
	* testsuite/22_locale/codecvt/codecvt_utf8_utf16/requirements/1.cc:
	Likewise.
	* testsuite/22_locale/codecvt/utf8.cc: Likewise.
	* testsuite/23_containers/vector/bool/72847.cc: Likewise.
	* testsuite/23_containers/vector/debug/multithreaded_swap.cc:
	Likewise.
	* testsuite/experimental/string_view/requirements/
	explicit_instantiation/char16_t/1.cc: Likewise.
	* testsuite/experimental/string_view/requirements/
	explicit_instantiation/char32_t/1.cc: Likewise.
	* testsuite/ext/vstring/requirements/explicit_instantiation/char16_t/
	1.cc: Likewise.
	* testsuite/ext/vstring/requirements/explicit_instantiation/char32_t/
	1.cc: Likewise.

From-SVN: r263005
2018-07-26 15:02:26 +01:00
Jonathan Wakely 8ba7f29e3d Remove <chrono> dependency on _GLIBCXX_USE_C99_STDINT_TR1
By adding fallback definitions of std::intmax_t and std::uintmax_t it's
possible to define <ratio> without _GLIBCXX_USE_C99_STDINT_TR1. This in
turn allows most of <chrono> to be defined, which removes the dependency
on _GLIBCXX_USE_C99_STDINT_TR1 for all of the C++11 concurrency features.

The compiler defines __INTMAX_TYPE__ and __UINTMAX_TYPE__
unconditionally so it should be safe to rely on them.

	* include/bits/atomic_futex.h [!_GLIBCXX_USE_C99_STDINT_TR1]
	(__atomic_futex_unsigned_base): Remove dependency on
	_GLIBCXX_USE_C99_STDINT_TR1 macro.
	* include/bits/unique_lock.h [!_GLIBCXX_USE_C99_STDINT_TR1]
	(unique_lock): Remove dependency on _GLIBCXX_USE_C99_STDINT_TR1.
	* include/c_global/cstdint [!_GLIBCXX_USE_C99_STDINT_TR1] (intmax_t)
	(uintmax_t): Define using predefined macros.
	* include/std/chrono [!_GLIBCXX_USE_C99_STDINT_TR1] (duration)
	(time_point, system_clock, high_resolution_clock, steady_clock): Remove
	dependency on _GLIBCXX_USE_C99_STDINT_TR1 macro.
	(nanoseconds, microseconds, milliseconds, seconds, minutes, hours):
	[!_GLIBCXX_USE_C99_STDINT_TR1]: Define using __INT64_TYPE__ or
	long long when <stdint.h> is not usable.
	* include/std/condition_variable [!_GLIBCXX_USE_C99_STDINT_TR1]
	(condition_variable, condition_variable_any): Remove dependency on
	_GLIBCXX_USE_C99_STDINT_TR1.
	* include/std/future [!_GLIBCXX_USE_C99_STDINT_TR1] (future, promise)
	(packaged_task, async): Likewise.
	* include/std/mutex [!_GLIBCXX_USE_C99_STDINT_TR1] (recursive_mutex)
	(timed_mutex, recursive_timed_mutex, try_lock, lock, scoped_lock)
	(once_flag, call_once): Likewise.
	* include/std/ratio [!_GLIBCXX_USE_C99_STDINT_TR1] (ratio): Likewise.
	* include/std/shared_mutex [!_GLIBCXX_USE_C99_STDINT_TR1]
	(shared_mutex, shared_timed_mutex, shared_lock): Likewise.
	* include/std/thread [!_GLIBCXX_USE_C99_STDINT_TR1] (thread)
	(this_thread::get_id, this_thread::yield, this_thread::sleep_for)
	(this_thread::sleep_until): Likewise.
	* src/c++11/chrono.cc: Remove dependency on
	_GLIBCXX_USE_C99_STDINT_TR1 macro.
	* src/c++11/condition_variable.cc: Likewise.
	* src/c++11/futex.cc: Likewise.
	* src/c++11/future.cc: Likewise.
	* src/c++11/mutex.cc: Likewise.
	* src/c++11/thread.cc: Likewise.
	* testsuite/20_util/duration/literals/range_neg.cc: Adjust dg-error.
	* testsuite/20_util/duration/requirements/typedefs_neg1.cc: Likewise.
	* testsuite/20_util/duration/requirements/typedefs_neg2.cc: Likewise.
	* testsuite/20_util/duration/requirements/typedefs_neg3.cc: Likewise.
	* testsuite/20_util/ratio/cons/cons_overflow_neg.cc: Likewise.
	* testsuite/20_util/ratio/operations/ops_overflow_neg.cc: Likewise.

From-SVN: r263001
2018-07-26 15:01:55 +01:00
Rainer Orth 864f020a10 xfail experimental/memory_resource/new_delete_resource.cc on 32-bit Solaris/x86 (PR libstdc++/77691)
PR libstdc++/77691
	* testsuite/experimental/memory_resource/new_delete_resource.cc:
	xfail execution on 32-bit Solaris/x86.

From-SVN: r263000
2018-07-26 12:36:21 +00:00
Jonathan Wakely aea3722348 PR libstdc++/86676 another alignment fix for test
PR libstdc++/86676
	* testsuite/20_util/monotonic_buffer_resource/release.cc: Request
	same alignment for post-release allocation.

From-SVN: r262984
2018-07-26 00:38:17 +01:00
Jonathan Wakely 17a6321210 PR libstdc++/86676 Do not assume stack buffer is aligned
PR libstdc++/86676
	* testsuite/20_util/monotonic_buffer_resource/release.cc: Allow for
	buffer being misaligned and so returned pointer not being at start.

From-SVN: r262980
2018-07-25 21:23:07 +01:00
Jonathan Wakely dfaa3c47cc Add initial version of C++17 <memory_resource> header
This is missing the synchronized_pool_resource and
unsynchronized_pool_resource classes but is otherwise complete.

This is a new implementation, not based on the existing code in
<experimental/memory_resource>, but memory_resource and
polymorphic_allocator ended up looking almost the same anyway.

The constant_init kluge in src/c++17/memory_resource.cc is apparently
due to Richard Smith and ensures that the objects are constructed during
constant initialiation phase and not destroyed (because the
constant_init destructor doesn't destroy the union member and the
storage is not reused).

	* config/abi/pre/gnu.ver: Export new symbols.
	* configure: Regenerate.
	* include/Makefile.am: Add new <memory_resource> header.
	* include/Makefile.in: Regenerate.
	* include/precompiled/stdc++.h: Include <memory_resource> for C++17.
	* include/std/memory_resource: New header.
	(memory_resource, polymorphic_allocator, new_delete_resource)
	(null_memory_resource, set_default_resource, get_default_resource)
	(pool_options, monotonic_buffer_resource): Define.
	* src/Makefile.am: Add c++17 directory.
	* src/Makefile.in: Regenerate.
	* src/c++11/Makefile.am: Fix comment.
	* src/c++17/Makefile.am: Add makefile for new sub-directory.
	* src/c++17/Makefile.in: Generate.
	* src/c++17/memory_resource.cc: New.
	(newdel_res_t, null_res_t, constant_init, newdel_res, null_res)
	(default_res, new_delete_resource, null_memory_resource)
	(set_default_resource, get_default_resource): Define.
	* testsuite/20_util/memory_resource/1.cc: New test.
	* testsuite/20_util/memory_resource/2.cc: New test.
	* testsuite/20_util/monotonic_buffer_resource/1.cc: New test.
	* testsuite/20_util/monotonic_buffer_resource/allocate.cc: New test.
	* testsuite/20_util/monotonic_buffer_resource/deallocate.cc: New test.
	* testsuite/20_util/monotonic_buffer_resource/release.cc: New test.
	* testsuite/20_util/monotonic_buffer_resource/upstream_resource.cc:
	New test.
	* testsuite/20_util/polymorphic_allocator/1.cc: New test.
	* testsuite/20_util/polymorphic_allocator/resource.cc: New test.
	* testsuite/20_util/polymorphic_allocator/select.cc: New test.
	* testsuite/util/testsuite_allocator.h (__gnu_test::memory_resource):
	Define concrete memory resource for testing.
	(__gnu_test::default_resource_mgr): Define RAII helper for changing
	default resource.

From-SVN: r262953
2018-07-24 22:09:55 +01:00
Jonathan Wakely e874029dd9 PR libstdc++/86658 fix __niter_wrap to not copy invalid iterators
An output iterator passed as the unused first argument to __niter_wrap
might have already been invalidated, so don't copy it.

	PR libstdc++/86658
	* include/bits/stl_algobase.h (__niter_wrap<_Iterator>): Pass unused
	parameter by reference, to avoid copying invalid iterators.
	* testsuite/25_algorithms/copy/86658.cc: New test.

From-SVN: r262952
2018-07-24 21:49:10 +01:00
Jonathan Wakely 4f3c75ba3a Reorder conditions in uses-allocator construction helper
The erased_type condition is only true for code using the Library
Fundamentals TS, so assume it's less common and only check it after
checking for convertibility.

This does mean for types using erased_type the more expensive
convertibility check is done first, but such types are rare.

	* include/bits/uses_allocator.h (__is_erased_or_convertible): Reorder
	conditions. Add comments.
	* testsuite/20_util/uses_allocator/69293_neg.cc: Adjust dg-error line.
	* testsuite/20_util/uses_allocator/cons_neg.cc: Likewise.
	* testsuite/20_util/scoped_allocator/69293_neg.cc: Likewise.

From-SVN: r262945
2018-07-24 14:03:25 +01:00
Jonathan Wakely 2d6c8eea1d PR libstdc++/70940 optimize pmr::resource_adaptor for allocators using malloc
pmr::resource_adaptor can avoid allocating an oversized buffer and doing
manual alignment within that buffer when the wrapped allocator is known
to always meet the requested alignment. Specifically, if the allocator
is known to use malloc or new directly, then we can call the allocator
directly for any fundamental alignment.

	PR libstdc++/70940
	* include/experimental/memory_resource
	(__resource_adaptor_common::_AlignMgr::_M_unadjust): Add assertion.
	(__resource_adaptor_common::__guaranteed_alignment): New helper to
	give maximum alignment an allocator guarantees. Specialize for known
	allocators using new and malloc.
	(__resource_adaptor_imp::do_allocate): Use __guaranteed_alignment.
	(__resource_adaptor_imp::do_deallocate): Likewise.
	* testsuite/experimental/memory_resource/new_delete_resource.cc:
	Check that new and delete are called with expected sizes.

From-SVN: r262935
2018-07-23 20:40:28 +01:00
Jonathan Wakely c01f9216b7 Simplify the base characteristics for some type traits
* include/std/type_traits (__is_member_object_pointer_helper): Use
	__not_<is_function<_Tp>>::type instead of integral_constant.
	(__is_member_function_pointer_helper): Likewise for
	is_function<_Tp>::type.
	(is_compund): Likewise for __not_<is_fundamental<_Tp>>::type.
	(__do_is_nt_destructible_impl): Use __bool_constant and reindent.
	(is_trivially_constructible): Remove redundant use of
	is_constructible.
	(__is_trivially_copy_assignable_impl): Remove redundant use of
	is_copy_assignable.
	(__is_trivially_move_assignable_impl): Remove redundant use of
	is_move_assignable.
	(is_trivially_destructible): Use __bool_constant.
	* testsuite/20_util/is_trivially_assignable/value.cc: Add some more
	tests for scalar types.

From-SVN: r262889
2018-07-19 20:12:37 +01:00
Glen Joseph Fernandes 20a0c4e3dc Use __builtin_memmove for trivially copyable types
2018-07-19  Glen Joseph Fernandes  <glenjofe@gmail.com>

	* include/bits/stl_algobase.h (__copy_move_a): Used
	__is_trivially_copyable.
	(__copy_move_backward_a): Likewise.
	* testsuite/20_util/specialized_algorithms/uninitialized_copy/1.cc:
	New test.

From-SVN: r262884
2018-07-19 19:58:09 +01:00
Jonathan Wakely c3be340eb6 PR libstdc++/86450 use -Wabi=2 and simplify -Werror use
Use -Wabi=2 to fix warnings about -Wabi having no effect on its own.
This requires suppressing two warnings in src/c++11/debug.cc which do
not affect the library ABI.

Previously libstdc++ defaulted to --enable-werror but the -Werror flag
was not actually added unless --enable-maintainer-mode was used. This is
not documented and not the expected behaviour. This removes any special
treatment for maintainer-mode, makes -Werror depend directly on
--enable-werror, and changes the default to --enable-werror=no.

	PR libstdc++/86450
	* acinclude.m4 (GLIBCXX_CHECK_COMPILER_FEATURES): Don't define WERROR.
	(GLIBCXX_EXPORT_FLAGS): Use -Wabi=2 instead of -Wabi.
	* configure: Regenerate.
	* configure.ac: Change GLIBCXX_ENABLE_WERROR default to "no".
	* doc/Makefile.in: Regenerate.
	* fragment.am: Set WERROR_FLAG to -Werror instead of $(WERROR).
	* include/Makefile.in: Regenerate.
	* libsupc++/Makefile.in: Regenerate.
	* po/Makefile.in: Regenerate.
	* python/Makefile.in: Regenerate.
	* src/Makefile.in: Regenerate.
	* src/c++11/Makefile.in: Regenerate.
	* src/c++11/debug.cc: Use diagnostic pragmas to suppress warnings
	from -Wabi=2 that don't affect exported symbols.
	* src/c++98/Makefile.in: Regenerate.
	* src/filesystem/Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.

From-SVN: r262824
2018-07-17 14:18:47 +01:00
Jonathan Wakely 20b47be02c PR libstdc++/86537 remove less<shared_ptr<T>> partial specialization
The standard doesn't specify this partial specialization (it was
required after the changes in N2637 but then should have been removed
following LWG 1262). Its presence is observable because it causes
different results when operator< has been overloaded for a shared_ptr
specialization.

	PR libstdc++/86537
	* include/bits/shared_ptr.h (less<shared_ptr<_Tp>>): Remove
	non-standard partial specialization.
	* include/bits/shared_ptr_base.h (_Sp_less): Remove class definition.
	(less<__shared_ptr<_Tp, _Lp>): Remove partial specialization.
	* testsuite/20_util/shared_ptr/comparison/86537.cc: New test.

From-SVN: r262739
2018-07-16 18:13:41 +01:00
François Dumont 1e736a9531 functions.h (__gnu_debug::__check_string): Move...
2018-07-06  François Dumont  <fdumont@gcc.gnu.org>

	* include/debug/functions.h (__gnu_debug::__check_string): Move...
	* include/debug/string (__gnu_debug::__check_string): ... here.
	(_GLIBCXX_DEBUG_VERIFY_STR_COND_AT): New.
	(__glibcxx_check_string_n_constructor): New.
	(__gnu_debug::basic_string<>(const _CharT*, size_type, const _Alloc&)):
	Use latter.
	(__glibcxx_check_string_constructor): New.
	(__gnu_debug::basic_string<>(const _CharT*, const _Alloc&)):
	Use latter.
	* testsuite/21_strings/basic_string/debug/1_neg.cc: New.
	* testsuite/21_strings/basic_string/debug/2_neg.cc: New.

From-SVN: r262480
2018-07-06 17:02:33 +00:00
Jonathan Wakely 5840e3b8ff PR libstdc++/84928 use std::move in <numeric> algorithms
P0616R0 altered the effects of the <numeric> algorithms to use std::move
on the accumulator values (resolving LWG 2055). This implements the
change for C++2a, but retains the previous behaviour for older
standards.

	* include/bits/stl_numeric.h (_GLIBCXX_MOVE_IF_20): Define macro to
	conditionally move, according to __cplusplus value.
	(accumulate, inner_product, partial_sum, adjacent_difference): Use
	_GLIBCXX_MOVE_IF_20.
	* testsuite/26_numerics/accumulate/lwg2055.cc: New test.
	* testsuite/26_numerics/adjacent_difference/lwg2055.cc: New test.
	* testsuite/26_numerics/inner_product/lwg2055.cc: New test.
	* testsuite/26_numerics/partial_sum/lwg2055.cc: New test.

From-SVN: r262477
2018-07-06 15:16:13 +01:00
Jonathan Wakely 97271bd88f P0935R0 Eradicating unnecessarily explicit default constructors
This is the last remaining piece of P0935R0. This adds a default
constructor to each of the streambuf and stream types in <sstream> so
that default construction does not use the 'explicit' constructor that
has a single, defaulted argument.

	P0935R0 Eradicating unnecessarily explicit default constructors
	* config/abi/pre/gnu.ver: Tighten existing patterns and export new
	default constructor symbols.
	* include/std/sstream (basic_stringbuf, basic_istringstream)
	(basic_ostringstream, basic_stringstream): Remove default arguments
	from explicit constructors taking ios_base::openmode and add separate
	non-explicit default constructors.
	* testsuite/27_io/basic_istringstream/cons/default.cc: New.
	* testsuite/27_io/basic_ostringstream/cons/default.cc: New.
	* testsuite/27_io/basic_stringstream/cons/default.cc: New.
	* testsuite/27_io/basic_stringbuf/cons/char/default.cc: New.
	* testsuite/27_io/basic_stringbuf/cons/wchar_t/default.cc: New.

From-SVN: r262474
2018-07-06 13:39:02 +01:00
Jonathan Wakely d04dbb8ad3 PR libstdc++/85831 define move constructors and operators for exceptions
PR libstdc++/85831
	* config/abi/pre/gnu.ver: Export move constructors and move
	assignment operators for std::logic_error and std::runtime_error.
	* include/std/stdexcept: Use _GLIBCXX_NOTHROW instead of
	_GLIBCXX_USE_NOEXCEPT.
	(logic_error, runtime_error): Declare move constructors and move
	assignment operators. When not declared already, define copy
	constructors and copy assignment operators as explicit-defaulted.
	(domain_error, invalid_argument, length_error, out_of_range)
	(overflow_error, underflow_error): Define move constructors and move
	assignment operators as explicitly-defaulted.
	* libsupc++/exception.h (exception): Likewise.
	* src/c++11/cow-stdexcept.cc (logic_error, runtime_error): Define
	move constructors and move assignment operators as defaulted.
	* testsuite/19_diagnostics/stdexcept.cc: Check that constructors and
	assignment operators are defined.

From-SVN: r262456
2018-07-05 22:29:51 +01:00
Jonathan Wakely 339657d2d3 Add xfail-if to some tests that fail with COW strings
These tests fail when run with -D_GLIBCXX_USE_CXX11_ABI=0

	* testsuite/21_strings/basic_string/cons/char/deduction.cc: XFAIL for
	COW strings.
	* testsuite/21_strings/basic_string/cons/wchar_t/deduction.cc:
	Likewise.
	* testsuite/21_strings/basic_string/requirements/
	explicit_instantiation/debug.cc: Likewise.

From-SVN: r262448
2018-07-05 18:03:14 +01:00
Jonathan Wakely 30236791e0 PR libstdc++/58265 add noexcept to basic_string::assign(basic_string&&)
PR libstdc++/58265
	* include/bits/basic_string.h [!_GLIBCXX_USE_CXX11_ABI]
	(basic_string::assign(basic_string&&)): Add conditional noexcept
	depending on the allocator's is_always_equal property (LWG 2063).
	* testsuite/21_strings/basic_string/modifiers/assign/char/
	move_assign.cc: Check for non-throwing exception specification.
	* testsuite/21_strings/basic_string/modifiers/assign/wchar_t/
	move_assign.cc: Likewise.

From-SVN: r262447
2018-07-05 18:03:05 +01:00
Jonathan Wakely d8d9b83b33 PR libstdc++/58265 implement LWG 2063 for COW strings
For COW strings the default constructor does not allocate when
_GLIBCXX_FULLY_DYNAMIC_STRING == 0, so can be noexcept. The move
constructor and swap do not allocate when the allocators are equal, so
add conditional noexcept using allocator_traits::is_always_equal.

	PR libstdc++/58265
	* include/bits/basic_string.h [!_GLIBCXX_USE_CXX11_ABI]
	[_GLIBCXX_FULLY_DYNAMIC_STRING==0] (basic_string::basic_string()):
	Add GLIBCXX_NOEXCEPT.
	(basic_string::operator=(basic_string&&)): Add _GLIBCXX_NOEXCEPT_IF
	to depend on the allocator's is_always_equal property (LWG 2063).
	(basic_string::swap(basic_string&)): Likewise.
	* include/bits/basic_string.tcc [!_GLIBCXX_USE_CXX11_ABI]
	(basic_string::swap(basic_string&)): Likewise.
	* testsuite/21_strings/basic_string/allocator/char/move_assign.cc:
	Check is_nothrow_move_assignable.
	* testsuite/21_strings/basic_string/allocator/wchar_t/move_assign.cc:
	Check is_nothrow_move_assignable.
	* testsuite/21_strings/basic_string/cons/char/
	noexcept_move_construct.cc: Likewise.
	* testsuite/21_strings/basic_string/cons/wchar_t/
	noexcept_move_construct.cc: Likewise.

From-SVN: r262443
2018-07-05 16:56:06 +01:00
Jonathan Wakely ef45724acd P0646R1 Improving the Return Value of Erase-Like Algorithms I
In C++2a the remove, remove_if and unique members of std::list and
std::forward_list have been changed to return the number of elements
removed. This is an ABI change for the remove members and the
non-template unique members, so an abi-tag is used to give those symbols
new mangled names in C++2a mode. For the function templates the return
type is part of the mangled name so no abi-tag is needed.

	* include/bits/forward_list.h (__cpp_lib_list_remove_return_type):
	Define.
	(forward_list::__remove_return_type): Define typedef as size_type or
	void, according to __cplusplus value.
	(_GLIBCXX_FWDLIST_REMOVE_RETURN_TYPE_TAG): Define macro as abi-tag or
	empty, according to __cplusplus value.
	(forward_list::remove, forward_list::unique): Use typedef and macro
	to change return type and add abi-tag for C++2a.
	(forward_list::remove_if<Pred>, forward_list::unique<BinPred>): Use
	typedef to change return type for C++2a.
	* include/bits/forward_list.tcc (_GLIBCXX20_ONLY): Define macro.
	(forward_list::remove, forward_list::remove_if<Pred>)
	(forward_list::unique<BinPred>): Return number of removed elements
	for C++2a.
	* include/bits/list.tcc (_GLIBCXX20_ONLY): Define macro.
	(list::remove, list::unique, list::remove_if<Predicate>)
	(list::unique<BinaryPredicate>): Return number of removed elements
	for C++2a.
	* include/bits/stl_list.h (__cpp_lib_list_remove_return_type): Define.
	(list::__remove_return_type): Define typedef as size_type or
	void, according to __cplusplus value.
	(_GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG): Define macro as abi-tag or
	empty, according to __cplusplus value.
	(list::remove, list::unique): Use typedef and macro to change return
	type and add abi-tag for C++2a.
	(list::remove_if<Predicate>, list::unique<BinaryPredicate>): Use
	typedef to change return type for C++2a.
	* include/std/version (__cpp_lib_list_remove_return_type): Define.
	* testsuite/23_containers/forward_list/operations/
	remove_cxx20_return.cc: New.
	* testsuite/23_containers/forward_list/operations/
	unique_cxx20_return.cc: New.

From-SVN: r262423
2018-07-04 21:15:01 +01:00
Jonathan Wakely 3adea09eea P0458R2 Checking for Existence of an Element in Associative Containers
* include/bits/stl_map.h (map::contains): Add for C++2a.
	* include/bits/stl_multimap.h (multimap::contains): Likewise.
	* include/bits/stl_multiset.h (multiset::contains): Likewise.
	* include/bits/stl_set.h (set::contains): Likewise.
	* include/bits/stl_tree.h (__has_is_transparent_t): Define alias.
	(_Rb_tree::_M_find_tr, _Rb_tree::_M_count_tr)
	(_Rb_tree::_M_lower_bound_tr, _Rb_tree::_M_upper_bound_tr)
	(_Rb_tree::_M_equal_range_tr): Use __has_is_transparent_t.
	* include/bits/unordered_map.h (unordered_map::contains)
	(unordered_multimap::contains): Add for C++2a.
	* include/bits/unordered_set.h (unordered_set::contains)
	(unordered_multiset::contains): Likewise.
	* testsuite/23_containers/map/operations/contains.cc: New.
	* testsuite/23_containers/multimap/operations/contains.cc: New.
	* testsuite/23_containers/multiset/operations/contains.cc: New.
	* testsuite/23_containers/set/operations/contains.cc: New.
	* testsuite/23_containers/unordered_map/operations/contains.cc: New.
	* testsuite/23_containers/unordered_multimap/operations/contains.cc:
	New.
	* testsuite/23_containers/unordered_multiset/operations/contains.cc:
	New.
	* testsuite/23_containers/unordered_set/operations/contains.cc: New.

From-SVN: r262418
2018-07-04 19:16:26 +01:00
François Dumont 96eb9df619 re PR libstdc++/86272 (__gnu_debug::string uses undefined __glibcxx_check_insert_range2)
2018-07-04  François Dumont  <fdumont@gcc.gnu.org>

	PR libstdc++/86272
	* include/debug/string
	(__gnu_debug::basic_string<>::insert<_Ite>(const_iterator, _Ite, _Ite)):
	Use __glibcxx_check_insert_range.
	* 21_strings/basic_string/cons/char/1.cc: Adapt test to use
	__gnu_debug::string when _GLIBCXX_DEBUG.
	* 21_strings/basic_string/init-list.cc: Likewise.
	* 21_strings/basic_string/modifiers/insert/char/1.cc: Likewise.
	* 21_strings/basic_string/modifiers/insert/char/2.cc: Likewise.
	* 21_strings/basic_string/modifiers/insert/char/83328.cc: Likewise.
	* 21_strings/basic_string/types/1.cc: Likewise.

From-SVN: r262417
2018-07-04 18:13:11 +00:00
Jonathan Wakely 89bc4ab198 Define "random_device" effective target
Currently only matches targets where _GLIBCXX_USE_RANDOM_TR1 is defined,
which means /dev/random and /dev/urandom are usable.

	* testsuite/25_algorithms/make_heap/complexity.cc: Require effective
	target for std::random_device.
	* testsuite/26_numerics/random/random_device/cons/default.cc:
	Likewise.
	* testsuite/experimental/algorithm/sample-2.cc: Likewise.
	* testsuite/experimental/algorithm/shuffle.cc: Likewise.
	* testsuite/experimental/random/randint.cc: Likewise.
	* testsuite/lib/libstdc++.exp
	(check_effective_target_random_device): New proc.

From-SVN: r262415
2018-07-04 17:56:21 +01:00
Jonathan Wakely e9029d55f2 PR libstdc++/86398 fix std::is_trivially_constructible regression
The intrinsic doesn't check for allowed conversions between scalar
types, so restore the std::is_constructible check.

Also make some trivial whitespace changes.

	PR libstdc++/86398
	* include/std/type_traits (is_trivially_constructible): Check
	is_constructible before __is_trivially_constructible.
	* testsuite/20_util/is_trivially_constructible/value.cc: Add more
	tests, including negative cases.
	* testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Use
	zero for dg-error lineno.
	* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc:
	Likewise.

From-SVN: r262379
2018-07-04 10:03:18 +01:00
Jonathan Wakely 90fc44ecfa Optimize std::rotl and std::rotr, add test for std::popcount
* include/std/bit (__rotl, __rotr): Avoid branch.
	(_If_is_unsigned_integer): Use remove_cv_t.
	* testsuite/26_numerics/bit/bitops.count/popcount.cc: New.

From-SVN: r262378
2018-07-04 09:07:23 +01:00
Jonathan Wakely f3e91052bd P0556R3 Integral power-of-2 operations, P0553R2 Bit operations
P0553R2 is not in the C++2a working draft yet, but is likely to be
approved soon. Neither proposal supports std::byte but this adds
overloads of each function for std::byte, assuming that will also get
added.

	* include/Makefile.am: Add new header.
	* include/Makefile.in: Regenerate.
	* include/precompiled/stdc++.h: Include new header.
	* include/std/bit: New header.
	(__rotl, __rotr, __countl_zero, __countl_one, __countr_zero)
	(__countr_one, __popcount, __ispow2, __ceil2, __floor2, __log2p1):
	Define for C++14.
	[!__STRICT_ANSI__] (rotl, rotr, countl_zero, countl_one, countr_zero)
	(countr_one, popcount): Define for C++2a. Also overload for std::byte.
	(ispow2, ceil2, floor2, log2p1): Define for C++2a.
	[!__STRICT_ANSI__] (ispow2, ceil2, floor2, log2p1): Overload for
	std::byte.
	* testsuite/26_numerics/bit/bit.pow.two/ceil2.cc: New.
	* testsuite/26_numerics/bit/bit.pow.two/floor2.cc: New.
	* testsuite/26_numerics/bit/bit.pow.two/ispow2.cc: New.
	* testsuite/26_numerics/bit/bit.pow.two/log2p1.cc: New.
	* testsuite/26_numerics/bit/bitops.rot/rotl.cc: New.
	* testsuite/26_numerics/bit/bitops.rot/rotr.cc: New.
	* testsuite/26_numerics/bit/bitops.count/countl_one.cc: New.
	* testsuite/26_numerics/bit/bitops.count/countl_zero.cc: New.
	* testsuite/26_numerics/bit/bitops.count/countr_one.cc: New.
	* testsuite/26_numerics/bit/bitops.count/countr_zero.cc: New.

From-SVN: r262360
2018-07-03 22:04:45 +01:00
Jonathan Wakely 8df27fcb91 P0758R1 Implicit conversion traits
Extend __is_convertible_helper to also detect whether the conversion is
non-throwing, for std::is_nothrow_convertible in C++2a,

	* include/std/type_traits [__cplusplus > 201703]
	(__is_convertible_helper::__is_nothrow_type): Define new member.
	(__is_convertible_helper<_From, _To, false>::__test_aux1): Add
	noexcept.
	(__is_convertible_helper<_From, _To, false>::__test_nothrow)
	(__is_convertible_helper<_From, _To, false>::__is_nothrow_type): Add
	new members.
	(is_nothrow_convertible, is_nothrow_convertible_v): Define for C++2a.
	* testsuite/20_util/is_nothrow_convertible/value.cc: New.
	* testsuite/20_util/is_nothrow_convertible/requirements/
	explicit_instantiation.cc: New.
	* testsuite/20_util/is_nothrow_convertible/requirements/typedefs.cc:
	New.

From-SVN: r262322
2018-07-02 23:09:25 +01:00
Jonathan Wakely ee896276f6 P0887R1 The identity metafunction
* include/std/type_traits (type_identity, type_identity_t): Define
        for C++2a.
	* testsuite/20_util/type_identity/requirements/alias_decl.cc: New.
	* testsuite/20_util/type_identity/requirements/
	explicit_instantiation.cc:New.
	* testsuite/20_util/type_identity/requirements/typedefs.cc: New.

From-SVN: r262319
2018-07-02 22:05:08 +01:00
Jonathan Wakely e112d53aca Optimize std::sub_match comparisons using string_view-like type
Avoid creation of unnecessary basic_string objects by using a simplified
string_view type and performing comparisons on that type instead. A
temporary basic_string object is still used when the sub_match's
iterators are not contiguous, in order to get an object that the
__string_view can reference.

	* include/bits/regex.h (sub_match::operator string_type): Call str().
	(sub_match::compare): Use _M_str() instead of str().
	(sub_match::_M_compare): New public function.
	(sub_match::__string_view): New helper type.
	(sub_match::_M_str): New overloaded functions to avoid creating a
	string_type object when not needed.
	(operator==, operator!=, operator<, operator>, operator<=, operator>=):
	Use sub_match::_M_compare instead of creating string_type objects.
	Fix Doxygen comments.
	* include/bits/regex_compiler.h (__has_contiguous_iter): Remove.
	(__is_contiguous_normal_iter): Rename to __is_contiguous_iter and
	simplify.
	(__enable_if_contiguous_iter, __disable_if_contiguous_iter): Use
	__enable_if_t.
	* include/std/type_traits (__enable_if_t): Define for C++11.
	* testsuite/28_regex/sub_match/compare.cc: New.
	* testsuite/util/testsuite_iterators.h (remove_cv): Add transformation
	trait.
	(input_iterator_wrapper): Use remove_cv for value_type argument of
	std::iterator base class.

From-SVN: r262318
2018-07-02 21:31:11 +01:00
Jonathan Wakely 6fdce073fc Add whitespace to some dejagnu directives in libstdc++ tests
* testsuite/20_util/add_rvalue_reference/requirements/alias_decl.cc:
	Add whitespace to dejagnu directive.
	* testsuite/23_containers/array/element_access/at_neg.cc: Likewise.

From-SVN: r262245
2018-06-29 10:54:07 +01:00
François Dumont e6cad9872b stl_vector.h (struct _Vector_base<>::_Vector_impl_data): New.
2018-06-27  François Dumont  <fdumont@gcc.gnu.org>

	* include/bits/stl_vector.h
	(struct _Vector_base<>::_Vector_impl_data): New.
	(struct _Vector_base<>::_Vector_impl): Inherit from latter.
	(_Vector_base<>::_Vector_impl::_M_swap_data): Move...
	(_Vector_base<>::_Vector_impl_data::_M_swap_data): ...here.
	(_Vector_base<>::_Vector_impl()): Add noexcept qualification.
	(_Vector_base<>::_Vector_impl(_Vector_impl&&)): New.
	(_Vector_base<>::_Vector_impl(_Tp_alloc_type&&, _Vector_impl&&)): New.
	(_Vector_base(const allocator_type&, _Vector_base&&)): New, use latter.
	(_Vector_base()): Default.
	(_Vector_base(_Vector_base&&)): Default.
	(_Vector_base(size_t)) [_GLIBCXX_INLINE_VERSION]: Delete.
	(_Vector_base(_Tp_alloc_type&&)) [_GLIBCXX_INLINE_VERSION]: Delete.
	(_Vector_base::_M_create_storage(size_t)): Make protected.
	(vector()): Default.
	(vector(vector&&)): Default.
	(vector(vector&&, const allocator_type&, true_type)): New.
	(vector(vector&&, const allocator_type&, false_type)): New.
	(vector(vector&&, const allocator_type&)): Use latters.
	(vector(_InputIte, _InputIte, const allocator_type&)): Call
	_M_range_initialize directly.
	* include/debug/vector
	(vector(vector&&, const allocator_type&)): Add noexcept qualification.
	* testsuite/23_containers/vector/allocator/default_init.cc: New.
	* testsuite/23_containers/vector/cons/noexcept_move_construct.cc: Add
	static assertions.

From-SVN: r262194
2018-06-27 20:23:20 +00:00
David Edelsohn 18338e9eee sample-2.cc: Add TLS DejaGNU directives.
* testsuite/experimental/algorithm/sample-2.cc: Add TLS DejaGNU
        directives.
        * testsuite/experimental/algorithm/shuffle.cc: Likewise.

From-SVN: r262163
2018-06-26 15:17:08 -04:00
Jonathan Wakely 3685dcd7fb PR libstdc++/86292 fix exception safety of std::vector<InputIterator> constructor
PR libstdc++/86292
	* include/bits/stl_vector.h (vector::_M_range_initialize<InputIter>):
	Add try-catch block.
	* testsuite/23_containers/vector/cons/86292.cc: New.

From-SVN: r262029
2018-06-25 17:46:33 +01:00
Jonathan Wakely 37cb7887f8 Add experimental::sample and experimental::shuffle from N4531
The additions to <experimental/random> were added in 2015 but the new
algorithms in <experimental/algorithm> were not. This adds them.

	* include/experimental/algorithm (sample, shuffle): Add new overloads
	using per-thread random number engine.
	* testsuite/experimental/algorithm/sample.cc: Simpify and reduce
	dependencies by using __gnu_test::test_container.
	* testsuite/experimental/algorithm/sample-2.cc: New.
	* testsuite/experimental/algorithm/shuffle.cc: New.

From-SVN: r262024
2018-06-25 17:23:49 +01:00
Jonathan Wakely d72888d340 PR libstdc++/86138 prevent implicit instantiation of COW empty rep
The explicit instantiation declarations for std::basic_string are
disabled for C++17 (and later) so that basic_string symbols get
implicitly instantiated in every translation unit that needs them.  On
targets that don't support STB_GNU_UNIQUE this leads to multiple copies
of the empty rep symbol for COW strings. In order to detect whether a
COW string needs to deallocate its storage it compares the address with
the empty rep.  When there are multiple copies of the empty rep object
the address is not unique, and so string destructors try to delete the
empty rep, which crashes.

In order to guarantee uniqueness of the _S_empty_rep_storage symbol this
patch adds an explicit instantiation declaration for just that symbol.
This means the other symbols are still implicitly instantiated in C++17
code, but for the empty rep the definition in the library gets used.

Separately, there is no need for C++17 code to implicitly instantiate
the I/O functions for strings, so this also restores the explicit
instantiation declarations for those functions.

	PR libstdc++/86138
	* include/bits/basic_string.tcc:
	[__cplusplus > 201402 && !_GLIBCXX_USE_CXX11_ABI]
	(basic_string<char>::_Rep::_S_empty_rep_storage)
	(basic_string<wchar_t>::_Rep::_S_empty_rep_storage): Add explicit
	instantiation declarations.
	[__cplusplus > 201402] (operator>>, operator<<, getline): Re-enable
	explicit instantiation declarations.
	* testsuite/21_strings/basic_string/cons/char/86138.cc: New.
	* testsuite/21_strings/basic_string/cons/wchar_t/86138.cc: New.

From-SVN: r261873
2018-06-22 00:29:01 +01:00
Jonathan Wakely cda121ac7a PR libstdc++/83328 add correct basic_string::insert for initializer_list
The SSO basic_string has a non-standard insert(iterator, initializer_list)
overload, from a C++0x draft. This adds the correct overload, while also
preserving the old one so that the old symbol is still exported from the
library.

The COW basic_string doesn't have any of the C++11 changes to the insert
overloads (they all still have non-const iterator parameters and the
ones that should return an iterator still return void). This doesn't
make any change to the COW string.

	PR libstdc++/83328
	* acinclude.m4 (libtool_VERSION): Bump to 6:26:0.
	* config/abi/pre/gnu.ver: Add GLIBCXX_3.4.26 and export new symbol.
	* configure: Regenerate.
	* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
	(basic_string::insert(const_iterator, initializer_list<C>)): Add.
	[_GLIBCXX_USE_CXX11_ABI && !_GLIBCXX_DEFINING_STRING_INSTANTIATIONS]
	(basic_string::insert(iterator, initializer_list<C>)): Suppress
	definition.
	* include/debug/string (basic_string::insert(iterator, C)): Change
	first parameter to const_iterator.
	(basic_string::insert(iterator, size_type, C)): Likewise. Change
	return type to iterator.
	(basic_string::insert(iterator, InputIterator, InputIterator)):
	Likewise.
	(basic_string::insert(iterator, initializer_list<C>)): Change first
	parameter to const_iterator and return type to iterator.
	* src/c++11/string-inst.cc: Extend comment.
	* testsuite/21_strings/basic_string/modifiers/insert/char/83328.cc:
	New.
	* testsuite/21_strings/basic_string/modifiers/insert/wchar_t/83328.cc:
	New.
	* testsuite/util/testsuite_abi.cc: Add new symbol version.

From-SVN: r261866
2018-06-21 23:01:25 +01:00
Jonathan Wakely e9df6a8f03 PR libstdc++/70940 make pmr::resource_adaptor return aligned memory
PR libstdc++/70940
	* include/experimental/memory_resource
	(__resource_adaptor_imp::do_deallocate): Add missing return.
	* testsuite/experimental/memory_resource/new_delete_resource.cc: New.
	* testsuite/experimental/memory_resource/resource_adaptor.cc: Test
	resource_adaptor with std::allocator, __gnu_cxx::new_allocator and
	__gnu_cxx::malloc_allocator.

From-SVN: r261851
2018-06-21 17:24:00 +01:00
Jonathan Wakely 7956c508dd PR libstdc++/70940 make pmr::resource_adaptor return aligned memory
PR libstdc++/70940
	* include/experimental/memory_resource (__resource_adaptor_common):
	New base class.
	(__resource_adaptor_common::_AlignMgr): Helper for obtaining aligned
	pointer from unaligned, and vice versa.
	(__resource_adaptor_imp::do_allocate): Use _AlignMgr to adjust
	allocated pointer to meet alignment request.
	(__resource_adaptor_imp::do_deallocate): Use _AlignMgr to retrieve
	original pointer for deallocation.
	(__resource_adaptor_imp::do_is_equal): Reformat.
	(__resource_adaptor_imp::_S_aligned_size): Remove.
	(__resource_adaptor_imp::_S_supported): Remove.
	(new_delete_resource): Use __gnu_cxx::new_allocator.
	* testsuite/experimental/memory_resource/resource_adaptor.cc: Test
	extended alignments and use debug_allocator to check for matching
	allocate/deallocate pairs.

From-SVN: r261849
2018-06-21 15:01:11 +01:00
Jonathan Wakely e70359b3de PR libstdc++/70966 make pmr::new_delete_resource() immortal
Construct the program-wide resource objects using placement new. This
means they have dynamic storage duration and won't be destroyed during
termination.

	PR libstdc++/70966
	* include/experimental/memory_resource (__resource_adaptor_imp): Add
	static assertions to enforce requirements on pointer types.
	(__resource_adaptor_imp::get_allocator()): Add noexcept.
	(new_delete_resource, null_memory_resource): Return address of an
	object with dynamic storage duration.
	(__null_memory_resource): Remove.
	* testsuite/experimental/memory_resource/70966.cc: New.

From-SVN: r261818
2018-06-20 20:34:53 +01:00
Jonathan Wakely d9addf3344 Add testcase accidentally not committed earlier
* testsuite/20_util/duration/arithmetic/dr3050.cc: Add new test
	missed from recent commit.

From-SVN: r261810
2018-06-20 16:54:57 +01:00