gcc/libstdc++-v3
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
..
config baseline_symbols.txt: Update. 2017-06-03 09:56:43 +00:00
doc Finish implementing P0426R1 "Constexpr for std::char_traits" for C++17 2017-06-12 22:22:39 +00:00
include Finish implementing P0426R1 "Constexpr for std::char_traits" for C++17 2017-06-12 22:22:39 +00:00
libsupc++ Remove libsupc++ makefile targets setting -std=gnu++11 or -std=gnu++14 2017-06-02 12:49:04 +01:00
po
python
scripts
src PR libstdc++/55917 do not handle exceptions in std::thread 2017-06-12 17:37:28 +01:00
testsuite Finish implementing P0426R1 "Constexpr for std::char_traits" for C++17 2017-06-12 22:22:39 +00:00
acinclude.m4 PR libstdc++/67578 Implement non-trivial std::random_device::entropy 2017-05-23 17:11:57 +01:00
aclocal.m4
ChangeLog Finish implementing P0426R1 "Constexpr for std::char_traits" for C++17 2017-06-12 22:22:39 +00:00
ChangeLog-1998
ChangeLog-1999
ChangeLog-2000
ChangeLog-2001
ChangeLog-2002
ChangeLog-2003
ChangeLog-2004
ChangeLog-2005
ChangeLog-2006
ChangeLog-2007
ChangeLog-2008
ChangeLog-2009
ChangeLog-2010
ChangeLog-2011
ChangeLog-2012
ChangeLog-2013
ChangeLog-2014
ChangeLog-2015
ChangeLog-2016
config.h.in PR libstdc++/67578 Implement non-trivial std::random_device::entropy 2017-05-23 17:11:57 +01:00
configure Fix cross compilation to Solaris 2017-06-01 13:50:03 +00:00
configure.ac PR libstdc++/67578 Implement non-trivial std::random_device::entropy 2017-05-23 17:11:57 +01:00
configure.host
crossconfig.m4 Fix cross compilation to Solaris 2017-06-01 13:50:03 +00:00
fragment.am
linkage.m4
Makefile.am
Makefile.in
README

file: libstdc++-v3/README

New users may wish to point their web browsers to the file
index.html in the 'doc/html' subdirectory.  It contains brief
building instructions and notes on how to configure the library in
interesting ways.