Commit Graph

12212 Commits

Author SHA1 Message Date
Jonathan Wakely
a47cec4ca7 libstdc++: Use uint32_t for all year_month_day::_S_from_days arithmetic
libstdc++-v3/ChangeLog:

	* include/std/chrono (year_month_day::_S_from_days): Perform
	all calculations with type uint32_t.
2021-02-25 16:57:20 +00:00
Jonathan Wakely
ed255fd5ed libstdc++: Document library versioning for GCC 11
libstdc++-v3/ChangeLog:

	* doc/xml/manual/abi.xml: Document versioning for GCC 11.
	* doc/html/manual/abi.html: Regenerate.
2021-02-25 15:35:59 +00:00
Jonathan Wakely
31002af904 libstdc++: Do not assume std::FILE is complete [PR 99270]
libstdc++-v3/ChangeLog:

	PR libstdc++/99270
	* testsuite/27_io/headers/cstdio/types_std.cc: Use pointer to
	FILE instead of FILE.
2021-02-25 15:35:58 +00:00
Andreas Schwab
e54e7286cc libstdc++: Update baseline symbols for {aarch64,ia64,m68k,riscv64}-linux
libstdc++-v3/
	* config/abi/post/aarch64-linux-gnu/baseline_symbols.txt: Update.
	* config/abi/post/ia64-linux-gnu/baseline_symbols.txt: Update.
	* config/abi/post/m68k-linux-gnu/baseline_symbols.txt: Update.
	* config/abi/post/riscv64-linux-gnu/baseline_symbols.txt: Update.
2021-02-25 14:19:00 +01:00
Jonathan Wakely
75c74a83ac libstdc++: Fix narrowing conversion in year_month_day [PR 99265]
libstdc++-v3/ChangeLog:

	PR libstdc++/99265
	* include/std/chrono (year_month_day::_S_from_days): Cast long
	to int explicitly.
2021-02-25 11:53:59 +00:00
Jonathan Wakely
7244879b88 libstdc++: Add std::to_underlying for C++23
Implement P1682R2 as just approved for C++23.

libstdc++-v3/ChangeLog:

	* include/std/utility (to_underlying): Define.
	* include/std/version (__cpp_lib_to_underlying): Define.
	* testsuite/20_util/to_underlying/1.cc: New test.
	* testsuite/20_util/to_underlying/version.cc: New test.
2021-02-25 11:53:58 +00:00
GCC Administrator
4028d01a05 Daily bump. 2021-02-25 00:16:29 +00:00
Jonathan Wakely
94bfe81afe libstdc++: Fix order of arguments to sprintf [PR 99261]
libstdc++-v3/ChangeLog:

	PR libstdc++/99261
	* src/c++17/floating_to_chars.cc (sprintf_ld): Add extra args
	before value to be printed.
2021-02-24 22:33:59 +00:00
Patrick Palka
cb0184b6a2 libstdc++: Fix __floating_to_chars_precision for __float128
The code path in __floating_to_chars_precision for handling long double
by going through printf now also handles __float128, so the condition
that guards this code path needs to get updated accordingly.

libstdc++-v3/ChangeLog:

	* src/c++17/floating_to_chars.cc (__floating_to_chars_precision):
	Relax the condition that guards the printf code path to accept
	F128_type as well as long double.
2021-02-24 17:31:04 -05:00
Cassio Neri
8265ab07f3 libstdc++: More efficient last day of month
This patch reimplements std::chrono::year_month_day_last:day() which yields the
last day of a particular month.  The current implementation uses a look-up table
implemented as an unsigned[12] array.  The new implementation instead
is based on
the fact that a month m in [1, 12], except for m == 2 (February), is
either 31 or
30 days long and m's length depends on two things: m's parity and whether m >= 8
or not. These two conditions are determined by the 0th and 3th bit of m and,
therefore, cheap and straightforward bit-twiddling can provide the right result.

Measurements in x86_64 [1] suggest a 10% performance boost.  Although this does
not seem to be huge, notice that measurements are done in hot L1 cache
conditions which might not be very representative of production runs. Also
freeing L1 cache from holding the look-up table might allow performance
improvements elsewhere.

