Commit Graph

634 Commits

Author SHA1 Message Date
Jonathan Wakely 37620d5751 libstdc++: Simplify n-ary arithmetic promotion traits
The std::complex partial specializations have been unnecessary since
774c3d8647

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/ext/type_traits.h (__promote_2, __promote_3)
	(__promote_4): Redfine as alias templates using __promoted_t.
	* include/std/complex (__promote_2): Remove partial
	specializations for std::complex.
2021-08-18 14:26:39 +01:00
Jonathan Wakely 9017326e19 libstdc++: Add additional overload of std::lerp [PR101870]
The [cmath.syn] p1 wording about additional overloads sufficient to
handle any arithmetic types also applies to std::lerp. This adds a new
overload of std::lerp that does the required promotions to support
arguments of arbitrary arithmetic types.

A new __promoted_t alias template is added, which the C++17 function
templates std::hypot and std::lerp can use to avoid instantiating the
__promote_3 class template.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	PR libstdc++/101870
	* include/c_global/cmath (hypot): Use __promoted_t.
	(lerp): Add new overload accepting any arithmetic types.
	* include/ext/type_traits.h (__promoted_t): New alias template.
	* testsuite/26_numerics/lerp.cc: Moved to...
	* testsuite/26_numerics/lerp/1.cc: ...here.
	* testsuite/26_numerics/lerp/constexpr.cc: New test.
	* testsuite/26_numerics/lerp/version.cc: New test.
2021-08-12 19:46:16 +01:00
Jonathan Wakely c9ca352186 libstdc++: Use __builtin_operator_new when available [PR94295]
Clang provides __builtin_operator_new and __builtin_operator_delete,
which have the same semantics as ::operator new and ::operator delete
except that the compiler is allowed to elide calls to them. This changes
std::allocator to use those built-in functions so that memory allocated
by std::allocator can be optimized away when using Clang. This avoids an
abstraction penalty for using std::allocator to allocate storage rather
than a new-expression.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	PR libstdc++/94295
	* include/ext/new_allocator.h (_GLIBCXX_OPERATOR_NEW)
	(_GLIBCXX_OPERATOR_DELETE, _GLIBCXX_SIZED_DEALLOC): Define.
	(allocator::allocate, allocator::deallocate): Use new macros.
2021-07-22 14:38:34 +01:00
Jonathan Wakely 8edb614205 libstdc++: Make __gnu_cxx::sequence_buffer move-aware [PR101542]
The PR explains that Clang trunk now selects a different constructor
when a non-const sequence_buffer is returned in a context where it
qualifies as an implicitly-movable entity. Because lookup is first
performed using an rvalue, the sequence_buffer(const sequence_buffer&)
constructor gets chosen, which makes a copy instead of a "pseudo-move"
via the sequence_buffer(sequence_buffer&) constructor. The problem isn't
seen with GCC because as noted in the r11-2412 commit log, GCC actually
implements a slightly modified rule that avoids breaking exactly this
type of code.

This patch adds a move constructor to sequence_buffer, so that implicit
or explicit moves will have the same effect, calling the
sequence_buffer(sequence_buffer&) constructor. A move assignment
operator is also added to make move assignment work similarly.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	PR libstdc++/101542
	* include/ext/rope (sequence_buffer): Add move constructor and
	move assignment operator.
	* testsuite/ext/rope/101542.cc: New test.
2021-07-21 17:20:37 +01:00
Jonathan Wakely 42167831ab libstdc++: Use __extension__ instead of diagnostic pragmas
This reverts c1676651b6 and uses the
__extension__ keyword to prevent pedantic warnings instead of diagnostic
pragmas.

This also adds the __extension__ keyword in <limits> and <bits/random.h>
where there are some more warnings that I missed in the previous commit.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/bits/cpp_type_traits.h (__INT_N): Use __extension__
	instead of diagnostic pragmas.
	* include/bits/functional_hash.h: Likewise.
	* include/bits/iterator_concepts.h (__is_signed_int128)
	(__is_unsigned_int128): Likewise.
	* include/bits/max_size_type.h (__max_size_type): Likewise.
	(numeric_limits<__max_size_type>): Likewise.
	* include/bits/std_abs.h (abs): Likewise.
	* include/bits/stl_algobase.h (__size_to_integer): Likewise.
	* include/bits/uniform_int_dist.h (uniform_int_distribution):
	Likewise.
	* include/ext/numeric_traits.h (_GLIBCXX_INT_N_TRAITS):
	Likewise.
	* include/std/type_traits (__is_integral_helper<INT_N>)
	(__is_signed_integer, __is_unsigned_integer)
	(__make_unsigned<INT_N>, __make_signed<INT_N>): Likewise.
	* include/std/limits (__INT_N): Add __extension__ keyword.
	* include/bits/random.h (_Select_uint_least_t)
	(random_device): Likewise.
2021-07-16 15:03:03 +01:00
Jonathan Wakely c1676651b6 libstdc++: Suppress pedantic warnings about __int128
With -std=c++NN -pedantic -Wsystem-headers there are warnings about the
use of __int128, which can be suppressed using diagnostic pragmas.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/bits/cpp_type_traits.h: Add diagnostic pragmas around
	uses of non-standard integer types.
	* include/bits/functional_hash.h: Likewise.
	* include/bits/iterator_concepts.h: Likewise.
	* include/bits/max_size_type.h: Likewise.
	* include/bits/std_abs.h: Likewise.
	* include/bits/stl_algobase.h: Likewise.
	* include/bits/uniform_int_dist.h: Likewise.
	* include/ext/numeric_traits.h: Likewise.
	* include/std/type_traits: Likewise.
2021-07-16 08:40:43 +01:00
Jonathan Wakely f2ce64b53f libstdc++: Improvements to Doxygen markup
This attempst to improve the doxygen output to work around what seems to
be some bugs in doxygen (issues 8635 and 8638).

The @addtogroup command doesn't work for entities inside a nested
namespace (see 8635) so we need to close and reopen groups on entering
and elaving nested namespaces. This fixes the problem that
chrono::duration and chrono::time_point were not documented in the
"Time" documentation group. I am unable to make the path classes appear
as part of their relevant groups (File System and Filesystem TS), nor
the contents of <exception> or <system_error>. I have made some minor
improvements to the docs for those types, including starting to address
PR 97001 by adding @since to the doxygen comments.

This change also excludes the <experimental/bits/net.h> header from
Doxygen processing, so we don't get an unwanted "Networking-ts" group
in the documentation.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* doc/doxygen/doxygroups.cc: Fix docs for std::literals.
	* doc/doxygen/user.cfg.in: Exclude the Networking TS header.
	Add some more predefined macros.
	* include/bits/fs_fwd.h: Move @addtogroup commands inside
	namespaces. Add better documentation.
	* include/bits/fs_path.h: Likewise.
	* include/experimental/bits/fs_fwd.h: Likewise.
	* include/experimental/bits/fs_path.h: Likewise.
	* include/ext/throw_allocator.h: Fix typo and improve docs.
	* include/std/chrono: Move @addtogroup commands.
	* include/std/system_error: Move @addtogroup commands.
	* libsupc++/exception: Improve documentation.
	* libsupc++/exception.h: Add @since documentation.
2021-07-01 18:45:48 +01:00
Jonathan Wakely 5e3a1ea3d8 libstdc++: Fix missing members in std::allocator<void>
The changes in 75c6a925da were slightly
incorrect, because the converting constructor should be noexcept, and
the POCMA and is_always_equal traits should still be present in C++20.
This fixes it, and slightly refactors the preprocessor conditions and
order of members. Also add comments explaining things.

The non-standard construct and destroy members added for PR 78052 can be
private if allocator_traits<allocator<void>> is made a friend.

libstdc++-v3/ChangeLog:

	* include/bits/allocator.h (allocator<void>) [C++20]: Add
	missing noexcept to constructor. Restore missing POCMA and
	is_always_equal_traits.
	[C++17]: Make construct and destroy members private and
	declare allocator_traits as a friend.
	* include/bits/memoryfwd.h (allocator_traits): Declare.
	* include/ext/malloc_allocator.h (malloc_allocator::allocate):
	Add nodiscard attribute. Add static assertion for LWG 3307.
	* include/ext/new_allocator.h (new_allocator::allocate): Add
	static assertion for LWG 3307.
	* testsuite/20_util/allocator/void.cc: Check that converting
	constructor is noexcept. Check for propagation traits and
	size_type and difference_type. Check that pointer and
	const_pointer are gone in C++20.
2021-05-11 16:11:01 +01:00
Jonathan Wakely ca871701c2 libstdc++: Fix null dereference in pb_ds containers
This fixes ubsan errors:

ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp:533:15: runtime error: member access within null pointer of type 'struct entry'

libstdc++-v3/ChangeLog:

	* include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp
	(find_key_pointer(key_const_reference, false_type))
	(find_key_pointer(key_const_reference, true_type)): Do not
	dereference null pointer.
2021-05-04 22:34:20 +01:00
Jonathan Wakely daef4e4d93 libstdc++: Fix Doxygen warnings
libstdc++-v3/ChangeLog:

	* include/bits/alloc_traits.h: Use markdown for code font.
	* include/bits/basic_string.h: Fix @param names.
	* include/bits/max_size_type.h: Remove period after @file.
	* include/bits/regex.h: Fix duplicate @retval names, and rename.
	* include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp: Add
	group open to match existing group close.
	* include/ext/pb_ds/priority_queue.hpp: Add blank line before group
	open.
