Commit Graph

14280 Commits

Author SHA1 Message Date
alnyan 71322b5ad3 alnyan/yggdrasil: target-level support for x86_64-unknown-yggdrasil 2024-03-14 22:09:26 +02:00
Jakub Jelinek c891d8dc23 Update ChangeLog and version files for release 2023-07-27 08:13:36 +00:00
GCC Administrator a5aac58fce Daily bump. 2023-07-20 00:21:40 +00:00
Jonathan Wakely cd2f934bb0 libstdc++: Fix preprocessor conditions for std::from_chars [PR109921]
We use the from_chars_strtod function with __strtof128 to read a
_Float128 value, but from_chars_strtod is not defined unless uselocale
is available. This can lead to compilation failures for some targets,
because we try to define the _Float128 overload in terms of a
non-existing from_chars_strtod function.

Only try to use __strtof128 if uselocale is available and therefore we
can use the from_chars_strtod function template.

This is a simpler change than r14-1431-g7037e7b6e4ac41 on trunk, because
that caused unwanted ABI regressions (PR libstdc++/110077).

libstdc++-v3/ChangeLog:

	PR libstdc++/109921
	* src/c++17/floating_from_chars.cc (USE_STRTOF128_FOR_FROM_CHARS):
	Only define when USE_STRTOD_FOR_FROM_CHARS is also defined.
	(USE_STRTOD_FOR_FROM_CHARS): Do not undefine when long double is
	binary64.
	(from_chars(const char*, const char*, double&, chars_format)):
	Check __LDBL_MANT_DIG__ == __DBL_MANT_DIG__ here.
2023-07-19 21:38:08 +01:00
Jonathan Wakely 61bf34d174 libstdc++: Fix iostream init for Clang on darwin [PR110432]
The __has_attribute(init_priority) check in <iostream> is true for Clang
on darwin, which means that user code including <iostream> thinks the
library will initialize the global streams. However, when libstdc++ is
built by GCC on darwin, the __has_attribute(init_priority) check is
false, which means that the library thinks that user code will do the
initialization when <iostream> is included. This means that the
initialization is never done.

Add an autoconf check so that the header and the library both make their
decision based on the static properties of GCC at build time, with a
consistent outcome.

As a belt and braces check, also do the initialization in <iostream> if
the compiler including that header doesn't support the attribute (even
if the library also containers the initialization). This might result in
redundant initialization done in <iostream>, but ensures the
initialization happens somewhere if there's any doubt about the
attribute working correctly due to missing linker support.

libstdc++-v3/ChangeLog:

	PR libstdc++/110432
	* acinclude.m4 (GLIBCXX_CHECK_INIT_PRIORITY): New.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Use GLIBCXX_CHECK_INIT_PRIORITY.
	* include/std/iostream: Use new autoconf macro as well as
	__has_attribute.
	* src/c++98/ios_base_init.h: Use new autoconf macro instead of
	__has_attribute.

Reviewed-by: Patrick Palka <ppalka@redhat.com>
(cherry picked from commit fe2651affa8c15624188bfd062fb894648743431)
2023-07-19 20:34:56 +01:00
Iain Sandoe c042baa99e testsuite, Darwin: Remove an unnecessary flags addition.
The addition of the multiply_defined suppress flag has been handled for some
considerable time now in the Darwin specs; remove it from the testsuite libs.
Avoid duplicates in the specs.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

gcc/ChangeLog:

	* config/darwin.h: Avoid duplicate multiply_defined specs on
	earlier Darwin versions with shared libgcc.

libstdc++-v3/ChangeLog:

	* testsuite/lib/libstdc++.exp: Remove additional flag handled
	by Darwin specs.

gcc/testsuite/ChangeLog:

	* lib/g++.exp: Remove additional flag handled by Darwin specs.
	* lib/obj-c++.exp: Likewise.

(cherry picked from commit 3c776fdf1a825818ad7248d442e846f532574ff7)
2023-07-19 09:06:45 +01:00
GCC Administrator 220275a22a Daily bump. 2023-07-19 00:21:29 +00:00
Jonathan Wakely a32d4a34da libstdc++: Fix std::__uninitialized_default_n for constant evaluation [PR110542]
libstdc++-v3/ChangeLog:

	PR libstdc++/110542
	* include/bits/stl_uninitialized.h (__uninitialized_default_n):
	Do not use std::fill_n during constant evaluation.

