Commit graph

13773 commits

Author SHA1 Message Date
Arsen Arsenović
88b34661f7 libstdc++: respect with-{headers, newlib} for default hosted value
This saves us a build flag when building for freestanding targets.

libstdc++-v3/ChangeLog:

	* acinclude.m4: Default hosted to off if building without
	headers and without newlib.
	* configure: Regenerate.
2022-10-21 10:41:12 +01:00
Jonathan Wakely
33de0ffcf0 libstdc++: Fix std::move_only_function for incomplete parameter types
The std::move_only_function::__param_t alias template attempts to
optimize argument passing for the invoker, by passing by rvalue
reference for types that are non-trivial or large. However, the
precondition for is_trivally_copyable makes it unsuitable for using
here, and can cause ODR violations. Just use is_scalar instead, and pass
all class types (even small, trivial ones) by value.

libstdc++-v3/ChangeLog:

	* include/bits/mofunc_impl.h (move_only_function::__param_t):
	Use __is_scalar instead of is_trivially_copyable.
	* testsuite/20_util/move_only_function/call.cc: Check parameters
	involving incomplete types.
2022-10-21 10:40:40 +01:00
GCC Administrator
47a6ae5658 Daily bump. 2022-10-21 00:17:52 +00:00
Patrick Palka
7bf3a4d36a libstdc++: Redefine __from_chars_alnum_to_val's table
After the C++23 constexpr <charconv> patch r13-3313-g378a0f1840e694 we
have some modules testsuite regressions:

  FAIL: g++.dg/modules/xtreme-header-4_b.C -std=c++2b (test for excess errors)
  FAIL: g++.dg/modules/xtreme-header_b.C -std=c++2b (test for excess errors)

Like with PR105297, the cause seems to be the deduced type of __table
resolving ahead of time to a local class type, which trips up modules.
And unfortunately that PR's minimal workaround of making __tables's
initializer value dependent doesn't help in this case.

So this patch works around this by avoiding using a local class for the
table type.  And I suppose we should use a static data member to define
the table once for all dialects (including C++14) instead of having to
define it twice in C++23 mode (once as a static local variable and again
as a variable template for sake of constexpr evaluation).

libstdc++-v3/ChangeLog:

	* include/std/charconv (__detail::__from_chars_alnum_to_val_table):
	Redefine as a class template containing the members type, value and
	_S_make_table.  Don't use a local class as the table type.
	(__detail::__table): Remove.
	(__detail::__from_chars_alnum_to_val): Adjust after the above.
2022-10-20 10:30:31 -04:00
GCC Administrator
87f9c4a433 Daily bump. 2022-10-20 00:17:52 +00:00
Patrick Palka
fb4db9bc1c libstdc++: Implement remaining P2474R2 changes to views::take/drop
libstdc++-v3/ChangeLog:

	* include/std/ranges (views::__detail::__is_repeat_view): Define
	and later define a partial specialization.
	(views::__detail::__take_of_repeat_view): Declare and later define.
	(views::__detail::__drop_of_repeat_view): Likewise.
	(views::_Take::operator()): Return a repeat_view if the argument
	is a repeat_view as per P2474R2.
	(views::_Drop::operator()): Likewise.
	(repeat_view): Befriend __take/drop_of_repeat_view.
	* testsuite/std/ranges/repeat/1.cc (test04): New test.
2022-10-19 15:43:13 -04:00
Patrick Palka
a10d6b5eb9 libstdc++: Fix typo in stride_view's operator- [PR107313]
PR libstdc++/107313

libstdc++-v3/ChangeLog:

	* include/std/ranges (stride_view::_Iterator::operator-): Fix typo.
	* testsuite/std/ranges/adaptors/stride/1.cc (test03): New test.
2022-10-19 13:03:25 -04:00
LIU Hao
47684e58ed libstdc++/thread: Implement _GLIBCXX_NPROCS for Windows
This makes `std:🧵:hardware_concurrency()` return the number of
logical processors, instead of zero.

libstdc++-v3/ChangeLog:
	* src/c++11/thread.cc (get_nprocs): Add new implementation
	for native Windows targets
2022-10-19 14:05:33 +00:00
LIU Hao
f036d759ec gcc: Add 'mcf' thread model support from mcfgthread
This patch adds the new thread model `mcf`, which implements mutexes
and condition variables with the mcfgthread library.

Source code for mcfgthread is available at <https://github.com/lhmouse/mcfgthread>.

config/ChangeLog:
	* gthr.m4 (GCC_AC_THREAD_HEADER): Add new case for `mcf` thread
	model

gcc/ChangeLog:
	* config/i386/mingw-mcfgthread.h: New file
	* config/i386/mingw32.h: Add builtin macro and default libraries
	for mcfgthread when thread model is `mcf`
	* config.gcc: Include 'i386/mingw-mcfgthread.h' when thread model
	is `mcf`
	* configure.ac: Recognize `mcf` as a valid thread model
	* config.in: Regenerate
	* configure: Regenerate