2021-04-06 16:43:24 +01:00
Jonathan Wakely f0b883464c libstdc++: Fix doxygen markup for group close commands
A change in Doxygen 1.8.16 means that "// @}" is no longer recognized by
Doxygen, so doesn't close a @{ group. A "///" comment needs to be used.

libstdc++-v3/ChangeLog:

	* include/bits/atomic_base.h: Fix doxygen group close.
	* include/bits/basic_ios.h: Likewise.
	* include/bits/forward_list.h: Likewise.
	* include/bits/fs_dir.h: Likewise.
	* include/bits/fs_ops.h: Likewise.
	* include/bits/fs_path.h: Likewise.
	* include/bits/functional_hash.h: Likewise.
	* include/bits/gslice.h: Likewise.
	* include/bits/gslice_array.h: Likewise.
	* include/bits/hashtable_policy.h: Likewise.
	* include/bits/indirect_array.h: Likewise.
	* include/bits/locale_classes.h: Likewise.
	* include/bits/locale_facets.h: Likewise.
	* include/bits/locale_facets_nonio.h: Likewise.
	* include/bits/mask_array.h: Likewise.
	* include/bits/refwrap.h: Likewise.
	* include/bits/regex.h: Likewise.
	* include/bits/regex_automaton.h: Likewise.
	* include/bits/regex_compiler.h: Likewise.
	* include/bits/regex_constants.h: Likewise.
	* include/bits/regex_error.h: Likewise.
	* include/bits/regex_executor.h: Likewise.
	* include/bits/regex_scanner.h: Likewise.
	* include/bits/shared_ptr.h: Likewise.
	* include/bits/shared_ptr_atomic.h: Likewise.
	* include/bits/shared_ptr_base.h: Likewise.
	* include/bits/slice_array.h: Likewise.
	* include/bits/specfun.h: Likewise.
	* include/bits/std_function.h: Likewise.
	* include/bits/std_mutex.h: Likewise.
	* include/bits/stl_deque.h: Likewise.
	* include/bits/stl_iterator.h: Likewise.
	* include/bits/stl_iterator_base_types.h: Likewise.
	* include/bits/stl_map.h: Likewise.
	* include/bits/stl_multimap.h: Likewise.
	* include/bits/stl_multiset.h: Likewise.
	* include/bits/stl_numeric.h: Likewise.
	* include/bits/stl_pair.h: Likewise.
	* include/bits/stl_set.h: Likewise.
	* include/bits/stl_uninitialized.h: Likewise.
	* include/bits/stream_iterator.h: Likewise.
	* include/bits/streambuf_iterator.h: Likewise.
	* include/bits/unique_ptr.h: Likewise.
	* include/bits/unordered_map.h: Likewise.
	* include/bits/unordered_set.h: Likewise.
	* include/decimal/decimal: Likewise.
	* include/experimental/any: Likewise.
	* include/experimental/array: Likewise.
	* include/experimental/bits/fs_dir.h: Likewise.
	* include/experimental/bits/fs_fwd.h: Likewise.
	* include/experimental/bits/fs_ops.h: Likewise.
	* include/experimental/bits/fs_path.h: Likewise.
	* include/experimental/buffer: Likewise.
	* include/experimental/internet: Likewise.
	* include/experimental/optional: Likewise.
	* include/experimental/propagate_const: Likewise.
	* include/experimental/socket: Likewise.
	* include/ext/pb_ds/assoc_container.hpp: Likewise.
	* include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp:
	Likewise.
	* include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp: Likewise.
	* include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp: Likewise.
	* include/ext/pb_ds/detail/types_traits.hpp: Likewise.
	* include/ext/pb_ds/exception.hpp: Likewise.
	* include/ext/pb_ds/priority_queue.hpp: Likewise.
	* include/ext/pb_ds/tag_and_trait.hpp: Likewise.
	* include/ext/random: Likewise.
	* include/std/any: Likewise.
	* include/std/atomic: Likewise.
	* include/std/bitset: Likewise.
	* include/std/chrono: Likewise.
	* include/std/complex: Likewise.
	* include/std/condition_variable: Likewise.
	* include/std/fstream: Likewise.
	* include/std/future: Likewise.
	* include/std/iostream: Likewise.
	* include/std/istream: Likewise.
	* include/std/mutex: Likewise.
	* include/std/numeric: Likewise.
	* include/std/ostream: Likewise.
	* include/std/ratio: Likewise.
	* include/std/shared_mutex: Likewise.
	* include/std/stdexcept: Likewise.
	* include/std/streambuf: Likewise.
	* include/std/system_error: Likewise.
	* include/std/thread: Likewise.
	* include/std/valarray: Likewise.
	* include/std/variant: Likewise.
	* include/tr1/cmath: Likewise.
	* include/tr1/regex: Likewise.
	* include/tr2/dynamic_bitset: Likewise.
	* libsupc++/atomic_lockfree_defines.h: Likewise.
	* libsupc++/exception: Likewise.
	* libsupc++/exception.h: Likewise.
	* libsupc++/exception_ptr.h: Likewise.
	* libsupc++/nested_exception.h: Likewise.

libstdc++-v3/ChangeLog:

	* include/tr1/regex:
2021-04-06 16:43:24 +01:00
Vladimir Vishnevsky adeaa43ad3 libstdc++: Fix build failure for targets without unistd.h
The patch fixes build issues occurring if build parameter
"--enable-cstdio=stdio_pure" is specified and no unistd.h is
present in the environment.

libstdc++-v3/ChangeLog:

	* include/ext/stdio_sync_filebuf.h: Remove unused <unistd.h>.
	* src/c++17/fs_ops.cc (fs::permissions): Qualify mode_t.
2021-02-09 12:31:52 +00:00
Jakub Jelinek 99dee82307 Update copyright years. 2021-01-04 10:26:59 +01:00
Jonathan Wakely 7c1e7eed89 libstdc++: Add C++ runtime support for new 128-bit long double format
This adds support for the new __ieee128 long double format on
powerpc64le targets.

Most of the complexity comes from wanting a single libstdc++.so library
that contains the symbols needed by code compiled with both
-mabi=ibmlongdouble and -mabi=ieeelongdouble (and not forgetting
-mlong-double-64 as well!)

In a few places this just requires an extra overload, for example
std::from_chars has to be overloaded for both forms of long double.
That can be done in a single translation unit that defines overloads
for 'long double' and also '__ieee128', so that user code including
<charconv> will be able to link to a definition for either type of long
double. Those are the easy cases.

The difficult parts are (as for the std::string ABI transition) the I/O
and locale facets. In order to be able to write either form of long
double to an ostream such as std::cout we need the locale to contain a
std::num_put facet that can handle both forms. The same approach is
taken as was already done for supporting 64-bit long double and 128-bit
long double: adding extra overloads of do_put to the facet class. On
targets where the new long double code is enabled, the facets that are
registered in the locale at program startup have additional overloads so
that they can work with any long double type. Where this fails to work
is if user code installs its own facet, which will probably not have the
additional overloads and so will only be able to output one or the other
type. In practice the number of users expecting to be able to use their
own locale facets in code using a mix of -mabi=ibmlongdouble and
-mabi=ieeelongdouble is probably close to zero.

