gcc/libstdc++-v3/libsupc++
Jonathan Wakely 74d14778e7 libstdc++: Define std::__is_constant_evaluated() for internal use
This adds std::__is_constant_evaluated() as a C++11 wrapper for
__builtin_is_constant_evaluated, but just returning false if the
built-in isn't supported by the compiler. This allows us to use it
throughout the library without checking __has_builtin every time.

Some uses in std::vector and std::string can only be constexpr when the
std::is_constant_evaluated() function actually works, so we might as
well guard them with a relevant macro and call that function directly,
rather than the built-in or std::__is_constant_evaluated().

The remaining checks of the __cpp_lib_is_constant_evaluated macro could
now be replaced by checking __cplusplus >= 202002 instead, but there's
no practical difference. We still need some kind of preprocessor check
there anyway.

libstdc++-v3/ChangeLog:

	* doc/doxygen/user.cfg.in (PREDEFINED): Change macro name.
	* include/bits/allocator.h (allocate, deallocate): Use
	std::__is_constant_evaluated() unconditionally, instead of
	checking whether std::is_constant_evaluated() (or the built-in)
	can be used.
	* include/bits/basic_string.h: Check new macro. call
	std::is_constant_evaluated() directly in C++20-only code that is
	guarded by a suitable macro.
	* include/bits/basic_string.tcc: Likewise.
	* include/bits/c++config (__is_constant_evaluated): Define.
	(_GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED): Replace with ...
	(_GLIBCXX_HAVE_IS_CONSTANT_EVALUATED): New macro.
	* include/bits/char_traits.h (char_traits): Replace conditional
	calls to std::is_constant_evaluated with unconditional calls to
	std::__is_constant_evaluated.
	* include/bits/cow_string.h: Use new macro.
	* include/bits/ranges_algobase.h (__copy_or_move): Replace
	conditional calls to std::is_constant_evaluated with unconditional
	calls to std::__is_constant_evaluated.
	(__copy_or_move_backward, __fill_n_fn): Likewise.
	* include/bits/ranges_cmp.h (ranges::less): Likewise.
	* include/bits/stl_algobase.h (lexicographical_compare_three_way):
	Likewise.
	* include/bits/stl_bvector.h: Call std::is_constant_evaluated
	directly in C++20-only code that is guarded by a suitable macro.
	* include/bits/stl_construct.h (_Construct, _Destroy, _Destroy_n):
	Replace is_constant_evaluated with __is_constant_evaluated.
	* include/bits/stl_function.h (greater, less, greater_equal)
	(less_equal): Replace __builtin_is_constant_evaluated and
	__builtin_constant_p with __is_constant_evaluated.
	* include/bits/stl_vector.h: Call std::is_constant_evaluated()
	in C++20-only code.
	* include/debug/helper_functions.h (__check_singular): Use
	__is_constant_evaluated instead of built-in, or remove check
	entirely.
	* include/std/array (operator<=>): Use __is_constant_evaluated
	unconditionally.
	* include/std/bit (__bit_ceil): Likewise.
	* include/std/type_traits (is_constant_evaluated): Define using
	'if consteval' if possible.
	* include/std/version: Use new macro.
	* libsupc++/compare: Use __is_constant_evaluated instead of
	__builtin_is_constant_evaluated.
	* testsuite/23_containers/array/tuple_interface/get_neg.cc:
	Adjust dg-error lines.
