Commit graph

14771 commits

Author SHA1 Message Date
GCC Administrator
3b6327461d Daily bump. 2023-10-23 00:16:43 +00:00
Iain Sandoe
6a6d3817af Config,Darwin: Allow for configuring Darwin to use embedded runpath.
Recent Darwin versions place contraints on the use of run paths
specified in environment variables.  This breaks some assumptions
in the GCC build.

This change allows the user to configure a Darwin build to use
'@rpath/libraryname.dylib' in library names and then to add an
embedded runpath to executables (and libraries with dependents).

The embedded runpath is added by default unless the user adds
'-nodefaultrpaths' to the link line.

For an installed compiler, it means that any executable built with
that compiler will reference the runtimes installed with the
compiler (equivalent to hard-coding the library path into the name
of the library).

During build-time configurations  any "-B" entries will be added to
the runpath thus the newly-built libraries will be found by exes.

Since the install name is set in libtool, that decision needs to be
available here (but might also cause dependent ones in Makefiles,
so we need to export a conditional).

This facility is not available for Darwin 8 or earlier, however the
existing environment variable runpath does work there.

We default this on for systems where the external DYLD_LIBRARY_PATH
does not work and off for Darwin 8 or earlier.  For systems that can
use either method, if the value is unset, we use the default (which
is currently DYLD_LIBRARY_PATH).

ChangeLog:

	* configure: Regenerate.
	* configure.ac: Do not add default runpaths to GCC exes
	when we are building -static-libstdc++/-static-libgcc (the
	default).
	* libtool.m4: Add 'enable-darwin-at-runpath'.  Act  on the
	enable flag to alter Darwin libraries to use @rpath names.

gcc/ChangeLog:

	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* configure.ac: Handle Darwin rpaths.
	* config/darwin.h: Handle Darwin rpaths.
	* config/darwin.opt: Handle Darwin rpaths.
	* Makefile.in:  Handle Darwin rpaths.

gcc/ada/ChangeLog:

	* gcc-interface/Makefile.in: Handle Darwin rpaths.

gcc/jit/ChangeLog:
	* Make-lang.in: Handle Darwin rpaths.

libatomic/ChangeLog:

	* Makefile.am: Handle Darwin rpaths.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Handle Darwin rpaths.

libbacktrace/ChangeLog:

	* configure: Regenerate.
	* configure.ac: Handle Darwin rpaths.

libcc1/ChangeLog:

	* configure: Regenerate.

libffi/ChangeLog:

	* Makefile.am: Handle Darwin rpaths.
	* Makefile.in: Regenerate.
	* configure: Regenerate.

libgcc/ChangeLog:

	* config/t-slibgcc-darwin: Generate libgcc_s
	with an @rpath name.
	* config.host: Handle Darwin rpaths.

libgfortran/ChangeLog:

	* Makefile.am: Handle Darwin rpaths.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Handle Darwin rpaths

libgm2/ChangeLog:

	* Makefile.am: Handle Darwin rpaths.
	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* configure.ac: Handle Darwin rpaths.
	* libm2cor/Makefile.am: Handle Darwin rpaths.
	* libm2cor/Makefile.in: Regenerate.
	* libm2iso/Makefile.am: Handle Darwin rpaths.
	* libm2iso/Makefile.in: Regenerate.
	* libm2log/Makefile.am: Handle Darwin rpaths.
	* libm2log/Makefile.in: Regenerate.
	* libm2min/Makefile.am: Handle Darwin rpaths.
	* libm2min/Makefile.in: Regenerate.
	* libm2pim/Makefile.am: Handle Darwin rpaths.
	* libm2pim/Makefile.in: Regenerate.

libgomp/ChangeLog:

	* Makefile.am: Handle Darwin rpaths.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Handle Darwin rpaths

libitm/ChangeLog:

	* Makefile.am: Handle Darwin rpaths.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Handle Darwin rpaths.

libobjc/ChangeLog:

	* configure: Regenerate.
	* configure.ac: Handle Darwin rpaths.

libphobos/ChangeLog:

	* configure: Regenerate.
	* configure.ac: Handle Darwin rpaths.
	* libdruntime/Makefile.am: Handle Darwin rpaths.
	* libdruntime/Makefile.in: Regenerate.
	* src/Makefile.am: Handle Darwin rpaths.
	* src/Makefile.in: Regenerate.

libquadmath/ChangeLog:

	* Makefile.am: Handle Darwin rpaths.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Handle Darwin rpaths.