libstdc++-v3/ChangeLog:

	* Makefile.in: Regenerate.
	* config.h.in: Regenerate.
	* config/abi/pre/gnu.ver: Make patterns less greedy.
	* config/os/gnu-linux/ldbl-ieee128-extra.ver: New file with patterns
	for IEEE128 long double symbols.
	* configure: Regenerate.
	* configure.ac: Enable alternative 128-bit long double format on
	powerpc64*-*-linux*.
	* doc/Makefile.in: Regenerate.
	* fragment.am: Regenerate.
	* include/Makefile.am: Set _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT.
	* include/Makefile.in: Regenerate.
	* include/bits/c++config: Define inline namespace for new long
	double symbols. Don't define _GLIBCXX_USE_FLOAT128 when it's the
	same type as long double.
	* include/bits/locale_classes.h [_GLIBCXX_LONG_DOUBLE_ALT128_COMPAT]
	(locale::_Impl::_M_init_extra_ldbl128): Declare new member function.
	* include/bits/locale_facets.h (_GLIBCXX_NUM_FACETS): Simplify by
	only counting narrow character facets.
	(_GLIBCXX_NUM_CXX11_FACETS): Likewise.
	(_GLIBCXX_NUM_LBDL_ALT128_FACETS): New.
	[_GLIBCXX_LONG_DOUBLE_ALT128_COMPAT] (num_get::__do_get): Define
	vtable placeholder for __ibm128 long double type.
	[_GLIBCXX_LONG_DOUBLE_ALT128_COMPAT && __LONG_DOUBLE_IEEE128__]
	(num_get::__do_get): Declare vtable placeholder for __ibm128 long
	double type.
	[_GLIBCXX_LONG_DOUBLE_ALT128_COMPAT && __LONG_DOUBLE_IEEE128__]
	(num_put::__do_put): Likewise.
	* include/bits/locale_facets.tcc
	[_GLIBCXX_LONG_DOUBLE_ALT128_COMPAT && __LONG_DOUBLE_IEEE128__]
	(num_get::__do_get, num_put::__do_put): Define.
	* include/bits/locale_facets_nonio.h
	[_GLIBCXX_LONG_DOUBLE_ALT128_COMPAT && __LONG_DOUBLE_IEEE128__]
	(money_get::__do_get): Declare vtable placeholder for __ibm128 long
	double type.
	[_GLIBCXX_LONG_DOUBLE_ALT128_COMPAT && __LONG_DOUBLE_IEEE128__]
	(money_put::__do_put): Likewise.
	* include/bits/locale_facets_nonio.tcc
	[_GLIBCXX_LONG_DOUBLE_ALT128_COMPAT && __LONG_DOUBLE_IEEE128__]
	(money_get::__do_get, money_put::__do_put): Define.
	* include/ext/numeric_traits.h [_GLIBCXX_LONG_DOUBLE_ALT128_COMPAT]
	(__numeric_traits<__ibm128>, __numeric_traits<__ieee128>): Define.
	* libsupc++/Makefile.in: Regenerate.
	* po/Makefile.in: Regenerate.
	* python/Makefile.in: Regenerate.
	* src/Makefile.am: Add compatibility-ldbl-alt128.cc and
	compatibility-ldbl-alt128-cxx11.cc sources and recipes for objects.
	* src/Makefile.in: Regenerate.
	* src/c++11/Makefile.in: Regenerate.
	* src/c++11/compatibility-ldbl-alt128-cxx11.cc: New file defining
	symbols using the old 128-bit long double format, for the cxx11 ABI.
	* src/c++11/compatibility-ldbl-alt128.cc: Likewise, for the
	gcc4-compatible ABI.
	* src/c++11/compatibility-ldbl-facets-aliases.h: New header for long
	double compat aliases.
	* src/c++11/cow-locale_init.cc: Add comment.
	* src/c++11/cxx11-locale-inst.cc: Define C and C_is_char
	unconditionally.
	* src/c++11/cxx11-wlocale-inst.cc: Add sanity check. Include
	locale-inst.cc directly, not via cxx11-locale-inst.cc.
	* src/c++11/locale-inst-monetary.h: New header for monetary
	category instantiations.
	* src/c++11/locale-inst-numeric.h: New header for numeric category
	instantiations.
	* src/c++11/locale-inst.cc: Include new headers for monetary,
	numeric, and long double definitions.
	* src/c++11/wlocale-inst.cc: Remove long double compat aliases that
	are defined in new header now.
	* src/c++17/Makefile.am: Use -mabi=ibmlongdouble for
	floating_from_chars.cc.
	* src/c++17/Makefile.in: Regenerate.
	* src/c++17/floating_from_chars.cc (from_chars_impl): Add
	if-constexpr branch for __ieee128.
	(from_chars): Overload for __ieee128.
	* src/c++20/Makefile.in: Regenerate.
	* src/c++98/Makefile.in: Regenerate.
	* src/c++98/locale_init.cc (num_facets): Adjust calculation.
	(locale::_Impl::_Impl(size_t)): Call _M_init_extra_ldbl128.
	* src/c++98/localename.cc (num_facets): Adjust calculation.
	(locale::_Impl::_Impl(const char*, size_t)): Call
	_M_init_extra_ldbl128.
	* src/filesystem/Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/util/testsuite_abi.cc: Add new symbol versions.
	Allow new symbols to be added to GLIBCXX_IEEE128_3.4.29 and
	CXXABI_IEEE128_1.3.13 too.
	* testsuite/26_numerics/complex/abi_tag.cc: Add u9__ieee128 to
	regex matching expected symbols.
2020-12-16 23:25:01 +00:00
Jonathan Wakely 96d9670e88 libstdc++: Only use __builtin_sprintf if supported [PR 96083]
Clang doesn't support __builtin_sprintf, so use std::sprintf instead.

libstdc++-v3/ChangeLog:

	PR libstdc++/96083
	* include/ext/throw_allocator.h: Use __has_builtin to check for
	__builtin_sprintf support, and use std::sprtinf if necessary.
2020-12-16 14:33:26 +00:00
Jonathan Wakely 74270a546c libstdc++: Fix null pointer dereferences in __gnu_cxx::rope
This fixes UBsan errors like:

/usr/include/c++/10/ext/ropeimpl.h:593:9: runtime error: member access within null pointer of type 'struct _RopeRep'
/usr/include/c++/10/ext/ropeimpl.h:593:9: runtime error: member call on null pointer of type 'struct _Rope_rep_base'
/usr/include/c++/10/ext/rope:556:17: runtime error: reference binding to null pointer of type 'struct allocator_type'
/usr/include/c++/10/ext/ropeimpl.h:593:9: runtime error: reference binding to null pointer of type 'struct allocator_type'
/usr/include/c++/10/ext/rope:1700:30: runtime error: member call on null pointer of type 'struct new_allocator'
/usr/include/c++/10/ext/new_allocator.h:105:29: runtime error: member call on null pointer of type 'struct new_allocator'
/usr/include/c++/10/ext/rope:1702:26: runtime error: reference binding to null pointer of type 'const struct allocator'
/usr/include/c++/10/bits/allocator.h:148:34: runtime error: reference binding to null pointer of type 'const struct new_allocator'
/usr/include/c++/10/ext/rope:1664:39: runtime error: reference binding to null pointer of type 'const struct allocator'
/usr/include/c++/10/ext/rope:1665:9: runtime error: reference binding to null pointer of type 'const struct allocator_type'
/usr/include/c++/10/ext/rope:725:36: runtime error: reference binding to null pointer of type 'const struct allocator_type'
/usr/include/c++/10/ext/rope:614:64: runtime error: reference binding to null pointer of type 'const struct allocator_type'

The problem is calling r->_M_get_allocator() when r is null.

libstdc++-v3/ChangeLog:

	* include/ext/rope (rope::_S_concat_char_iter)
	(rope::_S_destr_concat_char_iter): Add allocator parameter.
	(rope::push_back, rope::append, rope::insert, operator+):
	Pass allocator.
	* include/ext/ropeimpl.h (rope::_S_concat_char_iter)
	(rope::_S_destr_concat_char_iter): Add allocator parameter
	and use it.
	(_Rope_char_ref_proxy::operator=(_CharT)): Pass allocator.
2020-12-02 12:29:00 +00:00
Jonathan Wakely d38fbb5a86 libstdc++: Fix indentation in rope
libstdc++-v3/ChangeLog:

	* include/ext/rope: Fix indentation of access specifiers.
2020-12-02 12:28:22 +00:00
Jonathan Wakely d21776ef90 libstdc++: Simplify __numeric_traits definition
This changes the __numeric_traits primary template to assume its
argument is an integer type. For the three floating point types that are
supported by __numeric_traits_floating an explicit specialization of
__numeric_traits chooses the right base class.

This improves the failure mode for using __numeric_traits with an
unsupported type. Previously it would use __numeric_traits_floating as
the base class, and give somewhat obscure errors for trying to access
the static data members. Now it will use __numeric_traits_integer which
has a static_assert to check for supported types.

As a side effect of this change there is no need to instantiate
__conditional_type to decide which base class to use.

libstdc++-v3/ChangeLog:

	* include/ext/numeric_traits.h (__numeric_traits): Change
	primary template to always derive from __numeric_traits_integer.
	(__numeric_traits<float>, __numeric_traits<double>)
	(__numeric_traits<long double>): Add explicit specializations.
2020-11-12 14:36:39 +00:00
Jonathan Wakely 7f851c3341 libstdc++: Fix __numeric_traits_integer<__int20> [PR 97798]
The expression used to calculate the maximum value for an integer type
assumes that the number of bits in the value representation is always
sizeof(T) * CHAR_BIT. This is not true for the __int20 type on msp430,
which has only 20 bits in the value representation but 32 bits in the
object representation. This causes an integer overflow in a constant
expression, which is ill-formed.

This problem was already solved by DJ for std::numeric_limits<__int20>
by generalizing the helper macros to use a specified number of bits
instead of assuming sizeof(T) * CHAR_BIT. Then the INT_N_n types can
specify the number of bits using the __GLIBCXX_BITSIZE_INT_N_n macros
that the compiler defines.

I'm using a slightly different approach here. I've replaced the helper
macros entirely, and just expanded the calculations in the initializers
for the static data members. By reordering the data members we can reuse
__is_signed and __digits in the other initializers. This removes the
repetition of expanding __glibcxx_signed(T) and __glibcxx_digits(T)
multiple times in each initializer.

The __is_integer_nonstrict trait now defines a new constant, __width,
which is sizeof(T) * CHAR_BIT by default (defined as an enumerator so
that no storage is needed for a static data member). By specializing
__is_integer_nonstrict for the INT_N types that have padding bits, we
can provide the correct width via the __GLIBCXX_BITSIZE_INT_N_n macros.

libstdc++-v3/ChangeLog:

	PR libstdc++/97798
	* include/ext/numeric_traits.h (__glibcxx_signed)
	(__glibcxx_digits, __glibcxx_min, __glibcxx_max): Remove
	macros.
	(__is_integer_nonstrict::__width): Define new constant.
	(__numeric_traits_integer): Define constants in terms of each
	other and __is_integer_nonstrict::__width, rather than the
	removed macros.
	(_GLIBCXX_INT_N_TRAITS): Macro to define explicit
	specializations for non-standard integer types.
