gcc/libstdc++-v3/include/bits
Pedro Alves b51483f48f Finish implementing P0426R1 "Constexpr for std::char_traits" for C++17
As discussed in PR c++/80265 ("__builtin_{memcmp,memchr,strlen} are
not usable in constexpr functions"), use __builtin_constant_p to tell
whether we can defer to a constexpr algorithm.

I used __always_inline__ just to be thorough.  It isn't really really
necessary as far as I could determine.

Changes like these:

	 if (__n == 0)
	   return 0;
 -	return wmemcmp(__s1, __s2, __n);
 +	else
 +	  return wmemcmp(__s1, __s2, __n);

are necessary otherwise G++ complains that we're calling a
non-constexpr function, which looks like a a manifestation of PR67026
to me.

libstdc++-v3:
2017-06-12  Pedro Alves  <palves@redhat.com>

	* doc/xml/manual/status_cxx2017.xml: Update C++17 constexpr
	char_traits status.
	* doc/html/*: Regenerate.

	* include/bits/char_traits.h (_GLIBCXX_ALWAYS_INLINE): Define if
	not already defined.
	(__cpp_lib_constexpr_char_traits): Uncomment.
	(__constant_string_p, __constant_char_array_p): New.
	(std::char_traits<char>, std::char_traits<wchar_t>): Add
	_GLIBCXX17_CONSTEXPR on compare, length and find and use
	__constant_string_p, __constant_char_array_p and
	__builtin_constant_p to defer to __gnu_cxx::char_traits at compile
	time.

	* testsuite/21_strings/char_traits/requirements/
	constexpr_functions_c++17.cc: Uncomment
	__cpp_lib_constexpr_char_traits tests.  Uncomment
	test_compare<char>, test_length<char>, test_find<char>,
	test_compare<wchar_t>, test_length<wchar_t> and test_find<wchar_t>
	static_assert tests.

From-SVN: r249137
2017-06-12 22:22:39 +00:00
..
algorithmfwd.h Update copyright years. 2017-01-01 13:07:43 +01:00
alloc_traits.h Add C++17 deduction guide for std::basic_string (P0433R2, partial) 2017-06-07 13:35:08 +01:00
allocated_ptr.h Update copyright years. 2017-01-01 13:07:43 +01:00
allocator.h Update copyright years. 2017-01-01 13:07:43 +01:00
atomic_base.h Adjust whitespace in <bits/atomic_base.h> 2017-02-11 21:08:06 +00:00
atomic_futex.h Update copyright years. 2017-01-01 13:07:43 +01:00
basic_ios.h Update copyright years. 2017-01-01 13:07:43 +01:00
basic_ios.tcc Update copyright years. 2017-01-01 13:07:43 +01:00
basic_string.h Add C++17 deduction guide for std::basic_string (P0433R2, partial) 2017-06-07 13:35:08 +01:00
basic_string.tcc PR libstdc++/79254 simplify exception-safety in copy assignment 2017-02-01 11:41:48 +00:00
boost_concept_check.h Update copyright years. 2017-01-01 13:07:43 +01:00
c++0x_warning.h Update copyright years. 2017-01-01 13:07:43 +01:00
c++14_warning.h Update copyright years. 2017-01-01 13:07:43 +01:00
c++17_warning.h Update copyright years. 2017-01-01 13:07:43 +01:00
c++config Bump version namespace. 2017-05-10 20:40:28 +00:00
char_traits.h Finish implementing P0426R1 "Constexpr for std::char_traits" for C++17 2017-06-12 22:22:39 +00:00
codecvt.h Update copyright years. 2017-01-01 13:07:43 +01:00
concept_check.h Update copyright years. 2017-01-01 13:07:43 +01:00
cpp_type_traits.h Update copyright years. 2017-01-01 13:07:43 +01:00
deque.tcc Update copyright years. 2017-01-01 13:07:43 +01:00
enable_special_members.h Update copyright years. 2017-01-01 13:07:43 +01:00
forward_list.h Add deduction guides for sequence containers (P0433R2, partial) 2017-06-09 12:04:53 +01:00
forward_list.tcc Update copyright years. 2017-01-01 13:07:43 +01:00
fstream.tcc Update copyright years. 2017-01-01 13:07:43 +01:00
functexcept.h Update copyright years. 2017-01-01 13:07:43 +01:00
functional_hash.h Make poisoned hashes SFINAE away the call operator of the hash. 2017-01-21 17:38:23 +02:00
gslice_array.h Update copyright years. 2017-01-01 13:07:43 +01:00
gslice.h Update copyright years. 2017-01-01 13:07:43 +01:00
hashtable_policy.h PR libstdc++/79789 fix non-reserved names in headers 2017-03-02 03:43:49 +00:00
hashtable.h Update copyright years. 2017-01-01 13:07:43 +01:00
indirect_array.h Update copyright years. 2017-01-01 13:07:43 +01:00
invoke.h P0604R0 add invoke_result, is_invocable etc. for C++17 2017-03-10 15:29:38 +00:00
ios_base.h Fix comments in libstdc++ header and test 2017-04-03 18:16:06 +01:00
istream.tcc Update copyright years. 2017-01-01 13:07:43 +01:00
list.tcc re PR libstdc++/80034 (unqualified calls to std::distance in std::list::sort) 2017-03-13 21:41:50 +02:00
locale_classes.h PR78702 fix accessibility of locale::facet::__shim 2017-01-16 11:41:41 +00:00
locale_classes.tcc Update copyright years. 2017-01-01 13:07:43 +01:00
locale_conv.h PR libstdc++/79980 fix BOM detection, maxcode checks, UCS2 handling 2017-03-16 15:27:51 +00:00
locale_facets_nonio.h Update copyright years. 2017-01-01 13:07:43 +01:00
locale_facets_nonio.tcc Use temporary int objects to access struct tm members 2017-01-10 14:15:59 +00:00
locale_facets.h Update copyright years. 2017-01-01 13:07:43 +01:00
locale_facets.tcc PR libstdc++/67214 Avoid signed overflow in num_get::_M_extract_int 2017-05-23 11:16:08 +01:00
localefwd.h Update copyright years. 2017-01-01 13:07:43 +01:00
mask_array.h PR libstdc++/79789 fix non-reserved names in headers 2017-03-02 03:43:49 +00:00
memoryfwd.h Update copyright years. 2017-01-01 13:07:43 +01:00
move.h Update copyright years. 2017-01-01 13:07:43 +01:00
node_handle.h Fix order and types of members in C++17 insert_return_type structs 2017-05-15 14:47:40 +01:00
ostream_insert.h Update copyright years. 2017-01-01 13:07:43 +01:00
ostream.tcc Update copyright years. 2017-01-01 13:07:43 +01:00
parse_numbers.h Update copyright years. 2017-01-01 13:07:43 +01:00
postypes.h Update copyright years. 2017-01-01 13:07:43 +01:00
predefined_ops.h PR78346 make <bits/predefined_ops.h> handle stashing iterators 2017-02-01 12:57:35 +00:00
ptr_traits.h PR72792 detect allocator pointer types without invalid rebinding 2017-01-20 12:03:36 +00:00
quoted_string.h Update copyright years. 2017-01-01 13:07:43 +01:00
random.h PR libstdc++/67578 Implement non-trivial std::random_device::entropy 2017-05-23 17:11:57 +01:00
random.tcc PR libstdc++/80506 fix constant used in condition 2017-04-24 14:43:19 +01:00
range_access.h Update copyright years. 2017-01-01 13:07:43 +01:00
refwrap.h Fixes to Doxygen comments in libstdc++ headers 2017-05-17 17:02:33 +01:00
regex_automaton.h Update copyright years. 2017-01-01 13:07:43 +01:00
regex_automaton.tcc Update copyright years. 2017-01-01 13:07:43 +01:00
regex_compiler.h PR libstdc++/81002 fix std::basic_regex range constructor 2017-06-07 16:43:35 +01:00
regex_compiler.tcc Update copyright years. 2017-01-01 13:07:43 +01:00
regex_constants.h Implement P0607R0 "Inline Variables for Standard Library" for C++17 2017-03-23 19:40:07 +00:00
regex_error.h Update copyright years. 2017-01-01 13:07:43 +01:00
regex_executor.h Update copyright years. 2017-01-01 13:07:43 +01:00
regex_executor.tcc Update copyright years. 2017-01-01 13:07:43 +01:00
regex_scanner.h Update copyright years. 2017-01-01 13:07:43 +01:00
regex_scanner.tcc Update copyright years. 2017-01-01 13:07:43 +01:00
regex.h Add C++17 deduction guide for std::basic_regex (P0433R2, partial) 2017-06-07 16:43:54 +01:00
regex.tcc Update copyright years. 2017-01-01 13:07:43 +01:00
shared_ptr_atomic.h Update copyright years. 2017-01-01 13:07:43 +01:00
shared_ptr_base.h Support move-only deleters in std::shared_ptr (LWG 2802) 2017-06-09 14:20:37 +01:00
shared_ptr.h Support move-only deleters in std::shared_ptr (LWG 2802) 2017-06-09 14:20:37 +01:00
slice_array.h PR libstdc++/79789 fix non-reserved names in headers 2017-03-02 03:43:49 +00:00
specfun.h Fixes to Doxygen comments in libstdc++ headers 2017-05-17 17:02:33 +01:00
sstream.tcc Update copyright years. 2017-01-01 13:07:43 +01:00
std_abs.h Update copyright years. 2017-01-01 13:07:43 +01:00
std_function.h PR libstdc++/81017 add noexcept to std::function move operations 2017-06-08 15:27:45 +01:00
std_mutex.h Implement P0607R0 "Inline Variables for Standard Library" for C++17 2017-03-23 19:40:07 +00:00
stl_algo.h PR libstdc++/80796 Add new std::search overload for C++17 2017-05-19 13:11:31 +01:00
stl_algobase.h stl_algobase.h (std::__iter_swap<false>): Remove _GLIBCXX_MOVE usage. 2017-05-10 20:05:26 +00:00
stl_bvector.h PR libstdc++/80893 Fix null dereference in vector<bool> 2017-05-31 13:41:45 +01:00
stl_construct.h PR libstdc++/80553 don't allow destroying non-destructible types 2017-04-28 13:56:53 +01:00
stl_deque.h Add deduction guides for sequence containers (P0433R2, partial) 2017-06-09 12:04:53 +01:00
stl_function.h Update copyright years. 2017-01-01 13:07:43 +01:00
stl_heap.h PR libstdc++/80064 make heap algorithms work with function types 2017-03-16 14:32:07 +00:00
stl_iterator_base_funcs.h Optimize std::advance for single increments 2017-06-05 11:34:13 +01:00
stl_iterator_base_types.h Update copyright years. 2017-01-01 13:07:43 +01:00
stl_iterator.h Fixes to Doxygen comments in libstdc++ headers 2017-05-17 17:02:33 +01:00
stl_list.h Add deduction guides for sequence containers (P0433R2, partial) 2017-06-09 12:04:53 +01:00
stl_map.h stl_deque.h (deque): Access allocator value_type only if concept checks are enabled. 2017-03-20 20:51:40 +00:00
stl_multimap.h stl_deque.h (deque): Access allocator value_type only if concept checks are enabled. 2017-03-20 20:51:40 +00:00
stl_multiset.h stl_deque.h (deque): Access allocator value_type only if concept checks are enabled. 2017-03-20 20:51:40 +00:00
stl_numeric.h Update copyright years. 2017-01-01 13:07:43 +01:00
stl_pair.h re PR libstdc++/79141 (std::pair<int,int> p = {}; fails to compile due to ambiguous overload) 2017-04-03 19:30:58 +03:00
stl_queue.h stl_deque.h (deque): Access allocator value_type only if concept checks are enabled. 2017-03-20 20:51:40 +00:00
stl_raw_storage_iter.h Update copyright years. 2017-01-01 13:07:43 +01:00
stl_relops.h Update copyright years. 2017-01-01 13:07:43 +01:00
stl_set.h stl_deque.h (deque): Access allocator value_type only if concept checks are enabled. 2017-03-20 20:51:40 +00:00
stl_stack.h stl_deque.h (deque): Access allocator value_type only if concept checks are enabled. 2017-03-20 20:51:40 +00:00
stl_tempbuf.h Update copyright years. 2017-01-01 13:07:43 +01:00
stl_tree.h stl_tree.h (_Rb_tree_impl()): Restore _Node_allocator default init. 2017-06-12 20:38:16 +00:00
stl_uninitialized.h PR libstdc++/80553 don't allow destroying non-destructible types 2017-04-28 13:56:53 +01:00
stl_vector.h Add deduction guides for sequence containers (P0433R2, partial) 2017-06-09 12:04:53 +01:00
stream_iterator.h Update copyright years. 2017-01-01 13:07:43 +01:00
streambuf_iterator.h Update copyright years. 2017-01-01 13:07:43 +01:00
streambuf.tcc Update copyright years. 2017-01-01 13:07:43 +01:00
string_view.tcc Fixes to Doxygen comments in libstdc++ headers 2017-05-17 17:02:33 +01:00
stringfwd.h Update copyright years. 2017-01-01 13:07:43 +01:00
uniform_int_dist.h PR69240 Define inequality operators for <random> param types 2017-01-20 15:28:48 +00:00
unique_ptr.h Avoid deprecated warnings about std::auto_ptr in library headers 2017-04-21 14:08:51 +01:00
unordered_map.h Update copyright years. 2017-01-01 13:07:43 +01:00
unordered_set.h Update copyright years. 2017-01-01 13:07:43 +01:00
uses_allocator.h Implement P0607R0 "Inline Variables for Standard Library" for C++17 2017-03-23 19:40:07 +00:00
valarray_after.h Update copyright years. 2017-01-01 13:07:43 +01:00
valarray_array.h Update copyright years. 2017-01-01 13:07:43 +01:00
valarray_array.tcc Update copyright years. 2017-01-01 13:07:43 +01:00
valarray_before.h Update copyright years. 2017-01-01 13:07:43 +01:00
vector.tcc Update copyright years. 2017-01-01 13:07:43 +01:00