Revert r249889 due to bot failure.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@249926 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/cwchar b/include/cwchar
index ef4806d..797a177 100644
--- a/include/cwchar
+++ b/include/cwchar
@@ -106,6 +106,9 @@
 #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
@@ -158,13 +161,16 @@
 using ::wcsncmp;
 using ::wcsxfrm;
 
-#ifdef _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS
+#if defined(_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_)
+
 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);}
 
@@ -179,6 +185,7 @@
 
 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;
diff --git a/include/wchar.h b/include/wchar.h
deleted file mode 100644
index da34f73..0000000
--- a/include/wchar.h
+++ /dev/null
@@ -1,136 +0,0 @@
-// -*- C++ -*-
-//===--------------------------- wchar.h ----------------------------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#if defined(__need_wint_t) || defined(__need_mbstate_t)
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
-#endif
-
-#include_next <wchar.h>
-
-#elif !defined(_LIBCPP_WCHAR_H)
-#define _LIBCPP_WCHAR_H
-
-/*
-    wchar.h synopsis
-
-Macros:
-
-    NULL
-    WCHAR_MAX
-    WCHAR_MIN
-    WEOF
-
-Types:
-
-    mbstate_t
-    size_t
-    tm
-    wint_t
-
-int fwprintf(FILE* restrict stream, const wchar_t* restrict format, ...);
-int fwscanf(FILE* restrict stream, const wchar_t* restrict format, ...);
-int swprintf(wchar_t* restrict s, size_t n, const wchar_t* restrict format, ...);
-int swscanf(const wchar_t* restrict s, const wchar_t* restrict format, ...);
-int vfwprintf(FILE* restrict stream, const wchar_t* restrict format, va_list arg);
-int vfwscanf(FILE* restrict stream, const wchar_t* restrict format, va_list arg);  // C99
-int vswprintf(wchar_t* restrict s, size_t n, const wchar_t* restrict format, va_list arg);
-int vswscanf(const wchar_t* restrict s, const wchar_t* restrict format, va_list arg);  // C99
-int vwprintf(const wchar_t* restrict format, va_list arg);
-int vwscanf(const wchar_t* restrict format, va_list arg);  // C99
-int wprintf(const wchar_t* restrict format, ...);
-int wscanf(const wchar_t* restrict format, ...);
-wint_t fgetwc(FILE* stream);
-wchar_t* fgetws(wchar_t* restrict s, int n, FILE* restrict stream);
-wint_t fputwc(wchar_t c, FILE* stream);
-int fputws(const wchar_t* restrict s, FILE* restrict stream);
-int fwide(FILE* stream, int mode);
-wint_t getwc(FILE* stream);
-wint_t getwchar();
-wint_t putwc(wchar_t c, FILE* stream);
-wint_t putwchar(wchar_t c);
-wint_t ungetwc(wint_t c, FILE* stream);
-double wcstod(const wchar_t* restrict nptr, wchar_t** restrict endptr);
-float wcstof(const wchar_t* restrict nptr, wchar_t** restrict endptr);         // C99
-long double wcstold(const wchar_t* restrict nptr, wchar_t** restrict endptr);  // C99
-long wcstol(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
-long long wcstoll(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);  // C99
-unsigned long wcstoul(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
-unsigned long long wcstoull(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);  // C99
-wchar_t* wcscpy(wchar_t* restrict s1, const wchar_t* restrict s2);
-wchar_t* wcsncpy(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
-wchar_t* wcscat(wchar_t* restrict s1, const wchar_t* restrict s2);
-wchar_t* wcsncat(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
-int wcscmp(const wchar_t* s1, const wchar_t* s2);
-int wcscoll(const wchar_t* s1, const wchar_t* s2);
-int wcsncmp(const wchar_t* s1, const wchar_t* s2, size_t n);
-size_t wcsxfrm(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
-const wchar_t* wcschr(const wchar_t* s, wchar_t c);
-      wchar_t* wcschr(      wchar_t* s, wchar_t c);
-size_t wcscspn(const wchar_t* s1, const wchar_t* s2);
-size_t wcslen(const wchar_t* s);
-const wchar_t* wcspbrk(const wchar_t* s1, const wchar_t* s2);
-      wchar_t* wcspbrk(      wchar_t* s1, const wchar_t* s2);
-const wchar_t* wcsrchr(const wchar_t* s, wchar_t c);
-      wchar_t* wcsrchr(      wchar_t* s, wchar_t c);
-size_t wcsspn(const wchar_t* s1, const wchar_t* s2);
-const wchar_t* wcsstr(const wchar_t* s1, const wchar_t* s2);
-      wchar_t* wcsstr(      wchar_t* s1, const wchar_t* s2);
-wchar_t* wcstok(wchar_t* restrict s1, const wchar_t* restrict s2, wchar_t** restrict ptr);
-const wchar_t* wmemchr(const wchar_t* s, wchar_t c, size_t n);
-      wchar_t* wmemchr(      wchar_t* s, wchar_t c, size_t n);
-int wmemcmp(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
-wchar_t* wmemcpy(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
-wchar_t* wmemmove(wchar_t* s1, const wchar_t* s2, size_t n);
-wchar_t* wmemset(wchar_t* s, wchar_t c, size_t n);
-size_t wcsftime(wchar_t* restrict s, size_t maxsize, const wchar_t* restrict format,
-                const tm* restrict timeptr);
-wint_t btowc(int c);
-int wctob(wint_t c);
-int mbsinit(const mbstate_t* ps);
-size_t mbrlen(const char* restrict s, size_t n, mbstate_t* restrict ps);
-size_t mbrtowc(wchar_t* restrict pwc, const char* restrict s, size_t n, mbstate_t* restrict ps);
-size_t wcrtomb(char* restrict s, wchar_t wc, mbstate_t* restrict ps);
-size_t mbsrtowcs(wchar_t* restrict dst, const char** restrict src, size_t len,
-                 mbstate_t* restrict ps);
-size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
-                 mbstate_t* restrict ps);
-
-*/
-
-#include <__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
-#endif
-
-#ifdef __cplusplus
-#define __CORRECT_ISO_CPP_WCHAR_H_PROTO
-#endif
-
-#include_next <wchar.h>
-
-// Let <cwchar> know if we have const-correct overloads for wcschr and friends.
-#if defined(_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_)
-#  define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1
-#elif defined(__GLIBC_PREREQ)
-#  if __GLIBC_PREREQ(2, 10)
-#    define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1
-#  endif
-#endif
-
-#if defined(__cplusplus) && (defined(_LIBCPP_MSVCRT) || defined(__MINGW32__))
-extern "C++" {
-#include <support/win32/support.h> // pull in *swprintf defines
-}  // extern "C++"
-#endif  // __cplusplus && _LIBCPP_MSVCRT
-
-#endif  // _LIBCPP_WCHAR_H
diff --git a/test/std/depr/depr.c.headers/wchar_h.pass.cpp b/test/std/depr/depr.c.headers/wchar_h.pass.cpp
index 3ff1318..031fd1f 100644
--- a/test/std/depr/depr.c.headers/wchar_h.pass.cpp
+++ b/test/std/depr/depr.c.headers/wchar_h.pass.cpp
@@ -28,9 +28,13 @@
 #error WEOF not defined
 #endif
 
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wmissing-braces"
+#endif
+
 int main()
 {
-    mbstate_t mb = {0};
+    mbstate_t mb = {};
     size_t s = 0;
     tm *tm = 0;
     wint_t w = 0;
@@ -50,13 +54,19 @@
     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), "");
@@ -73,19 +83,14 @@
     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), "");
@@ -100,16 +105,4 @@
     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
 }