2020-11-12 12:10:10 +00:00
Jonathan Wakely d067bd7293 libstdc++: Do not use volatile for __gnu_cxx::rope reference counting
The rope extension uses a volatile variable for its reference count.
This is not only unnecessary for correctness (volatile provides neither
atomicity nor memory visibility, and the variable is only modified while
a lock is held) but it now causes deprecated warnings with
-Wsystem-headers due to the use of ++ and -- operators.

It would be possible to use __gnu_cxx::__exchange_and_add in _M_incr and
_M_decr when __atomic_is_lock_free(sizeof(_RC_t), &_M_ref_count) is
true, rather than locking a mutex. That would probably be a significant
improvement for multi-threaded and single-threaded code (because
__exchange_and_add will use non-atomic ops when possible, and even in MT
code it should be faster than the mutex lock/unlock pair). However,
mixing objects compiled with the old and new code would result in
inconsistent synchronization being used for the reference count.

libstdc++-v3/ChangeLog:

	* include/ext/rope (_Refcount_Base::_M_ref_count): Remove
	volatile qualifier.
	(_Refcount_Base::_M_decr()): Likewise.
2020-10-29 14:47:17 +00:00
Jonathan Wakely eb6b71b83c libstdc++: Fix some warnings in headers
These are usually suppressed without -Wsystem-headers.

libstdc++-v3/ChangeLog:

	* include/bits/hashtable_policy.h (_Local_iterator_base): Cast
	value to avoid -Wsign-compare warnings.
	* include/bits/regex.h (sub_match::_M_str): Avoid narrowing
	conversion.
	* include/bits/regex_compiler.tcc (_Compiler::_M_quantifier):
	Initialize variable to avoid -Wmaybe-uninitialized warning.
	* include/bits/shared_ptr_base.h (_Sp_counted_deleter::_Impl):
	Reorder mem-initializer-list to avoid -Wreorder warning.
	* include/bits/stl_tree.h (_Rb_tree_impl): Explicitly
	initialize base class in copy constructor.
	* include/debug/safe_iterator.h (_Safe_iterator): Likewise.
	* include/ext/debug_allocator.h: Reorder mem-initializer-list
	to avoid -Wreorder warning.
	* include/ext/throw_allocator.h (throw_allocator_limit)
	(throw_allocator_random): Add user-declared assignment operators
	to avoid -Wdeprecated-copy warnings.
2020-10-29 11:43:55 +00:00
Jonathan Wakely 0bc199fc5d libstdc++: Override BUFSIZ for Windows targets [PR 94268]
This replaces uses of BUFSIZ with a new _GLIBCXX_BUFSIZ macro that can
be overridden in target-specific config headers.

That allows the mingw and mingw-w64 targets to override it, because
BUFSIZ is apparently defined to 512, resulting in poor performance. The
MSVCRT stdio apparently uses 4096, so we use that too.

libstdc++-v3/ChangeLog:

	PR libstdc++/94268
	* config/os/mingw32-w64/os_defines.h (_GLIBCXX_BUFSIZ):
	Define.
	* config/os/mingw32/os_defines.h (_GLIBCXX_BUFSIZ):
	Define.
	* include/bits/fstream.tcc: Use _GLIBCXX_BUFSIZ instead
	of BUFSIZ.
	* include/ext/stdio_filebuf.h: Likewise.
	* include/std/fstream (_GLIBCXX_BUFSIZ): Define.
2020-10-28 13:19:21 +00:00
Jonathan Wakely f92a504fdd libstdc++: Make allocators throw bad_array_new_length on overflow [LWG 3190]
std::allocator and std::pmr::polymorphic_allocator should throw
std::bad_array_new_length from their allocate member functions if the
number of bytes required cannot be represented in std::size_t.

libstdc++-v3/ChangeLog:

	* config/abi/pre/gnu.ver: Add new symbol.
	* include/bits/functexcept.h (__throw_bad_array_new_length):
	Declare new function.
	* include/ext/malloc_allocator.h (malloc_allocator::allocate):
	Throw bad_array_new_length for impossible sizes (LWG 3190).
	* include/ext/new_allocator.h (new_allocator::allocate):
	Likewise.
	* include/std/memory_resource (polymorphic_allocator::allocate)
	(polymorphic_allocator::allocate_object): Use new function,
	__throw_bad_array_new_length.
	* src/c++11/functexcept.cc (__throw_bad_array_new_length):
	Define.
	* testsuite/20_util/allocator/lwg3190.cc: New test.
2020-10-05 15:18:56 +01:00
Jonathan Wakely e6923541fa libstdc++: Use __libc_single_threaded to optimise atomics [PR 96817]
Glibc 2.32 adds a global variable that says whether the process is
single-threaded. We can use this to decide whether to elide atomic
operations, as a more precise and reliable indicator than
__gthread_active_p.

This means that guard variables for statics and reference counting in
shared_ptr can use less expensive, non-atomic ops even in processes that
are linked to libpthread, as long as no threads have been created yet.
It also means that we switch to using atomics if libpthread gets loaded
later via dlopen (this still isn't supported in general, for other
reasons).

We can't use __libc_single_threaded to replace __gthread_active_p
everywhere. If we replaced the uses of __gthread_active_p in std::mutex
then we would elide the pthread_mutex_lock in the code below, but not
the pthread_mutex_unlock:

  std::mutex m;
  m.lock();            // pthread_mutex_lock
  std::thread t([]{}); // __libc_single_threaded = false
  t.join();
  m.unlock();          // pthread_mutex_unlock

We need the lock and unlock to use the same "is threading enabled"
predicate, and similarly for init/destroy pairs for mutexes and
condition variables, so that we don't try to release resources that were
never acquired.

There are other places that could use __libc_single_threaded, such as
_Sp_locker in src/c++11/shared_ptr.cc and locale init functions, but
they can be changed later.

libstdc++-v3/ChangeLog:

	PR libstdc++/96817
	* include/ext/atomicity.h (__gnu_cxx::__is_single_threaded()):
	New function wrapping __libc_single_threaded if available.
	(__exchange_and_add_dispatch, __atomic_add_dispatch): Use it.
	* libsupc++/guard.cc (__cxa_guard_acquire, __cxa_guard_abort)
	(__cxa_guard_release): Likewise.
	* testsuite/18_support/96817.cc: New test.
2020-09-26 20:32:36 +01:00
Krystian Kuźniarek 2b4cc19bd5 libstdc++: Add unused attributes to suppress warnings
libstdc++-v3/ChangeLog:

	* include/bits/atomic_base.h: Fix -Wunused-variable
	warnings.
	* include/ext/new_allocator.h: Fix -Wunused-parameter
	warnings.
2020-09-10 17:09:15 +01:00
Jonathan Wakely 386fd16c55 libstdc++: Make __int128 meet integer-class requirements [PR 96042]
Because __int128 can be used as the difference type for iota_view, we
need to ensure that it meets the requirements of an integer-class type.
The requirements in [iterator.concept.winc] p10 include numeric_limits
being specialized and giving meaningful answers. Currently we only
specialize numeric_limits for non-standard integer types in non-strict
modes.  However, nothing prevents us from defining an explicit
specialization for any implementation-defined type, so it doesn't matter
whether std::is_integral<__int128> is true or not.

This patch ensures that the numeric_limits specializations for signed
and unsigned __int128 are defined whenever __int128 is available. It
also makes the __numeric_traits and __int_limits helpers work for
__int128, via a new __gnu_cxx::__is_integer_nonstrict trait.