(cherry picked from commit 83cae6c4b788544635a71748e1881c150f42efef)
2023-07-18 10:10:11 +01:00
Jonathan Wakely d96e4962f5 libstdc++: Implement P2538R1 ADL-proof std::projected
This was recently approved for C++26, but there's no harm in
implementing it unconditionally for C++20 and C++23. As it says in the
paper, it doesn't change the meaning of any valid code. It only enables
things that were previously ill-formed for questionable reasons.

libstdc++-v3/ChangeLog:

	* include/bits/iterator_concepts.h (projected): Replace class
	template with alias template denoting an ADL-proofed helper.
	(incremental_traits<projected<Iter, Proj>>): Remove.
	* testsuite/24_iterators/indirect_callable/projected-adl.cc:
	New test.

(cherry picked from commit 6eafdfc73c21d7a5e59e18c9dee275af5bf6d979)
2023-07-18 10:09:17 +01:00
Jonathan Wakely 5342e3cc44 libstdc++: Fix --enable-cstdio=stdio_pure [PR110574]
When configured with --enable-cstdio=stdio_pure we need to consistently
use fseek and not mix seeks on the file descriptor with reads and writes
on the FILE stream.

There are also a number of bugs related to error handling and return
values, because fread and fwrite return 0 on error, not -1, and fseek
returns 0 on success, not the file offset.

libstdc++-v3/ChangeLog:

	PR libstdc++/110574
	* acinclude.m4 (GLIBCXX_CHECK_LFS): Check for fseeko and ftello
	and define _GLIBCXX_USE_FSEEKO_FTELLO.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* config/io/basic_file_stdio.cc (xwrite) [_GLIBCXX_USE_STDIO_PURE]:
	Check for fwrite error correctly.
	(__basic_file<char>::xsgetn) [_GLIBCXX_USE_STDIO_PURE]: Check for
	fread error correctly.
	(get_file_offset): New function.
	(__basic_file<char>::seekoff) [_GLIBCXX_USE_STDIO_PURE]: Use
	fseeko if available. Use get_file_offset instead of return value
	of fseek.
	(__basic_file<char>::showmanyc): Use get_file_offset.

(cherry picked from commit 2f6bbc9a7d9a62423c576e13dc46323fe16ba5aa)
2023-07-18 10:08:18 +01:00
Tianqiang Shuai c9da749155 libstdc++: Fix fwrite error parameter
The first parameter of fwrite should be the const char* __s which want
write to FILE *__file, rather than the FILE *__file write to the FILE
*__file.

libstdc++-v3/ChangeLog:

	* config/io/basic_file_stdio.cc (xwrite) [USE_STDIO_PURE]: Fix
	first argument.

(cherry picked from commit bb4f8f14ed15310b5e01f1c6013585550debdab9)
2023-07-18 10:07:18 +01:00
Jonathan Wakely 813722fbe4 libstdc++: Disable std::forward_list tests for C++98 mode
These tests fail with -std=gnu++98/-D_GLIBCXX_DEBUG in the runtest
flags. They should require the c++11 effective target.

libstdc++-v3/ChangeLog:

	* testsuite/23_containers/forward_list/debug/iterator1_neg.cc:
	Skip as UNSUPPORTED for C++98 mode.
	* testsuite/23_containers/forward_list/debug/iterator3_neg.cc:
	Likewise.

(cherry picked from commit cd9964b7e2311209ffaa00b322b31c67d64ca83d)
2023-07-18 10:06:52 +01:00
Jonathan Wakely d2c737c40c libstdc++: Fix <iosfwd> synopsis test
The <syncstream> header is only supported for the cxx11 ABI. The
declarations of basic_syncbuf, basic_osyncstream, syncbuf and
osyncstream were already correctly guarded by a check for
_GLIBCXX_USE_CXX11_ABI, but the wsyncbuf and wosyncstream declarations
were not.

libstdc++-v3/ChangeLog:

	* testsuite/27_io/headers/iosfwd/synopsis.cc: Make wsyncbuf and
	wosyncstream depend on _GLIBCXX_USE_CXX11_ABI.

(cherry picked from commit f9f05e483984bf89fec7778aaa55ece8ba2a86bb)
2023-07-18 10:06:21 +01:00
Jonathan Wakely c17539d71b libstdc++: Fix src/c++20/tzdb.cc for non-constexpr std::mutex
Building libstdc++ reportedly fails for targets without lock-free
std::atomic<T*> which don't define __GTHREAD_MUTEX_INIT:

