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
alloc_traits.h
allocated_ptr.h
allocator.h
atomic_base.h
atomic_futex.h
basic_ios.h
basic_ios.tcc
basic_string.h
basic_string.tcc
boost_concept_check.h
c++0x_warning.h
c++14_warning.h
c++17_warning.h
c++config
char_traits.h
codecvt.h
concept_check.h
cpp_type_traits.h
deque.tcc
enable_special_members.h
forward_list.h
forward_list.tcc
fstream.tcc
functexcept.h
functional_hash.h
gslice_array.h
gslice.h
hashtable_policy.h
hashtable.h
indirect_array.h
invoke.h
ios_base.h
istream.tcc
list.tcc
locale_classes.h
locale_classes.tcc
locale_conv.h
locale_facets_nonio.h
locale_facets_nonio.tcc
locale_facets.h
locale_facets.tcc
localefwd.h
mask_array.h
memoryfwd.h
move.h
node_handle.h
ostream_insert.h
ostream.tcc
parse_numbers.h
postypes.h
predefined_ops.h
ptr_traits.h
quoted_string.h
random.h
random.tcc
range_access.h
refwrap.h
regex_automaton.h
regex_automaton.tcc
regex_compiler.h
regex_compiler.tcc
regex_constants.h
regex_error.h
regex_executor.h
regex_executor.tcc
regex_scanner.h
regex_scanner.tcc
regex.h
regex.tcc
shared_ptr_atomic.h
shared_ptr_base.h
shared_ptr.h
slice_array.h
specfun.h
sstream.tcc
std_abs.h
std_function.h
std_mutex.h
stl_algo.h
stl_algobase.h
stl_bvector.h
stl_construct.h
stl_deque.h
stl_function.h
stl_heap.h
stl_iterator_base_funcs.h
stl_iterator_base_types.h
stl_iterator.h
stl_list.h
stl_map.h
stl_multimap.h
stl_multiset.h
stl_numeric.h
stl_pair.h
stl_queue.h
stl_raw_storage_iter.h
stl_relops.h
stl_set.h
stl_stack.h
stl_tempbuf.h
stl_tree.h
stl_uninitialized.h
stl_vector.h
stream_iterator.h
streambuf_iterator.h
streambuf.tcc
string_view.tcc
stringfwd.h
uniform_int_dist.h
unique_ptr.h
unordered_map.h
unordered_set.h
uses_allocator.h
valarray_after.h
valarray_array.h
valarray_array.tcc
valarray_before.h
vector.tcc