libstdc++-v3/ChangeLog:

	PR libstdc++/96042
	* include/ext/numeric_traits.h (__is_integer_nonstrict): New
	trait which is true for 128-bit integers even in strict modes.
	(__numeric_traits_integer, __numeric_traits): Use
	__is_integer_nonstrict instead of __is_integer.
	* include/std/limits [__STRICT_ANSI__ && __SIZEOF_INT128__]
	(numeric_limits<__int128>, (numeric_limits<unsigned __int128>):
	Define.
	* testsuite/std/ranges/iota/96042.cc: New test.
2020-08-19 16:49:07 +01:00
Jonathan Wakely eb04805be4 libstdc++: Replace __int_limits with __numeric_traits_integer
I recently added std::__detail::__int_limits as a lightweight
alternative to std::numeric_limits, forgetting that the values it
provides (digits, min and max) are already provided by
__gnu_cxx::__numeric_traits.

This change adds __int_traits as an alias for __numeric_traits_integer.
This avoids instantiating __numeric_traits to decide whether to use
__numeric_traits_integer or __numeric_traits_floating. Then all uses of
__int_limits can be replaced with __int_traits, and __int_limits can be
removed.

libstdc++-v3/ChangeLog:

	* include/Makefile.am: Remove bits/int_limits.h.
	* include/Makefile.in: Regenerate.
	* include/bits/int_limits.h: Removed.
	* include/bits/parse_numbers.h (_Select_int_base): Replace
	__int_limits with __int_traits.
	* include/bits/range_access.h (_SSize::operator()): Likewise.
	* include/ext/numeric_traits.h (__numeric_traits_integer): Add
	static assertion.
	(__int_traits): New alias template.
	* include/std/bit (__rotl, __rotr, __countl_zero, __countl_one)
	(__countr_zero, __countr_one, __popcount, __bit_ceil)
	(__bit_floor, __bit_width) Replace __int_limits with
	__int_traits.
	* include/std/charconv (__to_chars_8, __from_chars_binary)
	(__from_chars_alpha_to_num, from_chars): Likewise.
	* include/std/memory_resource (polymorphic_allocator::allocate)
	(polymorphic_allocator::allocate_object): Likewise.
	* include/std/string_view (basic_string_view::_S_compare):
	Likewise.
	* include/std/utility (cmp_equal, cmp_less, in_range): Likewise.
2020-07-07 23:36:29 +01:00
Jonathan Wakely b1983f4582 libstdc++: Avoid errors in allocator's noexcept-specifier (PR 89510)
This fixes a regression due to the conditional noexcept-specifier on
std::allocator::construct and std::allocator::destroy, as well as the
corresponding members of new_allocator, malloc_allocator, and
allocator_traits. Those noexcept-specifiers were using expressions which
might be ill-formed, which caused errors outside the immediate context
when checking for the presence of construct and destroy in SFINAE
contexts.

The fix is to use the is_nothrow_constructible and
is_nothrow_destructible type traits instead, because those traits are
safe to use even when the construction/destruction itself is not valid.

The is_nothrow_constructible trait will be false for a type that is not
also nothrow-destructible, even if the new-expression used in the
construct function body is actually noexcept. That's not the correct
answer, but isn't a problem because providing a noexcept-specifier on
these functions is not required by the standard anyway. If the answer is
false when it should be true, that's suboptimal but OK (unlike giving
errors for valid code, or giving a true answer when it should be false).

	PR libstdc++/89510
	* include/bits/alloc_traits.h (allocator_traits::_S_construct)
	(allocator_traits::_S_destroy)
	(allocator_traits<allocator<T>>::construct): Use traits in
	noexcept-specifiers.
	* include/bits/allocator.h (allocator<void>::construct)
	(allocator<void>::destroy): Likewise.
	* include/ext/malloc_allocator.h (malloc_allocator::construct)
	(malloc_allocator::destroy): Likewise.
	* include/ext/new_allocator.h (new_allocator::construct)
	(new_allocator::destroy): Likewise.
	* testsuite/20_util/allocator/89510.cc: New test.
	* testsuite/ext/malloc_allocator/89510.cc: New test.
	* testsuite/ext/new_allocator/89510.cc: New test.
2020-04-30 16:01:43 +01:00
Jonathan Wakely bd2420f8fa libstdc++: Add comparison operators to sequence containers
Some more C++20 changes from P1614R2, "The Mothership has Landed".

This implements <=> for sequence containers (and the __normal_iterator
and _Pointer_adapter class templates).

	* include/bits/forward_list.h (forward_list): Define operator<=> and
	remove redundant comparison operators for C++20.
	* include/bits/stl_bvector.h (vector<bool, Alloc>): Likewise.
	* include/bits/stl_deque.h (deque): Likewise.
	* include/bits/stl_iterator.h (__normal_iterator): Likewise.
	* include/bits/stl_list.h (list): Likewise.
	* include/bits/stl_vector.h (vector): Likewise.
	* include/debug/deque (__gnu_debug::deque): Likewise.
	* include/debug/forward_list (__gnu_debug::forward_list): Likewise.
	* include/debug/list (__gnu_debug::list): Likewise.
	* include/debug/safe_iterator.h (__gnu_debug::_Safe_iterator):
	Likewise.
	* include/debug/vector (__gnu_debug::vector): Likewise.
	* include/ext/pointer.h (__gnu_cxx::_Pointer_adapter): Define
	operator<=> for C++20.
	* testsuite/23_containers/deque/operators/cmp_c++20.cc: New test.
	* testsuite/23_containers/forward_list/cmp_c++20.cc: New test.
	* testsuite/23_containers/list/cmp_c++20.cc: New test.
	* testsuite/23_containers/vector/bool/cmp_c++20.cc: New test.
	* testsuite/23_containers/vector/cmp_c++20.cc: New test.
2020-04-17 23:41:04 +01:00
Jonathan Wakely 596676d66c libstdc++: Add comparison operators to types from Utilities clause
Some more C++20 changes from P1614R2, "The Mothership has Landed".

This removes all redundant equality and inequality operators in the
Utilities clause, as they can be synthesized from the remaining equality
operators.

It also removes the single redundant operator in the Localization
clause, because it didn't seem worth doing in a separate commit.

	* include/bits/allocator.h (operator!=): Do not define for C++20.
	* include/bits/locale_classes.h (operator!=): Likewise.
	* include/bits/std_function.h (operator==(nullptr_t, const function&))
	(operator!=(const function&, nullptr_t))
	(operator!=(nullptr_t, const function&)): Likewise.
	* include/ext/bitmap_allocator.h (operator!=): Likewise.
	* include/ext/debug_allocator.h (operator!=): Likewise.
	* include/ext/extptr_allocator.h (operator!=): Likewise.
	* include/ext/malloc_allocator.h (operator!=): Likewise.
	* include/ext/mt_allocator.h (operator!=): Likewise.
	* include/ext/new_allocator.h (operator!=): Likewise.
	* include/ext/pool_allocator.h (operator!=): Likewise.
	* include/ext/throw_allocator.h (operator!=): Likewise.
	* include/std/bitset (bitset::operator!=): Likewise.
	* include/std/memory_resource (operator!=): Likewise.
	* include/std/scoped_allocator (operator!=): Likewise.
2020-04-15 19:47:48 +01:00
Jonathan Wakely c8dd2446f5 libstdc++: Implement P1878R1 "Constraining Readable Types"
* include/bits/iterator_concepts.h (iter_difference_t, iter_value_t):
	Use remove_cvref_t.
	(readable_traits): Rename to indirectly_readable_traits.
	(readable): Rename to indirectly_readable.
	(writable): Rename to indirectly_writable.
	(__detail::__iter_exchange_move): Do not use remove_reference_t.
	(indirectly_swappable): Adjust requires expression parameter types.
	expression.
	* include/bits/ranges_algo.h (ranges::transform, ranges::replace)
	(ranges::replace_if, ranges::generate_n, ranges::generate)
	(ranges::remove): Use new name for writable.
	* include/bits/stl_iterator.h (__detail::__common_iter_has_arrow):
	Use new name for readable.
	* include/ext/pointer.h (readable_traits<_Pointer_adapter<P>>): Use
	new name for readable_traits.
	* testsuite/24_iterators/associated_types/readable.traits.cc: Likewise.
	* testsuite/24_iterators/indirect_callable/projected.cc: Adjust for
	new definition of indirectly_readable.
2020-02-07 16:58:43 +00:00
Jonathan Wakely 1a7886386c libstdc++: Fix <ext/pointer.h> incompatibilities with C++20
The equality operators for _ExtPtr_allocator are defined as non-const
member functions, which causes ambiguities in C++20 due to the
synthesized operator!= candidates. They should always have been const.

The _Pointer_adapter class template has both value_type and element_type
members, which makes readable_traits<_Pointer_adapter<T>> ambiguous. The
intended workaround is to add a specialization of readable_traits.

	* include/ext/extptr_allocator.h (_ExtPtr_allocator::operator==)
	(_ExtPtr_allocator::operator!=): Add missing const qualifiers.
	* include/ext/pointer.h (readable_traits<_Pointer_adapter<S>>): Add
	partial specialization to disambiguate the two constrained
	specializations.

From-SVN: r280067
2020-01-09 21:31:55 +00:00
Jakub Jelinek 8d9254fc8a Update copyright years.
From-SVN: r279813
2020-01-01 12:51:42 +01:00
Jonathan Wakely d03eca30d7 Remove some more using-declarations from namespace __gnu_cxx
Similar to some recent patches, this removes using-declarations for
names from namespace std, so that they are not redeclared in __gnu_cxx.

	* include/bits/stl_iterator.h (namespace __gnu_cxx): Remove
	using-declarations for std::iterator and std::iterator_traits.
	(__gnu_cxx::__normal_iterator): Qualify iterator_traits.
	* include/ext/algorithm (namespace __gnu_cxx): Remove
	using-declarations for std names and qualify those names when used.
	Also refer to std::min in parentheses to protect against function-like
	macros.
	* include/ext/rc_string_base.h: Qualify iterator_traits.
	* include/ext/sso_string_base.h: Qualify iterator_traits.

From-SVN: r277630
2019-10-30 15:48:23 +00:00
Jonathan Wakely 540218dd24 Fix compilation errors with Clang
* include/bits/alloc_traits.h (__cpp_lib_constexpr_dynamic_alloc):
	Define.
	(allocator_traits::_S_construct, allocator_traits::_S_destroy)
	(__alloc_on_copy, __alloc_on_move, __alloc_on_swap): Use
	_GLIBCXX14_CONSTEXPR instead of constexpr.
	* include/bits/stl_construct.h (_Destroy): Likewise.

From-SVN: r277588
2019-10-29 20:16:57 +00:00
Jonathan Wakely 85f2411493 PR c++/91369 Implement P0784R7 changes to allocation and construction
This patch is the first part of library support for constexpr
std::vector and std::string. This only includes the changes to
std::allocator, std::allocator_traits, std::construct_at,
std::destroy_at, std::destroy and std::destroy_n.