References:
[1] https://github.com/cassioneri/calendar

libstdc++-v3/ChangeLog:

	* include/std/chrono (year_month_day_last:day): New
	implementation.
2021-02-24 18:25:35 +00:00
Cassio Neri
126793971b libstdc++: More efficient is_leap
This patch reimplements std::chrono::year::is_leap().  Leap year check is
ubiquitously implemented (including here) as:

    y % 4 == 0 && (y % 100 != 0 || y % 400 == 0).

The rationale being that testing divisibility by 4 first implies an earlier
return for 75% of the cases, therefore, avoiding the needless calculations of
y % 100 and y % 400. Although this fact is true, it does not take into account
the cost of branching.  This patch, instead, tests divisibility by 100 first:

    (y % 100 != 0 || y % 400 == 0) && y % 4 == 0.

It is certainly counterintuitive that this could be more efficient since among
the three divisibility tests (4, 100 and 400) the one by 100 is the only one
that can never provide a definitive answer and a second divisibility test (by 4
or 400) is always required. However, measurements [1] in x86_64 suggest this is
3x more efficient!  A possible explanation is that checking divisibility by 100
first implies a split in the execution path with probabilities of (1%, 99%)
rather than (25%, 75%) when divisibility by 4 is checked first.  This decreases
the entropy of the branching distribution which seems to help prediction.

Given that y belongs to [-32767, 32767] [time.cal.year.members], a more
efficient algorithm [2] to check divisibility by 100 is used (instead of
y % 100 != 0).  Measurements suggest that this optimization improves performance
by 20%.

The patch adds a test that exhaustively compares the result of this
implementation with the ubiquitous one for all y in [-32767, 32767]. Although
its completeness, the test completes in a matter of seconds.

References:
[1] https://stackoverflow.com/a/60646967/1137388
[2] https://accu.org/journals/overload/28/155/overload155.pdf#page=16

libstdc++-v3/ChangeLog:

	* include/std/chrono (year::is_leap): New implementation.
	* testsuite/std/time/year/2.cc: New test.
2021-02-24 18:25:18 +00:00
Cassio Neri
97d6161f6a libstdc++: More efficient days from date
This patch reimplements std::chrono::year_month_day::_M_days_since_epoch()
which calculates the number of elapsed days since 1970/01/01.  The new
implementation is based on Proposition 6.2 of Neri and Schneider, "Euclidean
Affine Functions and Applications to Calendar Algorithms" available at
https://arxiv.org/abs/2102.06959.

The aforementioned paper benchmarks the implementation against several
counterparts, including libc++'s (which is identical to the current
implementation).  The results, shown in Figure 3, indicate the new algorithm is
1.7 times faster than the current one.

The patch adds a test which loops through all dates in [-32767/01/01,
32767/12/31], and for each of them, gets the number of days and compares the
result against its expected value. The latter is calculated using a much
simpler and easy to understand algorithm but which is also much slower.

The dates used in the test covers the full range of possible values
[time.cal.year.members].  Despite its completeness the test runs in matter of
seconds.

libstdc++-v3/ChangeLog:

	* include/std/chrono (year_month_day::_M_days_since_epoch):
	New implementation.
	* testsuite/std/time/year_month_day/4.cc: New test.
2021-02-24 17:58:48 +00:00
Cassio Neri
3dfd5493cf libstdc++: More efficient date from days
This patch reimplements std::chrono::year_month_day::_S_from_days() which
retrieves a date from the number of elapsed days since 1970/01/01.  The new
implementation is based on Proposition 6.3 of Neri and Schneider, "Euclidean
Affine Functions and Applications to Calendar Algorithms" available at
https://arxiv.org/abs/2102.06959.

The aforementioned paper benchmarks the implementation against several
counterparts, including libc++'s (which is identical to the current
implementation).  The results, shown in Figure 4, indicate the new algorithm is
2.2 times faster than the current one.

