aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include
AgeCommit message (Collapse)AuthorFilesLines
2 dayslibstdc++: Fix more pedwarns in headers for C++98Jonathan Wakely17-15/+97
Some tests e.g. 17_intro/headers/c++1998/all_pedantic_errors.cc FAIL with GLIBCXX_TESTSUITE_STDS=98 due to numerous C++11 extensions still in use in the library headers. The recent changes to not make them system headers means we get warnings now. This change adds more diagnostic pragmas to suppress those warnings. libstdc++-v3/ChangeLog: * include/bits/istream.tcc: Add diagnostic pragmas around uses of long long and extern template. * include/bits/locale_facets.h: Likewise. * include/bits/locale_facets.tcc: Likewise. * include/bits/locale_facets_nonio.tcc: Likewise. * include/bits/ostream.tcc: Likewise. * include/bits/stl_algobase.h: Likewise. * include/c_global/cstdlib: Likewise. * include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp: Likewise. * include/ext/pointer.h: Likewise. * include/ext/stdio_sync_filebuf.h: Likewise. * include/std/istream: Likewise. * include/std/ostream: Likewise. * include/tr1/cmath: Likewise. * include/tr1/type_traits: Likewise. * include/tr1/functional_hash.h: Likewise. Remove semi-colons at namespace scope that aren't needed after macro expansion. * include/tr1/tuple: Remove semi-colon at namespace scope. * include/bits/vector.tcc: Change LL suffix to just L.
2 dayslibstdc++: Refactor experimental::filesystem::path string conversionsJonathan Wakely1-84/+53
I noticed a -Wc++17-extensions warning due to use of if-constexpr in std::experimental::filesystem::path, which was not protected by diagnostic pragmas to disable the warning. While adding the pragmas I noticed that other places in the same file use tag dispatching and multiple overloads instead of if-constexpr. Since we're already using it in that file, we might as well just use it everywhere. libstdc++-v3/ChangeLog: * include/experimental/bits/fs_path.h (path::_Cvt): Refactor to use if-constexpr. (path::string(const Allocator&)): Likewise.
2 dayslibstdc++: Fix -Wsign-compare warning in std::string::resize_for_overwriteJonathan Wakely2-2/+2
libstdc++-v3/ChangeLog: * include/bits/basic_string.tcc (resize_for_overwrite): Fix -Wsign-compare warning. * include/bits/cow_string.h (resize_for_overwrite): Likewise.
2 dayslibstdc++: Fix test FAIL due to -Wpointer-arithJonathan Wakely2-34/+31
This fixes a FAIL due to a -Wpointer-arith warning when testing with c++11 or c++14 dialects. As an extension our std::atomic<void*> supports pointer arithmetic in C++11 and C++14, but due to the system header changes there is now a warning about it. The warning seems reasonable, so rather than suppress it we should make the test expect it. While looking into this I decided to simplify some of the code related to atomic<T*> arithmetic. libstdc++-v3/ChangeLog: * include/bits/atomic_base.h (__atomic_base<T*>::_M_type_size): Replace overloaded functions with static _S_type_size. * include/std/atomic (atomic<T*>): Use is_object_v instead of is_object. * testsuite/29_atomics/atomic/operators/pointer_partial_void.cc: Add dg-warning for -Wpointer-arith warning.
3 dayslibstdc++: Add missing 'inline' to always_inline functionJonathan Wakely1-1/+1
This fixes a -Wattributes warning for the COW std::string which was previously suppressed due to being in a system header. libstdc++-v3/ChangeLog: * include/bits/cow_string.h (__resize_for_overwrite): Add inline keyword to function with always_inline attribute.
3 dayslibgcc, libstdc++: Make declarations no longer TU-local [PR115126]Nathaniel Shead6-20/+20
In C++20, modules streaming check for exposures of TU-local entities. In general exposing internal linkage functions in a header is liable to cause ODR violations in C++, and this is now detected in a module context. This patch goes through and removes 'static' from many declarations exposed through libstdc++ to prevent code like the following from failing: export module M; extern "C++" { #include <bits/stdc++.h> } Since gthreads is used from C as well, we need to choose whether to use 'inline' or 'static inline' depending on whether we're compiling for C or C++ (since the semantics of 'inline' are different between the languages). Additionally we need to remove static global variables, so we migrate these to function-local statics to avoid the ODR issues. There doesn't seem to be a good workaround for weakrefs, so I've left them as-is and will work around it in the modules streaming code to consider them as not TU-local. The same issue occurs in the objective-C specific parts of gthreads, but I'm not familiar with the surrounding context and we don't currently test modules with Objective C++ anyway so I've left it as-is. PR libstdc++/115126 libgcc/ChangeLog: * gthr-posix.h (__GTHREAD_ALWAYS_INLINE): New macro. (__GTHREAD_INLINE): New macro. (__gthread_active): Convert from variable to (hidden) function. (__gthread_active_p): Mark as __GTHREAD_INLINE instead of static; make visibility("hidden") when it has a static local variable. (__gthread_trigger): Mark as __GTHREAD_INLINE instead of static. (__gthread_create): Likewise. (__gthread_join): Likewise. (__gthread_detach): Likewise. (__gthread_equal): Likewise. (__gthread_self): Likewise. (__gthread_yield): Likewise. (__gthread_once): Likewise. (__gthread_key_create): Likewise. (__gthread_key_delete): Likewise. (__gthread_getspecific): Likewise. (__gthread_setspecific): Likewise. (__gthread_mutex_init_function): Likewise. (__gthread_mutex_destroy): Likewise. (__gthread_mutex_lock): Likewise. (__gthread_mutex_trylock): Likewise. (__gthread_mutex_timedlock): Likewise. (__gthread_mutex_unlock): Likewise. (__gthread_recursive_mutex_init_function): Likewise. (__gthread_recursive_mutex_lock): Likewise. (__gthread_recursive_mutex_trylock): Likewise. (__gthread_recursive_mutex_timedlock): Likewise. (__gthread_recursive_mutex_unlock): Likewise. (__gthread_recursive_mutex_destroy): Likewise. (__gthread_cond_init_function): Likewise. (__gthread_cond_broadcast): Likewise. (__gthread_cond_signal): Likewise. (__gthread_cond_wait): Likewise. (__gthread_cond_timedwait): Likewise. (__gthread_cond_wait_recursive): Likewise. (__gthread_cond_destroy): Likewise. (__gthread_rwlock_rdlock): Likewise. (__gthread_rwlock_tryrdlock): Likewise. (__gthread_rwlock_wrlock): Likewise. (__gthread_rwlock_trywrlock): Likewise. (__gthread_rwlock_unlock): Likewise. * gthr-single.h: (__GTHREAD_ALWAYS_INLINE): New macro. (__GTHREAD_INLINE): New macro. (__gthread_active_p): Mark as __GTHREAD_INLINE instead of static. (__gthread_once): Likewise. (__gthread_key_create): Likewise. (__gthread_key_delete): Likewise. (__gthread_getspecific): Likewise. (__gthread_setspecific): Likewise. (__gthread_mutex_destroy): Likewise. (__gthread_mutex_lock): Likewise. (__gthread_mutex_trylock): Likewise. (__gthread_mutex_unlock): Likewise. (__gthread_recursive_mutex_lock): Likewise. (__gthread_recursive_mutex_trylock): Likewise. (__gthread_recursive_mutex_unlock): Likewise. (__gthread_recursive_mutex_destroy): Likewise. libstdc++-v3/ChangeLog: * include/bits/shared_ptr.h (std::__is_shared_ptr): Remove unnecessary 'static'. * include/bits/unique_ptr.h (std::__is_unique_ptr): Likewise. * include/std/future (std::__create_task_state): Likewise. * include/std/shared_mutex (_GLIBCXX_GTRHW): Likewise. (__glibcxx_rwlock_init): Likewise. (__glibcxx_rwlock_timedrdlock): Likewise. (__glibcxx_rwlock_timedwrlock): Likewise. (__glibcxx_rwlock_rdlock): Likewise. (__glibcxx_rwlock_tryrdlock): Likewise. (__glibcxx_rwlock_wrlock): Likewise. (__glibcxx_rwlock_trywrlock): Likewise. (__glibcxx_rwlock_unlock): Likewise. (__glibcxx_rwlock_destroy): Likewise. (__glibcxx_rwlock_init): Likewise. * include/pstl/algorithm_impl.h (__pstl::__internal::__set_algo_cut_off): Mark inline. * include/pstl/unseq_backend_simd.h (__pstl::__unseq_backend::__lane_size): Mark inline. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com> Reviewed-by: Jonathan Wakely <jwakely@redhat.com> Reviewed-by: Jakub Jelinek <jakub@redhat.com>
3 dayslibstdc++: Preserve signbit of nan when converting float to double [PR113578]Jonathan Wakely1-6/+37
LWG 117 specifies that inserting a float into an ostream should cast it to double, because there's no std::num_put::put member that takes a float. However, on RISC-V converting a NaN float to double loses the sign, which means that negative NaN floats are printed as positive. This has been reported as LWG 4101 and there is good support for fixing the standard to preserve the sign bit when printing negative NaN values. This change uses copysign((double)f, (double)std::bit_cast<int>(f)) to get a double that preserves the sign. The bit_cast gives us an integer with the same signbit, and casting that to the target type preserves the signbit. We don't care about the value, as copysign only uses the signbit. The inserters for extended floating-point types need the same treatment, so add a new _S_cast_flt helper to do the signbit-preserving conversion generically. So far only RISC-V has been confirmed to need this treatment, but we might need to extend it to other targets later. libstdc++-v3/ChangeLog: PR libstdc++/113578 * include/std/ostream (_S_cast_flt): New static member function to restore signbit after casting to double or long double. (operator<<(float), operator<<(_Float16), operator<<(_Float32)) (operator<<(_Float64), operator(_Float128)) (operator<<(__bfloat16_t)): Use _S_cast_flt. testsuite/27_io/basic_ostream/inserters_arithmetic/lwg4101.cc: New test. Co-authored-by: Andrew Waterman <andrew@sifive.com>
3 dayslibstdc++: Add [[nodiscard]] to iostream membersJonathan Wakely5-0/+47
These are all pure functions and MSVC also marks all of these as nodiscard except for std::basic_ios::tie() const, but that's been confirmed as an accidental omission. libstdc++-v3/ChangeLog: * include/bits/basic_ios.h (basic_ios::operator bool()): Add [[nodiscard]] attribute. (basic_ios::operator!(), basic_ios::rdstate()) (basic_ios::good(), basic_ios::eof(), basic_ios::fail()) (basic_ios::bad(), basic_ios::exceptions(), basic_ios::tie()) (basic_ios::rdbuf(), basic_ios::fill()): Likewise. * include/bits/ios_base.h (ios_base::flags()): Likewise. (ios_base::precision(), ios_base::width(), ios_base::getloc()): Likewise. * include/std/fstream (basic_filebuf::is_open) (basic_ifstream::rdbuf(), basic_ifstream::is_open) (basic_ofstream::rdbuf(), basic_ofstream::is_open) (basic_fstream::rdbuf(), basic_fstream::is_open): Likewise. * include/std/spanstream (basic_spanbuf::span()) (basic_ispanstream::span(), basic_ispanstream::rdbuf()) (basic_ospanstream::span(), basic_ospanstream::rdbuf()) (basic_spanstream::span(), basic_spanstream::rdbuf()): Likewise. * include/std/sstream (basic_stringbuf::str()) (basic_istringstream::rdbuf(), basic_istringstream::str()) (basic_ostringstream::rdbuf(), basic_ostringstream::str()) (basic_stringstream::rdbuf(), basic_stringstream::str()): Likewise. * testsuite/27_io/basic_istream/extractors_arithmetic/char/01.cc: Suppress -Wunused-result warnings. * testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/01.cc: Likewise.
4 dayslibstdc++: Suppress an attribute suggestion warning [PR116853].Iain Sandoe1-0/+3
This warning is triggering during the build and breaking bootstrap on at least two targets. The warning appears valid, but the final fix for it is not yet clear. In the meantime, to restore bootstrap, the following patch ignores the warning in the relevant code section. PR libstdc++/116853 libstdc++-v3/ChangeLog: * include/bits/basic_string.h: Ignore suggest-attribute=format warning when using posix vsnprintf in to_string() implementations. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
4 dayslibstdc++: Fix std::basic_stracktrace to not assume allocators throw ↵Jonathan Wakely1-2/+2
std::bad_alloc The standard allows allocators to throw any kind of exception, not only something that can be caught as std::bad_alloc. std::basic_stracktrace was assuming std::bad_alloc. libstdc++-v3/ChangeLog: * include/std/stacktrace (basic_stacktrace::_Impl::_M_allocate): Do not assume allocators only throw std::bad_alloc.
4 dayslibstdc++: #ifdef out #pragma GCC system_headerJason Merrill331-4/+663
In r15-3714-gd3a7302ec5985a I added -Wsystem-headers to the libstdc++ build flags to help catch problems in the library. This patch takes a different approach, of disabling the #pragma system_header unless _GLIBCXX_SYSHDR is defined. As a result, the testsuites will treat them as non-system-headers to get better warning coverage during regression testing of both gcc and libstdc++, not just when building the library. My rationale for the #ifdef instead of just removing the #pragma is the three G++ tests that want to test libstdc++ system header behavior, so we need a way to select it. This doesn't affect installed libraries, as they get their system-header status from the lookup path. But testsuite_flags --build-includes gives -I directives rather than -isystem. This patch doesn't change the headers in config/ because I'm not compiling with most of them, so won't see any warnings that need fixing. Adjusting them could happen later, or we can not bother. libstdc++-v3/ChangeLog: * acinclude.m4 (WARN_FLAGS): Remove -Wsystem-headers. * configure: Regenerate. * include/bits/algorithmfwd.h: #ifdef out #pragma GCC system_header. * include/bits/atomic_base.h * include/bits/atomic_futex.h * include/bits/atomic_timed_wait.h * include/bits/atomic_wait.h * include/bits/basic_ios.h * include/bits/basic_string.h * include/bits/boost_concept_check.h * include/bits/char_traits.h * include/bits/charconv.h * include/bits/chrono.h * include/bits/chrono_io.h * include/bits/codecvt.h * include/bits/concept_check.h * include/bits/cpp_type_traits.h * include/bits/elements_of.h * include/bits/enable_special_members.h * include/bits/erase_if.h * include/bits/forward_list.h * include/bits/functional_hash.h * include/bits/gslice.h * include/bits/gslice_array.h * include/bits/hashtable.h * include/bits/indirect_array.h * include/bits/invoke.h * include/bits/ios_base.h * include/bits/iterator_concepts.h * include/bits/locale_classes.h * include/bits/locale_facets.h * include/bits/locale_facets_nonio.h * include/bits/localefwd.h * include/bits/mask_array.h * include/bits/max_size_type.h * include/bits/memory_resource.h * include/bits/memoryfwd.h * include/bits/move_only_function.h * include/bits/node_handle.h * include/bits/ostream_insert.h * include/bits/out_ptr.h * include/bits/parse_numbers.h * include/bits/postypes.h * include/bits/quoted_string.h * include/bits/range_access.h * include/bits/ranges_base.h * include/bits/refwrap.h * include/bits/sat_arith.h * include/bits/semaphore_base.h * include/bits/slice_array.h * include/bits/std_abs.h * include/bits/std_function.h * include/bits/std_mutex.h * include/bits/std_thread.h * include/bits/stl_iterator_base_funcs.h * include/bits/stl_iterator_base_types.h * include/bits/stl_tree.h * include/bits/stream_iterator.h * include/bits/streambuf_iterator.h * include/bits/stringfwd.h * include/bits/this_thread_sleep.h * include/bits/unique_lock.h * include/bits/uses_allocator_args.h * include/bits/utility.h * include/bits/valarray_after.h * include/bits/valarray_array.h * include/bits/valarray_before.h * include/bits/version.h * include/c_compatibility/fenv.h * include/c_compatibility/inttypes.h * include/c_compatibility/stdint.h * include/decimal/decimal.h * include/experimental/bits/net.h * include/experimental/bits/shared_ptr.h * include/ext/aligned_buffer.h * include/ext/alloc_traits.h * include/ext/atomicity.h * include/ext/concurrence.h * include/ext/numeric_traits.h * include/ext/pod_char_traits.h * include/ext/pointer.h * include/ext/stdio_filebuf.h * include/ext/stdio_sync_filebuf.h * include/ext/string_conversions.h * include/ext/type_traits.h * include/ext/vstring.h * include/ext/vstring_fwd.h * include/ext/vstring_util.h * include/parallel/algorithmfwd.h * include/parallel/numericfwd.h * include/tr1/functional_hash.h * include/tr1/hashtable.h * include/tr1/random.h * libsupc++/exception.h * libsupc++/hash_bytes.h * include/bits/basic_ios.tcc * include/bits/basic_string.tcc * include/bits/fstream.tcc * include/bits/istream.tcc * include/bits/locale_classes.tcc * include/bits/locale_facets.tcc * include/bits/locale_facets_nonio.tcc * include/bits/ostream.tcc * include/bits/sstream.tcc * include/bits/streambuf.tcc * include/bits/string_view.tcc * include/bits/version.tpl * include/experimental/bits/string_view.tcc * include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp * include/ext/random.tcc * include/ext/vstring.tcc * include/tr2/bool_set.tcc * include/tr2/dynamic_bitset.tcc * include/bits/c++config * include/c/cassert * include/c/cctype * include/c/cerrno * include/c/cfloat * include/c/ciso646 * include/c/climits * include/c/clocale * include/c/cmath * include/c/csetjmp * include/c/csignal * include/c/cstdarg * include/c/cstddef * include/c/cstdio * include/c/cstdlib * include/c/cstring * include/c/ctime * include/c/cuchar * include/c/cwchar * include/c/cwctype * include/c_global/cassert * include/c_global/ccomplex * include/c_global/cctype * include/c_global/cerrno * include/c_global/cfenv * include/c_global/cfloat * include/c_global/cinttypes * include/c_global/ciso646 * include/c_global/climits * include/c_global/clocale * include/c_global/cmath * include/c_global/csetjmp * include/c_global/csignal * include/c_global/cstdalign * include/c_global/cstdarg * include/c_global/cstdbool * include/c_global/cstddef * include/c_global/cstdint * include/c_global/cstdio * include/c_global/cstdlib * include/c_global/cstring * include/c_global/ctgmath * include/c_global/ctime * include/c_global/cuchar * include/c_global/cwchar * include/c_global/cwctype * include/c_std/cassert * include/c_std/cctype * include/c_std/cerrno * include/c_std/cfloat * include/c_std/ciso646 * include/c_std/climits * include/c_std/clocale * include/c_std/cmath * include/c_std/csetjmp * include/c_std/csignal * include/c_std/cstdarg * include/c_std/cstddef * include/c_std/cstdio * include/c_std/cstdlib * include/c_std/cstring * include/c_std/ctime * include/c_std/cuchar * include/c_std/cwchar * include/c_std/cwctype * include/debug/array * include/debug/bitset * include/debug/deque * include/debug/forward_list * include/debug/list * include/debug/map * include/debug/set * include/debug/string * include/debug/unordered_map * include/debug/unordered_set * include/debug/vector * include/decimal/decimal * include/experimental/algorithm * include/experimental/any * include/experimental/array * include/experimental/buffer * include/experimental/chrono * include/experimental/contract * include/experimental/deque * include/experimental/executor * include/experimental/filesystem * include/experimental/forward_list * include/experimental/functional * include/experimental/internet * include/experimental/io_context * include/experimental/iterator * include/experimental/list * include/experimental/map * include/experimental/memory * include/experimental/memory_resource * include/experimental/net * include/experimental/netfwd * include/experimental/numeric * include/experimental/propagate_const * include/experimental/ratio * include/experimental/regex * include/experimental/scope * include/experimental/set * include/experimental/socket * include/experimental/string * include/experimental/string_view * include/experimental/synchronized_value * include/experimental/system_error * include/experimental/timer * include/experimental/tuple * include/experimental/type_traits * include/experimental/unordered_map * include/experimental/unordered_set * include/experimental/vector * include/ext/algorithm * include/ext/cmath * include/ext/functional * include/ext/iterator * include/ext/memory * include/ext/numeric * include/ext/random * include/ext/rb_tree * include/ext/rope * include/parallel/algorithm * include/std/algorithm * include/std/any * include/std/array * include/std/atomic * include/std/barrier * include/std/bit * include/std/bitset * include/std/charconv * include/std/chrono * include/std/codecvt * include/std/complex * include/std/concepts * include/std/condition_variable * include/std/coroutine * include/std/deque * include/std/execution * include/std/expected * include/std/filesystem * include/std/format * include/std/forward_list * include/std/fstream * include/std/functional * include/std/future * include/std/generator * include/std/iomanip * include/std/ios * include/std/iosfwd * include/std/iostream * include/std/istream * include/std/iterator * include/std/latch * include/std/limits * include/std/list * include/std/locale * include/std/map * include/std/memory * include/std/memory_resource * include/std/mutex * include/std/numbers * include/std/numeric * include/std/optional * include/std/ostream * include/std/print * include/std/queue * include/std/random * include/std/ranges * include/std/ratio * include/std/regex * include/std/scoped_allocator * include/std/semaphore * include/std/set * include/std/shared_mutex * include/std/span * include/std/spanstream * include/std/sstream * include/std/stack * include/std/stacktrace * include/std/stdexcept * include/std/streambuf * include/std/string * include/std/string_view * include/std/syncstream * include/std/system_error * include/std/text_encoding * include/std/thread * include/std/tuple * include/std/type_traits * include/std/typeindex * include/std/unordered_map * include/std/unordered_set * include/std/utility * include/std/valarray * include/std/variant * include/std/vector * include/std/version * include/tr1/array * include/tr1/cfenv * include/tr1/cinttypes * include/tr1/cmath * include/tr1/complex * include/tr1/cstdbool * include/tr1/cstdint * include/tr1/cstdio * include/tr1/cstdlib * include/tr1/cwchar * include/tr1/cwctype * include/tr1/functional * include/tr1/memory * include/tr1/random * include/tr1/regex * include/tr1/tuple * include/tr1/type_traits * include/tr1/unordered_map * include/tr1/unordered_set * include/tr1/utility * include/tr2/bool_set * include/tr2/dynamic_bitset * include/tr2/type_traits * libsupc++/atomic_lockfree_defines.h * libsupc++/compare * libsupc++/cxxabi.h * libsupc++/cxxabi_forced.h * libsupc++/cxxabi_init_exception.h * libsupc++/exception * libsupc++/initializer_list * libsupc++/new * libsupc++/typeinfo: Likewise. * testsuite/20_util/ratio/operations/ops_overflow_neg.cc * testsuite/23_containers/array/tuple_interface/get_neg.cc * testsuite/23_containers/vector/cons/destructible_debug_neg.cc * testsuite/24_iterators/operations/prev_neg.cc * testsuite/ext/type_traits/add_unsigned_floating_neg.cc * testsuite/ext/type_traits/add_unsigned_integer_neg.cc * testsuite/ext/type_traits/remove_unsigned_floating_neg.cc * testsuite/ext/type_traits/remove_unsigned_integer_neg.cc: Adjust line numbers. gcc/testsuite/ChangeLog * g++.dg/analyzer/fanalyzer-show-events-in-system-headers-default.C * g++.dg/analyzer/fanalyzer-show-events-in-system-headers-no.C * g++.dg/diagnostic/disable.C: #define _GLIBCXX_SYSHDR.
4 dayslibstdc++: more #pragma diagnosticJason Merrill2-0/+10
The CI saw failures on 17_intro/headers/c++2011/parallel_mode.cc due to -Wdeprecated-declarations warnings in some parallel/ headers. libstdc++-v3/ChangeLog: * include/parallel/base.h: Suppress -Wdeprecated-declarations. * include/parallel/multiseq_selection.h: Likewise.
6 dayslibstdc++: Remove unnecessary 'static' from __is_specialization_ofNathaniel Shead1-3/+2
This makes the declarations internal linkage, which is an ODR issue, and causes a future modules patch to fail regtest as it now detects attempted uses of TU-local entities in module CMIs. libstdc++-v3/ChangeLog: * include/std/format: Remove unnecessary 'static'. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
6 dayslibstdc++: guard c++config pragmasJason Merrill1-0/+2
c++config needs to be compilable as C, in which mode we complain about the -Wc++ pragmas. libstdc++-v3/ChangeLog: * include/bits/c++config: Don't try to disable -Wc++??-extensions when compiling as C.
7 dayslibstdc++: Disable std::formatter<char8_t, C> specializationJonathan Wakely1-25/+28
I noticed that char8_t was missing from the list of types that were prevented from using the std::formatter partial specialization for integer types. That partial specialization was also matching cv-qualified integer types, because std::integral<const int> is true. This change simplifies the constraints by introducing a new variable template which is only true for cv-unqualified integer types, with explicit specializations to exclude the character types. This should be slightly more efficient than the previous constraints that checked std::integral<T> and (!__is_one_of<T, char, wchar_t, ...>). It also avoids the need for a separate std::formatter specialization for 128-bit integers, as they can be handled by the new variable template too. libstdc++-v3/ChangeLog: * include/std/format (__format::__is_formattable_integer): New variable template and specializations. (template<integral, __char> struct formatter): Replace constraints on first arg with __is_formattable_integer. * testsuite/std/format/formatter/requirements.cc: Check that std::formatter specializations for char8_t and const int are disabled.
7 dayslibstdc++: Fix condition for ranges::copy to use memmove [PR116754]Jonathan Wakely1-1/+1
libstdc++-v3/ChangeLog: PR libstdc++/116754 * include/bits/ranges_algobase.h (__copy_or_move): Fix order of arguments to __memcpyable.
7 dayslibstdc++: Fix formatting of most negative chrono::duration [PR116755]Jonathan Wakely1-2/+14
When formatting chrono::duration<signed-integer-type, P>::min() we were causing undefined behaviour by trying to form the negative of the most negative value. If we convert negative durations with integer rep to the corresponding unsigned integer rep then we can safely represent all values. libstdc++-v3/ChangeLog: PR libstdc++/116755 * include/bits/chrono_io.h (formatter<duration<R,P>>::format): Cast negative integral durations to unsigned rep. * testsuite/20_util/duration/io.cc: Test the most negative integer durations.
7 dayslibstdc++: Use constexpr instead of _GLIBCXX20_CONSTEXPR in <vector>Jonathan Wakely1-3/+3
For the operator<=> overload we can use the 'constexpr' keyword directly, because we know the language dialect is at least C++20. libstdc++-v3/ChangeLog: * include/bits/stl_vector.h (operator<=>): Use constexpr instead of _GLIBCXX20_CONSTEXPR macro.
7 dayslibstdc++: Reorder C++26 entries in version.defJonathan Wakely2-37/+37
This puts the C++26 ftms definitions in alphabetical order. libstdc++-v3/ChangeLog: * include/bits/version.def: Sort C++26 entries alphabetically. * include/bits/version.h: Regenerate.
7 dayslibstdc++: add default template parameters to algorithmsJonathan Wakely17-81/+210
This implements P2248R8 + P3217R0, both approved for C++26. The changes are mostly mechanical; the struggle is to keep readability with the pre-P2248 signatures. * For containers, "classic STL" algorithms and their parallel versions, introduce a macro and amend their declarations/definitions with it. The macro either expands to the defaulted parameter or to nothing in pre-C++26 modes. * For range algorithms, we need to reorder their template parameters. I've done so unconditionally, because users cannot rely on template parameters of algorithms (this is explicitly authorized by [algorithms.requirements]/15). The defaults are then hidden behind another macro. libstdc++-v3/ChangeLog: * include/bits/iterator_concepts.h: Add projected_value_t. * include/bits/algorithmfwd.h: Add the default template parameter to the relevant forward declarations. * include/pstl/glue_algorithm_defs.h: Likewise. * include/bits/ranges_algo.h: Add the default template parameter to range-based algorithms. * include/bits/ranges_algobase.h: Likewise. * include/bits/ranges_util.h: Likewise. * include/bits/ranges_base.h: Add helper macros. * include/bits/stl_iterator_base_types.h: Add helper macro. * include/bits/version.def: Add the new feature-testing macro. * include/bits/version.h: Regenerate. * include/std/algorithm: Pull the feature-testing macro. * include/std/ranges: Likewise. * include/std/deque: Pull the feature-testing macro, add the default for std::erase. * include/std/forward_list: Likewise. * include/std/list: Likewise. * include/std/string: Likewise. * include/std/vector: Likewise. * testsuite/23_containers/default_template_value.cc: New test. * testsuite/25_algorithms/default_template_value.cc: New test. Signed-off-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Co-authored-by: Jonathan Wakely <jwakely@redhat.com>
9 dayslibstdc++: fix C header include guardsJason Merrill37-95/+92
Ever since the c_global and c_compatibility directories were added in r122533, the include guards have been oddly late in the files, with no comment about why that might be either in the commit message or the files themselves. I don't see any justification for this; it seems like a scripting error in creating these files based on the ones in include/c. libstdc++-v3/ChangeLog: * include/c_compatibility/ctype.h * include/c_compatibility/errno.h * include/c_compatibility/float.h * include/c_compatibility/iso646.h * include/c_compatibility/limits.h * include/c_compatibility/locale.h * include/c_compatibility/setjmp.h * include/c_compatibility/signal.h * include/c_compatibility/stdarg.h * include/c_compatibility/stdbool.h * include/c_compatibility/stddef.h * include/c_compatibility/stdio.h * include/c_compatibility/string.h * include/c_compatibility/tgmath.h * include/c_compatibility/time.h * include/c_compatibility/uchar.h * include/c_compatibility/wchar.h * include/c_compatibility/wctype.h * include/c_global/ccomplex * include/c_global/cctype * include/c_global/cerrno * include/c_global/cfloat * include/c_global/climits * include/c_global/clocale * include/c_global/cmath * include/c_global/csetjmp * include/c_global/csignal * include/c_global/cstdalign * include/c_global/cstdarg * include/c_global/cstdbool * include/c_global/cstdio * include/c_global/cstdlib * include/c_global/cstring * include/c_global/ctgmath * include/c_global/ctime * include/c_global/cwchar * include/c_global/cwctype: Move header guard before #includes.
9 dayslibstdc++: Avoid forming T* in unique_ptr(auto_ptr<U>&&) constraints [PR116529]Jonathan Wakely1-2/+3
PR 116529 shows that std::unique_ptr<X&, D> is currently unusable because the constructor taking std::auto_ptr (which is a non-standard extension since C++17) tries to form the invalid type X&* during overload resolution. We can use the `pointer` type in the constructor constraints, instead of trying to form an invalid type. The std::auto_ptr constructor can never actually match for the case where element_type is a reference, so we just need it to produce a substitution failure instead of being ill-formed. LWG 4144 might make std::unique_ptr<X&, D> ill-formed, which would invalidate this new test. We would have to remove this test in that case. Using `pointer` in the constructor from std::auto_ptr would not be needed to support the std::unique_ptr<X&, D> case, but would not cause any harm either. libstdc++-v3/ChangeLog: PR libstdc++/116529 * include/bits/unique_ptr.h (unique_ptr(auto_ptr<U>&&)): Use pointer instead of T*. * testsuite/20_util/unique_ptr/creation/116529.cc: New test.
10 dayslibstdc++: add #pragma diagnosticJason Merrill62-1/+298
The use of #pragma GCC system_header in libstdc++ has led to bugs going undetected for a while due to the silencing of compiler warnings that would have revealed them promptly, and also interferes with warnings about problematic template instantiations induced by user code. But removing it, or even compiling with -Wsystem-header, is also problematic due to warnings about deliberate uses of extensions. So this patch adds #pragma GCC diagnostic as needed to suppress these warnings. The change to acinclude.m4 changes -Wabi to warn only in comparison to ABI 19, to avoid lots of warnings that we now mangle concept requirements, which are in any case still experimental. I checked for any other changes against ABI v15, and found only the <format> lambda mangling, which we can ignore. This also enables -Wsystem-headers while building the library, so we see any warnings not silenced by these #pragmas. libstdc++-v3/ChangeLog: * include/bits/algorithmfwd.h: * include/bits/allocator.h: * include/bits/codecvt.h: * include/bits/concept_check.h: * include/bits/cpp_type_traits.h: * include/bits/hashtable.h: * include/bits/iterator_concepts.h: * include/bits/ostream_insert.h: * include/bits/ranges_base.h: * include/bits/regex_automaton.h: * include/bits/std_abs.h: * include/bits/stl_algo.h: * include/c_compatibility/fenv.h: * include/c_compatibility/inttypes.h: * include/c_compatibility/stdint.h: * include/ext/concurrence.h: * include/ext/type_traits.h: * testsuite/ext/type_traits/add_unsigned_floating_neg.cc: * testsuite/ext/type_traits/add_unsigned_integer_neg.cc: * testsuite/ext/type_traits/remove_unsigned_floating_neg.cc: * testsuite/ext/type_traits/remove_unsigned_integer_neg.cc: * include/bits/basic_ios.tcc: * include/bits/basic_string.tcc: * include/bits/fstream.tcc: * include/bits/istream.tcc: * include/bits/locale_classes.tcc: * include/bits/locale_facets.tcc: * include/bits/ostream.tcc: * include/bits/regex_compiler.tcc: * include/bits/sstream.tcc: * include/bits/streambuf.tcc: * configure: Regenerate. * include/bits/c++config: * include/c/cassert: * include/c/cctype: * include/c/cerrno: * include/c/cfloat: * include/c/climits: * include/c/clocale: * include/c/cmath: * include/c/csetjmp: * include/c/csignal: * include/c/cstdarg: * include/c/cstddef: * include/c/cstdio: * include/c/cstdlib: * include/c/cstring: * include/c/ctime: * include/c/cwchar: * include/c/cwctype: * include/c_global/climits: * include/c_global/cmath: * include/c_global/cstddef: * include/c_global/cstdlib: * include/decimal/decimal: * include/ext/rope: * include/std/any: * include/std/charconv: * include/std/complex: * include/std/coroutine: * include/std/format: * include/std/iomanip: * include/std/limits: * include/std/numbers: * include/tr1/functional: * include/tr1/tuple: * include/tr1/type_traits: * libsupc++/compare: * libsupc++/new: Add #pragma GCC diagnostic to suppress undesired warnings. * acinclude.m4: Change -Wabi version from 2 to 19. gcc/ChangeLog: * ginclude/stdint-wrap.h: Add #pragma GCC diagnostic to suppress undesired warnings. * gsyslimits.h: Likewise.
11 dayslibstdc++: add bracesJason Merrill1-1/+1
GCC compiles with -fno-exceptions, so __throw_exception_again is a no-op, and compilation gives a -Wempty-body warning here, so let's wrap it as is already done in a few other files. libstdc++-v3/ChangeLog: * include/bits/basic_ios.h: Add braces.
14 dayslibstdc++: Add .editorconfig filesJonathan Wakely1-0/+10
These config files set default formatting behaviour for a large number of common editors, see https://editorconfig.org The root=true setting in libstdc++-v3/.editorconfig prevents looking in parent directories for additional settings. If we add a .editorconfig at the top-level we might want to use root=true there instead, and allow libstdc++-v3/.editorconfig to inherit some some settings from there (and only override things we want to do differently). libstdc++-v3/ChangeLog: * .editorconfig: New file. * include/std/.editorconfig: New file.
2024-09-15libstdc++: Adjust std::span::iterator to be ADL-proofJonathan Wakely2-2/+7
Because std::span<Incomplete> can be useful, it makes sense to define std::span<Incomplete>::iterator such that Incomplete is not an associated class, and so the compiler won't attempt to complete it when doing ADL for span iterators (including during the definition of std::span<Incomplete>::const_iterator which checks that iterator satisfies std::input_or_output_iterator). We can't make this change for std::vector<Incomplete> because it would change the mangled name of std::vector<Incomplete>::iterator which would affect the mangled names of templates and functions written by users. We can do the same thing for std::basic_stacktrace<Alloc> just so that Alloc is not an associated class. This is probably less beneficial, as Alloc can't be incomplete, and using SomeAllocator<Incomplete> as the allocator parameter doesn't seem useful. But simply making the stacktrace iterator not use Alloc for ADL lookup seems worthwhile. This is doable because std::stacktrace is part of C++23 so its ABI isn't considered stable yet. libstdc++-v3/ChangeLog: * include/std/span (span::__iter_tag): Declare nested type. (span::iterator): Use __iter_tag as second template argument. * include/std/stacktrace (basic_stacktrace::iterator): Use _Impl as second template argument.
2024-09-15libstdc++: Enable most of <chrono> for freestandingJonathan Wakely4-13/+38
This makes durations, time points and calendrical types available for freestanding. The clocks and time zone utilities are disabled for freestanding, as they require functions in the hosted lib. Add support for a new macro _GLIBCXX_NO_FREESTANDING_CHRONO which can be used to explicitly disable <chrono> for freestanding. libstdc++-v3/ChangeLog: * doc/xml/manual/using.xml (_GLIBCXX_NO_FREESTANDING_CHRONO): Document macro. * doc/html/*: Regenerate. * include/bits/chrono.h [_GLIBCXX_NO_FREESTANDING_CHRONO]: Only include <bits/require_hosted.h> when this macro is defined. [_GLIBCXX_HOSTED]: Only define clocks for hosted. * include/bits/version.def (chrono_udls): Remove hosted=yes. * include/bits/version.h: Regenerate. * include/std/chrono [_GLIBCXX_HOSTED]: Only define clocks and time zone utilities for hosted. * testsuite/std/time/freestanding.cc: New test.
2024-09-15libstdc++: Add assertion for valid facet type argumentsJonathan Wakely2-0/+10
LWG 436 confirmed that const-qualified types are valid arguments for Facet template parameters, but volatile-qualified types are not. Add an assertion to locale::combine to check for valid types. libstdc++-v3/ChangeLog: * include/bits/locale_classes.h (__is_facet): New helper. * include/bits/locale_classes.tcc (locale::combine): Check that _Facet type is valid.
2024-09-15libstdc++: Make PSTL algorithms accept C++20 iterators [PR110512]Jonathan Wakely1-5/+16
This is a step towards implementing the C++23 change P2408R5, "Ranges iterators as inputs to non-Ranges algorithms". C++20 random access iterators which do not meet the Cpp17RandomAccessIterator requirements will now be recognized by the PSTL algorithms. As noted by Patrick, P2408R5 only relaxes the requirements for non-mutating algorithms, but this relaxes them for all parallel algorithms. I believe that's OK. A call with a type which previously didn't compile at all was undefined, so we're allowed to start accepting those calls if the type satisfies std::random_access_iterator. However, this also causes a change in behaviour for calls with arguments which satisfy std::random_access_iterator and meet the Cpp17ForwardIterator requirements but not the Cpp17RandomAccessIterator requirements. The algorithms will dispatch to a different implementation now. I believe that's also OK. The algorithms should give the same results whether acting on forward iterators or random access iterators, just more efficiently for the latter. Additionally, we can optimize the C++17 implementation by using std::__and_, and use std::__remove_cvref_t and std::__iter_category_t for readability. This diverges from the upstream PSTL, but since libc++ is no longer using that upstream (so we're the only consumer of this code) I think it's reasonable to use libstdc++ extensions in localized places like this. Rebasing this small header on upstream should not be difficult. libstdc++-v3/ChangeLog: PR libstdc++/110512 * include/pstl/execution_impl.h (__are_random_access_iterators): Recognize C++20 random access iterators, and use more efficient implementations. * testsuite/25_algorithms/pstl/110512.cc: New test.
2024-09-14libstdc++: Tweak localized formatting for floating-point typesJonathan Wakely1-7/+10
libstdc++-v3/ChangeLog: * include/std/format (__formatter_fp::_M_localize): Add comments and micro-optimize string copy.
2024-09-14libstdc++: Refactor loops in std::__platform_semaphoreJonathan Wakely1-38/+20
Refactor the loops to all use the same form, and to not need explicit 'break' or 'continue' jumps. This also avoids a -Wunused-variable warning with -Wsystem-headers. Also fix a bug for absolute timeouts specified with a time that isn't implicitly convertible to __clock_t::time_point, e.g. one with a higher resolution such as picoseconds. Use chrono::ceil to round up to the next time point representable by the clock. libstdc++-v3/ChangeLog: * include/bits/semaphore_base.h (__platform_semaphore): Refactor loops to all use similar forms. (__platform_semaphore::_M_try_acquire_until): Use chrono::ceil to explicitly convert to __clock_t::time_point. * testsuite/30_threads/semaphore/try_acquire_for.cc: Check that using a very high resolution timeout compiles. * testsuite/30_threads/semaphore/platform_try_acquire_for.cc: New test.
2024-09-13libstdc++: Do not use use memmove for 1-element ranges [PR108846,PR116471]Giuseppe D'Angelo1-25/+21
This commit ports the fixes already applied by r13-6372-g822a11a1e642e0 to the range-based versions of copy/move algorithms. When doing so, a further bug (PR116471) was discovered in the implementation of the range-based algorithms: although the algorithms are already constrained by the indirectly_copyable/movable concepts, there was a failing static_assert in the memmove path. This static_assert checked that iterator's value type was assignable by using the is_copy_assignable (move) type traits. However, this is a problem, because the traits are too strict when checking for constness; a type like struct S { S& operator=(S &) = default; }; is trivially copyable (and thus could benefit of the memmove path), but it does not satisfy is_copy_assignable because the operator takes by non-const reference. Now, the reason for the check to be there is because a type with a deleted assignment operator like struct E { E& operator=(const E&) = delete; }; is still trivially copyable, but not assignable. We don't want algorithms like std::ranges::copy to compile because they end up selecting the memmove path, "ignoring" the fact that E isn't even copy assignable. But the static_assert isn't needed here any longer: as noted before, the ranges algorithms already have the appropriate constraints; and even if they didn't, there's now a non-discarded codepath to deal with ranges of length 1 where there is an explicit assignment operation. Therefore, this commit removes it. (In fact, r13-6372-g822a11a1e642e0 removed the same static_assert from the non-ranges algorithms.) libstdc++-v3/ChangeLog: PR libstdc++/108846 PR libstdc++/116471 * include/bits/ranges_algobase.h (__assign_one): New helper function. (__copy_or_move): Remove a spurious static_assert; use __assign_one for memcpyable ranges of length 1. (__copy_or_move_backward): Likewise. * testsuite/25_algorithms/copy/108846.cc: Extend to range-based algorithms, and cover both memcpyable and non-memcpyable cases. * testsuite/25_algorithms/copy_backward/108846.cc: Likewise. * testsuite/25_algorithms/copy_n/108846.cc: Likewise. * testsuite/25_algorithms/move/108846.cc: Likewise. * testsuite/25_algorithms/move_backward/108846.cc: Likewise. Signed-off-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2024-09-12libstdc++: Remove unused alias template in std::optionalJonathan Wakely1-2/+0
I added this __is_bool alias template in r15-2309-g6d86486292acbe but it isn't actually used so can be removed. libstdc++-v3/ChangeLog: * include/std/optional (__is_bool): Remove.
2024-09-11libstdc++: Restore unrolling in std::find using pragma [PR116140]Alex Coplan1-0/+1
Together with the preparatory compiler patches, this patch restores unrolling in std::__find_if, but this time relying on the compiler to do it by using: #pragma GCC unroll 4 which should restore the majority of the regression relative to the hand-unrolled version while still being vectorizable with WIP alignment peeling enhancements. On Neoverse V1 with LTO, this reduces the regression in xalancbmk (from SPEC CPU 2017) from 5.8% to 1.7% (restoring ~71% of the lost performance). libstdc++-v3/ChangeLog: PR libstdc++/116140 * include/bits/stl_algobase.h (std::__find_if): Add #pragma to request GCC to unroll the loop.
2024-09-10libstdc++: Only use std::ios_base_library_init() for ELF [PR116159]Jonathan Wakely1-1/+1
The undefined std::ios_base_library_init() symbol that is referenced by <iostream> is only supposed to be used for targets where symbol versioning is supported. The mingw-w64 target defaults to --enable-symvers=gnu due to using GNU ld but doesn't actually support symbol versioning. This means it tries to emit references to the std::ios_base_library_init() symbol, which isn't really defined in the library. This causes problems when using lld to link user binaries. Disable the undefined symbol reference for non-ELF targets. libstdc++-v3/ChangeLog: PR libstdc++/116159 * include/std/iostream (ios_base_library_init): Only define for ELF targets. * src/c++98/ios_init.cc (ios_base_library_init): Likewise.
2024-09-10libstdc++: std::string move assignment should not use POCCA trait [PR116641]Jonathan Wakely1-1/+1
The changes to implement LWG 2579 (r10-327-gdb33efde17932f) made std::string::assign use the propagate_on_container_copy_assignment (POCCA) trait, for consistency with operator=(const basic_string&). However, this also unintentionally affected operator=(basic_string&&) which calls assign(str) to make a deep copy when performing a move is not possible. The fix is for the move assignment operator to call _M_assign(str) instead of assign(str), as this just does the deep copy and doesn't check the POCCA trait first. The bug only affects the unlikely/useless combination of POCCA==true and POCMA==false, but we should fix it for correctness anyway. it should also make move assignment slightly cheaper to compile and execute, because we skip the extra code in assign(const basic_string&). libstdc++-v3/ChangeLog: PR libstdc++/116641 * include/bits/basic_string.h (operator=(basic_string&&)): Call _M_assign instead of assign. * testsuite/21_strings/basic_string/allocator/116641.cc: New test.
2024-09-06libstdc++: Fix std::chrono::parse for TAI and GPS clocksJonathan Wakely1-5/+7
Howard Hinnant brought to my attention that chrono::parse was giving incorrect values for chrono::gps_clock, because it was applying the offset between the GPS clock and UTC. That's incorrect, because when we parse HH::MM::SS as a GPS time, the result should be that time, not HH:MM:SS+offset. The problem was that I was using clock_cast to convert from sys_time to utc_time and then using clock_time again to convert to gps_time. The solution is to convert the parsed time into an duration representing the time since the GPS clock's epoch, then construct a gps_time directly from that duration. As well as adding tests for correct round tripping of times for all clocks, this also adds some more tests for correct results with std::format. libstdc++-v3/ChangeLog: * include/bits/chrono_io.h (from_stream): Fix conversions in overloads for gps_time and tai_time. * testsuite/std/time/clock/file/io.cc: Test round tripping using chrono::parse. Add additional std::format tests. * testsuite/std/time/clock/gps/io.cc: Likewise. * testsuite/std/time/clock/local/io.cc: Likewise. * testsuite/std/time/clock/tai/io.cc: Likewise. * testsuite/std/time/clock/utc/io.cc: Likewise.
2024-09-06libstdc++: add missing __Jason Merrill1-1/+1
I forgot the __ in my recent r15-3500-g1914ca8791ce4e. libstdc++-v3/ChangeLog: * include/bits/regex_constants.h: Add __ to attribute.
2024-09-06libstdc++: avoid __GLIBCXX__ redefinitionJason Merrill1-0/+1
testsuite/lib/dg-options.exp defines __GLIBCXX__ to 9999999; avoid a macro redefinition warning in that case. libstdc++-v3/ChangeLog: * include/bits/c++config: Avoid redefining __GLIBCXX__.
2024-09-05c-family: add attribute flag_enum [PR81665]Jason Merrill1-1/+1
Several PRs complain about -Wswitch warning about a case for a bitwise combination of enumerators. Clang has an attribute flag_enum to prevent this; let's adopt that approach as well. This also recognizes the attribute as [[clang::flag_enum]], introducing handling of the clang attribute namespace. PR c++/46457 PR c++/81665 gcc/c-family/ChangeLog: * c-attribs.cc (handle_flag_enum_attribute): New. (c_common_gnu_attributes): Add it. (c_common_clang_attributes, c_common_clang_attribute_table): New. * c-common.h: Declare c_common_clang_attribute_table. * c-warn.cc (c_do_switch_warnings): Handle flag_enum. gcc/c/ChangeLog: * c-objc-common.h (c_objc_attribute_table): Add c_common_clang_attribute_table. gcc/cp/ChangeLog: * cp-objcp-common.h (cp_objcp_attribute_table): Add c_common_clang_attribute_table. gcc/testsuite/ChangeLog: * c-c++-common/attr-flag-enum-1.c: New test. gcc/ChangeLog: * doc/extend.texi: Document flag_enum attribute. * doc/invoke.texi: Mention flag_enum in -Wswitch. libstdc++-v3/ChangeLog: * include/bits/regex_constants.h: Use flag_enum.
2024-09-05libstdc++: -Wswitch and ios::openmodeJason Merrill1-5/+14
In addition to marking it as flag_enum, we want to avoid warnings about not having a case for the implementation detail enumerators _S_ios_openmode_*. And also for _S_noreplace in standard modes before it was added. libstdc++-v3/ChangeLog: * include/bits/ios_base.h (_GLIBCXX_NOREPLACE_UNUSED): New. (_Ios_Openmode): Add unused attributes. * testsuite/27_io/ios_base/types/openmode/case_label.cc: Handle noreplace.
2024-09-03libstdc++: Specialize std::disable_sized_sentinel_for for std::move_iterator ↵Jonathan Wakely1-0/+8
[PR116549] LWG 3736 added a partial specialization of this variable template for two std::move_iterator types. This is needed for the case where the types satisfy std::sentinel_for and are subtractable, but do not model the semantics requirements of std::sized_sentinel_for. libstdc++-v3/ChangeLog: PR libstdc++/116549 * include/bits/stl_iterator.h (disable_sized_sentinel_for): Define specialization for two move_iterator types, as per LWG 3736. * testsuite/24_iterators/move_iterator/lwg3736.cc: New test.
2024-09-03libstdc++: Simplify std::any to fix -Wdeprecated-declarations warningJonathan Wakely2-2/+2
We don't need to use std::aligned_storage in std::any. We just need a POD type of the right size. The void* union member already ensures the alignment will be correct. Avoiding std::aligned_storage means we don't need to suppress a -Wdeprecated-declarations warning. libstdc++-v3/ChangeLog: * include/experimental/any (experimental::any::_Storage): Use array of unsigned char instead of deprecated std::aligned_storage. * include/std/any (any::_Storage): Likewise. * testsuite/20_util/any/layout.cc: New test.
2024-09-03libstdc++: Add missing feature-test macro in various headersDhruv Chawla10-0/+12
version.syn#2 requires various headers to define __cpp_lib_allocator_traits_is_always_equal. Currently, only <memory> was defining this macro. Implement fixes for the other headers as well. Signed-off-by: Dhruv Chawla <dhruvc@nvidia.com> libstdc++-v3/ChangeLog: * include/std/deque: Define macro __glibcxx_want_allocator_traits_is_always_equal. * include/std/forward_list: Likewise. * include/std/list: Likewise. * include/std/map: Likewise. * include/std/scoped_allocator: Likewise. * include/std/set: Likewise. * include/std/string: Likewise. * include/std/unordered_map: Likewise. * include/std/unordered_set: Likewise. * include/std/vector: Likewise. * testsuite/20_util/headers/memory/version.cc: New test. * testsuite/20_util/scoped_allocator/version.cc: Likewise. * testsuite/21_strings/headers/string/version.cc: Likewise. * testsuite/23_containers/deque/version.cc: Likewise. * testsuite/23_containers/forward_list/version.cc: Likewise. * testsuite/23_containers/list/version.cc: Likewise. * testsuite/23_containers/map/version.cc: Likewise. * testsuite/23_containers/set/version.cc: Likewise. * testsuite/23_containers/unordered_map/version.cc: Likewise. * testsuite/23_containers/unordered_set/version.cc: Likewise. * testsuite/23_containers/vector/version.cc: Likewise.
2024-08-28libstdc++: Fix -Wunused-parameter warnings in Networking TS headersJonathan Wakely2-2/+2
libstdc++-v3/ChangeLog: * include/experimental/io_context: Remove name of unused parameter. * include/experimental/socket: Add [[maybe_unused]] attribute.
2024-08-28libstdc++: Fix -Wunused-variable warning in <format>Jonathan Wakely1-0/+5
libstdc++-v3/ChangeLog: * include/std/format (format_parse_context::check_dynamic_spec): Add [[maybe_unused]] attribute and comment.
2024-08-28libstdc++: Remove unused typedef in <ranges>Jonathan Wakely1-1/+0
This local typedef should have been removed in r14-6199-g45630fbcf7875b. libstdc++-v3/ChangeLog: * include/std/ranges (to): Remove unused typedef.
2024-08-28libstdc++: Fix @headername for bits/cpp_type_traits.hKim Gräsman1-1/+1
There is no file ext/type_traits, point it to ext/type_traits.h instead. libstdc++-v3/ChangeLog: * include/bits/cpp_type_traits.h: Improve doxygen file docs.
2024-08-28libstdc++: avoid -Wsign-compareJason Merrill2-2/+3
-Wsign-compare complained about these comparisons between (unsigned) size_t and (signed) streamsize, or between (unsigned) native_handle_type and (signed) -1. Fixed by adding casts to unify the types. libstdc++-v3/ChangeLog: * include/std/istream: Add cast to avoid -Wsign-compare. * include/std/stacktrace: Likewise.
2024-08-28libstdc++: avoid -Wzero-as-null-pointer-constantJason Merrill1-1/+1
libstdc++-v3/ChangeLog: * include/std/coroutine (coroutine_handle): Use nullptr instead of 0 as initializer for _M_fr_ptr.