src/c++20/tzdb.cc:110:21: error: 'constinit' variable 'std::chrono::{anonymous}::list_mutex' does not have a constant initializer
src/c++20/tzdb.cc:110:21: error: call to non-'constexpr' function 'std::mutex::mutex()'

The solution implemented by this commit is to use a local static mutex
when it can't be constinit, so that it's constructed on first use.

With this change, we can also simplify the preprocessor logic for
defining USE_ATOMIC_SHARED_PTR. It now depends on the same conditions as
USE_ATOMIC_LIST_HEAD, so in theory we could have a single macro. Keeping
them separate would allow us to replace the use of atomic<shared_ptr<T>>
with a mutex if that performs better, without having to give up on the
lock-free cache for fast access to the list head.

libstdc++-v3/ChangeLog:

	* src/c++20/tzdb.cc (USE_ATOMIC_SHARED_PTR): Define consistently
	with USE_ATOMIC_LIST_HEAD.
	(list_mutex): Replace global object with function. Use local
	static object when std::mutex constructor isn't constexpr.

(cherry picked from commit 5dfdf0ae4dca44a4f572c346d322fd6244598190)
2023-07-18 10:05:48 +01:00
Jonathan Wakely dae9635887 libstdc++: Qualify calls to std::_Destroy and _Destroy_aux
These calls should be qualified to prevent ADL, which can cause errors
for incomplete types that are associated classes.

libstdc++-v3/ChangeLog:

	* include/bits/alloc_traits.h (_Destroy): Qualify call.
	* include/bits/stl_construct.h (_Destroy, _Destroy_n): Likewise.
	* testsuite/23_containers/vector/cons/destroy-adl.cc: New test.

(cherry picked from commit 33245d6b87a284495304c9952813b6b83d5df99f)
2023-07-18 10:03:15 +01:00
Jonathan Wakely 5439234be2 libstdc++: Qualify calls to debug mode helpers
These functions should be qualified to disable unwanted ADL.

The overload of __check_singular_aux for safe iterators was previously
being found by ADL, because it wasn't declared before __check_singular.
Add a declaration so that it can be found by qualified lookup.

libstdc++-v3/ChangeLog:

	* include/debug/helper_functions.h (__get_distance)
	(__check_singular, __valid_range_aux, __valid_range): Qualify
	calls to disable ADL.
	(__check_singular_aux(const _Safe_iterator_base*)): Declare
	overload that was previously found via ADL.

(cherry picked from commit fa98bc4270dcb4ec78b5b1c0f4c067094c84bae6)
2023-07-18 10:02:47 +01:00
GCC Administrator 04a3fa2233 Daily bump. 2023-07-13 00:20:44 +00:00
Jonathan Wakely db179779c9 libstdc++: Check conversion from filesystem::path to wide strings [PR95048]
The testcase added for this bug only checks conversion from wide strings
on construction, but the fix also covered conversion to wide strings via
path::wstring(). Add checks for that, and u16string() and u32string().

libstdc++-v3/ChangeLog:

	PR libstdc++/95048
	* testsuite/27_io/filesystem/path/construct/95048.cc: Check
	conversions to wide strings.
	* testsuite/experimental/filesystem/path/construct/95048.cc:
	Likewise.

(cherry picked from commit d6384ad1a9ab7ea46990a7ed1299d5a2be4acece)
2023-07-12 21:15:35 +01:00
GCC Administrator 4a158c09e5 Daily bump. 2023-07-07 00:20:19 +00:00
Jonathan Wakely 94d24f1af6 libstdc++: Document --enable-cstdio=stdio_pure [PR104299]
libstdc++-v3/ChangeLog:

	PR libstdc++/104299
	* doc/xml/manual/configure.xml: Describe stdio_pure argument to
	--enable-cstdio.
	* doc/html/manual/configure.html: Regenerate.

(cherry picked from commit b90a70984a9beee39b41f842b56926f9db2069ca)
2023-07-06 16:39:13 +01:00
GCC Administrator e2dd8e421f Daily bump. 2023-06-30 00:21:39 +00:00
Jonathan Wakely b7b70cba65 libstdc++: Fix configure test for 32-bit targets
The -mlarge model for msp430-elf uses 20-bit pointers, which means that
sizeof(void*) == 4 and so the r14-1432-g51cf0b3949b88b change gives the
wrong answer. Check __INTPTR_WIDTH__ >= 32 instead.