libsanitizer/ChangeLog:

	* asan/Makefile.am: Handle Darwin rpaths.
	* asan/Makefile.in: Regenerate.
	* configure: Regenerate.
	* hwasan/Makefile.am: Handle Darwin rpaths.
	* hwasan/Makefile.in: Regenerate.
	* lsan/Makefile.am: Handle Darwin rpaths.
	* lsan/Makefile.in: Regenerate.
	* tsan/Makefile.am: Handle Darwin rpaths.
	* tsan/Makefile.in: Regenerate.
	* ubsan/Makefile.am: Handle Darwin rpaths.
	* ubsan/Makefile.in: Regenerate.

libssp/ChangeLog:

	* Makefile.am: Handle Darwin rpaths.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Handle Darwin rpaths.

libstdc++-v3/ChangeLog:

	* configure: Regenerate.
	* configure.ac: Handle Darwin rpaths.
	* src/Makefile.am: Handle Darwin rpaths.
	* src/Makefile.in: Regenerate.

libvtv/ChangeLog:

	* configure: Regenerate.
	* configure.ac: Handle Darwin rpaths.

lto-plugin/ChangeLog:
	* configure: Regenerate.
	* configure.ac: Handle Darwin rpaths.

zlib/ChangeLog:
	* configure: Regenerate.
	* configure.ac: Handle Darwin rpaths.
2023-10-22 19:30:02 +01:00
GCC Administrator
bc43a9e21c Daily bump. 2023-10-22 00:16:41 +00:00
Jonathan Wakely
405a4140fc libstdc++: Split std::basic_string::_M_use_local_data into two functions
This splits out the activate-the-union-member-for-constexpr logic from
_M_use_local_data, so that it can be used separately in cases that don't
need to use std::pointer_traits<pointer>::pointer_to to obtain the
return value.

This leaves only three uses of _M_use_local_data() which are all of the
same form:

  __s._M_data(_M_use_local_data());
  __s._M_set_length(0);

We could remove _M_use_local_data() and change those three places to use
a new _M_reset() function that does:

  _M_init_local_buf();
  _M_data(_M_local_data());
  _M_set_length(0);

This is left for a future change.

libstdc++-v3/ChangeLog:

	* include/bits/basic_string.h (_M_init_local_buf()): New
	function.
	(_M_use_local_data()): Use _M_init_local_buf.
	(basic_string(), basic_string(const Alloc&))
	(basic_string(basic_string&&))
	(basic_string(basic_string&&, const Alloc&)): Use
	_M_init_local_buf instead of _M_use_local_data().
	* include/bits/basic_string.tcc (swap(basic_string&))
	(_M_construct(InIter, InIter, input_iterator_tag))
	(_M_construct(InIter, InIter, forward_iterator_tag))
	(_M_construct(size_type, CharT), reserve()): Likewise.
2023-10-21 11:54:00 +01:00
Benjamin Brock
be34a8b538 libstdc++: Workaround for LLVM-61763 in <ranges>
This patch adds a small workaround that avoids declaring constrained
friends when compiling with Clang, instead making some members public.
MSVC's standard library has implemented a similar workaround.

Signed-off-by: Benjamin Brock <brock@cs.berkeley.edu>

libstdc++-v3/ChangeLog:

	* include/std/ranges (zip_view, adjacent_view): Implement
	workaround for LLVM-61763.
2023-10-21 11:54:00 +01:00
Dimitrij Mijoski
59a7d38997 libstdc++: testsuite: Enhance codecvt_unicode with tests for length()
We can test codecvt::length() with the same data that we test
codecvt::in(). For each call of in() we add another call to length().
Some additional small cosmentic changes are applied.

libstdc++-v3/ChangeLog:

	* testsuite/22_locale/codecvt/codecvt_unicode.h: Test length()
2023-10-21 11:54:00 +01:00
Jonathan Wakely
77209d43f1 libstdc++: Fix formatting of filesystem directory iterators
Fix indentation.

libstdc++-v3/ChangeLog:

	* include/bits/fs_dir.h (operator==(default_sentinel_t)): Fix
	indentation.
2023-10-21 11:54:00 +01:00
GCC Administrator
6f684dd259 Daily bump. 2023-10-21 00:17:36 +00:00
Marek Polacek
1d9263f292 libstdc++: add casts to from_chars in <charconv> [PR111883]
This fixes

.../charconv: In function 'std::from_chars_result std::from_chars(const char*, const char*, _Float16&, chars_format)':
.../charconv:687:17: warning: converting to '_Float16' from 'float' with greater conversion rank
  687 |       __value = __val;
      |                 ^~~~~