std::allocator::allocate and std::allocator::deallocate need to be
added so that they can be intercepted by the compiler during constant
evaluation. Outside of constant evaluation those new member functions
just forward to the existing implementation in the base class.

	PR c++/91369 Implement P0784R7 changes to allocation and construction
	* include/bits/alloc_traits.h: Include <bits/stl_construct.h>.
	(allocator_traits::_S_allocate, allocator_traits::_S_construct)
	(allocator_traits::_S_destroy, allocator_traits::_S_max_size)
	(allocator_traits::_S_select, allocator_traits::allocate)
	(allocator_traits::deallocate, allocator_traits::construct)
	(allocator_traits::destroy, allocator_traits::max_size)
	(allocator_traits::select_on_container_copy_construction)
	(allocator_traits<allocator<T>>): Add constexpr specifier for C++20.
	(allocator_traits<allocator<T>>::construct): Use construct_at.
	(allocator_traits<allocator<T>>::destroy): Use destroy_at.
	(__alloc_on_copy, __alloc_on_move, __alloc_on_swap): Add constexpr
	specifier.
	(_Destroy(ForwardIterator, ForwardIterator, Alloc&))
	(_Destroy(ForwardIterator, ForwardIterator, allocator<T>&)): Move here
	from <bits/stl_construct.h>.
	* include/bits/allocator.h (allocator::~allocator): Remove for C++20.
	(allocator::allocate, allocate::deallocate): Define for C++20 and up.
	(operator==, operator!=): Add constexpr specifier for C++20.
	* include/bits/stl_construct.h: Don't include <ext/alloc_traits.h>.
	(destroy_at): For C++20 add constexpr specifier and support for
	destroying arrays.
	(construct_at): Define new function for C++20.
	(_Construct): Return result of placement new-expression. For C++11 and
	up add constexpr. For C++20 dispatch to std::construct_at during
	constant evaluation.
	(_Destroy(pointer)): Add constexpr specifier. For C++20 dispatch to
	std::destroy_at during constant evaluation.
	(_Destroy_aux::__destroy, _Destroy_n_aux::__destroy_n): Add constexpr
	specifier for C++20.
	(_Destroy(ForwardIterator, ForwardIterator))
	(_Destroy(ForwardIterator, Size)): Likewise. Do not elide trivial
	destructors during constant evaluation.
	(destroy, destroy_n): Add constexpr specifier for C++20.
	(_Destroy(ForwardIterator, ForwardIterator, Alloc&))
	(_Destroy(ForwardIterator, ForwardIterator, allocator<T>&)): Move to
	<bits/alloc_traits.h>, to remove dependency on allocators.
	* include/bits/stl_uninitialized.h: Include <ext/alloc_traits.h>.
	Include <bits/stl_pair.h> instead of <utility>.
	* include/ext/alloc_traits.h: Always include <bits/alloc_traits.h>.
	(__alloc_traits::construct, __alloc_traits::destroy)
	(__alloc_traits::_S_select_on_copy, __alloc_traits::_S_on_swap): Add
	constexpr specifier.
	* include/ext/malloc_allocator.h  (operator==, operator!=): Add
	constexpr specifier for C++20.
	* include/ext/new_allocator.h (operator==, operator!=): Likewise.
	* testsuite/20_util/headers/memory/synopsis.cc: Add constexpr.
	* testsuite/20_util/scoped_allocator/69293_neg.cc: Ignore additional
	errors due to constexpr function called after failed static_assert.
	* testsuite/20_util/specialized_algorithms/construct_at/1.cc: New test.
	* testsuite/23_containers/vector/cons/destructible_debug_neg.cc:
	Ignore additional errors due to constexpr function called after failed
	static_assert.
	* testsuite/23_containers/vector/cons/destructible_neg.cc: Likewise.

From-SVN: r277342
2019-10-23 18:42:11 +01:00
Jonathan Wakely 84a2f4b3a6 Qualify type names in <ext/throw_allocator.h>
* include/ext/throw_allocator.h (throw_allocator_base): Qualify
	size_t and ptrdiff_t.

From-SVN: r277337
2019-10-23 17:14:47 +01:00
Jonathan Wakely ec541f1bc1 Adjust pb_ds extensions to use allocator_traits
These changes are largely useless, because most of them are simply
allowing 'reference' and 'const_reference' types to be obtained from an
allocator, and since C++11 allocators don't define reference types (they
just use plain lvalue references. Pretending to support C++98 allocators
with user-defined reference types is a waste of time (especially as
several of the pb_ds types appear to use a static allocator object which
means stateful allocators are not supported).

	* include/ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp:
	Use detail::rebind_traits.
	* include/ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp:
	Likewise.
	* include/ext/pb_ds/detail/bin_search_tree_/traits.hpp: Likewise.
	* include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp: Likewise.
	* include/ext/pb_ds/detail/binary_heap_/entry_cmp.hpp: Likewise.
	* include/ext/pb_ds/detail/binary_heap_/entry_pred.hpp: Likewise.
	* include/ext/pb_ds/detail/binary_heap_/point_const_iterator.hpp:
	Likewise.
	* include/ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp:
	Likewise.
	* include/ext/pb_ds/detail/branch_policy/branch_policy.hpp: Likewise.
	* include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp: Likewise.
	* include/ext/pb_ds/detail/cond_dealtor.hpp: Likewise.
	* include/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp (has_eq_fn): Likewise.
	* include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp: Likewise.
	* include/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp: Likewise.
	* include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp: Likewise.
	* include/ext/pb_ds/detail/left_child_next_sibling_heap_/
	left_child_next_sibling_heap_.hpp: Likewise.
	* include/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp:
	Likewise.
	* include/ext/pb_ds/detail/left_child_next_sibling_heap_/
	point_const_iterator.hpp: Likewise.
	* include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp: Likewise.
	* include/ext/pb_ds/detail/ov_tree_map_/
	constructors_destructor_fn_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp: Likewise.
	* include/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp: Likewise.
	* include/ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp: Likewise.
	* include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp: Likewise.
	* include/ext/pb_ds/detail/pat_trie_/pat_trie_base.hpp: Likewise.
	* include/ext/pb_ds/detail/rb_tree_map_/node.hpp: Likewise.
	* include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp: Likewise.
	* include/ext/pb_ds/detail/splay_tree_/node.hpp: Likewise.
	* include/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp: Likewise.
	* include/ext/pb_ds/detail/trie_policy/sample_trie_access_traits.hpp:
	Likewise.
	* include/ext/pb_ds/detail/type_utils.hpp: Fix typo in comment.
	* include/ext/pb_ds/detail/types_traits.hpp (stored_value): Add
	bool parameter to control whether the hash value is stored.
	(select_base_type): New class template and partial specialization.
	(maybe_null_type): Likewise.
	(rebind_traits): New class template.
	(type_base): Remove four nearly identical specializations.
	(type_dispatch): Remove.
	(type_traits): Use select_base_type and maybe_null_type instead of
	type_base to control differences between specializations.
	* include/ext/pb_ds/list_update_policy.hpp: Use detail::rebind_traits.
	* include/ext/pb_ds/priority_queue.hpp: Likewise.
	* include/ext/pb_ds/tree_policy.hpp: Likewise.
	* include/ext/pb_ds/trie_policy.hpp: Likewise.

From-SVN: r277336
2019-10-23 17:14:43 +01:00
Jonathan Wakely 603aec6775 Adjust extension types to use allocator_traits
This makes these extensions work with types meeting the Cpp17Allocator
requirements as well as the C++98 Allocator requirements.

	* include/backward/hash_set (hash_set): Use __alloc_traits.
	* include/backward/hashtable.h (_Hashtable): Likewise.
	* include/ext/alloc_traits.h (__alloc_traits::allocate): Add overload
	taking a hint.
	* include/ext/extptr_allocator.h (_ExtPtr_allocator::allocate): Ignore
	hint.
	* include/ext/slist (_Slist_base): Use __alloc_traits.
	* include/tr1/hashtable.h (_Hashtable): Likewise.
	* include/tr1/regex (match_results): Use vector::const_reference
	instead of assuming the allocator defines it.
	* testsuite/backward/hash_map/23528.cc: Use allocator_traits in C++11.
	* testsuite/tr1/6_containers/unordered_map/capacity/29134-map.cc: Use
	__gnu_test::max_size.
	* testsuite/tr1/6_containers/unordered_multimap/capacity/
	29134-multimap.cc: Likewise.
	* testsuite/tr1/6_containers/unordered_multiset/capacity/
	29134-multiset.cc: Likewise.
	* testsuite/tr1/6_containers/unordered_set/capacity/29134-set.cc:
	Likewise.

From-SVN: r277335
2019-10-23 17:14:28 +01:00
Jonathan Wakely 2cae56bd61 Remove redundant std::allocator members for C++20
C++20 removes a number of std::allocator members that have correct
defaults provided by std::allocator_traits, so aren't needed.

