Commit Graph

4 Commits

Author SHA1 Message Date
Richard Smith 5fd17ab1b0 Fix overload sets of strchr, strpbrk, strrchr, memchr and strstr from
<string.h> and wcschr, wcspbrk, wcsrchr, wmemchr, and wcsstr from <wchar.h> to
provide a const-correct overload set even when the underlying C library does
not.

This change adds a new macro, _LIBCPP_PREFERRED_OVERLOAD, which (if defined)
specifies that a given overload is a better match than an otherwise equally
good function declaration without the overload. This is implemented in modern
versions of Clang via __attribute__((enable_if)), and not elsewhere.

We use this new macro to define overloads in the global namespace for these
functions that displace the overloads provided by the C library, unless we
believe the C library is already providing the correct signatures.

llvm-svn: 260337
2016-02-10 00:59:02 +00:00
Richard Smith 0ecae015ff Unrevert r249889, and XFAIL the test for Darwin, where the libc apparently doesn't provide a correct overload set for some functions.
llvm-svn: 249932
2015-10-10 01:39:51 +00:00
Manman Ren 79d8bc4c88 Revert r249889 due to bot failure.
llvm-svn: 249926
2015-10-10 01:03:55 +00:00
Richard Smith 897758d6ba Split <wchar.h> out of <cwchar>.
llvm-svn: 249889
2015-10-09 19:56:37 +00:00