The patch adds a test which loops through all integers in [-12687428, 11248737],
and for each of them, gets the corresponding date and compares the result
against its expected value.  The latter is calculated using a much simpler and
easy to understand algorithm but which is also much slower.

The interval used in the test covers the full range of values for which a
roundtrip must work [time.cal.ymd.members].  Despite its completeness the test
runs in a matter of seconds.

libstdc++-v3/ChangeLog:

	* include/std/chrono (year_month_day::_S_from_days): New
	implementation.
	* testsuite/std/time/year_month_day/3.cc: New test.
2021-02-24 17:58:47 +00:00
Patrick Palka
70aa0e6eef libstdc++: Robustify long double std::to_chars testcase [PR98384]
The long double std::to_chars testcase currently verifies the
correctness of its output by comparing it to that of printf, so if
there's a mismatch between to_chars and printf, the test FAILs.  This
works well for the scientific, fixed and general formatting modes,
because the corresponding printf conversion specifiers (%e, %f and %g)
are rigidly specified.

But this doesn't work well for the hex formatting mode because the
corresponding printf conversion specifier %a is more flexibly specified.
For instance, the hexadecimal forms 0x1p+0, 0x2p-1, 0x4p-2 and 0x8p-3
are all equivalent and valid outputs of the %a specifier for the number 1.
The apparent freedom here is the choice of leading hex digit -- the
standard just requires that the leading hex digit is nonzero for
normalized numbers.

Currently, our hexadecimal formatting implementation uses 0/1/2 as the
leading hex digit for floating point types that have an implicit leading
mantissa bit which in practice means all supported floating point types
except x86 long double.  The latter type has a 64 bit mantissa with an
explicit leading mantissa bit, and for this type our implementation uses
the most significant four bits of the mantissa as leading hex digit.
This seems to be consistent with most printf implementations, but not
all, as PR98384 illustrates.

In order to avoid false-positive FAILs due to arbitrary disagreement
between to_chars and printf about the choice of leading hex digit, this
patch makes the testcase's verification via printf conditional on the
leading hex digits first agreeing.  An additional verification step is
also added: round-tripping the output of to_chars through from_chars
should recover the value exactly.

libstdc++-v3/ChangeLog:

	PR libstdc++/98384
	* testsuite/20_util/to_chars/long_double.cc: Include <optional>.
	(test01): Simplify verifying the nearby values by using a
	2-iteration loop and a dedicated output buffer to check that the
	nearby values are different.  Factor out the printf-based
	verification into a local function, and check that the leading
	hex digits agree before comparing to the output of printf.  Also
	verify the output by round-tripping it through from_chars.
2021-02-24 12:24:43 -05:00
Jonathan Wakely
f90027d18a libstdc++: Define std::to_chars overloads for __ieee128 [PR 98389]
This adds overloads of std::to_chars for powerpc64's __ieee128, so that
std::to_chars can be used for long double when -mabi=ieeelongdouble is
in used.

Eventually we'll want to extend these new overloads to work for
__float128 on all targets that support that type. For now, we're only
doing it for powerpc64 when the new long double type is supported in
parallel to the old long double type.

Additionally the existing std::to_chars overloads for long double
are given the right symbol version, resolving PR libstdc++/98389.

libstdc++-v3/ChangeLog:

	PR libstdc++/98389
	* config/abi/pre/gnu.ver (GLIBCXX_3.4.29): Do not match to_chars
	symbols for long double arguments mangled as 'g'.
	* config/os/gnu-linux/ldbl-extra.ver: Likewise.
	* config/os/gnu-linux/ldbl-ieee128-extra.ver: Likewise.
	* src/c++17/Makefile.am [GLIBCXX_LDBL_ALT128_COMPAT_TRUE]:
	Use -mabi=ibmlongdouble for floating_to_chars.cc.
	* src/c++17/Makefile.in: Regenerate.
	* src/c++17/floating_to_chars.cc (floating_type_traits_binary128):
	New type defining type traits of IEEE binary128 format.
	(floating_type_traits<__float128>): Define specialization.
	(floating_type_traits<long double>): Define in terms of
	floating_type_traits_binary128 when appropriate.
	(floating_to_shortest_scientific): Handle __float128.
	(sprintf_ld): New function template for printing a long double
	or __ieee128 value using sprintf.
	(__floating_to_chars_shortest, __floating_to_chars_precision):
	Use sprintf_ld.
	(to_chars): Define overloads for __float128.