Several extensions including __gnu_cxx::hash_map and tr1 containers are
no longer usable with std::allocator in C++20 mode. They need to be
updated to use __gnu_cxx::__alloc_traits in a follow-up patch.

	* include/bits/alloc_traits.h
	(allocator_traits<allocator<T>>::allocate): Ignore hint for C++20.
	(allocator_traits<allocator<T>>::construct): Perform placement new
	directly for C++20, instead of calling allocator<T>::construct.
	(allocator_traits<allocator<T>>::destroy): Call destructor directly
	for C++20, instead of calling allocator<T>::destroy.
	(allocator_traits<allocator<T>>::max_size): Return value directly
	for C++20, instead of calling std::allocator<T>::max_size().
	(__do_alloc_on_copy, __do_alloc_on_move, __do_alloc_on_swap): Do not
	define for C++17 and up.
	(__alloc_on_copy, __alloc_on_move, __alloc_on_swap): Use if-constexpr
	for C++17 and up, instead of tag dispatching.
	* include/bits/allocator.h (allocator<void>): Remove for C++20.
	(allocator::pointer, allocator::const_pointer, allocator::reference)
	(allocator::const_reference, allocator::rebind): Remove for C++20.
	* include/bits/basic_string.h (basic_string): Use __alloc_traits to
	rebind allocator.
	* include/bits/memoryfwd.h (allocator<void>): Remove for C++20.
	* include/ext/debug_allocator.h: Use __alloc_traits for rebinding.
	* include/ext/malloc_allocator.h (malloc_allocator::~malloc_allocator)
	(malloc_allocator::pointer, malloc_allocator::const_pointer)
	(malloc_allocator::reference, malloc_allocator::const_reference)
	(malloc_allocator::rebind, malloc_allocator::max_size)
	(malloc_allocator::construct, malloc_allocator::destroy): Do not
	define for C++20.
	(malloc_allocator::_M_max_size): Define new function.
	* include/ext/new_allocator.h (new_allocator::~new_allocator)
	(new_allocator::pointer, new_allocator::const_pointer)
	(new_allocator::reference, new_allocator::const_reference)
	(new_allocator::rebind, new_allocator::max_size)
	(new_allocator::construct, new_allocator::destroy): Do not
	define for C++20.
	(new_allocator::_M_max_size): Define new function.
	* include/ext/rc_string_base.h (__rc_string_base::_Rep): Use
	__alloc_traits to rebind allocator.
	* include/ext/rope (_Rope_rep_base, _Rope_base): Likewise.
	(rope::rope(CharT, const allocator_type&)): Use __alloc_traits
	to construct character.
	* include/ext/slist (_Slist_base): Use __alloc_traits to rebind
	allocator.
	* include/ext/sso_string_base.h (__sso_string_base::_M_max_size):
	Use __alloc_traits.
	* include/ext/throw_allocator.h (throw_allocator): Do not use optional
	members of std::allocator, use __alloc_traits members instead.
	* include/ext/vstring.h (__versa_string): Use __alloc_traits.
	* include/ext/vstring_util.h (__vstring_utility): Likewise.
	* include/std/memory: Include <bits/alloc_traits.h>.
	* testsuite/20_util/allocator/8230.cc: Use __gnu_test::max_size.
	* testsuite/20_util/allocator/rebind_c++20.cc: New test.
	* testsuite/20_util/allocator/requirements/typedefs.cc: Do not check
	for pointer, const_pointer, reference, const_reference or rebind in
	C++20.
	* testsuite/20_util/allocator/requirements/typedefs_c++20.cc: New test.
	* testsuite/23_containers/deque/capacity/29134.cc: Use
	__gnu_test::max_size.
	* testsuite/23_containers/forward_list/capacity/1.cc: Likewise.
	* testsuite/23_containers/list/capacity/29134.cc: Likewise.
	* testsuite/23_containers/map/capacity/29134.cc: Likewise.
	* testsuite/23_containers/multimap/capacity/29134.cc: Likewise.
	* testsuite/23_containers/multiset/capacity/29134.cc: Likewise.
	* testsuite/23_containers/set/capacity/29134.cc: Likewise.
	* testsuite/23_containers/vector/capacity/29134.cc: Likewise.
	* testsuite/ext/malloc_allocator/variadic_construct.cc: Do not run
	test for C++20.
	* testsuite/ext/new_allocator/variadic_construct.cc: Likewise.
	* testsuite/ext/vstring/capacity/29134.cc: Use __gnu_test::max_size.
	* testsuite/util/replacement_memory_operators.h: Do not assume
	Alloc::pointer exists.
	* testsuite/util/testsuite_allocator.h (__gnu_test::max_size): Define
	helper to call max_size for any allocator.

From-SVN: r277300
2019-10-22 22:48:39 +01:00
Alexandre Oliva c787deb012 skip Cholesky decomposition in is>>n_mv_dist
normal_mv_distribution maintains the variance-covariance matrix param
in Cholesky-decomposed form.  Existing param_type constructors, when
taking a full or lower-triangle varcov matrix, perform Cholesky
decomposition to convert it to the internal representation.  This
internal representation is visible both in the varcov() result, and in
the streamed-out representation of a normal_mv_distribution object.

The problem is that when that representation is streamed back in, the
read-back decomposed varcov matrix is used as a lower-triangle
non-decomposed varcov matrix, and it undergoes Cholesky decomposition
again.  So, each cycle of stream-out/stream-in changes the varcov
matrix to its "square root", instead of restoring the original
params.

This patch includes Corentin's changes that introduce verification in
testsuite/ext/random/normal_mv_distribution/operators/serialize.cc and
other similar tests that the object read back in compares equal to the
written-out object: the modified tests pass only if (u == v).

This patch also fixes the error exposed by his change, introducing an
alternate private constructor for param_type, used only by operator>>.


for  libstdc++-v3/ChangeLog

	* include/ext/random
	(normal_mv_distribution::param_type::param_type): New private
	ctor taking a decomposed varcov matrix, for use by...
	(operator>>): ... this, befriended.
	* include/ext/random.tcc (operator>>): Use it.
	(normal_mv_distribution::param_type::_M_init_lower): Adjust
	member function name in exception message.

for  libstdc++-v3/ChangeLog
from  Corentin Gay  <gay@adacore.com>

	* testsuite/ext/random/beta_distribution/operators/serialize.cc,
	testsuite/ext/random/hypergeometric_distribution/operators/serialize.cc,
	testsuite/ext/random/normal_mv_distribution/operators/serialize.cc,
	testsuite/ext/random/triangular_distribution/operators/serialize.cc,
	testsuite/ext/random/von_mises_distribution/operators/serialize.cc:
	Add call to `VERIFY`.

From-SVN: r274233
2019-08-09 09:20:58 +00:00
Jonathan Wakely a10b664eb7 Fix recent regression in __atomic_add_dispatch
* include/ext/atomicity.h (__exchange_and_add, __atomic_add): Replace
	throw() with _GLIBCXX_NOTHROW.
	(__atomic_add_dispatch): Return after performing atomic increment.

From-SVN: r273167
2019-07-06 22:16:38 +01:00
Jonathan Wakely 0dc7adb037 Fix ODR violations in code using <ext/atomicity.h>
Because the inline versions of __exchange_and_add and __atomic_add are
also marked static, they cannot be used from templates or other inline
functions without ODR violations. This change gives them external
linkage, but adds the always_inline attribute.

    	* include/ext/atomicity.h [_GLIBCXX_ATOMIC_BUILTINS] (__atomic_add)
    	(__exchange_and_add): Replace static specifier with always_inline
    	attribute.
    	(__exchange_and_add_single, __atomic_add_single): Likewise.
    	(__exchange_and_add_dispatch, __atomic_add_dispatch): Likewise. Also
    	combine !__gthread_active_p() and !__GTHREADS branches.

From-SVN: r273144
2019-07-05 17:10:47 +01:00
Jonathan Wakely 3263fb9c6b Remove using-declarations that add std names to __gnu_cxx
These using-declarations appear to have been added for simplicity when
moving the non-standard extensions from namespace std to namespace
__gnu_cxx. Dumping all these names into namespace __gnu_cxx allows
unportable uses like __gnu_cxx::size_t and __gnu_cxx::pair, which serve
no useful purpose.

This patch removes most of the using-declarations from namespace scope,
then either qualifies names as needed or adds using-declarations at
block scope or typedefs at class scope.

	* include/backward/hashtable.h (size_t, ptrdiff_t)
	(forward_iterator_tag, input_iterator_tag, _Construct, _Destroy)
	(distance, vector, pair, __iterator_category): Remove
	using-declarations that add these names to namespace __gnu_cxx.
	* include/ext/bitmap_allocator.h (size_t, ptrdiff_t): Likewise.
	* include/ext/debug_allocator.h (size_t): Likewise.
	* include/ext/functional (size_t, unary_function, binary_function)
	(mem_fun1_t, const_mem_fun1_t, mem_fun1_ref_t, const_mem_fun1_ref_t):
	Likewise.
	* include/ext/malloc_allocator.h (size_t, ptrdiff_t): Likewise.
	* include/ext/memory (ptrdiff_t, pair, __iterator_category): Likewise.
	* include/ext/mt_allocator.h (size_t, ptrdiff_t): Likewise.
	* include/ext/new_allocator.h (size_t, ptrdiff_t): Likewise.
	* include/ext/numeric (iota): Fix outdated comment.
	* include/ext/pool_allocator.h (size_t, ptrdiff_t): Likewise.
	* include/ext/rb_tree (_Rb_tree, allocator): Likewise.
	* include/ext/rope (size_t, ptrdiff_t, allocator, _Destroy): Likewise.
	* include/ext/ropeimpl.h (size_t, printf, basic_ostream)
	(__throw_length_error, _Destroy, std::__uninitialized_fill_n_a):
	Likewise.
	* include/ext/slist (size_t, ptrdiff_t, _Construct, _Destroy)
	(allocator, __true_type, __false_type): Likewise.