libstdc++-v3/ChangeLog:

	* acinclude.m4 (GLIBCXX_ZONEINFO_DIR): Fix for 32-bit pointers
	to check __INT_PTR_WIDTH__ instead of sizeof(void*).
	* configure: Regenerate.

(cherry picked from commit 2a919c08abb2cc5aeb31abb400b3489f67467dbf)
2023-06-29 23:59:44 +01:00
Jonathan Wakely fa78e9a672 libstdc++: Disable embedded tzdata for all 16-bit targets
libstdc++-v3/ChangeLog:

	* acinclude.m4 (GLIBCXX_ZONEINFO_DIR): Extend logic for avr and
	msp430 to all 16-bit targets.
	* configure: Regenerate.

(cherry picked from commit 51cf0b3949b88b5e622872e4dac019ceb27400e1)
2023-06-29 23:59:43 +01:00
Jonathan Wakely 2d40cd2f19 libstdc++: Fix std::format for pointers [PR110239]
The formatter for pointers was casting to uint64_t which sign extends a
32-bit pointer and produces a value that won't fit in the provided
buffer. Cast to uintptr_t instead.

There was also a bug in the __parse_integer helper when converting a
wide string to a narrow string in order to use std::from_chars on it.
The function would always try to read 32 characters, even if the format
string was shorter than that. Fix that bug, and remove the constexpr
implementation of __parse_integer by just using __from_chars_alnum
instead of from_chars, because that's usable in constexpr even in
C++20.

libstdc++-v3/ChangeLog:

	PR libstdc++/110239
	* include/std/format (__format::__parse_integer): Fix buffer
	overflow for wide chars.
	(formatter<const void*, C>::format): Cast to uintptr_t instead
	of uint64_t.
	* testsuite/std/format/string.cc: Test too-large widths.

(cherry picked from commit 3bb9f9329c378934541ae4cff9977b7487e97cf0)
2023-06-29 23:59:43 +01:00
Jonathan Wakely ae7cdc8c0f libstdc++: Fix P2510R3 "Formatting pointers" [PR110149]
I had intended to support the P2510R3 proposal unconditionally in C++20
mode, but I left it half implemented. The parse function supported the
new extensions, but the format function didn't.

This adds the missing pieces, and makes it only enabled for C++26 and
non-strict modes.

libstdc++-v3/ChangeLog:

	PR libstdc++/110149
	* include/std/format (formatter<const void*, charT>::parse):
	Only alow 0 and P for C++26 and non-strict modes.
	(formatter<const void*, charT>::format): Use toupper for P
	type, and insert zero-fill characters for 0 option.
	* testsuite/std/format/functions/format.cc: Check pointer
	formatting. Only check P2510R3 extensions conditionally.
	* testsuite/std/format/parse_ctx.cc: Only check P2510R3
	extensions conditionally.

(cherry picked from commit 628ba410b9265dbd4278c1f1b1fadf05348adef2)
2023-06-29 23:59:43 +01:00
Jonathan Wakely dbd4acd722 libstdc++: Disable cacheline alignment for DJGPP [PR109741]
DJGPP (and maybe other targets) uses MAX_OFILE_ALIGNMENT=16 which means
that globals (and static objects) can't have alignment greater than 16.
This causes an error for the locks defined in src/c++11/shared_ptr.cc
because we try to align them to the cacheline size, to avoid false
sharing.

Add a configure check for the increased alignment, and live with false
sharing where we can't increase the alignment.

libstdc++-v3/ChangeLog:

	PR libstdc++/109741
	* acinclude.m4 (GLIBCXX_CHECK_ALIGNAS_CACHELINE): Define.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Use GLIBCXX_CHECK_ALIGNAS_CACHELINE.
	* src/c++11/shared_ptr.cc (__gnu_internal::get_mutex): Do not
	align lock table if not supported. use __GCC_DESTRUCTIVE_SIZE
	instead of hardcoded 64.

(cherry picked from commit 94a311abf783de754f0f1b2d4c1f00a9788e795b)
2023-06-29 23:59:43 +01:00
Jonathan Wakely 132015b9c6 libstdc++: Add preprocessor checks to <experimental/internet> [PR100285]
We can't define endpoints and resolvers without the relevant OS support.
If IPPROTO_TCP and IPPROTO_UDP are both undefined then we won't need
basic_endpoint and basic_resolver anyway, so make them depend on those
macros.