libatomic/ChangeLog:
	* configure.tgt: Add new case for `mcf` thread model

libgcc/ChangeLog:
	* config.host: Add new cases for `mcf` thread model
	* config/i386/gthr-mcf.h: New file
	* config/i386/t-mingw-mcfgthread: New file
	* config/i386/t-slibgcc-cygming: Add mcfgthread for libgcc DLL
	* configure: Regenerate

libstdc++-v3/ChangeLog:
	* libsupc++/atexit_thread.cc (__cxa_thread_atexit): Use
	implementation from mcfgthread if available
	* libsupc++/guard.cc (__cxa_guard_acquire, __cxa_guard_release,
	__cxa_guard_abort): Use implementations from mcfgthread if
	available
	* configure: Regenerate
2022-10-19 13:52:37 +00:00
Jakub Jelinek
ba281da28d libstdc++-v3: Implement {,b}float16_t nextafter and some fixes [PR106652]
The following patch implements nextafter for std::{,b}float16_t,
though right now only without constexpr support, and adds a testcase for it.
The testcase unfortunately relevealed I've screwed up testing of my last
patch.  I've tested earlier version of the patch with
--target_board=unix/-std=c++23
but didn't test the final version with that RUNTESTFLAGS, so missed
an invalid call to std::sph_neumann (too many arguments) in the test.
And, I've made a typo in the guard for numeric_limits (the reason
for the guard is I wanted to avoid defining a large macro that nothing
will then use because the std::{,b}float*_t types are C++23 only) and
so numeric_limits wasn't specialized for the types at all but
testsuite/18_support/headers/limits/synopsis_cxx23.cc test didn't
detect that.
In the nextafter implementation I'm calling __builtin_nextafterf
to get various required side-effects for nextafter from 0/-0, or from max
to inf or from min to largest subnormal to avoid needing to set errno
inline, or use inline asm specific for each processor to force math
evaluation barriers.  Dunno if
  #ifdef __INT16_TYPE__
    using __float16_int_type = __INT16_TYPE__;
  #else
    using __float16_int_type = short int;
  #endif
isn't too ugly, perhaps we could just blindly use short int and hope
or even assert it has the same size as _Float16 or __gnu_cxx::__bfloat16_t?
Only aarch64, arm, csky, gcn, x86, nvptx and riscv support these types
and all of them have 16-bit short (I think the only target with some
other short size is avr with certain command line switches where both
short and int are 8-bit, but such mode isn't compatible with C and C++
requirements).

2022-10-19  Jakub Jelinek  <jakub@redhat.com>

	PR c++/106652
	* include/std/limits: Fix a typo, 202202L -> 202002L.
	(numeric_limits::<_Float16>::radix, numeric_limits::<_Float32>::radix,
	numeric_limits::<_Float64>::radix, numeric_limits::<_Float128>::radix,
	numeric_limits::<__gnu_cxx::__bfloat16_t>::radix): Use __FLT_RADIX__
	macro instead of type specific macros.
	* include/c_global/cmath (nextafter(_Float16, _Float16)): New
	overload.
	(nextafter(__gnu_cxx::__bfloat16_t, __gnu_cxx::__bfloat16_t)):
	Likewise.
	* testsuite/26_numerics/headers/cmath/functions_std_c++23.cc
	(test_functions): Uncomment nextafter test.  Fix up sph_neumann call.
	* testsuite/26_numerics/headers/cmath/nextafter_c++23.cc: New test.
2022-10-19 11:26:17 +02:00
GCC Administrator
21de009f74 Daily bump. 2022-10-19 00:19:08 +00:00
Patrick Palka
c70b44f2c1 libstdc++: Implement ranges::stride_view from P1899R3
libstdc++-v3/ChangeLog:

	* include/std/ranges (stride_view): Define.
	(stride_view::_Iterator): Define.
	(views::__detail::__can_stride_view): Define.
	(views::_Stride, views::stride): Define.
	* testsuite/std/ranges/adaptors/stride/1.cc: New test.
2022-10-18 10:51:52 -04:00
Jakub Jelinek
a23225fb4f libstdc++: Partial library support for std::float{16,32,64,128}_t and std::bfloat16_t
The following patch is partial support for std::float{16,32,64,128}_t
and std::bfloat16_t in libstdc++.
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p1467r9.html
says that <ostream>, <istream>, <charconv> and <complex>
need changes toom, but that isn't implemented so far.
In <cmath> the only thing missing I'm aware of is
std::nextafter std::float16_t and std::bfloat16_t overloads (I think
we probably need to implement that out of line somewhere, or inline? - might
need inline asm barriers) and std::nexttoward overloads (those are
intentional, you said there is a LWG issue about that).
Also, this patch has the glibc 2.26+ std::float128_t support for platforms
where long double isn't IEEE quad format temporarily disabled
because it depends on
https://gcc.gnu.org/pipermail/gcc-patches/2022-October/603665.html
changes which aren't in yet.

The patch also doesn't include any testcases to cover the <type_traits>
changes, it isn't clear to me where to put that.