From-SVN: r271807
2019-05-31 11:35:07 +01:00
Pádraig Brady e5178b986a std::allocator::deallocate support sized-deallocation
Pass the size to the allocator so that it may optimize deallocation.
This was seen to significantly reduce the work required in jemalloc,
with about 40% reduction in CPU cycles in the free path.

Note jemalloc >= 5.2 is required to fix a crash with 0 sizes.

2019-05-20  Pádraig Brady  <pbrady@fb.com>

	* libstdc++-v3/include/ext/new_allocator.h (deallocate): Pass the size
	to the deallocator with -fsized-deallocation.

From-SVN: r271409
2019-05-20 12:15:03 +01:00
Jonathan Wakely 0d09ca2550 Remove array_allocator extension, deprecated since 4.9.0
This type is not a conforming allocator, because it cannot be reliably
rebound to allocate for a different type. The result of the rebind
transformation still uses the same underlying std::tr1::array<T, 1>
array, which may not be correctly aligned or even have elements the
right size for the value_type of the rebound allocator.

It has been deprecated for several years and should now be removed.

	* doc/xml/manual/allocator.xml: Remove documentation for
	array_allocator.
	* doc/xml/manual/evolution.xml: Document array_allocator removal.
	* doc/xml/manual/using.xml: Remove header from documentation.
	* include/Makefile.am: Remove <ext/array_allocator.h> header.
	* include/Makefile.in: Regenerate.
	* include/ext/array_allocator.h: Remove.
	* include/precompiled/extc++.h: Do not include removed header.
	* testsuite/ext/array_allocator/1.cc: Remove.
	* testsuite/ext/array_allocator/2.cc: Remove.
	* testsuite/ext/array_allocator/26875.cc: Remove.
	* testsuite/ext/array_allocator/3.cc: Remove.
	* testsuite/ext/array_allocator/check_deallocate_null.cc: Remove.
	* testsuite/ext/array_allocator/check_delete.cc: Remove.
	* testsuite/ext/array_allocator/check_new.cc: Remove.
	* testsuite/ext/array_allocator/variadic_construct.cc: Remove.
	* testsuite/ext/headers.cc: Do not include removed header.

From-SVN: r271119
2019-05-13 11:49:58 +01:00
Jonathan Wakely 56e5b093de Avoid -Woverflow warning in __numeric_limits_integer
This is the same fix as was done for std::numeric_limits in r183905.

	PR libstdc++/52119
	* include/ext/numeric_traits.h (__glibcxx_min): Avoid integer
	overflow warning with -Wpedantic -Wsystem-headers.

From-SVN: r270858
2019-05-03 20:13:31 +01:00
Jonathan Wakely 574dfb67be Adjust Doxygen processing of pb_ds containers
Several of the pb_ds headers are intended to be included multiple times,
within the definition of various class templates. The including files
define macros like PB_DS_CLASS_C_DEC and PB_DS_GEN_POS before including
these headers.

In some cases the types defined in the headers are actually nested types
within other classes, and so should not have been documented as though
they are declared in the global namespace, as in:
https://gcc.gnu.org/onlinedocs/gcc-8.3.0/libstdc++/api/a12028.html

In other cases the headers provide inline member function definitions,
but when processed by Doxygen the class name "PB_DS_CLASS_C_DEC" is not
recognised.

This patch makes Doxygen ignore definitions that only make sense when
included in the right context with the right macros defined.

	* include/ext/pb_ds/detail/bin_search_tree_/*_imps.hpp: Do not define
	anything unless PB_DS_CLASS_C_DEC is defined.
	* include/ext/pb_ds/detail/binary_heap_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/binomial_heap_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/binomial_heap_base_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/cc_hash_table_map_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/gp_hash_table_map_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/hash_fn/*_imp.hpp: Likewise.
	* include/ext/pb_ds/detail/left_child_next_sibling_heap_/*_imps.hpp:
	Likewise.
	* include/ext/pb_ds/detail/list_update_map_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/ov_tree_map_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/pairing_heap_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/pat_trie_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/rb_tree_map_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/rc_binomial_heap_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/resize_policy*_imp.hpp: Likewise.
	* include/ext/pb_ds/detail/splay_tree_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/thin_heap_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/trie_policy*_imp.hpp: Likewise.
	* include/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp:
	Likewise.
	* include/ext/pb_ds/detail/unordered_iterator/iterator.hpp: Likewise.
	* include/ext/pb_ds/detail/unordered_iterator/point_const_iterator.hpp:
	Likewise.
	* include/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp:
	Likewise.

From-SVN: r270803
2019-05-02 16:44:46 +01:00
Tom Honermann 65bbaf3125 Disambiguate __gnu_cxx::append_ partial specialization
This patch corrects ambiguous partial specializations of
typelist::detail::append_.  Previously, neither append_<chain<Hd, Tl>,
Typelist_Chain> nor append_<Typelist_Chain, null_type> was a better
match for append_<chain<Hd, Tl>, null_type>.

2019-02-22  Tom Honermann  <tom@honermann.net>

	* include/ext/typelist.h: Constrain a partial specialization of
	typelist::detail::append_ to only match chain<T1,T2>.

From-SVN: r269088
2019-02-22 01:15:58 +00:00
Ulrich Drepper d715f55431 Fix after P0600.
gcc/testsuite/ChangeLog
2019-02-20  Ulrich Drepper  <drepper@redhat.com>

	Fix after P0600.
	* g++.dg/init/new39.C: Don't just ignore result of new.

libstdc++/ChangeLog
2019-02-20  Ulrich Drepper  <drepper@redhat.com>

	Implement C++20 P0600r1.
	* include/backward/hash_map: Add nodiscard attribute to empty.
	* include/backward/hash_set: Likewise.
	* backward/hashtable.h: Likewise.
	* include/bits/basic_string.h: Likewise.
	* include/bits/forward_list.h: Likewise.
	* include/bits/hashtable.h: Likewise.
	* include/bits/regex.h: Likewise.
	* include/bits/stl_deque.h: Likewise.
	* include/bits/stl_list.h: Likewise.
	* include/bits/stl_map.h: Likewise.
	* include/bits/stl_multimap.h: Likewise.
	* include/bits/stl_multiset.h: Likewise.
	* include/bits/stl_queue.h: Likewise.
	* include/bits/stl_set.h: Likewise.
	* include/bits/stl_stack.h: Likewise.
	* include/bits/stl_tree.h: Likewise.
	* include/bits/stl_vector.h: Likewise.
	* include/bits/unordered_map.h: Likewise.
	* include/bits/unordered_set.h: Likewise.
	* include/debug/array: Likewise.
	* include/experimental/any: Likewise.
	* include/experimental/bits/fs_path.h: Likewise.
	* include/experimental/internet: Likewise.
	* include/experimental/string_view: Likewise.
	* include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp:
	Likewise.
	* include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp:
	Likewise.
	* include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp:
	Likewise.
	* include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp:
	Likewise.
	* include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp:
	Likewise.
	* include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp:
	Likewise.
	* include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp:
	Likewise.
	* include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp:
	Likewise.
	* include/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp:
	Likewise.
	*
include/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp:
	Likewise.
	* include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp:
	Likewise.
	* include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp:
	Likewise.
	* include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp:
	Likewise.
	* include/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hp:
	Likewise.
	* include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp:
	Likewise.
	* include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp:
	Likewise.
	* include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp:
	Likewise.
	* include/ext/pb_ds/detail/tree_trace_base.hpp: Likewise.
	* include/ext/pb_ds/trie_policy.hpp: Likewise.
	* include/ext/rope: Likewise.
	* include/ext/slist: Likewise.
	* include/ext/vstring.h: Likewise.
	* include/profile/array: Likewise.
	* include/std/array: Likewise.
	* include/tr1/array: Likewise.
	* include/tr1/hashtable.h: Likewise.
	* include/tr1/regex: Likewise.
	* include/tr2/dynamic_bitset: Likewise.
	* include/bits/alloc_traits.h: Add nodiscard attribute to
	allocate.
	* include/experimental/memory_resource: Likewise.
	* include/ext/alloc_traits.h: Likewise.
	* include/ext/array_allocator.h: Likewise.
	* include/ext/bitmap_allocator.h: Likewise.
	* include/ext/debug_allocator.h: Likewise.
	* include/ext/extptr_allocator.h: Likewise.
	* include/ext/mt_allocator.h: Likewise.
	* include/ext/new_allocator.h: Likewise.
	* include/ext/pool_allocator.h: Likewise.
	* include/ext/throw_allocator.h: Likewise.
	* include/std/scoped_allocator: Likewise.
	* libsupc++/eh_alloc.cc: Likewise.
	* include/std/future: Add nodiscard attribute to async.
	* libsupc++/new: Add nodiscard attribute to new.

From-SVN: r268111
2019-01-21 11:47:30 +00:00