2021-12-01 15:00:33 +00:00
..
Makefile.am libstdc++: Move atomic functions to libsupc++ [PR 96657] 2021-04-15 16:56:44 +01:00
Makefile.in libstdc++: Move atomic functions to libsupc++ [PR 96657] 2021-04-15 16:56:44 +01:00
array_type_info.cc Update copyright years. 2021-01-04 10:26:59 +01:00
atexit_arm.cc Update copyright years. 2021-01-04 10:26:59 +01:00
atexit_thread.cc Update copyright years. 2021-01-04 10:26:59 +01:00
atomic_lockfree_defines.h libstdc++: Fix doxygen markup for group close commands 2021-04-06 16:43:24 +01:00
bad_alloc.cc Update copyright years. 2021-01-04 10:26:59 +01:00
bad_array_length.cc Update copyright years. 2021-01-04 10:26:59 +01:00
bad_array_new.cc Update copyright years. 2021-01-04 10:26:59 +01:00
bad_cast.cc Update copyright years. 2021-01-04 10:26:59 +01:00
bad_typeid.cc Update copyright years. 2021-01-04 10:26:59 +01:00
class_type_info.cc Update copyright years. 2021-01-04 10:26:59 +01:00
compare libstdc++: Define std::__is_constant_evaluated() for internal use 2021-12-01 15:00:33 +00:00
cxxabi.h Update copyright years. 2021-01-04 10:26:59 +01:00
cxxabi_forced.h Update copyright years. 2021-01-04 10:26:59 +01:00
cxxabi_init_exception.h Update copyright years. 2021-01-04 10:26:59 +01:00
del_op.cc Update copyright years. 2021-01-04 10:26:59 +01:00
del_opa.cc Update copyright years. 2021-01-04 10:26:59 +01:00
del_opant.cc Update copyright years. 2021-01-04 10:26:59 +01:00
del_opnt.cc Update copyright years. 2021-01-04 10:26:59 +01:00
del_ops.cc Update copyright years. 2021-01-04 10:26:59 +01:00
del_opsa.cc Update copyright years. 2021-01-04 10:26:59 +01:00
del_opv.cc Update copyright years. 2021-01-04 10:26:59 +01:00
del_opva.cc Update copyright years. 2021-01-04 10:26:59 +01:00
del_opvant.cc Update copyright years. 2021-01-04 10:26:59 +01:00
del_opvnt.cc Update copyright years. 2021-01-04 10:26:59 +01:00
del_opvs.cc Update copyright years. 2021-01-04 10:26:59 +01:00
del_opvsa.cc Update copyright years. 2021-01-04 10:26:59 +01:00
dyncast.cc libstdc++: Use __builtin_expect in __dynamic_cast 2021-08-23 14:45:00 +01:00
eh_alloc.cc Update copyright years. 2021-01-04 10:26:59 +01:00
eh_arm.cc Update copyright years. 2021-01-04 10:26:59 +01:00
eh_atomics.h Update copyright years. 2021-01-04 10:26:59 +01:00
eh_aux_runtime.cc Update copyright years. 2021-01-04 10:26:59 +01:00
eh_call.cc Update copyright years. 2021-01-04 10:26:59 +01:00
eh_catch.cc Update copyright years. 2021-01-04 10:26:59 +01:00
eh_exception.cc Update copyright years. 2021-01-04 10:26:59 +01:00
eh_globals.cc Update copyright years. 2021-01-04 10:26:59 +01:00
eh_personality.cc libstdc++: Deprecate std::unexpected and handler functions 2021-11-04 20:53:29 +00:00
eh_ptr.cc libstdc++: Deprecate std::unexpected and handler functions 2021-11-04 20:53:29 +00:00
eh_term_handler.cc Update copyright years. 2021-01-04 10:26:59 +01:00
eh_term_handler.h Update copyright years. 2021-01-04 10:26:59 +01:00
eh_terminate.cc libstdc++: Deprecate std::unexpected and handler functions 2021-11-04 20:53:29 +00:00
eh_throw.cc libstdc++: Deprecate std::unexpected and handler functions 2021-11-04 20:53:29 +00:00
eh_tm.cc Update copyright years. 2021-01-04 10:26:59 +01:00
eh_type.cc Update copyright years. 2021-01-04 10:26:59 +01:00
eh_unex_handler.cc Update copyright years. 2021-01-04 10:26:59 +01:00
enum_type_info.cc Update copyright years. 2021-01-04 10:26:59 +01:00
exception libstdc++: Deprecate std::unexpected and handler functions 2021-11-04 20:53:29 +00:00
exception.h libstdc++: Improvements to Doxygen markup 2021-07-01 18:45:48 +01:00
exception_defines.h Update copyright years. 2021-01-04 10:26:59 +01:00
exception_ptr.h libstdc++: Fix doxygen markup for group close commands 2021-04-06 16:43:24 +01:00
function_type_info.cc Update copyright years. 2021-01-04 10:26:59 +01:00
fundamental_type_info.cc Update copyright years. 2021-01-04 10:26:59 +01:00
guard.cc Update copyright years. 2021-01-04 10:26:59 +01:00
guard_error.cc Update copyright years. 2021-01-04 10:26:59 +01:00
hash_bytes.cc Update copyright years. 2021-01-04 10:26:59 +01:00
hash_bytes.h Update copyright years. 2021-01-04 10:26:59 +01:00
initializer_list Update copyright years. 2021-01-04 10:26:59 +01:00
nested_exception.cc Update copyright years. 2021-01-04 10:26:59 +01:00
nested_exception.h libstdc++: Fix doxygen markup for group close commands 2021-04-06 16:43:24 +01:00
new c++: implement C++17 hardware interference size 2021-09-13 12:28:06 -04:00
new_handler.cc Update copyright years. 2021-01-04 10:26:59 +01:00
new_op.cc Update copyright years. 2021-01-04 10:26:59 +01:00
new_opa.cc libstdc++: Declare malloc for freestanding 2021-03-25 18:25:40 +00:00
new_opant.cc Update copyright years. 2021-01-04 10:26:59 +01:00
new_opnt.cc Update copyright years. 2021-01-04 10:26:59 +01:00
new_opv.cc Update copyright years. 2021-01-04 10:26:59 +01:00
new_opva.cc Update copyright years. 2021-01-04 10:26:59 +01:00
new_opvant.cc Update copyright years. 2021-01-04 10:26:59 +01:00
new_opvnt.cc Update copyright years. 2021-01-04 10:26:59 +01:00
pbase_type_info.cc Update copyright years. 2021-01-04 10:26:59 +01:00
pmem_type_info.cc Update copyright years. 2021-01-04 10:26:59 +01:00
pointer_type_info.cc Update copyright years. 2021-01-04 10:26:59 +01:00
pure.cc Update copyright years. 2021-01-04 10:26:59 +01:00
si_class_type_info.cc Update copyright years. 2021-01-04 10:26:59 +01:00
tinfo.cc Update copyright years. 2021-01-04 10:26:59 +01:00
tinfo.h Update copyright years. 2021-01-04 10:26:59 +01:00
tinfo2.cc libstdc++: Fix std::type_info::before for ARM [PR103240] 2021-11-17 17:21:24 +00:00
typeinfo Update copyright years. 2021-01-04 10:26:59 +01:00
unwind-cxx.h libstdc++: Deprecate std::unexpected and handler functions 2021-11-04 20:53:29 +00:00
vec.cc Update copyright years. 2021-01-04 10:26:59 +01:00
vmi_class_type_info.cc Update copyright years. 2021-01-04 10:26:59 +01:00
vterminate.cc Update copyright years. 2021-01-04 10:26:59 +01:00
vtv_stubs.cc Update copyright years. 2021-01-04 10:26:59 +01:00