libstdc++-v3/ChangeLog:

	PR libstdc++/100285
	* include/experimental/internet [IPPROTO_TCP || IPPROTO_UDP]
	(basic_endpoint, basic_resolver_entry, resolver_base)
	(basic_resolver_results, basic_resolver): Only define if the tcp
	or udp protocols will be defined.

(cherry picked from commit 793ed718b522b15e2d758eca953feeec1979fe2c)
2023-06-29 23:59:25 +01:00
Jonathan Wakely aa087355c7 libstdc++: Fix some tests that fail with -fexcess-precision=standard
libstdc++-v3/ChangeLog:

	* testsuite/20_util/duration/cons/2.cc: Use values that aren't
	affected by rounding.
	* testsuite/20_util/from_chars/5.cc: Cast arithmetic result to
	double before comparing for equality.
	* testsuite/20_util/from_chars/6.cc: Likewise.
	* testsuite/20_util/variant/86874.cc: Use values that aren't
	affected by rounding.
	* testsuite/25_algorithms/lower_bound/partitioned.cc: Compare to
	original value instead of to floating-point-literal.
	* testsuite/26_numerics/random/discrete_distribution/cons/range.cc:
	Cast arithmetic result to double before comparing for equality.
	* testsuite/26_numerics/random/piecewise_constant_distribution/cons/range.cc:
	Likewise.
	* testsuite/26_numerics/random/piecewise_linear_distribution/cons/range.cc:
	Likewise.
	* testsuite/26_numerics/valarray/transcend.cc (eq): Check that
	the absolute difference is less than 0.01 instead of comparing
	to two decimal places.
	* testsuite/27_io/basic_istream/extractors_arithmetic/char/01.cc:
	Cast arithmetic result to double before comparing for equality.
	* testsuite/27_io/basic_istream/extractors_arithmetic/char/09.cc:
	Likewise.
	* testsuite/27_io/basic_istream/extractors_arithmetic/char/10.cc:
	Likewise.
	* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/01.cc:
	Likewise.
	* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/09.cc:
	Likewise.
	* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/10.cc:
	Likewise.
	* testsuite/ext/random/hoyt_distribution/cons/parms.cc: Likewise.

(cherry picked from commit ae12aced97b41c7498ffc5b4dd314878289547ab)
2023-06-29 23:58:48 +01:00
Jonathan Wakely 4b05a7d051 libstdc++: Add missing noexcept to std::scoped_allocator_adaptor
The standard requires these constructors and accessors to be noexcept.

libstdc++-v3/ChangeLog:

	* include/std/scoped_allocator (scoped_allocator_adaptor): Add
	noexcept to all constructors except the default constructor.
	(scoped_allocator_adaptor::inner_allocator): Add noexcept.
	(scoped_allocator_adaptor::outer_allocator): Likewise.
	* testsuite/20_util/scoped_allocator/noexcept.cc: New test.

(cherry picked from commit b960c253e988c68ed3f3829125bc267bdf169356)
2023-06-29 23:58:48 +01:00
Jonathan Wakely 52997b1431 libstdc++: Improve tests for emplace member of sequence containers
Our existing tests for std::deque::emplace, std::list::emplace and
std::vector::emplace are poor. We only have compile tests for PR 52799
and the equivalent for a const_iterator as the insertion point. This
fails to check that the value is actually inserted correctly and the
right iterator is returned.

Add new tests that cover the existing 52799.cc and const_iterator.cc
compile-only tests, as well as verifying the effects are correct.

libstdc++-v3/ChangeLog:

	* testsuite/23_containers/deque/modifiers/emplace/52799.cc:
	Removed.
	* testsuite/23_containers/deque/modifiers/emplace/const_iterator.cc:
	Removed.
	* testsuite/23_containers/list/modifiers/emplace/52799.cc:
	Removed.
	* testsuite/23_containers/list/modifiers/emplace/const_iterator.cc:
	Removed.
	* testsuite/23_containers/vector/modifiers/emplace/52799.cc:
	Removed.
	* testsuite/23_containers/vector/modifiers/emplace/const_iterator.cc:
	Removed.
	* testsuite/23_containers/deque/modifiers/emplace/1.cc: New
	test.
	* testsuite/23_containers/list/modifiers/emplace/1.cc: New
	test.
	* testsuite/23_containers/vector/modifiers/emplace/1.cc: New
	test.

