gcc/libstdc++-v3/include
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
..
backward Avoid deprecated warnings about std::auto_ptr in library headers 2017-04-21 14:08:51 +01:00
bits Finish implementing P0426R1 "Constexpr for std::char_traits" for C++17 2017-06-12 22:22:39 +00:00
c
c_compatibility
c_global
c_std
debug Revert revision 247926. 2017-05-12 21:19:39 +00:00
decimal
experimental Implement std::experimental::source_location (N4519) 2017-05-16 14:37:52 +01:00
ext Add C++17 deduction guide for std::basic_string (P0433R2, partial) 2017-06-07 13:35:08 +01:00
parallel
precompiled
profile
std PR libstdc++/80939 Remove unmeetable constexpr specifiers 2017-06-05 17:49:04 +01:00
tr1 PR libstdc++/68397 std::tr1::expint fails ... long double arguments. 2017-04-20 15:41:59 +00:00
tr2
Makefile.am Implement std::experimental::source_location (N4519) 2017-05-16 14:37:52 +01:00
Makefile.in Implement std::experimental::source_location (N4519) 2017-05-16 14:37:52 +01:00