2022-10-18  Jakub Jelinek  <jakub@redhat.com>

	PR c++/106652
	* include/std/stdfloat: New file.
	* include/std/numbers (__glibcxx_numbers): Define and use it
	for __float128 explicit instantiations as well as
	_Float{16,32,64,128} and __gnu_cxx::__bfloat16_t.
	* include/std/atomic (atomic<_Float16>, atomic<_Float32>,
	atomic<_Float64>, atomic<_Float128>, atomic<__gnu_cxx::__bfloat16_t>):
	New explicit instantiations.
	* include/std/type_traits (__is_floating_point_helper<_Float16>,
	__is_floating_point_helper<_Float32>,
	__is_floating_point_helper<_Float64>,
	__is_floating_point_helper<_Float128>,
	__is_floating_point_helper<__gnu_cxx::__bfloat16_t>): Likewise.
	* include/std/limits (__glibcxx_concat3_, __glibcxx_concat3,
	__glibcxx_float_n): Define.
	(numeric_limits<_Float16>, numeric_limits<_Float32>,
	numeric_limits<_Float64>, numeric_limits<_Float128>,
	numeric_limits<__gnu_cxx::__bfloat16_t>): New explicit instantiations.
	* include/bits/std_abs.h (abs): New overloads for
	_Float{16,32,64,128} and __gnu_cxx::__bfloat16_t.
	* include/bits/c++config (_GLIBCXX_LDOUBLE_IS_IEEE_BINARY128): Define
	if long double is IEEE quad.
	(__gnu_cxx::__bfloat16_t): New using.
	* include/c_global/cmath (acos, asin, atan, atan2, ceil, cos, cosh,
	exp, fabs, floor, fmod, frexp, ldexp, log, log10, modf, pow, sin,
	sinh, sqrt, tan, tanh, fpclassify, isfinite, isinf, isnan, isnormal,
	signbit, isgreater, isgreaterequal, isless, islessequal,
	islessgreater, isunordered, acosh, asinh, atanh, cbrt, copysign, erf,
	erfc, exp2, expm1, fdim, fma, fmax, fmin, hypot, ilogb, lgamma,
	llrint, llround, log1p, log2, logb, lrint, lround, nearbyint,
	nextafter, remainder, rint, round, scalbln, scalbn, tgamma, trunc,
	lerp): New overloads with _Float{16,32,64,128} or
	__gnu_cxx::__bfloat16_t types.
	* config/os/gnu-linux/os_defines.h (_GLIBCXX_HAVE_FLOAT128_MATH):
	Prepare for definition if glibc 2.26 and later implements *f128 APIs
	but comment out the actual definition for now.
	* include/ext/type_traits.h (__promote<_Float16>, __promote<_Float32>,
	__promote<_Float64>, __promote<_Float128>,
	__promote<__gnu_cxx::__bfloat16_t>): New specializations.
	* include/Makefile.am (std_headers): Add stdfloat.
	* include/Makefile.in: Regenerated.
	* include/precompiled/stdc++.h: Include stdfloat.
	* testsuite/18_support/headers/stdfloat/types_std.cc: New test.
	* testsuite/18_support/headers/limits/synopsis_cxx23.cc: New test.
	* testsuite/26_numerics/headers/cmath/c99_classification_macros_c++23.cc:
	New test.
	* testsuite/26_numerics/headers/cmath/functions_std_c++23.cc: New test.
	* testsuite/26_numerics/numbers/4.cc: New test.
	* testsuite/29_atomics/atomic_float/requirements_cxx23.cc: New test.
2022-10-18 11:37:13 +02:00
GCC Administrator
6237663c17 Daily bump. 2022-10-18 00:17:40 +00:00
Jonathan Wakely
0f4815502d libstdc++: Fix value of __cpp_lib_constexpr_charconv
libstdc++-v3/ChangeLog:

	* include/std/charconv (__cpp_lib_constexpr_charconv): Define to
	correct value.
	* include/std/version (__cpp_lib_constexpr_charconv): Likewise.
	* testsuite/20_util/to_chars/constexpr.cc: Check correct value.
	* testsuite/20_util/to_chars/version.cc: Likewise.
2022-10-17 09:39:37 +01:00
GCC Administrator
8f605de98d Daily bump. 2022-10-16 00:16:25 +00:00
Jonathan Wakely
030a08c857 libstdc++: Fix -Wunused-function warning in src/c++11/debug.cc
The only remaining use of print_raw is conditionally compiled, so when
libstdc++ i built without debug backtrace support, there's an unused
warning function for it. Move it inside the conditional block.

libstdc++-v3/ChangeLog:

	* src/c++11/debug.cc (print_raw): Move inside #if block.
2022-10-15 21:20:53 +01:00
Jonathan Wakely
378a0f1840 libstdc++: Implement constexpr std::to_chars for C++23 (P2291R3)
Some of the helper functions use static constexpr local variables, which
is not permitted in a core constant expression. Removing the 'static'
seems to have negligible performance effect for __to_chars and
__to_chars_16. For __from_chars_alnum_to_val removing the 'static'
causes a significant performance impact for base 36 conversions. Use a
consteval lambda instead.