(cherry picked from commit 3ec1d76a359542ed4c8370390efa9ee9e25e757f)
2023-06-29 23:58:48 +01:00
GCC Administrator 4513d0a2eb Daily bump. 2023-06-07 00:22:21 +00:00
Jonathan Wakely ff58310f27 libstdc++: Do not use std::expected::value() in monadic ops (LWG 3938)
The monadic operations in std::expected always check has_value() so we
can avoid the execptional path in value() and the assertions in error()
by accessing _M_val and _M_unex directly. This means that the monadic
operations no longer require _M_unex to be copyable so that it can be
thrown from value(), as modified by LWG 3938.

This also fixes two incorrect uses of std::move in transform(F&&)& and
transform(F&&) const& which I found while making these changes.

Now that move-only error types are supported, it's possible to properly
test the constraints that LWG 3877 added to and_then and transform. The
lwg3877.cc test now does that.

libstdc++-v3/ChangeLog:

	* include/std/expected (expected::and_then, expected::or_else)
	(expected::transform_error): Use _M_val and _M_unex instead of
	calling value() and error(), as per LWG 3938.
	(expected::transform): Likewise. Remove incorrect std::move
	calls from lvalue overloads.
	(expected<void, E>::and_then, expected<void, E>::or_else)
	(expected<void, E>::transform): Use _M_unex instead of calling
	error().
	* testsuite/20_util/expected/lwg3877.cc: Add checks for and_then
	and transform, and for std::expected<void, E>.
	* testsuite/20_util/expected/lwg3938.cc: New test.

(cherry picked from commit fe94f8b7e022b7e154f6c47cc292d4463bddac5e)
2023-06-06 23:58:17 +01:00
Jonathan Wakely b14121a2ac libstdc++: Implement LWG 3877 for std::expected monadic ops
This was approved in Issaquah 2023. As well as fixing the value
categories, this fixes the fact that we were incorrectly testing E
instead of T in the or_else constraints.

libstdc++-v3/ChangeLog:

	* include/std/expected (expected::and_then, expected::or_else)
	(expected::transform, expected::transform_error): Fix exception
	specifications as per LWG 3877.
	(expected<void, E>::and_then, expected<void, E>::transform):
	Likewise.
	* testsuite/20_util/expected/lwg3877.cc: New test.

(cherry picked from commit ba490492e51834db645a3165d14f2ba0af62a8c7)
2023-06-06 23:58:17 +01:00
Jonathan Wakely c0a5790430 libstdc++: Make std::filesystem::copy_file work for procfs [PR108178]
The size reported by stat is always zero for some special files such as
those under /proc, which means the current copy_file implementation
thinks there is nothing to copy. Instead of trusting the stat value, try
to read a character from a streambuf and check for EOF.

For the backport, we also need to avoid trying to use sendfile when stat
reports a zero size, so that we use streambufs to copy the file.

libstdc++-v3/ChangeLog:

	PR libstdc++/108178
	* src/filesystem/ops-common.h (do_copy_file): Check for empty
	files by trying to read a character.
	* testsuite/27_io/filesystem/operations/copy_file_108178.cc:
	New test.

(cherry picked from commit 07a0e108247f23fcb919c61595adae143f1ea02a)
2023-06-06 15:07:44 +01:00
Jonathan Wakely bae27ba9de libstdc++: Use close-on-exec for file descriptors in filesystem::copy_file
libstdc++-v3/ChangeLog:

	* src/filesystem/ops-common.h (do_copy_file) [O_CLOEXEC]: Set
	close-on-exec flag on file descriptors.

(cherry picked from commit 7e8e071c4b64f1b6ea5ddf528724fc793a0f0e36)
2023-06-06 14:33:47 +01:00
Jonathan Wakely 32f2b0f328 libstdc++: Fix ambiguous expression in std::array<T, 0>::front() [PR110139]
For 32-bit targets using -pedantic (or using Clang) makes the expression
_M_elems[0] ambiguous.  The overloaded operator[] that we want to call
has a size_t parameter, but 0 is type ptrdiff_t for many ILP32 targets,
so using the implicit conversion from _M_elems to T* and then
subscripting that is also viable.

Change the 0 to (size_type)0 and also make the conversion to T*
explicit, so that's it's not viable here. The latter change requires a
static_cast in data() where we really do want to convert _M_elems to a
pointer.