.../charconv: In function 'std::from_chars_result std::from_chars(const char*, const char*, __gnu_cxx::__bfloat16_t&, chars_format)':
.../charconv:763:17: warning: converting to '__gnu_cxx::__bfloat16_t' {aka '__bf16'} from 'float' with greater conversion rank
  763 |       __value = __val;
      |                 ^~~~~

which was breaking a test:

FAIL: g++.dg/warn/Wstringop-overflow-6.C  -std=gnu++26 (test for excess errors)

	PR testsuite/111883

libstdc++-v3/ChangeLog:

	* include/std/charconv (from_chars): Add explicit casts.
2023-10-20 12:35:58 -04:00
GCC Administrator
c85f74813f Daily bump. 2023-10-20 00:16:39 +00:00
François Dumont
c714b4d30d libstdc++: [_Hashtable] Do not reuse untrusted cached hash code
On merge, reuse a merged node's possibly cached hash code only if we are on the
same type of hash and this hash is stateless.

Usage of function pointers or std::function as hash functor will prevent reusing
cached hash code.

libstdc++-v3/ChangeLog

	* include/bits/hashtable_policy.h
	(_Hash_code_base::_M_hash_code(const _Hash&, const _Hash_node_value<>&)): Remove.
	(_Hash_code_base::_M_hash_code<_H2>(const _H2&, const _Hash_node_value<>&)): Remove.
	* include/bits/hashtable.h
	(_M_src_hash_code<_H2>(const _H2&, const key_type&, const __node_value_type&)): New.
	(_M_merge_unique<>, _M_merge_multi<>): Use latter.
	* testsuite/23_containers/unordered_map/modifiers/merge.cc
	(test04, test05, test06): New test cases.