libstdc++-v3/ChangeLog:

	* include/bits/charconv.h (__to_chars_10_impl): Add constexpr
	for C++23. Remove 'static' from array.
	* include/std/charconv (__cpp_lib_constexpr_charconv): Define.
	(__to_chars, __to_chars_16): Remove 'static' from array, add
	constexpr.
	(__to_chars_10, __to_chars_8, __to_chars_2, __to_chars_i)
	(to_chars, __raise_and_add, __from_chars_pow2_base)
	(__from_chars_alnum, from_chars): Add constexpr.
	(__from_chars_alnum_to_val): Avoid local static during constant
	evaluation. Add constexpr.
	* include/std/version (__cpp_lib_constexpr_charconv): Define.
	* testsuite/20_util/from_chars/constexpr.cc: New test.
	* testsuite/20_util/to_chars/constexpr.cc: New test.
	* testsuite/20_util/to_chars/version.cc: New test.
2022-10-15 21:20:47 +01:00
Jonathan Wakely
e24b430f1e libstdc++: Fix uses_allocator_construction args for cv pair (LWG 3677)
The _Std_pair concept uses in <bits/uses_allocator_args.h> handles const
qualified pairs, but not volatile qualified. That's because it just uses
__is_pair which is specialized for const pairs.

This removes the partial specialization __is_pair<const pair<T,U>>, so
that __is_pair is now only true for cv-unqualified pairs. Then _Std_pair
needs to explicitly use remove_cv_t for the argument to __is_pair.

The other use of __is_pair is in map::insert(Pair&&) which doesn't want
to handle volatile so should just use remove_const_t.

libstdc++-v3/ChangeLog:

	* include/bits/stl_map.h (map::insert(Pair&&)): Use
	remove_const_t on argument to __is_pair.
	* include/bits/stl_pair.h (__is_pair<const pair<T,U>>): Remove
	partial specialization.
	* include/bits/uses_allocator_args.h (_Std_pair): Use
	remove_cv_t as per LWG 3677.
	* testsuite/20_util/uses_allocator/lwg3677.cc: New test.
2022-10-15 21:17:48 +01:00
GCC Administrator
baeec7cc83 Daily bump. 2022-10-15 00:17:38 +00:00
Jonathan Wakely
0dd9dd1fdf libstdc++: Disable all emergency EH pool code if obj-count == 0
For a zero-sized static pool we can completely elide all code for the EH
pool.

We no longer need to adjust the static buffer size to ensure at least
one free_entry can be created in it, because we no longer use a static
buffer at all if obj_count == 0. If the buffer exists, obj_count >= 1
and the buffer will be much larger than sizeof(free_entry).

libstdc++-v3/ChangeLog:

	* libsupc++/eh_alloc.cc [USE_POOL]: New macro.
	[!USE_POOL] (__gnu_cxx::__freeres, pool): Do not define.
	[_GLIBCXX_EH_POOL_STATIC] (pool::arena): Do not use std::max.
	(__cxxabiv1::__cxa_allocate_exception) [!USE_POOL]: Do not use
	pool.
	(__cxxabiv1::__cxa_free_exception) [!USE_POOL]: Likewise.
	(__cxxabiv1::__cxa_allocate_dependent_exception) [!USE_POOL]:
	Likewise.
	(__cxxabiv1::__cxa_free_dependent_exception) [!USE_POOL]:
	Likewise.
2022-10-14 15:35:41 +01:00
Jonathan Wakely
cf0b7e9787 libstdc++: Simplify print_raw function for debug assertions
Replace two uses of print_raw where it's clearer to just use fprintf
directly. Then the only remaining use of print_raw is as the print_func
argument of pretty_print. When called by pretty_print the count is
either a positive integer or -1, so we can simplify print_raw itself.

Remove the default argument, because it's never used. Remove the check
for nbc == 0, which never happens (but would be harmless if it did).
Replace the conditional expression with a single call to fprintf, using
INT_MAX as the maximum length.

libstdc++-v3/ChangeLog:

	* src/c++11/debug.cc (print_raw): Simplify.
	(print_word): Print indentation by calling fprintf directly.
	(_Error_formatter::_M_error): Print unindented string by calling
	fprintf directly.
2022-10-14 15:35:41 +01:00
Jonathan Wakely
6e8ce5d651 libstdc++: Use markdown in Doxygen comment
This makes the comment easier to read in the source, without altering
the Doxygen output.

libstdc++-v3/ChangeLog:

	* include/std/iostream: Use markdown in Doxygen comment.
2022-10-14 10:09:52 +01:00
GCC Administrator
781f477a13 Daily bump. 2022-10-13 00:17:37 +00:00
François Dumont
f77281b25c libstdc++: Add __gnu_debug::basic_string<>::compare overloads
Rather than adding those implementations we are adding a:
using _Base::compare;

so that any compare method not implemented at __gnu_debug::basic_string
level are injected from the base class.

