[libcxx] r249932 - Unrevert r249889, and XFAIL the test for Darwin, where the libc apparently doesn't provide a correct overload set for some functions.
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 9 18:39:51 PDT 2015
Author: rsmith
Date: Fri Oct 9 20:39:51 2015
New Revision: 249932
URL: http://llvm.org/viewvc/llvm-project?rev=249932&view=rev
Log:
Unrevert r249889, and XFAIL the test for Darwin, where the libc apparently doesn't provide a correct overload set for some functions.
Added:
libcxx/trunk/include/wchar.h
- copied unchanged from r249925, libcxx/trunk/include/wchar.h
Modified:
libcxx/trunk/include/cwchar
libcxx/trunk/test/std/depr/depr.c.headers/wchar_h.pass.cpp
Modified: libcxx/trunk/include/cwchar
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cwchar?rev=249932&r1=249931&r2=249932&view=diff
==============================================================================
--- libcxx/trunk/include/cwchar (original)
+++ libcxx/trunk/include/cwchar Fri Oct 9 20:39:51 2015
@@ -106,9 +106,6 @@ size_t wcsrtombs(char* restrict dst, con
#include <__config>
#include <cwctype>
#include <wchar.h>
-#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
-#include <support/win32/support.h> // pull in *swprintf defines
-#endif // _LIBCPP_MSVCRT
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
@@ -161,16 +158,13 @@ using ::wcscoll;
using ::wcsncmp;
using ::wcsxfrm;
-#if defined(_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_)
-
+#ifdef _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS
using ::wcschr;
using ::wcspbrk;
using ::wcsrchr;
using ::wcsstr;
using ::wmemchr;
-
#else
-
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcschr(const wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);}
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcschr( wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);}
@@ -185,7 +179,6 @@ inline _LIBCPP_INLINE_VISIBILITY w
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);}
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wmemchr( wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);}
-
#endif
using ::wcscspn;
Modified: libcxx/trunk/test/std/depr/depr.c.headers/wchar_h.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.c.headers/wchar_h.pass.cpp?rev=249932&r1=249931&r2=249932&view=diff
==============================================================================
--- libcxx/trunk/test/std/depr/depr.c.headers/wchar_h.pass.cpp (original)
+++ libcxx/trunk/test/std/depr/depr.c.headers/wchar_h.pass.cpp Fri Oct 9 20:39:51 2015
@@ -9,6 +9,12 @@
// <wchar.h>
+// This test fails on systems whose C library doesn't provide a correct overload
+// set for wcschr, wcspbrk, wcsrchr, wcsstr, and wmemchr. There's no way for
+// libc++ to fix that on the C library's behalf.
+//
+// XFAIL: apple-darwin
+
#include <wchar.h>
#include <type_traits>
@@ -28,13 +34,9 @@
#error WEOF not defined
#endif
-#if defined(__clang__)
-#pragma clang diagnostic ignored "-Wmissing-braces"
-#endif
-
int main()
{
- mbstate_t mb = {};
+ mbstate_t mb = {0};
size_t s = 0;
tm *tm = 0;
wint_t w = 0;
@@ -54,19 +56,13 @@ int main()
static_assert((std::is_same<decltype(vfwscanf(fp, L"", va)), int>::value), "");
static_assert((std::is_same<decltype(vswprintf(ws, s, L"", va)), int>::value), "");
static_assert((std::is_same<decltype(vswscanf(L"", L"", va)), int>::value), "");
- static_assert((std::is_same<decltype(vwprintf(L"", va)), int>::value), "");
- static_assert((std::is_same<decltype(vwscanf(L"", va)), int>::value), "");
- static_assert((std::is_same<decltype(wprintf(L"")), int>::value), "");
- static_assert((std::is_same<decltype(wscanf(L"")), int>::value), "");
static_assert((std::is_same<decltype(fgetwc(fp)), wint_t>::value), "");
static_assert((std::is_same<decltype(fgetws(ws, 0, fp)), wchar_t*>::value), "");
static_assert((std::is_same<decltype(fputwc(L' ', fp)), wint_t>::value), "");
static_assert((std::is_same<decltype(fputws(L"", fp)), int>::value), "");
static_assert((std::is_same<decltype(fwide(fp, 0)), int>::value), "");
static_assert((std::is_same<decltype(getwc(fp)), wint_t>::value), "");
- static_assert((std::is_same<decltype(getwchar()), wint_t>::value), "");
static_assert((std::is_same<decltype(putwc(L' ', fp)), wint_t>::value), "");
- static_assert((std::is_same<decltype(putwchar(L' ')), wint_t>::value), "");
static_assert((std::is_same<decltype(ungetwc(L' ', fp)), wint_t>::value), "");
static_assert((std::is_same<decltype(wcstod(L"", (wchar_t**)0)), double>::value), "");
static_assert((std::is_same<decltype(wcstof(L"", (wchar_t**)0)), float>::value), "");
@@ -83,14 +79,19 @@ int main()
static_assert((std::is_same<decltype(wcscoll(L"", L"")), int>::value), "");
static_assert((std::is_same<decltype(wcsncmp(L"", L"", s)), int>::value), "");
static_assert((std::is_same<decltype(wcsxfrm(ws, L"", s)), size_t>::value), "");
+ static_assert((std::is_same<decltype(wcschr((const wchar_t*)0, L' ')), const wchar_t*>::value), "");
static_assert((std::is_same<decltype(wcschr((wchar_t*)0, L' ')), wchar_t*>::value), "");
static_assert((std::is_same<decltype(wcscspn(L"", L"")), size_t>::value), "");
static_assert((std::is_same<decltype(wcslen(L"")), size_t>::value), "");
+ static_assert((std::is_same<decltype(wcspbrk((const wchar_t*)0, L"")), const wchar_t*>::value), "");
static_assert((std::is_same<decltype(wcspbrk((wchar_t*)0, L"")), wchar_t*>::value), "");
+ static_assert((std::is_same<decltype(wcsrchr((const wchar_t*)0, L' ')), const wchar_t*>::value), "");
static_assert((std::is_same<decltype(wcsrchr((wchar_t*)0, L' ')), wchar_t*>::value), "");
static_assert((std::is_same<decltype(wcsspn(L"", L"")), size_t>::value), "");
+ static_assert((std::is_same<decltype(wcsstr((const wchar_t*)0, L"")), const wchar_t*>::value), "");
static_assert((std::is_same<decltype(wcsstr((wchar_t*)0, L"")), wchar_t*>::value), "");
static_assert((std::is_same<decltype(wcstok(ws, L"", (wchar_t**)0)), wchar_t*>::value), "");
+ static_assert((std::is_same<decltype(wmemchr((const wchar_t*)0, L' ', s)), const wchar_t*>::value), "");
static_assert((std::is_same<decltype(wmemchr((wchar_t*)0, L' ', s)), wchar_t*>::value), "");
static_assert((std::is_same<decltype(wmemcmp(L"", L"", s)), int>::value), "");
static_assert((std::is_same<decltype(wmemcpy(ws, L"", s)), wchar_t*>::value), "");
@@ -105,4 +106,16 @@ int main()
static_assert((std::is_same<decltype(wcrtomb(ns, L' ', &mb)), size_t>::value), "");
static_assert((std::is_same<decltype(mbsrtowcs(ws, (const char**)0, s, &mb)), size_t>::value), "");
static_assert((std::is_same<decltype(wcsrtombs(ns, (const wchar_t**)0, s, &mb)), size_t>::value), "");
+
+#ifndef _LIBCPP_HAS_NO_STDIN
+ static_assert((std::is_same<decltype(getwchar()), wint_t>::value), "");
+ static_assert((std::is_same<decltype(vwscanf(L"", va)), int>::value), "");
+ static_assert((std::is_same<decltype(wscanf(L"")), int>::value), "");
+#endif
+
+#ifndef _LIBCPP_HAS_NO_STDOUT
+ static_assert((std::is_same<decltype(putwchar(L' ')), wint_t>::value), "");
+ static_assert((std::is_same<decltype(vwprintf(L"", va)), int>::value), "");
+ static_assert((std::is_same<decltype(wprintf(L"")), int>::value), "");
+#endif
}
More information about the cfe-commits
mailing list