gcc/libstdc++-v3/testsuite
Jonathan Wakely babaabbcc8 libstdc++: Implement std::unreachable() for C++23 (P0627R6)
This defines std::unreachable as an assertion for debug mode, a trap
when _GLIBCXX_ASSERTIONS is defined, and __builtin_unreachable()
otherwise.

The reason for only using __builtin_trap() in the second case is to
avoid the overhead of setting up a call to __glibcxx_assert_fail that
should never happen.

UBsan can detect if __builtin_unreachable() is executed, so if a feature
test macro for that sanitizer is added, we could change just use
__builtin_unreachable() when the sanitizer is enabled.

While thinking about what the debug assertion failure should print, I
noticed that the __glibcxx_assert_fail function doesn't check for null
pointers. This adds a check so we don't try to print them if null.

libstdc++-v3/ChangeLog:

	* include/std/utility (unreachable): Define for C++23.
	* include/std/version (__cpp_lib_unreachable): Define.
	* src/c++11/debug.cc (__glibcxx_assert_fail): Check for valid
	arguments. Handle only the function being given.
	* testsuite/20_util/unreachable/1.cc: New test.
	* testsuite/20_util/unreachable/version.cc: New test.
2022-04-01 13:17:18 +01:00
..
17_intro libstdc++: Fix test failure on AIX 2022-03-03 22:25:44 +00:00
18_support testsuite: Disable tests for C++23 that depend on std::unexpected 2022-03-29 20:30:43 +01:00
19_diagnostics
20_util libstdc++: Implement std::unreachable() for C++23 (P0627R6) 2022-04-01 13:17:18 +01:00
21_strings
22_locale libstdc++: Fix typos in comments in tests 2022-03-28 12:20:42 +01:00
23_containers libstdc++: Deprecate non-standard std::vector<bool>::insert(pos) [PR104559] 2022-02-17 23:44:25 +00:00
24_iterators
25_algorithms libstdc++: Reduce header dependencies from PSTL headers [PR92546] 2022-03-18 10:16:36 +00:00
26_numerics libstdc++: Add missing constraints to std::bit_cast [PR105027] 2022-03-23 12:17:16 +00:00
27_io libstdc++: Do not use dirent::d_type unconditionally 2022-02-02 00:01:43 +00:00
28_regex
29_atomics libstdc++: Fix test failures at -O0 2022-02-11 21:41:43 +00:00
30_threads
abi
backward
config
data
decimal
experimental libstdc++: Adjust Filesystem TS test for Windows 2022-02-08 13:31:09 +00:00
ext
lib
libstdc++-abi
libstdc++-dg
libstdc++-prettyprinters libstdc++: Make std::error_code printer more robust 2022-02-17 22:22:14 +00:00
libstdc++-xmethods
performance
special_functions
std libstdc++: Reduce header dependencies from PSTL headers [PR92546] 2022-03-18 10:16:36 +00:00
tr1
tr2
util libstdc++: Fix comment in testsuite utility 2022-03-17 12:23:56 +00:00
Makefile.am
Makefile.in