Also review how __gnu_debug::basic_string is tested. Now require to define
_GLIBCXX_TEST_DEBUG_STRING when running 'make check-debug'.

libstdc++-v3/ChangeLog

	* include/debug/string: Add using _Base::compare.
	(__gnu_debug::basic_string<>::compare(const basic_string<>&)): Remove.
	(__gnu_debug::basic_string<>::compare(size_type, size_type, const basic_string<>&)):
	Remove.
	(__gnu_debug::basic_string<>::compare(size_type, size_type, const basic_string<>&,
	size_type, size_type)): Remove.
	* testsuite/util/testsuite_string.h [_GLIBCXX_TEST_DEBUG_STRING]: Include <debug/string>.
	* testsuite/21_strings/basic_string/operations/compare/char/1.cc: Include testsuite_string.h
	and use __gnu_test::string.
	* testsuite/21_strings/basic_string/operations/compare/char/13650.cc: Likewise.
	* testsuite/21_strings/basic_string/operations/compare/char/2.cc: Likewise.
	* testsuite/21_strings/basic_string/operations/rfind/char/1.cc: Likewise.
	* testsuite/21_strings/basic_string/operations/rfind/char/2.cc: Likewise.
	* testsuite/21_strings/basic_string/operations/rfind/char/3.cc: Likewise.
	* testsuite/21_strings/basic_string/operations/compare/wchar_t/1.cc:
	Include testsuite_string.h
	and use __gnu_test::wstring.
	* testsuite/21_strings/basic_string/operations/compare/wchar_t/13650.cc: Likewise.
	* testsuite/21_strings/basic_string/operations/compare/wchar_t/2.cc: Likewise.
2022-10-12 21:50:21 +02:00
Patrick Palka
bfcd9f8453 libstdc++: Implement ranges::repeat_view from P2474R2
libstdc++-v3/ChangeLog:

	* include/std/ranges (repeat_view): Define.
	(repeat_view::_Iterator): Define.
	(views::__detail::__can_repeat_view): Define.
	(views::__detail::__can_bounded_repeat_view): Define.
	(views::_Repeat, views::repeat): Define.
	* testsuite/std/ranges/repeat/1.cc: New test.
2022-10-12 11:14:11 -04:00
Martin Liska
6d2294a83e regenerate configure files
Needed after a recent change.

gcc/ChangeLog:

	* configure: Regenerate.

libatomic/ChangeLog:

	* configure: Regenerate.

libbacktrace/ChangeLog:

	* configure: Regenerate.

libcc1/ChangeLog:

	* configure: Regenerate.

libffi/ChangeLog:

	* configure: Regenerate.

libgfortran/ChangeLog:

	* configure: Regenerate.

libgomp/ChangeLog:

	* configure: Regenerate.

libitm/ChangeLog:

	* configure: Regenerate.

libobjc/ChangeLog:

	* configure: Regenerate.

liboffloadmic/ChangeLog:

	* configure: Regenerate.
	* plugin/configure: Regenerate.

libphobos/ChangeLog:

	* configure: Regenerate.

libquadmath/ChangeLog:

	* configure: Regenerate.

libsanitizer/ChangeLog:

	* configure: Regenerate.

libssp/ChangeLog:

	* configure: Regenerate.

libstdc++-v3/ChangeLog:

	* configure: Regenerate.

libvtv/ChangeLog:

	* configure: Regenerate.

lto-plugin/ChangeLog:

	* configure: Regenerate.

zlib/ChangeLog:

	* configure: Regenerate.
2022-10-12 09:31:32 +02:00
GCC Administrator
ab332cd78d Daily bump. 2022-10-12 00:17:24 +00:00
Jonathan Wakely
23c3cbaed3 libstdc++: Fix bootstrap for --disable-threads build [PR107221]
The __scoped_lock type should be used unqualified so that we always
refer to pool::__scoped_lock, which might be the dummy fallback
implementation.

The __mutex and __scoped_lock types in <ext/concurrence.h> already work
fine without __GTHREADS being defined, but that header isn't included at
all unless _GLIBCXX_HOSTED != 0. The fallback implementation should be
used for ! _GLIBCXX_HOSTED instead of for !defined __GTHREADS.

libstdc++-v3/ChangeLog:

	PR bootstrap/107221
	* libsupc++/eh_alloc.cc (pool): Change preprocessor condition
	for using __mutex from __GTHREADS to _GLIBCXX_HOSTED.
	(pool::allocate): Remove namespace qualification to use
	pool::__scoped_lock instead of __gnu_cxx::__scoped_lock.
2022-10-11 20:36:09 +01:00
Jonathan Wakely
637e3668fd libstdc++: Allow emergency EH alloc pool size to be tuned [PR68606]
Implement a long-standing request to support tuning the size of the
emergency buffer for allocating exceptions after malloc fails, or to
disable that buffer entirely.

It's now possible to disable the dynamic allocation of the buffer and
use a fixed-size static buffer, via --enable-libstdcxx-static-eh-pool.
This is a built-time choice that is baked into libstdc++ and so affects
all code linked against that build of libstdc++.