2021-02-24 16:34:06 +00:00
Jonathan Wakely
d0453cf5c6 libstdc++: Fix failing tests due to 'u' identifier in kernel header
libstdc++-v3/ChangeLog:

	* testsuite/17_intro/names.cc: Undefine 'u' on powerpc*-linux*.
2021-02-24 16:34:05 +00:00
GCC Administrator
71e24b0601 Daily bump. 2021-02-24 00:16:26 +00:00
Martin Sebor
6d134ca4b9 PR c++/99074 - crash in dynamic_cast<>() on null pointer
libstdc++-v3/ChangeLog:

	PR c++/99074
	* libsupc++/dyncast.cc (__dynamic_cast): Return null when
	first argument is null.

gcc/testsuite/ChangeLog:

	PR c++/99074
	* g++.dg/warn/Wnonnull11.C: New test.
2021-02-23 14:14:20 -07:00
Jakub Jelinek
efa64fcce1 libstdc++: Fix up constexpr std::char_traits<char>::compare [PR99181]
Because of LWG 467, std::char_traits<char>::lt compares the values
cast to unsigned char rather than char, so even when char is signed
we get unsigned comparision.  std::char_traits<char>::compare uses
__builtin_memcmp and that works the same, but during constexpr evaluation
we were calling __gnu_cxx::char_traits<char_type>::compare.  As
char_traits::lt is not virtual, __gnu_cxx::char_traits<char_type>::compare
used __gnu_cxx::char_traits<char_type>::lt rather than
std::char_traits<char>::lt and thus compared chars as signed if char is
signed.
This change fixes it by inlining __gnu_cxx::char_traits<char_type>::compare
into std::char_traits<char>::compare by hand, so that it calls the right
lt method.

2021-02-23  Jakub Jelinek  <jakub@redhat.com>

	PR libstdc++/99181
	* include/bits/char_traits.h (char_traits<char>::compare): For
	constexpr evaluation don't call
	__gnu_cxx::char_traits<char_type>::compare but do the comparison loop
	directly.

	* testsuite/21_strings/char_traits/requirements/char/99181.cc: New
	test.
2021-02-23 09:30:18 +01:00
Jakub Jelinek
7e647d71d5 libstdc++: Fix up parallel_backend_serial.h [PR97549]
In GCC 10, parallel_backend.h just included parallel_backend_{serial,tbb}.h and
did nothing beyond that, and parallel_backend_tbb.h provided directly
namespace __pstl { namespace __par_backend { ... } }
and defined everything in there, while parallel_backend_serial.h did:
namespace __pstl { namespace __serial { ... } } and had this
namespace __pstl { namespace __par_backend { using namespace __pstl::__serial; } }
at the end.
In GCC 11, parallel_backend.h does:
namespace __pstl { namespace __par_backend = __serial_backend; }
after including parallel_backend_serial.h or
namespace __pstl { namespace __par_backend = __tbb_backend; }
after including parallel_backend_tbb.h.  The latter then has:
namespace __pstl { namespace __tbb_backend { ... } }
and no using etc. at the end, while parallel_backend_serial.h changed to:
namespace __pstl { namespace __serial_backend { ... } }
but has this leftover block from the GCC 10 times.  Even changing that
using namespace __pstl::__serial;
to
using namespace __pstl::__serial_backend;
doesn't work, as it clashes with
namespace __pstl { namespace __par_backend = __serial_backend; }
in parallel_backend.h.

2021-02-23  Jakub Jelinek  <jakub@redhat.com>

	PR libstdc++/97549
	* include/pstl/parallel_backend_serial.h: Remove __pstl::__par_backend.