2023-10-19 19:06:08 +02:00
GCC Administrator
300d7d3a8f Daily bump. 2023-10-14 00:16:40 +00:00
Jakub Jelinek
badb798f5e libstdc++: Fix tr1/8_c_compatibility/cstdio/functions.cc regression with recent glibc
The following testcase started FAILing recently after the
https://sourceware.org/git/?p=glibc.git;a=commit;h=64b1a44183a3094672ed304532bedb9acc707554
glibc change which marked vfscanf with nonnull (1) attribute.
While vfwscanf hasn't been marked similarly (strangely), the patch changes
that too.  By using va_arg one hides the value of it from the compiler
(volatile keyword would do too, or making the FILE* stream a function
argument, but then it might need to be guarded by #if or something).

2023-10-13  Jakub Jelinek  <jakub@redhat.com>

	* testsuite/tr1/8_c_compatibility/cstdio/functions.cc (test01):
	Initialize stream to va_arg(ap, FILE*) rather than 0.
	* testsuite/tr1/8_c_compatibility/cwchar/functions.cc (test01):
	Likewise.
2023-10-13 09:09:32 +02:00
Hans-Peter Nilsson
ba0cde8ba2 testsuite: Replace many dg-require-thread-fence with dg-require-atomic-cmpxchg-word
These tests actually use a form of atomic compare and exchange
operation, not just atomic loading and storing.  Some targets (not
supported by e.g. libatomic) have atomic loading and storing, but not
compare and exchange, yielding linker errors for missing library
functions.

This change is just for existing uses of
dg-require-thread-fence.  It does not fix any other tests
that should also be gated on dg-require-atomic-cmpxchg-word.

	* testsuite/29_atomics/atomic/compare_exchange_padding.cc,
	testsuite/29_atomics/atomic_flag/clear/1.cc,
	testsuite/29_atomics/atomic_flag/cons/value_init.cc,
	testsuite/29_atomics/atomic_flag/test_and_set/explicit.cc,
	testsuite/29_atomics/atomic_flag/test_and_set/implicit.cc,
	testsuite/29_atomics/atomic_ref/compare_exchange_padding.cc,
	testsuite/29_atomics/atomic_ref/generic.cc,
	testsuite/29_atomics/atomic_ref/integral.cc,
	testsuite/29_atomics/atomic_ref/pointer.cc: Replace
	dg-require-thread-fence with dg-require-atomic-cmpxchg-word.
2023-10-13 02:20:30 +02:00
Hans-Peter Nilsson
2a4d9e4f53 testsuite: Add dg-require-atomic-cmpxchg-word
Some targets (armv6-m) support inline atomic load and store,
i.e. dg-require-thread-fence matches, but not atomic operations like
compare and exchange.

This directive can be used to replace uses of dg-require-thread-fence
where an atomic operation is actually used.

	* testsuite/lib/dg-options.exp (dg-require-atomic-cmpxchg-word):
	New proc.
	* testsuite/lib/libstdc++.exp (check_v3_target_atomic_cmpxchg_word):
	Ditto.
2023-10-13 02:19:53 +02:00
GCC Administrator
6c44b95d97 Daily bump. 2023-10-06 00:17:37 +00:00
François Dumont
7c0ae1a85b libstdc++: [_GLIBCXX_INLINE_VERSION] Add missing symbols
libstdc++-v3/ChangeLog:

	* config/abi/pre/gnu-versioned-namespace.ver: Add missing symbols
	for _Float{16,32,64,128,32x,64x,128x}.
2023-10-05 21:58:57 +02:00
GCC Administrator
bf2e66e3ee Daily bump. 2023-10-05 00:18:18 +00:00
Tom Tromey
4bf77db70e libstdc++: Correctly call _string_types function
flake8 points out that the new call to _string_types from
StdExpAnyPrinter.__init__ is not correct -- it needs to be qualified.

libstdc++-v3/ChangeLog:

	* python/libstdcxx/v6/printers.py
	(StdExpAnyPrinter.__init__): Qualify call to
	_string_types.
2023-10-04 10:38:33 -06:00
Tom Tromey
d342c9de6a libstdc++: _versioned_namespace is always non-None
Some code in the pretty-printers seems to assume that the
_versioned_namespace global might be None (or the empty string).
However, doesn't occur, as the variable is never reassigned.

libstdc++-v3/ChangeLog:

	* python/libstdcxx/v6/printers.py: Assume that
	_versioned_namespace is non-None.
	* python/libstdcxx/v6/xmethods.py (is_specialization_of):
	Assume that _versioned_namespace is non-None.
2023-10-04 08:23:30 -06:00
Tom Tromey
83ec6e80ff libstdc++: Define _versioned_namespace in xmethods.py
flake8 pointed out that is_specialization_of in xmethods.py looks at a
global that wasn't added to the file.  This patch correct the
oversight.

libstdc++-v3/ChangeLog:

	* python/libstdcxx/v6/xmethods.py (_versioned_namespace):
	Define.
2023-10-04 08:23:30 -06:00
GCC Administrator
87c00507b8 Daily bump. 2023-09-30 00:17:24 +00:00
Dimitrij Mijoski
a8b9c32da7 libstdc++: Fix handling of surrogate CP in codecvt [PR108976]
This patch fixes the handling of surrogate code points in all standard
facets for transcoding Unicode that are based on std::codecvt. Surrogate
code points should always be treated as error. On the other hand
surrogate code units can only appear in UTF-16 and only when they come
in a proper pair.

Additionally, it fixes a bug in std::codecvt_utf16::in() when odd number
of bytes were given in the range [from, from_end), error was returned
always. The last byte in such range does not form a full UTF-16 code
unit and we can not make any decisions for error, instead partial should
be returned.

The testsuite for testing these facets was updated in the following
order:

1. All functions that test codecvts that work with UTF-8 were refactored
   and made more generic so they accept codecvt that works with the char
   type char8_t.
2. The same functions were updated with new test cases for transcoding
   errors and now additionally test for surrogates, overlong UTF-8
   sequences, code points out of the Unicode range, and more tests for
   missing leading and trailing code units.
3. New tests were added to test codecvt_utf16 in both of its variants,
   UTF-16 <-> UTF-32/UCS-4 and UTF-16 <-> UCS-2.

libstdc++-v3/ChangeLog:

	PR libstdc++/108976
	* src/c++11/codecvt.cc (read_utf8_code_point): Fix handing of
	surrogates in UTF-8.
	(ucs4_out): Fix handling of surrogates in UCS-4 -> UTF-8.
	(ucs4_in): Fix handling of range with odd number of bytes.
	(ucs4_out): Fix handling of surrogates in UCS-4 -> UTF-16.
	(ucs2_out): Fix handling of surrogates in UCS-2 -> UTF-16.
	(ucs2_in): Fix handling of range with odd number of bytes.
	(__codecvt_utf16_base<char16_t>::do_in): Likewise.
	(__codecvt_utf16_base<char32_t>::do_in): Likewise.
	(__codecvt_utf16_base<wchar_t>::do_in): Likewise.
	* testsuite/22_locale/codecvt/codecvt_unicode.cc: Renames, add
	tests for codecvt_utf16<char16_t> and codecvt_utf16<char32_t>.
	* testsuite/22_locale/codecvt/codecvt_unicode.h: Refactor UTF-8
	testing functions for char8_t, add more test cases for errors,
	add testing functions for codecvt_utf16.
	* testsuite/22_locale/codecvt/codecvt_unicode_wchar_t.cc:
	Renames, add tests for codecvt_utf16<whchar_t>.
	* testsuite/22_locale/codecvt/codecvt_utf16/79980.cc (test06):
	Fix test.
	* testsuite/22_locale/codecvt/codecvt_unicode_char8_t.cc: New
	test.
2023-09-29 16:01:21 +01:00
Nathaniel Shead
28adad7a32 libstdc++: Ensure active union member is correctly set
This patch ensures that the union members for std::string and
std::variant are always properly set when a change occurs.

libstdc++-v3/ChangeLog:

	* include/bits/basic_string.h: (basic_string(basic_string&&)):
	Activate _M_local_buf when needed.
	(basic_string(basic_string&&, const _Alloc&)): Likewise.
	* include/bits/basic_string.tcc: (basic_string::swap): Likewise.
	* include/std/variant: (__detail::__variant::__construct_n): New.
	(__detail::__variant::__emplace): Use __construct_n.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
2023-09-29 16:01:20 +01:00
GCC Administrator
14c363c135 Daily bump. 2023-09-29 00:17:28 +00:00
Tom Tromey
202810947c libstdc++: Use Python "not in" operator
flake8 warns about code like

    not something in "whatever"

Ordinarily in Python this should be written as:

    something not in "whatever"

This patch makes this change.

libstdc++-v3/ChangeLog:

	* python/libstdcxx/v6/printers.py (Printer.add_version)
	(add_one_template_type_printer)
	(FilteringTypePrinter.add_one_type_printer): Use Python
	"not in" operator.
2023-09-28 14:56:09 -06:00
Tom Tromey
860b284e3e libstdc++: Remove std_ratio_t_tuple
This removes the std_ratio_t_tuple function from the Python
pretty-printer code.  It is not used.  Apparently the relevant parts
were moved to StdChronoDurationPrinter._ratio at some point in the
past.

libstdc++-v3/ChangeLog:

	* python/libstdcxx/v6/printers.py (std_ratio_t_tuple):
	Remove.
2023-09-28 14:56:05 -06:00
Tom Tromey
33841921a2 libstdc++: Remove unused locals from printers.py
flake8 pointed out some unused local variables in the libstdc++
pretty-printers.  This removes them.

libstdc++-v3/ChangeLog:

	* python/libstdcxx/v6/printers.py
	(StdExpOptionalPrinter.__init__, lookup_node_type):
	Remove unused variables.
2023-09-28 14:56:00 -06:00
Tom Tromey
bed1f8498a libstdc++: Remove unused Python imports
flake8 pointed out some unused imports.

libstdc++-v3/ChangeLog:

	* python/libstdcxx/v6/printers.py: Don't import 'os'.
	* python/libstdcxx/v6/__init__.py: Don't import 'gdb'.
2023-09-28 14:55:54 -06:00
Tom Tromey
64f1210301 libstdc++: Use gdb.ValuePrinter base class
GDB 14 will add a new ValuePrinter tag class that will be used to
signal that pretty-printers will agree to the "extension protocol" --
essentially that they will follow some simple namespace rules, so that
GDB can add new methods over time.

A couple new methods have already been added to GDB, to support DAP.
While I haven't implemented these for any libstdc++ printers yet, this
patch makes the basic conversion: printers derive from
gdb.ValuePrinter if it is available, and all "non-standard" (that is,
not specified by GDB) members of the various value-printing classes
are renamed to have a leading underscore.

libstdc++-v3/ChangeLog:

	* python/libstdcxx/v6/printers.py: Use gdb.ValuePrinter
	everywhere.  Rename members to start with "_".
2023-09-28 14:55:23 -06:00
Tom Tromey
98db58eb0b libstdc++: Show full Python stack on error
This changes the libstdc++ test suite to arrange for gdb to show the
full Python stack if any sort of Python exception occurs.  This makes
debugging the printers a little simpler.

libstdc++-v3/ChangeLog:

	* testsuite/lib/gdb-test.exp (gdb-test): Enable Python
	stack traces from gdb.
2023-09-28 14:55:18 -06:00
Jonathan Wakely
17d3477fa8 libstdc++: Refactor Python Xmethods to use is_specialization_of
This copies the is_specialization_of function from printers.py (with
slight modification for versioned namespace handling) and reuses it in
xmethods.py to replace repetitive re.match calls in every class.

This fixes the problem that the regular expressions used \d without
escaping the backslash properly.

libstdc++-v3/ChangeLog:

	* python/libstdcxx/v6/xmethods.py (is_specialization_of): Define
	new function.
	(ArrayMethodsMatcher, DequeMethodsMatcher)
	(ForwardListMethodsMatcher, ListMethodsMatcher)
	(VectorMethodsMatcher, AssociativeContainerMethodsMatcher)
	(UniquePtrGetWorker, UniquePtrMethodsMatcher)
	(SharedPtrSubscriptWorker, SharedPtrMethodsMatcher): Use
	is_specialization_of instead of re.match.
2023-09-28 21:20:27 +01:00
Jonathan Wakely
6b5c3f9b81 libstdc++: Reformat Python code
Some of these changes were suggested by autopep8's --aggressive
option, others are for readability.

Break long lines by splitting strings across multiple lines, or
introducing local variables to hold results.

Use raw strings for regular expressions, so that backslashes don't need
to be escaped.

libstdc++-v3/ChangeLog:

	* python/libstdcxx/v6/printers.py: Break long lines. Use raw
	strings for regular expressions. Add whitespace around
	operators.
	(is_member_of_namespace): Use isinstance to check type.
	(is_specialization_of): Likewise. Adjust template_name
	for versioned namespace instead of duplicating the re.match
	call.
	(StdExpAnyPrinter._string_types): New static method.
	(StdExpAnyPrinter.to_string): Use _string_types.
2023-09-28 21:20:21 +01:00
Jonathan Wakely
0ef4cc8225 libstdc++: Format Python docstrings according to PEP 357
libstdc++-v3/ChangeLog:

	* python/libstdcxx/v6/printers.py: Format docstrings according
	to PEP 257.
	* python/libstdcxx/v6/xmethods.py: Likewise.
2023-09-28 20:56:44 +01:00
Tim Song
2c1e3544a9 libstdc++: Force _Hash_node_value_base methods inline to fix abi (PR111050)
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=1b6f0476837205932613ddb2b3429a55c26c409d
changed _Hash_node_value_base to no longer derive from _Hash_node_base, which means
that its member functions expect _M_storage to be at a different offset. So explosions
result if an out-of-line definition is emitted for any of the member functions (say,
in a non-optimized build) and the resulting object file is then linked with code built
using older version of GCC/libstdc++.

libstdc++-v3/ChangeLog:

	PR libstdc++/111050
	* include/bits/hashtable_policy.h
	(_Hash_node_value_base<>::_M_valptr(), _Hash_node_value_base<>::_M_v())
	Add [[__gnu__::__always_inline__]].
2023-09-28 19:14:30 +02:00
GCC Administrator
0d9b4e8647 Daily bump. 2023-09-28 09:50:12 +00:00
Jonathan Wakely
1fab05a885 libstdc++: Fix format string in StdChronoTimeZoneRulePrinter
libstdc++-v3/ChangeLog:

	* python/libstdcxx/v6/printers.py (StdChronoTimeZoneRulePrinter):
	Fix incorrect number of replacement fields.
2023-09-27 17:09:52 +01:00
Hans-Peter Nilsson
dd0c42cd37 testsuite: Require thread-fence for 29_atomics/atomic_flag/cons/value_init.cc
A recent patch made __atomic_test_and_set no longer fall
back to emitting non-atomic code, but instead will then emit
a call to __atomic_test_and_set, thereby exposing the need
to gate also this test on support for atomics, similar to
r14-3980-g62b29347c38394.

libstdc++-v3:
	* testsuite/29_atomics/atomic_flag/cons/value_init.cc: Add
	dg-require-thread-fence.
2023-09-26 23:39:17 +02:00
GCC Administrator
a435e4ab2e Daily bump. 2023-09-26 00:17:58 +00:00
Patrick Palka
bf3c19903a libstdc++: Shorten integer std::to/from_chars symbol names
For std::to_chars:

The constrained alias __integer_to_chars_result_type seems unnecessary
ever since r10-3080-g28f0075742ed58 got rid of the only public overload
which used it.  Now only non-public overloads are constrained by it
(through their return type) and these non-public overloads aren't used
in a SFINAE context, so the constraints have no observable effect.  So
this patch gets rid of this alias, which greatly shortens the symbol names
of the affected functions (since the expanded alias is quite large).

For std::from_chars:

We can't get rid of the corresponding alias because its constrains the
public integer std::from_chars overload.  But we can avoid having the
constraint bloat the mangled name by instead encoding it as a defaulted
template parameter.  We use the non-type parameter form

  enable_if_t<..., int> = 0

instead of the type parameter form

  typename = enable_if_t<...>

because the type form can be bypassed by giving an explicit template
argument for the type parameter, e.g. 'std::from_chars<int, void>(...)',
so the non-type form seems like the more robust choice.

In passing, use __is_standard_integer in the constraint.

libstdc++-v3/ChangeLog:

	* include/std/charconv (__detail::__integer_to_chars_result_type):
	Remove.
	(__detail::__to_chars_16): Use to_chars_result as return type.
	(__detail::__to_chars_10): Likewise.
	(__detail::__to_chars_8): Likewise.
	(__detail::__to_chars_2): Likewise.
	(__detail::__to_chars_i): Likewise.
	(__detail::__integer_from_chars_result_type): Inline the
	constraint into ...
	(from_chars): ... here.  Use __is_standard_integer in the
	constraint.  Encode constraint as a defaulted non-type template
	parameter instead of within the return type.
2023-09-25 14:48:26 -04:00
John David Anglin
c92d330c63 Update baseline symbols for hppa-linux.
2023-09-25  John David Anglin  <danglin@gcc.gnu.org>

libstdc++-v3/ChangeLog:

	* config/abi/post/hppa-linux-gnu/baseline_symbols.txt: Update.
2023-09-25 15:16:49 +00:00
Jonathan Wakely
77cf377302 libstdc++: Prevent unwanted ADL in std::to_array [PR111512]
As noted in PR c++/111512, GCC does ADL for __builtin_memcpy if it is
unqualified, which can cause errors for template argument types which
cannot be completed.

Casting the memcpy arguments to void* prevents ADL from considering the
problem type.

libstdc++-v3/ChangeLog:

	PR libstdc++/111511
	PR c++/111512
	* include/std/array (to_array): Cast memcpy arguments to void*.
	* testsuite/23_containers/array/creation/111512.cc: New test.
2023-09-25 09:48:44 +01:00
Jonathan Wakely
55cf4f8437 libstdc++: Define C++23 std::forward_like (P2445R1)
libstdc++-v3/ChangeLog:

	* include/bits/move.h (forward_list): Define for C++23.
	* include/bits/version.def (forward_like): Define.
	* include/bits/version.h: Regenerate.
	* include/std/utility (__glibcxx_want_forward_like): Define.
	* testsuite/20_util/forward_like/1.cc: New test.
	* testsuite/20_util/forward_like/2_neg.cc: New test.
	* testsuite/20_util/forward_like/version.cc: New test.
2023-09-25 09:48:44 +01:00
GCC Administrator
590a8bec3e Daily bump. 2023-09-20 00:17:55 +00:00
Marek Polacek
6851e3423c c++: Move consteval folding to cp_fold_r
In the review of P2564:
<https://gcc.gnu.org/pipermail/gcc-patches/2023-August/628747.html>
it turned out that in order to correctly handle an example in the paper,
we should stop doing immediate evaluation in build_over_call and
bot_replace, and instead do it in cp_fold_r.  This patch does that.

Another benefit is that this is a pretty significant simplification, at
least in my opinion.  Also, this fixes the c++/110997 ICE (but the test
doesn't compile yet).

The main drawback seems to be that cp_fold_r doesn't process
uninstantiated templates.  We still have to handle things like
"false ? foo () : 1".  To that end, I've added cp_fold_immediate, called
on dead branches in cxx_eval_conditional_expression.

You'll see that I've reintroduced ADDR_EXPR_DENOTES_CALL_P here.  This
is to detect

  *(&foo)) ()
  (s.*&S::foo) ()

which were deemed ill-formed.

gcc/cp/ChangeLog:

	* call.cc (build_over_call): Set ADDR_EXPR_DENOTES_CALL_P.  Don't handle
	immediate_invocation_p here.
	* constexpr.cc (cxx_eval_call_expression): Use mce_true for
	DECL_IMMEDIATE_FUNCTION_P.
	(cxx_eval_conditional_expression): Call cp_fold_immediate.
	* cp-gimplify.cc (enum fold_flags): Add ff_fold_immediate.
	(maybe_replace_decl): Make static.
	(cp_fold_r): Expand immediate invocations.
	(cp_fold_immediate_r): New.
	(cp_fold_immediate): New.
	* cp-tree.h (ADDR_EXPR_DENOTES_CALL_P): Define.
	(cp_fold_immediate): Declare.
	* tree.cc (bot_replace): Don't handle immediate invocations here.

libstdc++-v3/ChangeLog:

	* testsuite/20_util/allocator/105975.cc: Add dg-error.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp23/consteval-if2.C: Add xfail.
	* g++.dg/cpp2a/consteval-memfn1.C: Adjust.
	* g++.dg/cpp2a/consteval11.C: Remove dg-message.
	* g++.dg/cpp2a/consteval3.C: Remove dg-message and dg-error.
	* g++.dg/cpp2a/consteval9.C: Remove dg-message.
	* g++.dg/cpp2a/consteval32.C: New test.
	* g++.dg/cpp2a/consteval33.C: New test.
	* g++.dg/cpp2a/consteval34.C: New test.
	* g++.dg/cpp2a/consteval35.C: New test.
2023-09-19 09:24:44 -04:00
GCC Administrator
6b78e9a59b Daily bump. 2023-09-19 00:17:49 +00:00
Patrick Palka
6e92a6a2a7 c++: non-dependent assignment checking [PR63198, PR18474]
This patch makes us recognize and check non-dependent simple assigments
ahead of time, like we already do for compound assignments.  This means
the templated representation of such assignments will now usually have
an implicit INDIRECT_REF (due to the reference return type), which the
-Wparentheses code needs to handle.  As a drive-by improvement, this
patch also makes maybe_convert_cond issue -Wparentheses warnings ahead
of time, and removes a seemingly unnecessary suppress_warning call in
build_x_modify_expr.

On the libstdc++ side, some tests were attempting to modify a data
member from a uninstantiated const member function, which this patch
minimally fixes by making the data member mutable.

	PR c++/63198
	PR c++/18474

gcc/cp/ChangeLog:

	* semantics.cc (maybe_convert_cond): Look through implicit
	INDIRECT_REF when deciding whether to issue a -Wparentheses
	warning, and consider templated assignment expressions as well.
	(finish_parenthesized_expr): Look through implicit INDIRECT_REF
	when suppressing -Wparentheses warning.
	* typeck.cc (build_x_modify_expr): Check simple assignments
	ahead time too, not just compound assignments.  Give the second
	operand of MODOP_EXPR a non-null type so that it's not considered
	always instantiation-dependent.  Don't call suppress_warning.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/static_assert15.C: Expect diagnostic for
	non-constant static_assert condition.
	* g++.dg/expr/unary2.C: Remove xfails.
	* g++.dg/template/init7.C: Make initializer type-dependent to
	preserve intent of test.
	* g++.dg/template/recurse3.C: Likewise for the erroneous
	statement.
	* g++.dg/template/non-dependent26.C: New test.
	* g++.dg/warn/Wparentheses-32.C: New test.

libstdc++-v3/ChangeLog:

	* testsuite/26_numerics/random/discard_block_engine/cons/seed_seq2.cc:
	Make data member seed_seq::called mutable.
	* testsuite/26_numerics/random/independent_bits_engine/cons/seed_seq2.cc:
	Likewise.
	* testsuite/26_numerics/random/linear_congruential_engine/cons/seed_seq2.cc:
	Likewise.
	* testsuite/26_numerics/random/mersenne_twister_engine/cons/seed_seq2.cc:
	Likewise.
	* testsuite/26_numerics/random/shuffle_order_engine/cons/seed_seq2.cc:
	Likewise.
	* testsuite/26_numerics/random/subtract_with_carry_engine/cons/seed_seq2.cc:
	Likewise.
	* testsuite/ext/random/simd_fast_mersenne_twister_engine/cons/seed_seq2.cc:
	Likewise.
2023-09-18 14:47:52 -04:00
Jonathan Wakely
00d16a269a libstdc++: Minor tweak to C++20 status docs
The row for P1466R3 was missing the info on when it was implemented.

libstdc++-v3/ChangeLog:

	* doc/xml/manual/status_cxx2020.xml: Tweak P1466R3 status.
	* doc/html/manual/status.html: Regenerate.
2023-09-18 15:21:22 +01:00
Jonathan Wakely
c8e9a75085 libstdc++: Update C++20 and C++23 status docs
libstdc++-v3/ChangeLog:

	* doc/xml/manual/configure.xml: Use conventional option name.
	* doc/xml/manual/status_cxx2020.xml: Update.
	* doc/xml/manual/status_cxx2023.xml: Update.
	* doc/html/*: Regenerate.
2023-09-18 14:09:53 +01:00
Jonathan Wakely
12755fe40b libstdc++: Minor update to installation docs
libstdc++-v3/ChangeLog:

	* doc/xml/manual/intro.xml: Clarify that building libstdc++
	separately from GCC is not supported.
	* doc/xml/manual/prerequisites.xml: Note msgfmt prerequisite for
	testing.
	* doc/html/manual/setup.html: Regenerate.
2023-09-18 12:15:34 +01:00