The size of the pool can be set by --with-libstdcxx-eh-pool-obj-count=N
which is measured in units of sizeof(void*) not bytes. A given exception
type such as std::system_error depends on the target, so giving a size
in bytes wouldn't be portable across 16/32/64-bit targets.

When libstdc++ is configured to use a dynamic buffer, the size of that
buffer can now be tuned at runtime by setting the GLIBCXX_TUNABLES
environment variable (c.f. PR libstdc++/88264). The number of exceptions
to reserve space for is controlled by the "glibcxx.eh_pool.obj_count"
and "glibcxx.eh_pool.obj_size" tunables. The pool will be sized to be
able to allocate obj_count exceptions of size obj_size*sizeof(void*) and
obj_count "dependent" exceptions rethrown by std::rethrow_exception.

With the ability to tune the buffer size, we can reduce the default pool
size on 32-bit and 16-bit targets. Most users never need to throw 1kB
exceptions in parallel from hundreds of threads after malloc is OOM. The
users who do need that can use the tunables to select larger sizes.

The old defaults can be chosen at runtime by setting GLIBCXX_TUNABLES
to:
64-bit: glibcxx.eh_pool.obj_count=64:glibcxx.eh_pool.obj_size=112
32-bit: glibcxx.eh_pool.obj_count=32:glibcxx.eh_pool.obj_size=104

Or approximated by configuring with:
64-bit: --with-libstdcxx-eh-pool-obj-count=252
32-bit: --with-libstdcxx-eh-pool-obj-count=94