libstdc++-v3/ChangeLog:

	PR libstdc++/110139
	* include/std/array (__array_traits<T, 0>::operator T*()): Make
	conversion operator explicit.
	(array::front): Use size_type as subscript operand.
	(array::data): Use static_cast to make conversion explicit.
	* testsuite/23_containers/array/element_access/110139.cc: New
	test.

(cherry picked from commit 56001fad4ecc32396beead6644906e3846244b67)
2023-06-06 14:33:47 +01:00
Joseph Faulls ad12d81e59 libstdc++: Do not assume existence of char8_t codecvt facet
It is not required that codecvt<char8_t, char, mbstate_t> facet be
supported by the locale, nor is it added as part of the default locale.
This can lead to dangerous behaviour when static_cast.

libstdc++-v3/ChangeLog:

	* include/bits/locale_classes.tcc: Remove check for
	codecvt<char8_t, char, mbstate_t> facet.

(cherry picked from commit 3d9b3ddb5fc9087c17645d53e6bcb1881e1955a4)
2023-06-06 14:33:46 +01:00
GCC Administrator c3e954f9d8 Daily bump. 2023-06-02 00:21:53 +00:00
Jonathan Wakely 099d469df6 libstdc++: Fix std::abs(__float128) for -NaN and -0.0 [PR109758]
The current implementation of this non-standard overload of std::abs
incorrectly returns a negative value for negative NaNs and negative
zero, because x < 0 is false in both cases.

Use fabsl(long double) or fabsf128(_Float128) if those do the right
thing.  Otherwise, use __builtin_signbit(x) instead of x < 0 to detect
negative inputs. This assumes that __builtin_signbit handles __float128
correctly, but that seems to be true for all of GCC, clang and icc.

libstdc++-v3/ChangeLog:

	PR libstdc++/109758
	* include/bits/std_abs.h (abs(__float128)): Handle negative NaN
	and negative zero correctly.
	* testsuite/26_numerics/headers/cmath/109758.cc: New test.

(cherry picked from commit af595613acbd9863198ae69c7b1c9e856bca9e4f)
2023-06-01 18:11:08 +01:00
Jonathan Wakely 19527073d0 libstdc++: Remove test dependency on _GLIBCXX_USE_C99_STDINT_TR1
This should have been done in r9-2028-g8ba7f29e3dd064 when
std::shared_mutex was changed to be defined without depending on
_GLIBCXX_USE_C99_STDINT_TR1.

libstdc++-v3/ChangeLog:

	* testsuite/experimental/feat-cxx14.cc: Remove dependency on
	_GLIBCXX_USE_C99_STDINT_TR1.

(cherry picked from commit 2c04284abe5d5f1148c709a769f3b83bee2485d0)
2023-06-01 18:08:29 +01:00
Jonathan Wakely 8c221f315d libstdc++: Remove test dependencies on _GLIBCXX_USE_C99_STDINT_TR1
These #ifdef checks should have been removed in r9-2029-g612c9c702e2c9e
when the u16string_view and u32string_view aliases were changed to be
defined unconditionally.

libstdc++-v3/ChangeLog:

	* testsuite/21_strings/basic_string_view/typedefs.cc: Remove
	dependency on _GLIBCXX_USE_C99_STDINT_TR1.
	* testsuite/experimental/string_view/typedefs.cc: Likewise.

(cherry picked from commit fe0e3df6f3751a0164c8e92a0d6519f2e10527a8)
2023-06-01 18:08:29 +01:00
Jonathan Wakely cfaacee1f9 libstdc++: Fix PSTL test that fails in C++20
This test fails in C++20 and later due to a warning:

warning: C++20 says that these are ambiguous, even though the second is reversed:
note: candidate 1: 'bool MyClass::operator==(const MyClass&)'
note: candidate 2: 'bool MyClass::operator==(const MyClass&)' (reversed)
note: try making the operator a 'const' member function
FAIL: 26_numerics/pstl/numeric_ops/transform_reduce.cc (test for excess errors)

libstdc++-v3/ChangeLog:

	* testsuite/26_numerics/pstl/numeric_ops/transform_reduce.cc:
	Add const to equality operator.

(cherry picked from commit f8403c43045cd56b5f775e1cf12a3f22feca4b58)
2023-06-01 18:08:29 +01:00
Jonathan Wakely d50255d8d2 libstdc++: Document removal of implicit allocator rebinding extensions
Traditionally libstdc++ allowed containers to be
instantiated with allocator's that have the wrong value type, implicitly
rebinding the allocator to the container's value type. Since C++20 that
has been explicitly ill-formed, so the extension is no longer supported
in strict modes (e.g. -std=c++17) and in C++20 and later.