2021-02-23 09:28:14 +01:00
Patrick Palka
198c56052e libstdc++: Fix endianness issue with IBM long double [PR98384]
The code in std::to_chars for extracting the high- and low-order parts
of an IBM long double value does the right thing on powerpc64le, but not
on powerpc64be.  This patch makes the extraction endian-agnostic, which
fixes the execution FAIL of to_chars/long_double.cc on powerpc64be.

libstdc++-v3/ChangeLog:

	PR libstdc++/98384
	* src/c++17/floating_to_chars.cc (get_ieee_repr): Extract
	the high- and low-order parts from an IBM long double value
	in an endian-agnostic way.
2021-02-22 21:49:25 -05:00
GCC Administrator
50352c6cd2 Daily bump. 2021-02-20 00:16:26 +00:00
Jonathan Wakely
9d449189ee libstdc++: Fix __thread_relax for non-gthreads non-x86 targets
My recent change to the preprocessor conditions in __thread_relax() was
supposed to also change the __gthread_yield() call to __thread_yield(),
which has the right preprocessor checks. Instead I just removed the
check for _GLIBCXX_USE_SCHED_YIELD which means the __gthread_yield()
call will be ill-formed for non-gthreads targets, and targets without
sched_yield(). This fixes it properly.

libstdc++-v3/ChangeLog:

	* include/bits/atomic_wait.h (__thread_relax()): Call
	__thread_yield() not __gthread_yield().
2021-02-19 09:56:36 +00:00
GCC Administrator
de594739f7 Daily bump. 2021-02-16 00:16:22 +00:00
Jonathan Wakely
cc9a0a3d79 libstdc++: Fix __thread_yield for non-gthreads targets
The __gthread_yield() function is only defined for gthreads targets, so
check _GLIBCXX_HAS_GTHREADS before using it.

Also reorder __thread_relax and __thread_yield so that the former can
use the latter instead of repeating the same preprocessor checks.

libstdc++-v3/ChangeLog:

	* include/bits/atomic_wait.h (__thread_yield()): Check
	_GLIBCXX_HAS_GTHREADS before using __gthread_yield.
	(__thread_relax()): Use __thread_yield() instead of repeating
	the preprocessor checks for __gthread_yield.
2021-02-15 15:52:25 +00:00
Jonathan Wakely
d27153f038 libstdc++: Add missing return and use reserved name
The once_flag::_M_activate() function is only ever called immediately
after a call to once_flag::_M_passive(), and so in the non-gthreads case
it is impossible for _M_passive() to be true in the body of
_M_activate(). Add a check for it anyway, to avoid warnings about
missing return.

Also replace a non-reserved name with a reserved one.

libstdc++-v3/ChangeLog:

	* include/std/mutex (once_flag::_M_activate()): Add explicit
	return statement for passive case.
	(once_flag::_M_finish(bool)): Use reserved name for parameter.
2021-02-15 15:52:25 +00:00
GCC Administrator
c5ae38e8dc Daily bump. 2021-02-15 00:16:18 +00:00
Jonathan Wakely
4e3590d06c libstdc++: Restore <unistd.h> in testsuite_fs.h header [PR 99096]
libstdc++-v3/ChangeLog:

	PR libstdc++/99096
	* testsuite/util/testsuite_fs.h: Always include <unistd.h>.
2021-02-14 20:38:32 +00:00
GCC Administrator
fab095dad5 Daily bump. 2021-02-13 00:16:38 +00:00
Jonathan Wakely
b7210405ed libstdc++: Re-enable workaround for _wstat64 bug, again [PR 88881]
I forgot that the workaround is present in both filesystem::status and
filesystem::symlink_status. This restores it in the latter.

libstdc++-v3/ChangeLog:

	PR libstdc++/88881
	* src/c++17/fs_ops.cc (fs::symlink_status): Re-enable workaround.
2021-02-12 15:30:35 +00:00
Jonathan Wakely
1dfd95f0a0 libstdc++: Fix filesystem::rename on Windows [PR 98985]
The _wrename function won't overwrite an existing file, so use
MoveFileEx instead. That allows renaming directories over files, which
POSIX doesn't allow, so check for that case explicitly and report an
error.

Also document the deviation from the expected behaviour, and add a test
for filesystem::rename which was previously missing.