libstdc++-v3/ChangeLog:

	PR libstdc++/68606
	* Makefile.in: Regenerate.
	* acinclude.m4 (GLIBCXX_EMERGENCY_EH_ALLOC): New macro.
	* configure: Regenerate.
	* configure.ac: Use GLIBCXX_EMERGENCY_EH_ALLOC.
	* crossconfig.m4: Check for secure_getenv.
	* doc/Makefile.in: Regenerate.
	* doc/xml/manual/configure.xml: Document new configure options.
	* doc/xml/manual/evolution.xml: Document addition of tunables.
	* doc/xml/manual/using_exceptions.xml: Document emergency
	buffer and tunables.
	* doc/html/*: Regenerate.
	* include/Makefile.in: Regenerate.
	* libsupc++/Makefile.am: Use EH_POOL_FLAGS.
	* libsupc++/Makefile.in: Regenerate.
	* libsupc++/eh_alloc.cc (EMERGENCY_OBJ_SIZE): Define in units
	of sizeof(void*) not including the ABI's exception header.
	(EMERGENCY_OBJ_COUNT): Define as target-independent calculation
	based on word size.
	(MAX_OBJ_COUNT): Define macro for upper limit on pool size.
	(pool) [_GLIBCXX_EH_POOL_STATIC]: Use fixed-size buffer.
	(pool::buffer_size_in_bytes): New static member function.
	(pool::pool): Parse GLIBCXX_TUNABLES environment variable to set
	pool size at runtime.
	(pool::in_pool): Use std::less<void*> for total order.
	(__freeres) [_GLIBCXX_EH_POOL_STATIC]: Do nothing.
	(__cxa_free_exception, __cxa_free_dependent_exception): Add
	[[unlikely]] attributes.
	* po/Makefile.in: Regenerate.
	* python/Makefile.in: Regenerate.
	* src/Makefile.in: Regenerate.
	* src/c++11/Makefile.in: Regenerate.
	* src/c++17/Makefile.in: Regenerate.
	* src/c++20/Makefile.in: Regenerate.
	* src/c++98/Makefile.in: Regenerate.
	* src/filesystem/Makefile.in: Regenerate.
	* src/libbacktrace/Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.
2022-10-11 16:21:48 +01:00
Olivier Hainque
0ecd0f1cc6 Generic configury support for shared libs on VxWorks
This change adds the configury bits to activate the build of
shared libs on VxWorks ports configured with --enable-shared,
for libraries variants where this is generally supported (rtp,
code model !large - currently not compatible with -fPIC).

Set lt_cv_deplibs_check_method in libtool.m4, so the build of
libraries know how to establish dependencies.  This is useful in
configurations such as aarch64 where proper support of LSE relies
on accurate dependency information between libstdc++ and libgcc_s
to begin with.

Regenerate configure scripts to reflect libtool.m4 change.

2022-10-09  Olivier Hainque  <hainque@adacore.com>

	* libtool.m4 (*vxworks*): When enable_shared, set dynamic_linker
	and friends for rtp !large. Assume the linker has the required
	abilities and set lt_cv_deplibs_check_method.

gcc/
	* config.gcc (*vxworks*): Add t-slibgcc fragment
	if enable_shared.

libgcc/
	* config.host (*vxworks*): When enable_shared, add
	libgcc and crtstuff "shared" fragments for rtp except
	large code model.
	(aarch64*-wrs-vxworks7*): Remove t-slibgcc-libgcc from
	the list of fragments.

2022-10-09  Olivier Hainque  <hainque@adacore.com>

gcc/
	* configure: Regenerate.

libatomic/
	* configure: Regenerate.

libbacktrace/
	* configure: Regenerate.

libcc1/
	* configure: Regenerate.

libffi/
	* configure: Regenerate.

libgfortran/
	* configure: Regenerate.

libgomp/
	* configure: Regenerate.

libitm/
	* configure: Regenerate.

libobjc/
	* configure: Regenerate.

liboffloadmic/
	* configure: Regenerate.

liboffloadmic/
	* plugin/configure: Regenerate.

libphobos/
	* configure: Regenerate.

libquadmath/
	* configure: Regenerate.

libsanitizer/
	* configure: Regenerate.

libssp/
	* configure: Regenerate.

libstdc++-v3/
	* configure: Regenerate.

libvtv/
	* configure: Regenerate.

lto-plugin/
	* configure: Regenerate.

zlib/
	* configure: Regenerate.
2022-10-11 07:31:07 +00:00
GCC Administrator
27bfe54e97 Daily bump. 2022-10-11 00:17:00 +00:00
Jonathan Wakely
1d2f07ed4c libstdc++: Revert addition of constraints to make_signed/make_unsigned
Constraining the primary template makes it unusable in uninstantiated
contexts.

libstdc++-v3/ChangeLog:

	* include/std/type_traits (make_signed, make_unsigned): Remove
	constraints on primary template.
	* testsuite/20_util/make_signed/requirements/typedefs_neg.cc:
	Undo changes to expected error in C++20 mode.
	* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc:
	Likewise.
	* testsuite/24_iterators/range_access/range_access_cpp20_neg.cc:
	Likewise.
	* testsuite/20_util/make_signed/requirements/uninstantiated.cc:
	New test.
	* testsuite/20_util/make_unsigned/requirements/uninstantiated.cc:
	New test.
2022-10-10 21:37:03 +01:00
Jonathan Wakely
2bd112dee7 libstdc++: std::make_signed_t<cv bool> should be ill-formed
Currently we only reject std::make_signed_t<bool> but not cv bool.
Similarly for std::make_unsigned_t<cv bool>.

As well as making those ill-formed, this adds a requires-clause to the
make_signed and make_unsigned primary templates. This makes
non-integral, non-enum cases fail immediately with a clear error, rather
than giving an error about __make_signed_selector<T, false, false> being
incomplete.

libstdc++-v3/ChangeLog:

	* include/std/type_traits (make_signed, make_unsigned): Add
	specializations for cv bool. Add requires-clause for C++20 to
	improve diagnostics for non-integral, non-enum cases.
	* testsuite/20_util/make_signed/requirements/typedefs_neg.cc:
	Check cv bool.
	* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc:
	Likewise.
	* testsuite/24_iterators/range_access/range_access_cpp20_neg.cc:
	Adjust expected errors for C++20 and later.
	* testsuite/lib/prune.exp: Prune "in requirements  [with ...]"
	lines from diagnostics.
2022-10-10 12:19:11 +01:00
GCC Administrator
9ff6c33e2e Daily bump. 2022-10-08 00:17:29 +00:00
Jonathan Wakely
6bd2c1231a libstdc++: Add --disable-libstdcxx-hosted as an alias for hosted-libstdcxx
Most libstdc++ configure args are of the form --enable-libstdcxx-xxx but
the option to build freestanding is --disable-hosted-libstdcxx. If you
accidentally type --disable-libstdcxx-hosted then it will be ignored.

This adds --disable-libstdcxx-hosted as an alias for the existing arg,
so it works whichever way you say it. If both args are used explicitly
and their values do not agree, configure fails with an error.

libstdc++-v3/ChangeLog:

	* acinclude.m4 (GLIBCXX_ENABLE_HOSTED): Add libstdcxx-hosted
	enable arg as an alias for hosted-libstdcxx enable arg.
	* configure: Regenerate.
2022-10-07 12:55:52 +01:00
Jonathan Wakely
93b3ab6c0c libstdc++: Shuffle header dependencies of <functional>
The <new> header is needed by std::function to use placement new, so
include it in <bits/std_function.h> instead of in <functional>.

libstdc++-v3/ChangeLog:

	* include/bits/std_function.h: Include <new> but do not include
	<bits/stl_function.h>.
	* include/std/functional: Do not include <new>.
2022-10-07 12:55:33 +01:00
Jonathan Wakely
8e2f453de3 libstdc++: Use bold style for DR titles in the manual
This matches how the issues are styled in the LWG issues list, and also
allows us to use italics for "cv" (e.g. in issue 2487).

libstdc++-v3/ChangeLog:

	* doc/xml/manual/intro.xml: Add role="bold" attribute to
	emphasis elements for issue titles.
	* doc/html/manual/bugs.html: Regenerate.
2022-10-07 12:20:24 +01:00
GCC Administrator
966010b2eb Daily bump. 2022-10-06 00:17:24 +00:00
Jonathan Wakely
b8473c9a2b libtdc++: Regenerate Makefile.in after freestanding header changes
libstdc++-v3/ChangeLog:

	* include/Makefile.in: Regenerate.
2022-10-05 14:09:11 +01:00
Jonathan Wakely
dc70f3f81b libstdc++: Guard use of new built-in with __has_builtin
Another case where I forgot that non-GCC compilers don't have this
built-in yet.

libstdc++-v3/ChangeLog:

	* include/bits/invoke.h (__invoke_r): Check
	__has_builtin(__reference_converts_from_temporary) before using
	built-in.
2022-10-05 13:39:28 +01:00
GCC Administrator
85872a69ee Daily bump. 2022-10-05 00:17:25 +00:00
Jonathan Wakely
5aa18176ad libstdc++: Fix test FAIL for old std::string ABI
libstdc++-v3/ChangeLog:

	* testsuite/std/ranges/adaptors/join_with/1.cc: Remove unused
	<sstream header.
	(test04): Remove constexpr for old std::string ABI and test at
	runtime.
2022-10-04 17:43:00 +01:00
Jonathan Wakely
6ddbbbffbb libstdc++: Use new built-ins __remove_cv, __remove_reference etc.
libstdc++-v3/ChangeLog:

	* include/std/type_traits (remove_cv): Use __remove_cv built-in.
	(remove_reference): Use __remove_reference built-in.
	(remove_cvref): Use __remove_cvref built-in. Remove inheritance
	for fallback implementation.
2022-10-04 17:42:59 +01:00
Jonathan Wakely
68ed966793 libstdc++: Refactor seed sequence constraints in <random>
Every use of _If_seed_seq in <random> and <ext/random> uses it with
enable_if. We can just move the enable_if into the helper alias instead
of repeating it everywhere.

libstdc++-v3/ChangeLog:

	* include/bits/random.h (__is_seed_seq): Replace with ...
	(_If_seed_seq_for): ... this.
	* include/ext/random: Adjust to use _If_seed_seq_for.
2022-10-04 17:42:59 +01:00
Patrick Palka
3b8bcc3f8b libstdc++: Avoid heavyweight std::visit in ranges::join_with_view
libstdc++-v3/ChangeLog:

	* include/std/ranges (join_with_view::_Iterator::operator*):
	Replace use of std::visit with manual visitation.
	(join_with_view::_Iterator::operator++): Likewise.
	(join_with_view::_Iterator::operator--): Likewise.
	(join_with_view::_Iterator::iter_move): Likewise.
	(join_with_view::_Iterator::iter_swap): Likewise.
2022-10-04 10:54:36 -04:00
Jonathan Wakely
beeb6898fe libstdc++: Disable test for freestanding
This test checks the exception-safety of std::stable_sort if copying a
value throws. For freestanding we don't allocate in std::stable_sort
anyway, and the exception thrown via __throw_runtime_error terminates,
so disable the test.

libstdc++-v3/ChangeLog:

	* testsuite/25_algorithms/stable_sort/mem_check.cc: Do nto run
	for freestanding.
2022-10-04 15:03:28 +01:00
Jonathan Wakely
b74ab7a160 libstdc++: Enable std::hash<coroutine_handle<P>> [PR107139]
Everything that <coroutine> depends on is available for freestanding
now.

libstdc++-v3/ChangeLog:

	PR libstdc++/107139
	* include/std/coroutine: Remove all _GLIBCXXHOSTED preprocessor
	conditionals.
2022-10-04 15:03:28 +01:00
Jonathan Wakely
7cdab65f3d libstdc++: Make <cstdint> work freestanding [PR107134]
When gcc/config.gcc defines use_gcc_stdin=wrap, GCC's <stdint.h> tries
to use libc's <stdint.h> unless -ffreestanding is used.

When libstdc++ is configured --disable-hosted-libstdcxx we want
<cstdint> to work even without -ffreestanding being given. This is a
kluge to make it include GCC's <stdint-gcc.h> directly even without
-ffreestanding.

libstdc++-v3/ChangeLog:

	PR libstdc++/107134
	* include/c_global/cstdint [!_GLIBCXX_HOSTED]: Include
	<stdint-gcc.h> directly.
2022-10-04 15:03:28 +01:00
Jonathan Wakely
7d8189882f libstdc++: Define <bits/functexcept.h> functions for freestanding [PR107135]
We don't compile src/c++11/functexcept.cc for freestanding, so just
define the functions used by freestanding entities as inline calls to
std::terminate.

libstdc++-v3/ChangeLog:

	PR libstdc++/107135
	* include/bits/functexcept.h [!_GLIBCXX_HOSTED]
	(__throw_invalid_argument, __throw_out_of_range)
	(__throw_out_of_range_fmt, __throw_runtime_error)
	(__throw_overflow_error): Define inline.
	* include/std/bitset (_M_copy_from_ptr) [!_GLIBCXX_HOSTED]:
	Replace __builtin_abort with __throw_invalid_argument.
2022-10-04 15:03:28 +01:00