libstdc++-v3/ChangeLog:

	* doc/xml/manual/evolution.xml: Document removal of implicit
	allocator rebinding extensions in strict mode and for C++20.
	* doc/html/*: Regenerate.

(cherry picked from commit 8cbaf679a3c1875c5475bd1cb0fb86fb9d03b2d4)
2023-06-01 18:08:12 +01:00
Jonathan Wakely 81059051f8 libstdc++: Fix -Wnonnull warnings during configure
We should not test for nan by passing it a null pointer, as this can
trigger -Wnonnull warnings.

Also fix an outdated comment about the default -std mode.

libstdc++-v3/ChangeLog:

	* acinclude.m4 (GLIBCXX_CHECK_C99_TR1): Use a non-null pointer
	to check for nan, nanf, and nanl.
	* configure: Regenerate.

(cherry picked from commit 6190a74ebee69415b501996821c92f60d892fb81)
2023-06-01 17:22:53 +01:00
Jonathan Wakely 2162c2082d libstdc++: Require tzdb support for chrono::zoned_time printer test
libstdc++-v3/ChangeLog:

	* testsuite/libstdc++-prettyprinters/chrono.cc: Only test
	printer for chrono::zoned_time for cx11 ABI and tzdb effective
	target.

(cherry picked from commit 151bad410218d266e16b90da0147d57f9d661c1a)
2023-06-01 17:22:19 +01:00
Jonathan Wakely b05b8c9a1f libstdc++: Fix <chrono> pretty printers and add tests
This fixes a couple of errors in the printers for chrono types, and adds
tests to ensure they keep working.

libstdc++-v3/ChangeLog:

	* python/libstdcxx/v6/printers.py (StdChronoDurationPrinter):
	Print floating-point durations correctly.
	(StdChronoTimePointPrinter): Support printing only the value,
	not the type name. Uncomment handling for known clocks.
	(StdChronoZonedTimePrinter): Remove type names from output.
	(StdChronoCalendarPrinter): Fix hh_mm_ss member access.
	(StdChronoTimeZonePrinter): Add equals sign to output.
	* testsuite/libstdc++-prettyprinters/chrono.cc: New test.

(cherry picked from commit 7bd251ca751317385f7e2e4e031736a99f376012)
2023-06-01 17:21:54 +01:00
GCC Administrator c9e208b213 Daily bump. 2023-05-31 00:21:11 +00:00
Alexandre Oliva 7d92616a9b [libstdc++] [testsuite] xfail double-prec from_chars for x86_64 ldbl
When long double is wider than double, but from_chars is implemented
in terms of double, tests that involve the full precision of long
double are expected to fail.  Mark them as such on x86_64-*-vxworks*.

for  libstdc++-v3/ChangeLog

	* testsuite/20_util/from_chars/4.cc: Skip long double test06
	on x86_64-vxworks.
	* testsuite/20_util/to_chars/long_double.cc: Xfail run on
	x86_64-vxworks.

(cherry picked from commit 282e4e745981c5c6e3edaae315e1f499a45402df)
2023-05-30 18:46:26 -03:00
Matthias Kretz 717a14e727 libstdc++: Correct NTTP and simd_mask ctor call
Signed-off-by: Matthias Kretz <m.kretz@gsi.de>

libstdc++-v3/ChangeLog:

	PR libstdc++/109822
	* include/experimental/bits/simd.h (to_native): Use int NTTP
	as specified in PTS2.
	(to_compatible): Likewise. Add missing tag to call mask
	generator ctor.
	* testsuite/experimental/simd/pr109822_cast_functions.cc: New
	test.

(cherry picked from commit 668d43502f465d48adbc1fe2956b979f36657e5f)
2023-05-30 16:24:24 +02:00
Matthias Kretz 3f90a56c08 libstdc++: Simplify calculation of expected value in simd test
This avoids a failure on PR109964.

Signed-off-by: Matthias Kretz <m.kretz@gsi.de>

libstdc++-v3/ChangeLog:

	* testsuite/experimental/simd/tests/integer_operators.cc:
	Compute expected value differently to avoid getting turned into
	a vector shift.

(cherry picked from commit 3e2689e568425f14d6728504ad6f5d32b90320ad)
2023-05-30 16:24:19 +02:00