libstdc++-v3/ChangeLog:
* include/bits/shared_ptr_base.h
(_Sp_counted_base::_M_add_ref_lock_nothrow(): Add noexcept to
definitions to match declaration.
(__shared_count(const __weak_count&, nothrow_t)): Add noexcept
to declaration to match definition.
libstdc++-v3/ChangeLog:
* include/std/ranges (single_view::single_view): Mark the
in place constructor explicit as per LWG 3428.
(take_view): Remove the constraint on the deduction guide's
template parameter as per LWG 3447.
The recent changes to reduce includes in <memory_resource> went a bit
too far, and it's possible for std::forward_as_tuple to not be defined
when used.
While doing this, I noticed the problematic calls to forward_as_tuple
were not qualified, so performed unwanted ADL.
libstdc++-v3/ChangeLog:
* include/experimental/memory_resource: Include <tuple>.
(polymorphic_allocator::construct): Qualify forward_as_tuple.
* include/std/memory_resource: Likewise.
This test fails in C++20 mode because std::is_clock is false for the
test clock, because it doesn't define a duration member.
libstdc++-v3/ChangeLog:
* testsuite/30_threads/condition_variable/members/68519.cc:
Define recent_epoch_float_clock::duration to meet the Cpp17Clock
requirements.
The <condition_variable> header is not small, so <shared_mutex> should
not include it unless it actually needs std::condition_variable, which
is only the case when we don't have pthread_rwlock_t and the POSIX
Timers option.
The <shared_mutex> header would be even smaller if we had a header for
std::condition_variable (separate from std::condition_variable_any).
That's already planned for a future change.
And <memory_resource> would be even smaller if it was possible to get
std::shared_mutex without std::shared_timed_mutex (which depends on
<chrono>). For that to be effective, the synchronized_pool_resource
would have to create its own simpler version of std::shared_lock without
the timed waiting functions. I have no plans to do that.
libstdc++-v3/ChangeLog:
* include/std/shared_mutex: Only include <condition_variable>
when pthread_rwlock_t and POSIX timers are not available.
(__cpp_lib_shared_mutex, __cpp_lib_shared_timed_mutex): Change
value to be type 'long'.
* include/std/version (__cpp_lib_shared_mutex)
(__cpp_lib_shared_timed_mutex): Likewise.
By moving std::make_obj_using_allocator and the related "utility
functions for uses-allocator construction" to a new header, we can avoid
including the whole of <memory> in <scoped_allocator> and
<memory_resource>.
In order to simplify the implementation of those utility functions they
now use concepts unconditionally. They are no longer defined if
__cpp_concepts is not defined. To simplify the code that uses those
functions I've introduced a __cpp_lib_make_obj_using_allocator feature
test macro (not specified in the standard, which might be an oversight).
That allows the code in <memory_resource> and <scoped_allocator> to
check the feature test macro to decide whether to use the new utilities,
or fall back to the C++17 code.
At the same time, this reshuffles some of the headers included by
<memory> so that they are (mostly?) self-contained. It should no longer
be necessary to include other headers before <bits/shared_ptr.h> when
other parts of the library want to use std::shared_ptr without including
the whole of <memory>.
libstdc++-v3/ChangeLog:
* include/Makefile.am: Add new header.
* include/Makefile.in: Regenerate.
* include/bits/shared_ptr.h: Include <iosfwd>.
* include/bits/shared_ptr_base.h: Include required headers here
directly, instead of in <memory>.
* include/bits/uses_allocator_args.h: New file. Move utility
functions for uses-allocator construction from <memory> to here.
Only define the utility functions when concepts are available.
(__cpp_lib_make_obj_using_allocator): Define non-standard
feature test macro.
* include/std/condition_variable: Remove unused headers.
* include/std/future: Likewise.
* include/std/memory: Remove headers that are not needed
directly, and are now inclkuded where they're needed. Include
new <bits/uses_allocator_args.h> header.
* include/std/memory_resource: Include only the necessary
headers. Use new feature test macro to detect support for the
utility functions.
* include/std/scoped_allocator: Likewise.
* include/std/version (__cpp_lib_make_obj_using_allocator):
Define.
When libstdc++ is enabled, the current high level configuration
bits should apply the same to all versions of VxWorks. Adjust the
config triplets matching rules accordingly.
2010-10-21 Olivier Hainque <hainque@adacore.com>
libstdc++-v3/
* crossconfig.m4: Turn vxworks matcher into vxworks*.
* configure.host: Likewise.
* configure: Regenerate.
The _M_add_ref_lock() and _M_add_ref_lock_nothrow() members of
_Sp_counted_base are very similar, except that the former throws an
exception when the use count is zero and the latter returns false. The
former (and its callers) can be implemented in terms of the latter.
This results in a small reduction in code size, because throwing an
exception now only happens in one place.
libstdc++-v3/ChangeLog:
* include/bits/shared_ptr.h (shared_ptr(const weak_ptr&, nothrow_t)):
Add noexcept.
* include/bits/shared_ptr_base.h (_Sp_counted_base::_M_add_ref_lock):
Remove specializations and just call _M_add_ref_lock_nothrow.
(__shared_count, __shared_ptr): Use nullptr for null pointer
constants.
(__shared_count(const __weak_count&)): Use _M_add_ref_lock_nothrow
instead of _M_add_ref_lock.
(__shared_count(const __weak_count&, nothrow_t)): Add noexcept.
(__shared_ptr::operator bool()): Add noexcept.
(__shared_ptr(const __weak_ptr&, nothrow_t)): Add noexcept.
The definition of ranges::subrange was moved to the new
<bits/ranges_util.h> header so that it could be used in <algorithm>
without including the whole of <ranges>. However, the tuple-like support
that enables subrange to be used with structured bindings was left in
<ranges>. This is arguably conforming (to use a subrange you should
include <ranges>) but it's inconvenient and probably confusing.
This change makes the tuple-like support available whenever subrange
itself is available.
libstdc++-v3/ChangeLog:
PR libstdc++/97512
* include/bits/ranges_util.h (tuple_size<subrange>)
(tuple_element<I, cv subrange>): Move here from ...
* include/std/ranges: ... here.
* testsuite/std/ranges/subrange/97512.cc: New test.
There is one adjustment to a C++ test which now gives a false positive.
After talking with Martin Sebor, we've concluded this is expected. There
is no way to communicate that libstdc++ allocated objects are always
less than PTRDIFF_MAX.
gcc/ChangeLog:
* calls.c (get_size_range): Adjust to work with ranger.
* calls.h (get_size_range): Add ranger argument to prototype.
* gimple-ssa-warn-restrict.c (class wrestrict_dom_walker): Remove.
(check_call): Pull out of wrestrict_dom_walker into a
static function.
(wrestrict_dom_walker::before_dom_children): Rename to...
(wrestrict_walk): ...this.
(pass_wrestrict::execute): Instantiate ranger.
(class builtin_memref): Add stmt and query fields.
(builtin_access::builtin_access): Add range_query field.
(builtin_memref::builtin_memref): Same.
(builtin_memref::extend_offset_range): Same.
(builtin_access::builtin_access): Make work with ranger.
(wrestrict_dom_walker::check_call): Pull out into...
(check_call): ...here.
(check_bounds_or_overlap): Add range_query argument.
* gimple-ssa-warn-restrict.h (check_bounds_or_overlap):
Add range_query and gimple stmt arguments.
gcc/testsuite/ChangeLog:
* gcc.dg/Wrestrict-22.c: New test.
* g++.dg/torture/pr92421.C: Adjust for ranger.
libstdc++-v3/ChangeLog:
* testsuite/21_strings/basic_string/capacity/1.cc: Pass
-Wno-stringop-overflow to test.
This moves the __noop_coro_frame type, the __noop_coro_fr global
variable, and the __dummy_resume_destroy function from namespace scope,
replacing them with private members of the specialization
coroutine_handle<noop_coroutine_promise>.
The function and variable are also declared inline, so that they
generate no code unless used.
libstdc++-v3/ChangeLog:
PR libstdc++/95917
* include/std/coroutine (__noop_coro_frame): Replace with
noop_coroutine_handle::__frame.
(__dummy_resume_destroy): Define inline in __frame.
(__noop_coro_fr): Replace with noop_coroutine_handle::_S_fr
and define as inline.
* testsuite/18_support/coroutines/95917.cc: New test.
This removes the coroutine_handle<> base class from the primary template
and the noop_coroutine_promise explicit specialization. To preserve the
API various members are added, as they are no longer inherited from the
base class.
I've also tweaked some indentation and formatting, and replaced
subclause numbers from the standard with stable names like
[coroutine.handle.con].
libstdc++-v3/ChangeLog:
* include/std/coroutine (coroutine_handle<_Promise>): Remove
base class. Add constructors, conversions, accessors etc. as
proposed for LWG 3460.
(coroutine_handle<noop_coroutine_promise>): Likewise.
* testsuite/18_support/coroutines/lwg3460.cc: New test.
This is the std::unique_ptr part of P1020R1 (as amended by P1973R1) for
C++20. The std::shared_ptr part still needs to be done.
libstdc++-v3/ChangeLog:
* include/bits/unique_ptr.h (make_unique_for_overwrite): Define
for C++20.
* testsuite/20_util/unique_ptr/creation/array_neg.cc: Remove
unused header. Adjust standard reference.
* testsuite/20_util/unique_ptr/creation/for_overwrite.cc: New test.
* testsuite/20_util/unique_ptr/creation/for_overwrite__neg.cc: New test.
Although the compiler supports the [[no_unique_address]] attribute, it's
not a reserved name prior to C++20, so we can't use it in std::tuple.
Use [[__no_unique_address__]] instead.
libstdc++-v3/ChangeLog:
* include/std/tuple (_Head_base<Idx, Head, true>): Use reserved
form of __no_unique_address__ attribute because
no_unique_address is not reserved prior to C++20.
The use of std::optional in _Node_handle makes the node handle types for
associative and unordered containers larger than necessary. It also
greatly increases the amount of code included, as <optional> is quite
large.
The boolean flag that records whether the std::optional contains a value
is redundant, because the _Node_handle::_M_ptr member provides the same
information. If the node handle has a non-null pointer it also has an
allocator, and not otherwise. By replacing std::optional with a custom
union type (and using _M_ptr to tell which union member is active) all
node handle sizes can be reduced by sizeof(allocator_type::pointer).
This makes the node handle types incompatible with previous releases, so
must be done before the C++17 ABI is fixed for GCC 11.
libstdc++-v3/ChangeLog:
* include/bits/node_handle.h (_Node_handle_common): Replace
std::optional with custom type.
* testsuite/20_util/variant/exception_safety.cc: Add missing
header include.
This header was not part of the patch submitted and reviewed, and was
not added to include/Makefile.am so never gets installed anyway. It
appears to have been committed by mistake, so let's remove it.
libstdc++-v3/ChangeLog:
* include/precompiled/expc++.h: Removed.
It looks like I did a s/a/__a/ substition in one of these headers, and
then copied it to the other one.
libstdc++-v3/ChangeLog:
* include/std/concepts: Fix typos in copyright notice.
* include/std/ranges: Likewise.
The standard doesn't guarantee that null pointers compare less than
non-null pointers. AddressSanitizer complains about the pptr()> egptr()
comparison in basic_stringbuf::str() when egptr() is null.
libstdc++-v3/ChangeLog:
PR libstdc++/97415
* include/std/sstream (basic_stringbuf::str()): Check for
null egptr() before comparing to non-null pptr().
These two tests have started to fail with the old std::string ABI. The
scan-assembler-not checks fail because they match debug info, not code.
Adding -g0 to the test flags fixes them.
libstdc++-v3/ChangeLog:
* testsuite/21_strings/basic_string/modifiers/assign/char/move_assign_optim.cc:
Do not generate debug info.
* testsuite/21_strings/basic_string/modifiers/assign/wchar_t/move_assign_optim.cc:
Likewise.
There are a lot of very simple constructors for the old string which are
not defined inline. I don't see any reason for this and it probably
makes them less likely to be optimized away. Move the definitions into
the class body.
libstdc++-v3/ChangeLog:
* include/bits/basic_string.h (basic_string(const Alloc&))
(basic_string(const basic_string&)
(basic_string(const CharT*, size_type, const Alloc&))
(basic_string(const CharT*, const Alloc&))
(basic_string(size_type, CharT, const Alloc&))
(basic_string(initializer_list<CharT>, const Alloc&))
(basic_string(InputIterator, InputIterator, const Alloc&)):
Define inline in class body.
* include/bits/basic_string.tcc (basic_string(const Alloc&))
(basic_string(const basic_string&)
(basic_string(const CharT*, size_type, const Alloc&))
(basic_string(const CharT*, const Alloc&))
(basic_string(size_type, CharT, const Alloc&))
(basic_string(initializer_list<CharT>, const Alloc&))
(basic_string(InputIterator, InputIterator, const Alloc&)):
Move definitions into class body.
The COW std::string does support some features of C++11 allocators, just
not propagation. Change some comments in the tests to be more precise
about that.
libstdc++-v3/ChangeLog:
* testsuite/21_strings/basic_string/allocator/char/copy.cc: Make
comment more precise about what isn't supported by COW strings.
* testsuite/21_strings/basic_string/allocator/char/copy_assign.cc:
Likewise.
* testsuite/21_strings/basic_string/allocator/char/move.cc:
Likewise.
* testsuite/21_strings/basic_string/allocator/char/move_assign.cc:
Likewise.
* testsuite/21_strings/basic_string/allocator/char/noexcept.cc:
Likewise.
* testsuite/21_strings/basic_string/allocator/char/operator_plus.cc:
Likewise.
* testsuite/21_strings/basic_string/allocator/char/swap.cc:
Likewise.
* testsuite/21_strings/basic_string/allocator/wchar_t/copy.cc:
Likewise.
* testsuite/21_strings/basic_string/allocator/wchar_t/copy_assign.cc:
Likewise.
* testsuite/21_strings/basic_string/allocator/wchar_t/move.cc:
Likewise.
* testsuite/21_strings/basic_string/allocator/wchar_t/move_assign.cc:
Likewise.
* testsuite/21_strings/basic_string/allocator/wchar_t/noexcept.cc:
Likewise.
* testsuite/21_strings/basic_string/allocator/wchar_t/operator_plus.cc:
Likewise.
* testsuite/21_strings/basic_string/allocator/wchar_t/swap.cc:
Likewise.
These tests were not being run when -D_GLIBCXX_USE_CXX11_ABI=0 was added
to the test flags, but they actually work OK with the old string.
libstdc++-v3/ChangeLog:
* testsuite/21_strings/basic_string/allocator/char/minimal.cc:
Do not require cxx11-abi effective target.
* testsuite/21_strings/basic_string/allocator/wchar_t/minimal.cc:
Likewise.
* testsuite/27_io/basic_fstream/cons/base.cc: Likewise.
The basic_string deduction guides are defined for the old ABI, but the
tests are currently disabled. This is because a single case fails when
using the old ABI, which is just because LWG 3706 isn't implemented for
the old ABI. That can be done easily, and the tests can be enabled.
libstdc++-v3/ChangeLog:
* include/bits/basic_string.h [!_GLIBCXX_USE_CXX11_ABI]
(basic_string(const _CharT*, const _Alloc&)): Constrain to
require an allocator-like type to fix CTAD ambiguity (LWG 3706).
* testsuite/21_strings/basic_string/cons/char/deduction.cc:
Remove dg-skip-if.
* testsuite/21_strings/basic_string/cons/wchar_t/deduction.cc:
Likewise.
libstdc++-v3/ChangeLog:
* include/std/ranges (take_while_view::begin): Constrain the
const overload further as per LWG 3450.
(take_while_view::end): Likewise.
* testsuite/std/ranges/adaptors/take_while.cc: Add test for LWG
3450.
Now that the frontend bug PR96805 is fixed, we can cleanly apply the
proposed resolution for this issue.
This slightly deviates from the proposed resolution by declaring _CI a
member of take_view instead of take_view::_Sentinel, since it doesn't
depend on anything within _Sentinel anymore.
libstdc++-v3/ChangeLog:
PR libstdc++/95322
* include/std/ranges (take_view::_CI): Define this alias
template as per LWG 3449 and remove ...
(take_view::_Sentinel::_CI): ... this type alias.
(take_view::_Sentinel::operator==): Adjust use of _CI
accordingly. Define a second overload that accepts an iterator
of the opposite constness as per LWG 3449.
(take_while_view::_Sentinel::operator==): Likewise.
* testsuite/std/ranges/adaptors/95322.cc: Add tests for LWG 3449.
The doxygen comments for these algos all incorrectly claim to use
(first - last) as the difference from the start of the output range to
the return value. As reported on the mailing list by Johannes Choo, it
should be (last - first).
libstdc++-v3/ChangeLog:
* include/bits/stl_algobase.h (copy, move, copy_backward)
(move_backward): Fix documentation for returned iterator.
gcc/cp/ChangeLog:
PR c++/97201
* error.c (dump_type_suffix): Handle both the C and C++ forms of
zero-length arrays.
libstdc++-v3/ChangeLog:
PR c++/97201
* libsupc++/new (operator new): Add attribute alloc_size and malloc.
gcc/testsuite/ChangeLog:
PR c++/97201
* g++.dg/warn/Wplacement-new-size-8.C: Adjust expected message.
* g++.dg/warn/Warray-bounds-10.C: New test.
* g++.dg/warn/Warray-bounds-11.C: New test.
* g++.dg/warn/Warray-bounds-12.C: New test.
* g++.dg/warn/Warray-bounds-13.C: New test.
Make libstdc++fs.a a 32/64 bit FAT library.
It is too complicated for the FAT library Makefile fragment to determine if
--enable-libstdcxx-filesystem-ts has been enabled. This patch checks the
existence of libstdc++fs.a at build time and adds the complementary object
file if it was built.
libstdc++-v3/Changelog:
2020-10-11 Clement Chigot <clement.chigot@atos.net>
* config/os/aix/t-aix: Add complementary mode object file to
libstdc++fs.a