The Filesystem TS experimental::filesystem::rename doesn't have that
extra code to handle directories correctly, so the relevant parts of the
new test are not run on Windows.

libstdc++-v3/ChangeLog:

	* doc/xml/manual/status_cxx2014.xml: Document implementation
	specific properties of std::experimental::filesystem::rename.
	* doc/xml/manual/status_cxx2017.xml: Document implementation
	specific properties of std::filesystem::rename.
	* doc/html/*: Regenerate.
	* src/c++17/fs_ops.cc (fs::rename): Implement correct behaviour
	for directories on Windows.
	* src/filesystem/ops-common.h (__gnu_posix::rename): Use
	MoveFileExW on Windows.
	* testsuite/27_io/filesystem/operations/rename.cc: New test.
	* testsuite/experimental/filesystem/operations/rename.cc: New test.
2021-02-12 15:29:50 +00:00
Jonathan Wakely
4179ec1079 libstdc++: Make "nonexistent" paths less predictable in filesystem tests
The helper function for creating new paths doesn't work well on Windows,
because the PID of a process started by Wine is very consistent and so
the same path gets created each time.

libstdc++-v3/ChangeLog:

	* testsuite/util/testsuite_fs.h (nonexistent_path): Add
	random number to the path.
2021-02-12 15:13:02 +00:00
Jonathan Wakely
d1a821b93c libstdc++: Include scope ID in net::internet::address_v6::to_string()
libstdc++-v3/ChangeLog:

	* include/experimental/internet (address_v6::to_string): Include
	scope ID in string.
	* testsuite/experimental/net/internet/address/v6/members.cc:
	Test to_string() results.
2021-02-12 15:08:29 +00:00
Jonathan Wakely
970ba71925 libstdc++: Fix errors in <experimental/internet>
libstdc++-v3/ChangeLog:

	* include/experimental/internet (address_v6::any): Avoid using
	memcpy in constexpr function.
	(address_v6::loopback): Likewise.
	(make_address_v6): Fix missing return statements on error paths.
	* include/experimental/io_context: Avoid -Wdangling-else
	warning.
	* testsuite/experimental/net/internet/address/v4/members.cc:
	Remove unused variables.
	* testsuite/experimental/net/internet/address/v6/members.cc:
	New test.
2021-02-12 14:30:14 +00:00
Jonathan Wakely
87eaa3c525 libstdc++: Add unused attributes to shared_ptr functions
This avoids some warnings when building with -fno-rtti because the
function parameters are only used when RTTI is enabled.

libstdc++-v3/ChangeLog:

	* include/bits/shared_ptr_base.h (__shared_ptr::_M_get_deleter):
	Add unused attribute to parameter.
	* src/c++11/shared_ptr.cc (_Sp_make_shared_tag::_S_eq):
	Likewise.
2021-02-12 14:30:14 +00:00
Jonathan Wakely
c4ece1d96a libstdc++: XFAIL tests that depends on RTTI
The std::emit_on_flush manipulator depends on dynamic_cast, so fails
without RTTI.

The std::async code can't catch a forced_unwind exception when RTTI is
disabled, so it can't rethrow it either, and the test aborts.

libstdc++-v3/ChangeLog:

	* testsuite/27_io/basic_ostream/emit/1.cc: Expect test to fail
	if -fno-rtti is used.
	* testsuite/30_threads/async/forced_unwind.cc: Expect test
	to abort if -fno-rtti is used.
2021-02-12 14:30:13 +00:00
Jonathan Wakely
0bd242ec5a libstdc++: Make test memory_resource work without exceptions and RTTI
libstdc++-v3/ChangeLog:

	* testsuite/util/testsuite_allocator.h (memory_resource):
	Remove requirement for RTTI and exceptions to be enabled.
2021-02-12 14:30:13 +00:00
Jonathan Wakely
e9c3105211 libstdc++: Only use dynamic_cast in tests when RTTI is enabled
libstdc++-v3/ChangeLog:

	* testsuite/27_io/basic_istringstream/rdbuf/char/2832.cc: Use
	static_cast when RTTI is disabled.
	* testsuite/27_io/basic_istringstream/rdbuf/wchar_t/2832.cc:
	Likewise.
	* testsuite/27_io/basic_ostringstream/rdbuf/char/2832.cc:
	Likewise.
	* testsuite/27_io/basic_ostringstream/rdbuf/wchar_t/2832.cc:
	Likewise.
	* testsuite/27_io/basic_stringstream/str/char/2.cc:
	Likewise.
	* testsuite/27_io/basic_stringstream/str/wchar_t/2.cc:
	Likewise.
2021-02-12 14:30:13 +00:00
Jonathan Wakely
14b554c462 libstdc++: Fix errors when syncbuf is used without RTTI
libstdc++-v3/ChangeLog:

	* include/std/ostream (__syncbuf_base::_S_get): Mark parameter
	as unused and only use dynamic_cast when RTTI is enabled.
2021-02-12 14:30:12 +00:00
Jonathan Wakely
4591f7e532 libstdc++: Fix bootstrap with -fno-rtti [PR 99077]
When libstdc++ is built without RTTI the __ios_failure type is just an
alias for std::ios_failure, so trying to construct it from an int won't
compile. This changes the RTTI-enabled __ios_failure type to have the
same constructor parameters as std::ios_failure, so that the constructor
takes the same arguments whether RTTI is enabled or not.

The __throw_ios_failure function now constructs the error_code, instead
of the __ios_failure constructor. As a drive-by fix that error_code is
constructed with std::generic_category() not std::system_category(),
because the int comes from errno which corresponds to the generic
category.

libstdc++-v3/ChangeLog:

	PR libstdc++/99077
	* src/c++11/cxx11-ios_failure.cc (__ios_failure(const char*, int)):
	Change int parameter to error_code, to match std::ios_failure.
	(__throw_ios_failure(const char*, int)): Construct error_code
	from int parameter.
2021-02-12 14:30:12 +00:00
GCC Administrator
0c5cdb31bd Daily bump. 2021-02-12 00:16:25 +00:00
Jonathan Wakely
bc0f7db7eb libstdc++: Fix versioned namespace build
The recent changes to define various std::exception_ptr functions inline
included a change so that the definitions of those functions would be
omitted for the ABI unstable gnu-versioned-namespace configuration. That
change was incorrect, because the existing functions that are gated by
the _GLIBCXX_EH_PTR_COMPAT macro are always needed even for the
versioned namespace.

This change introduces a new macro to control whether operator== is
defined as deleted or not, distinct from the existing macro. The new
macro is not defined for versioned namespace builds, but the old macro
still is.

libstdc++-v3/ChangeLog:

	* libsupc++/eh_ptr.cc (_GLIBCXX_EH_PTR_RELOPS_COMPAT): Define
	new macro.
	* libsupc++/exception_ptr.h (_GLIBCXX_EH_PTR_USED): Check new
	macro instead of _GLIBCXX_EH_PTR_COMPAT.
	(operator==): Likewise.
2021-02-11 17:28:16 +00:00
Jonathan Wakely
ce43c90604 libstdc++: Document when C++11/14/17 support became stable [PR 99058]
libstdc++-v3/ChangeLog:

	PR libstdc++/99058
	* doc/xml/manual/status_cxx2011.xml: Document when support
	became stable.
	* doc/xml/manual/status_cxx2014.xml: Likewise.
	* doc/xml/manual/status_cxx2017.xml: Likewise.
	* doc/html/manual/status.html: Regenerate.
2021-02-11 17:28:16 +00:00
GCC Administrator
4b37c3ea8a Daily bump. 2021-02-11 00:16:33 +00:00
Jonathan Wakely
3df5b249b3 libstdc++: Re-enable workaround for _wstat64 bug [PR 88881]
This wasn't fixed upstream for mingw-w64 so we still need the
workaround.

libstdc++-v3/ChangeLog:

	PR libstdc++/88881
	* src/c++17/fs_ops.cc (fs::status): Re-enable workaround.
2021-02-10 16:51:34 +00:00
Jonathan Wakely
313e2dc377 libstdc++: Use correct error category for Windows error codes
When the result of GetLastError() is stored in a std::error_code it
should use std::system_category(), not std::generic_category() that is
used for POSIX errno values.

libstdc++-v3/ChangeLog:

	* src/c++17/fs_ops.cc (fs::create_hard_link, fs::equivalent)
	(fs::remove): Use std::system_category() for error codes from
	GetLastError().
	* src/filesystem/ops.cc (fs::create_hard_link, fs::remove):
	Likewise.
2021-02-10 16:45:38 +00:00
Jonathan Wakely
6a6f74be9d libstdc++: Fix spelling of __MINGW32__ macros
libstdc++-v3/ChangeLog:

	* testsuite/27_io/filesystem/operations/proximate.cc: Fix typo
	in __MINGW32__ macro name.
	* testsuite/27_io/filesystem/path/compare/lwg2936.cc: Likewise.
	* testsuite/27_io/filesystem/path/generation/proximate.cc:
	Likewise.
	* testsuite/27_io/filesystem/path/generation/relative.cc:
	Likewise.
	* testsuite/util/testsuite_fs.h: Likewise.
2021-02-10 16:40:29 +00:00
GCC Administrator
0a91b73e5b Daily bump. 2021-02-10 00:16:39 +00:00
François Dumont
d2b1a6842c libstdc++: Add unordered containers heterogeneous lookup
Add unordered containers heterogeneous lookup member functions find, count, contains and
equal_range in C++20. Those members are considered for overload resolution only if hash and
equal functors used to instantiate the container have a nested is_transparent type.

libstdc++-v3/ChangeLog:

	* include/bits/stl_tree.h
	(__has_is_transparent, __has_is_transparent_t): Move...
	* include/bits/stl_function.h: ...here.
	* include/bits/hashtable_policy.h (_Hash_code_base<>::_M_hash_code_tr): New..
	(_Hashtable_base<>::_M_equals_tr): New.
	* include/bits/hashtable.h (_Hashtable<>::_M_find_tr, _Hashtable<>::_M_count_tr,
	_Hashtable<>::_M_equal_range_tr): New member function templates to perform
	heterogeneous lookup.
	(_Hashtable<>::_M_find_before_node_tr): New.
	(_Hashtable<>::_M_find_node_tr): New.
	* include/bits/unordered_map.h (unordered_map::find<>, unordered_map::count<>,
	unordered_map::contains<>, unordered_map::equal_range<>): New member function
	templates to perform heterogeneous lookup.
	(unordered_multimap::find<>, unordered_multimap::count<>,
	unordered_multimap::contains<>, unordered_multimap::equal_range<>): Likewise.
	* include/bits/unordered_set.h  (unordered_set::find<>, unordered_set::count<>,
	unordered_set::contains<>, unordered_set::equal_range<>): Likewise.
	(unordered_multiset::find<>, unordered_multiset::count<>,
	unordered_multiset::contains<>, unordered_multiset::equal_range<>): Likewise.
	* include/debug/unordered_map
	(unordered_map::find<>, unordered_map::equal_range<>): Likewise.
	(unordered_multimap::find<>, unordered_multimap::equal_range<>): Likewise.
	* include/debug/unordered_set
	(unordered_set::find<>, unordered_set::equal_range<>): Likewise.
	(unordered_multiset::find<>, unordered_multiset::equal_range<>): Likewise.
	* testsuite/23_containers/unordered_map/operations/1.cc: New test.
	* testsuite/23_containers/unordered_multimap/operations/1.cc: New test.
	* testsuite/23_containers/unordered_multiset/operations/1.cc: New test.
	* testsuite/23_containers/unordered_set/operations/1.cc: New test.
2021-02-09 21:56:27 +01:00
François Dumont
f6be5d6ee3 libstdc++: Remove execution branch in deque iterator operator-
libstdc++-v3/ChangeLog:

	* include/bits/stl_deque.h
	(std::operator-(deque::iterator, deque::iterator)): Replace if/then with
	a null pointer test.
2021-02-09 21:56:27 +01:00