[libc++] Refactor the std/depr C headers tests
authorLouis Dionne <ldionne.2@gmail.com>
Wed, 1 Mar 2023 19:45:17 +0000 (14:45 -0500)
committerLouis Dionne <ldionne.2@gmail.com>
Wed, 1 Mar 2023 19:55:05 +0000 (14:55 -0500)
Move multiple tests to .compile.pass.cpp when they were not running
anything and reindent a bit more consistently.

27 files changed:
libcxx/test/std/depr/depr.c.headers/assert_h.pass.cpp
libcxx/test/std/depr/depr.c.headers/ciso646.compile.pass.cpp [moved from libcxx/test/std/depr/depr.c.headers/ciso646.pass.cpp with 85% similarity]
libcxx/test/std/depr/depr.c.headers/complex_h.compile.pass.cpp [moved from libcxx/test/std/depr/depr.c.headers/complex.h.pass.cpp with 79% similarity]
libcxx/test/std/depr/depr.c.headers/ctype_h.pass.cpp
libcxx/test/std/depr/depr.c.headers/errno_h.compile.pass.cpp [moved from libcxx/test/std/depr/depr.c.headers/errno_h.pass.cpp with 90% similarity]
libcxx/test/std/depr/depr.c.headers/fenv_h.compile.pass.cpp [moved from libcxx/test/std/depr/depr.c.headers/fenv_h.pass.cpp with 51% similarity]
libcxx/test/std/depr/depr.c.headers/float_h.compile.pass.cpp [moved from libcxx/test/std/depr/depr.c.headers/float_h.pass.cpp with 98% similarity]
libcxx/test/std/depr/depr.c.headers/inttypes_h.pass.cpp
libcxx/test/std/depr/depr.c.headers/iso646_h.compile.pass.cpp [moved from libcxx/test/std/depr/depr.c.headers/iso646_h.pass.cpp with 81% similarity]
libcxx/test/std/depr/depr.c.headers/limits_h.compile.pass.cpp [moved from libcxx/test/std/depr/depr.c.headers/limits_h.pass.cpp with 95% similarity]
libcxx/test/std/depr/depr.c.headers/locale_h.compile.pass.cpp [moved from libcxx/test/std/depr/depr.c.headers/locale_h.pass.cpp with 76% similarity]
libcxx/test/std/depr/depr.c.headers/setjmp_h.compile.pass.cpp [moved from libcxx/test/std/depr/depr.c.headers/setjmp_h.pass.cpp with 64% similarity]
libcxx/test/std/depr/depr.c.headers/signal_h.compile.pass.cpp [moved from libcxx/test/std/depr/depr.c.headers/signal_h.pass.cpp with 75% similarity]
libcxx/test/std/depr/depr.c.headers/stdarg_h.compile.pass.cpp [moved from libcxx/test/std/depr/depr.c.headers/stdarg_h.pass.cpp with 90% similarity]
libcxx/test/std/depr/depr.c.headers/stdbool_h.compile.pass.cpp [moved from libcxx/test/std/depr/depr.c.headers/stdbool_h.pass.cpp with 91% similarity]
libcxx/test/std/depr/depr.c.headers/stddef_h.pass.cpp
libcxx/test/std/depr/depr.c.headers/stdint_h.pass.cpp
libcxx/test/std/depr/depr.c.headers/stdio_h.pass.cpp
libcxx/test/std/depr/depr.c.headers/stdlib_h.pass.cpp
libcxx/test/std/depr/depr.c.headers/string_h.pass.cpp
libcxx/test/std/depr/depr.c.headers/tgmath_h.pass.cpp
libcxx/test/std/depr/depr.c.headers/time_h.compile.pass.cpp [new file with mode: 0644]
libcxx/test/std/depr/depr.c.headers/time_h.pass.cpp [deleted file]
libcxx/test/std/depr/depr.c.headers/wchar_h.compile.pass.cpp [new file with mode: 0644]
libcxx/test/std/depr/depr.c.headers/wchar_h.pass.cpp [deleted file]
libcxx/test/std/depr/depr.c.headers/wctype_h.compile.pass.cpp [new file with mode: 0644]
libcxx/test/std/depr/depr.c.headers/wctype_h.pass.cpp [deleted file]

index 364e931..8d1b883 100644 (file)
 
 #include <assert.h>
 
-#include "test_macros.h"
-
 #ifndef assert
 #error assert not defined
 #endif
 
-int main(int, char**)
-{
+int main(int, char**) {
+  assert(true);
 
   return 0;
 }
 
 #include <complex.h>
 
-#include "test_macros.h"
-
-int main(int, char**)
-{
-    std::complex<double> d;
-    (void)d;
-
-  return 0;
-}
+std::complex<double> d;
index b5deeee..94bff2e 100644 (file)
@@ -12,8 +12,6 @@
 #include <type_traits>
 #include <cassert>
 
-#include "test_macros.h"
-
 #ifdef isalnum
 #error isalnum defined
 #endif
 #error toupper defined
 #endif
 
-int main(int, char**)
-{
-    static_assert((std::is_same<decltype(isalnum(0)), int>::value), "");
-    static_assert((std::is_same<decltype(isalpha(0)), int>::value), "");
-    static_assert((std::is_same<decltype(isblank(0)), int>::value), "");
-    static_assert((std::is_same<decltype(iscntrl(0)), int>::value), "");
-    static_assert((std::is_same<decltype(isdigit(0)), int>::value), "");
-    static_assert((std::is_same<decltype(isgraph(0)), int>::value), "");
-    static_assert((std::is_same<decltype(islower(0)), int>::value), "");
-    static_assert((std::is_same<decltype(isprint(0)), int>::value), "");
-    static_assert((std::is_same<decltype(ispunct(0)), int>::value), "");
-    static_assert((std::is_same<decltype(isspace(0)), int>::value), "");
-    static_assert((std::is_same<decltype(isupper(0)), int>::value), "");
-    static_assert((std::is_same<decltype(isxdigit(0)), int>::value), "");
-    static_assert((std::is_same<decltype(tolower(0)), int>::value), "");
-    static_assert((std::is_same<decltype(toupper(0)), int>::value), "");
-
-    assert(isalnum('a'));
-    assert(isalpha('a'));
-    assert(isblank(' '));
-    assert(!iscntrl(' '));
-    assert(!isdigit('a'));
-    assert(isgraph('a'));
-    assert(islower('a'));
-    assert(isprint('a'));
-    assert(!ispunct('a'));
-    assert(!isspace('a'));
-    assert(!isupper('a'));
-    assert(isxdigit('a'));
-    assert(tolower('A') == 'a');
-    assert(toupper('a') == 'A');
+int main(int, char**) {
+  static_assert(std::is_same<decltype(isalnum(0)), int>::value, "");
+  static_assert(std::is_same<decltype(isalpha(0)), int>::value, "");
+  static_assert(std::is_same<decltype(isblank(0)), int>::value, "");
+  static_assert(std::is_same<decltype(iscntrl(0)), int>::value, "");
+  static_assert(std::is_same<decltype(isdigit(0)), int>::value, "");
+  static_assert(std::is_same<decltype(isgraph(0)), int>::value, "");
+  static_assert(std::is_same<decltype(islower(0)), int>::value, "");
+  static_assert(std::is_same<decltype(isprint(0)), int>::value, "");
+  static_assert(std::is_same<decltype(ispunct(0)), int>::value, "");
+  static_assert(std::is_same<decltype(isspace(0)), int>::value, "");
+  static_assert(std::is_same<decltype(isupper(0)), int>::value, "");
+  static_assert(std::is_same<decltype(isxdigit(0)), int>::value, "");
+  static_assert(std::is_same<decltype(tolower(0)), int>::value, "");
+  static_assert(std::is_same<decltype(toupper(0)), int>::value, "");
+
+  assert(isalnum('a'));
+  assert(isalpha('a'));
+  assert(isblank(' '));
+  assert(!iscntrl(' '));
+  assert(!isdigit('a'));
+  assert(isgraph('a'));
+  assert(islower('a'));
+  assert(isprint('a'));
+  assert(!ispunct('a'));
+  assert(!isspace('a'));
+  assert(!isupper('a'));
+  assert(isxdigit('a'));
+  assert(tolower('A') == 'a');
+  assert(toupper('a') == 'A');
 
   return 0;
 }
@@ -10,8 +10,6 @@
 
 #include <errno.h>
 
-#include "test_macros.h"
-
 #ifndef EDOM
 #error EDOM not defined
 #endif
@@ -27,9 +25,3 @@
 #ifndef errno
 #error errno not defined
 #endif
-
-int main(int, char**)
-{
-
-  return 0;
-}
@@ -11,8 +11,6 @@
 #include <fenv.h>
 #include <type_traits>
 
-#include "test_macros.h"
-
 #ifndef FE_DIVBYZERO
 #error FE_DIVBYZERO not defined
 #endif
 #error FE_DFL_ENV not defined
 #endif
 
-int main(int, char**)
-{
-    fenv_t fenv = {};
-    fexcept_t fex = 0;
-    static_assert((std::is_same<decltype(::feclearexcept(0)), int>::value), "");
-    static_assert((std::is_same<decltype(::fegetexceptflag(&fex, 0)), int>::value), "");
-    static_assert((std::is_same<decltype(::feraiseexcept(0)), int>::value), "");
-    static_assert((std::is_same<decltype(::fesetexceptflag(&fex, 0)), int>::value), "");
-    static_assert((std::is_same<decltype(::fetestexcept(0)), int>::value), "");
-    static_assert((std::is_same<decltype(::fegetround()), int>::value), "");
-    static_assert((std::is_same<decltype(::fesetround(0)), int>::value), "");
-    static_assert((std::is_same<decltype(::fegetenv(&fenv)), int>::value), "");
-    static_assert((std::is_same<decltype(::feholdexcept(&fenv)), int>::value), "");
-    static_assert((std::is_same<decltype(::fesetenv(&fenv)), int>::value), "");
-    static_assert((std::is_same<decltype(::feupdateenv(&fenv)), int>::value), "");
-
-  return 0;
-}
+fenv_t fenv = {};
+fexcept_t fex = 0;
+static_assert(std::is_same<decltype(::feclearexcept(0)), int>::value, "");
+static_assert(std::is_same<decltype(::fegetexceptflag(&fex, 0)), int>::value, "");
+static_assert(std::is_same<decltype(::feraiseexcept(0)), int>::value, "");
+static_assert(std::is_same<decltype(::fesetexceptflag(&fex, 0)), int>::value, "");
+static_assert(std::is_same<decltype(::fetestexcept(0)), int>::value, "");
+static_assert(std::is_same<decltype(::fegetround()), int>::value, "");
+static_assert(std::is_same<decltype(::fesetround(0)), int>::value, "");
+static_assert(std::is_same<decltype(::fegetenv(&fenv)), int>::value, "");
+static_assert(std::is_same<decltype(::feholdexcept(&fenv)), int>::value, "");
+static_assert(std::is_same<decltype(::fesetenv(&fenv)), int>::value, "");
+static_assert(std::is_same<decltype(::feupdateenv(&fenv)), int>::value, "");
index b9f9a58..dc47114 100644 (file)
 #error SCNxPTR not defined
 #endif
 
-template <class T> void test()
-{
+template <class T>
+void test() {
     T t = 0;
     ((void)t); // Prevent unused warning
 }
 
-int main(int, char**)
-{
+int main(int, char**) {
     test<int8_t >();
     test<int16_t>();
     test<int32_t>();
@@ -917,8 +916,8 @@ int main(int, char**)
     test<uintmax_t>();
 
     {
-    imaxdiv_t  i1 = {};
-    ((void)i1); // Prevent unused warning
+        imaxdiv_t  i1 = {};
+        ((void)i1); // Prevent unused warning
     }
 
     intmax_t i = 0;
@@ -932,5 +931,5 @@ int main(int, char**)
     static_assert((std::is_same<decltype(wcstoumax(L"", (wchar_t**)0, 0)), uintmax_t>::value), "");
 #endif
 
-  return 0;
+    return 0;
 }
@@ -9,12 +9,3 @@
 // <iso646.h>
 
 #include <iso646.h>
-
-#include "test_macros.h"
-
-int main(int, char**)
-{
-    // Nothing to test
-
-  return 0;
-}
@@ -10,8 +10,6 @@
 
 #include <limits.h>
 
-#include "test_macros.h"
-
 #ifndef CHAR_BIT
 #error CHAR_BIT not defined
 #endif
@@ -87,9 +85,3 @@
 #ifndef ULLONG_MAX
 #error ULLONG_MAX not defined
 #endif
-
-int main(int, char**)
-{
-
-  return 0;
-}
@@ -13,8 +13,6 @@
 #include <locale.h>
 #include <type_traits>
 
-#include "test_macros.h"
-
 #ifndef LC_ALL
 #error LC_ALL not defined
 #endif
 #error NULL not defined
 #endif
 
-int main(int, char**)
-{
-    lconv lc; ((void)lc);
-    static_assert((std::is_same<decltype(setlocale(0, "")), char*>::value), "");
-    static_assert((std::is_same<decltype(localeconv()), lconv*>::value), "");
-
-    return 0;
-}
+lconv lc;
+static_assert((std::is_same<decltype(setlocale(0, "")), char*>::value), "");
+static_assert((std::is_same<decltype(localeconv()), lconv*>::value), "");
 #include <setjmp.h>
 #include <type_traits>
 
-#include "test_macros.h"
-
 #ifndef setjmp
 #error setjmp not defined
 #endif
 
-int main(int, char**)
-{
-    jmp_buf jb;
-    ((void)jb); // Prevent unused warning
-    static_assert((std::is_same<decltype(longjmp(jb, 0)), void>::value),
-                  "std::is_same<decltype(longjmp(jb, 0)), void>::value");
-
-  return 0;
-}
+jmp_buf jb;
+static_assert(std::is_same<decltype(longjmp(jb, 0)), void>::value, "");
@@ -11,8 +11,6 @@
 #include <signal.h>
 #include <type_traits>
 
-#include "test_macros.h"
-
 #ifndef SIG_DFL
 #error SIG_DFL not defined
 #endif
 #error SIGTERM not defined
 #endif
 
-int main(int, char**)
-{
-    sig_atomic_t sig; ((void)sig);
-    typedef void (*func)(int);
-    static_assert((std::is_same<decltype(signal(0, (func)0)), func>::value), "");
-    static_assert((std::is_same<decltype(raise(0)), int>::value), "");
-
-  return 0;
-}
+sig_atomic_t sig;
+typedef void (*func)(int);
+static_assert((std::is_same<decltype(signal(0, (func)0)), func>::value), "");
+static_assert((std::is_same<decltype(raise(0)), int>::value), "");
 #error va_start not defined
 #endif
 
-int main(int, char**)
-{
-    va_list va;
-    ((void)va);
-
-  return 0;
-}
+va_list va;
@@ -10,8 +10,6 @@
 
 #include <stdbool.h>
 
-#include "test_macros.h"
-
 #ifndef __bool_true_false_are_defined
 #error __bool_true_false_are_defined not defined
 #endif
@@ -27,9 +25,3 @@
 #ifdef false
 #error false should not be defined
 #endif
-
-int main(int, char**)
-{
-
-  return 0;
-}
index 1fe48b5..43db797 100644 (file)
@@ -22,8 +22,7 @@
 #error offsetof not defined
 #endif
 
-int main(int, char**)
-{
+int main(int, char**) {
     void *p = NULL;
     assert(!p);
 
@@ -68,5 +67,5 @@ int main(int, char**)
                   "std::alignment_of<void*>::value");
 #endif
 
-  return 0;
+    return 0;
 }
index 37945ee..9a5faad 100644 (file)
@@ -22,8 +22,7 @@
 #   include <cwctype>
 #endif
 
-int main(int, char**)
-{
+int main(int, char**) {
     // typedef int8_t
     static_assert(sizeof(int8_t)*CHAR_BIT == 8,
                  "sizeof(int8_t)*CHAR_BIT == 8");
@@ -295,5 +294,5 @@ int main(int, char**)
 #error UINTMAX_C not defined
 #endif
 
-  return 0;
+    return 0;
 }
index effb633..293b094 100644 (file)
 TEST_CLANG_DIAGNOSTIC_IGNORED("-Wformat-zero-length")
 TEST_GCC_DIAGNOSTIC_IGNORED("-Wformat-zero-length")
 
-int main(int, char**)
-{
+int main(int, char**) {
     FILE* fp = 0;
     fpos_t fpos = fpos_t();
     size_t s = 0;
@@ -184,5 +183,5 @@ int main(int, char**)
     static_assert((std::is_same<decltype(ferror(fp)), int>::value), "");
     static_assert((std::is_same<decltype(perror("")), void>::value), "");
 
-  return 0;
+    return 0;
 }
index 9d60f94..3fd615d 100644 (file)
@@ -100,8 +100,7 @@ void test_abs() {
   assert(abs(-1.) == 1);
 }
 
-int main(int, char**)
-{
+int main(int, char**) {
     size_t s = 0; ((void)s);
     div_t d; ((void)d);
     ldiv_t ld; ((void)ld);
index 5ccccd4..068aa19 100644 (file)
@@ -18,8 +18,7 @@
 #error NULL not defined
 #endif
 
-int main(int, char**)
-{
+int main(int, char**) {
     // Functions we get directly from the C library (just check the signature)
     {
         size_t s = 0;
index 88e42fb..e29c1a7 100644 (file)
 
 #include <tgmath.h>
 
-#include "test_macros.h"
-
-int main(int, char**)
-{
+int main(int, char**) {
     std::complex<double> cd;
     (void)cd;
     double x = sin(1.0);
     (void)x; // to placate scan-build
 
-  return 0;
+    return 0;
 }
diff --git a/libcxx/test/std/depr/depr.c.headers/time_h.compile.pass.cpp b/libcxx/test/std/depr/depr.c.headers/time_h.compile.pass.cpp
new file mode 100644 (file)
index 0000000..7249911
--- /dev/null
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// test <time.h>
+
+#include <time.h>
+#include <type_traits>
+
+#ifndef NULL
+#error NULL not defined
+#endif
+
+#ifndef CLOCKS_PER_SEC
+#error CLOCKS_PER_SEC not defined
+#endif
+
+clock_t c = 0;
+size_t s = 0;
+time_t t = 0;
+tm tmv = {};
+static_assert((std::is_same<decltype(clock()), clock_t>::value), "");
+static_assert((std::is_same<decltype(difftime(t,t)), double>::value), "");
+static_assert((std::is_same<decltype(mktime(&tmv)), time_t>::value), "");
+static_assert((std::is_same<decltype(time(&t)), time_t>::value), "");
+static_assert((std::is_same<decltype(asctime(&tmv)), char*>::value), "");
+static_assert((std::is_same<decltype(ctime(&t)), char*>::value), "");
+static_assert((std::is_same<decltype(gmtime(&t)), tm*>::value), "");
+static_assert((std::is_same<decltype(localtime(&t)), tm*>::value), "");
+char* c1 = 0;
+const char* c2 = 0;
+static_assert((std::is_same<decltype(strftime(c1,s,c2,&tmv)), size_t>::value), "");
diff --git a/libcxx/test/std/depr/depr.c.headers/time_h.pass.cpp b/libcxx/test/std/depr/depr.c.headers/time_h.pass.cpp
deleted file mode 100644 (file)
index 31aff19..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// test <time.h>
-
-#include <time.h>
-#include <type_traits>
-
-#include "test_macros.h"
-
-#ifndef NULL
-#error NULL not defined
-#endif
-
-#ifndef CLOCKS_PER_SEC
-#error CLOCKS_PER_SEC not defined
-#endif
-
-int main(int, char**)
-{
-    clock_t c = 0; ((void)c);
-    size_t s = 0;
-    time_t t = 0;
-    tm tmv = {};
-    static_assert((std::is_same<decltype(clock()), clock_t>::value), "");
-    static_assert((std::is_same<decltype(difftime(t,t)), double>::value), "");
-    static_assert((std::is_same<decltype(mktime(&tmv)), time_t>::value), "");
-    static_assert((std::is_same<decltype(time(&t)), time_t>::value), "");
-    static_assert((std::is_same<decltype(asctime(&tmv)), char*>::value), "");
-    static_assert((std::is_same<decltype(ctime(&t)), char*>::value), "");
-    static_assert((std::is_same<decltype(gmtime(&t)), tm*>::value), "");
-    static_assert((std::is_same<decltype(localtime(&t)), tm*>::value), "");
-    char* c1 = 0;
-    const char* c2 = 0;
-    static_assert((std::is_same<decltype(strftime(c1,s,c2,&tmv)), size_t>::value), "");
-
-  return 0;
-}
diff --git a/libcxx/test/std/depr/depr.c.headers/wchar_h.compile.pass.cpp b/libcxx/test/std/depr/depr.c.headers/wchar_h.compile.pass.cpp
new file mode 100644 (file)
index 0000000..ae08ebd
--- /dev/null
@@ -0,0 +1,114 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// XFAIL: no-wide-characters
+
+// <wchar.h>
+
+#include <wchar.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <type_traits>
+
+#include "test_macros.h"
+
+#ifndef NULL
+#error NULL not defined
+#endif
+
+#ifndef WCHAR_MAX
+#error WCHAR_MAX not defined
+#endif
+
+#ifndef WCHAR_MIN
+#error WCHAR_MIN not defined
+#endif
+
+#ifndef WEOF
+#error WEOF not defined
+#endif
+
+// mbstate_t comes from the underlying C library; it is defined (in C99) as:
+//    a complete object type other than an array type that can hold the conversion
+//    state information necessary to convert between sequences of multibyte
+//    characters and wide characters
+mbstate_t mb = {};
+size_t s = 0;
+tm *tm = 0;
+wint_t w = 0;
+::FILE* fp = 0;
+::va_list va;
+char* ns = 0;
+wchar_t* ws = 0;
+const wchar_t* cws = 0;
+wchar_t** wsp = 0;
+
+ASSERT_SAME_TYPE(int,                decltype(fwprintf(fp, L"")));
+ASSERT_SAME_TYPE(int,                decltype(fwscanf(fp, L"")));
+ASSERT_SAME_TYPE(int,                decltype(swprintf(ws, s, L"")));
+ASSERT_SAME_TYPE(int,                decltype(swscanf(L"", L"")));
+ASSERT_SAME_TYPE(int,                decltype(vfwprintf(fp, L"", va)));
+ASSERT_SAME_TYPE(int,                decltype(vfwscanf(fp, L"", va)));
+ASSERT_SAME_TYPE(int,                decltype(vswprintf(ws, s, L"", va)));
+ASSERT_SAME_TYPE(int,                decltype(vswscanf(L"", L"", va)));
+ASSERT_SAME_TYPE(wint_t,             decltype(fgetwc(fp)));
+ASSERT_SAME_TYPE(wchar_t*,           decltype(fgetws(ws, 0, fp)));
+ASSERT_SAME_TYPE(wint_t,             decltype(fputwc(L' ', fp)));
+ASSERT_SAME_TYPE(int,                decltype(fputws(L"", fp)));
+ASSERT_SAME_TYPE(int,                decltype(fwide(fp, 0)));
+ASSERT_SAME_TYPE(wint_t,             decltype(getwc(fp)));
+ASSERT_SAME_TYPE(wint_t,             decltype(putwc(L' ', fp)));
+ASSERT_SAME_TYPE(wint_t,             decltype(ungetwc(L' ', fp)));
+ASSERT_SAME_TYPE(double,             decltype(wcstod(L"", wsp)));
+ASSERT_SAME_TYPE(float,              decltype(wcstof(L"", wsp)));
+ASSERT_SAME_TYPE(long double,        decltype(wcstold(L"", wsp)));
+ASSERT_SAME_TYPE(long,               decltype(wcstol(L"", wsp, 0)));
+ASSERT_SAME_TYPE(long long,          decltype(wcstoll(L"", wsp, 0)));
+ASSERT_SAME_TYPE(unsigned long,      decltype(wcstoul(L"", wsp, 0)));
+ASSERT_SAME_TYPE(unsigned long long, decltype(wcstoull(L"", wsp, 0)));
+ASSERT_SAME_TYPE(wchar_t*,           decltype(wcscpy(ws, L"")));
+ASSERT_SAME_TYPE(wchar_t*,           decltype(wcsncpy(ws, L"", s)));
+ASSERT_SAME_TYPE(wchar_t*,           decltype(wcscat(ws, L"")));
+ASSERT_SAME_TYPE(wchar_t*,           decltype(wcsncat(ws, L"", s)));
+ASSERT_SAME_TYPE(int,                decltype(wcscmp(L"", L"")));
+ASSERT_SAME_TYPE(int,                decltype(wcscoll(L"", L"")));
+ASSERT_SAME_TYPE(int,                decltype(wcsncmp(L"", L"", s)));
+ASSERT_SAME_TYPE(size_t,             decltype(wcsxfrm(ws, L"", s)));
+ASSERT_SAME_TYPE(wchar_t*,           decltype(wcschr(ws, L' ')));
+ASSERT_SAME_TYPE(const wchar_t*,     decltype(wcschr(cws, L' ')));
+ASSERT_SAME_TYPE(size_t,             decltype(wcscspn(L"", L"")));
+ASSERT_SAME_TYPE(size_t,             decltype(wcslen(L"")));
+ASSERT_SAME_TYPE(wchar_t*,           decltype(wcspbrk(ws, L"")));
+ASSERT_SAME_TYPE(const wchar_t*,     decltype(wcspbrk(cws, L"")));
+ASSERT_SAME_TYPE(wchar_t*,           decltype(wcsrchr(ws, L' ')));
+ASSERT_SAME_TYPE(const wchar_t*,     decltype(wcsrchr(cws, L' ')));
+ASSERT_SAME_TYPE(size_t,             decltype(wcsspn(L"", L"")));
+ASSERT_SAME_TYPE(wchar_t*,           decltype(wcsstr(ws, L"")));
+ASSERT_SAME_TYPE(const wchar_t*,     decltype(wcsstr(cws, L"")));
+ASSERT_SAME_TYPE(wchar_t*,           decltype(wcstok(ws, L"", wsp)));
+ASSERT_SAME_TYPE(wchar_t*,           decltype(wmemchr(ws, L' ', s)));
+ASSERT_SAME_TYPE(const wchar_t*,     decltype(wmemchr(cws, L' ', s)));
+ASSERT_SAME_TYPE(int,                decltype(wmemcmp(L"", L"", s)));
+ASSERT_SAME_TYPE(wchar_t*,           decltype(wmemcpy(ws, L"", s)));
+ASSERT_SAME_TYPE(wchar_t*,           decltype(wmemmove(ws, L"", s)));
+ASSERT_SAME_TYPE(wchar_t*,           decltype(wmemset(ws, L' ', s)));
+ASSERT_SAME_TYPE(size_t,             decltype(wcsftime(ws, s, L"", tm)));
+ASSERT_SAME_TYPE(wint_t,             decltype(btowc(0)));
+ASSERT_SAME_TYPE(int,                decltype(wctob(w)));
+ASSERT_SAME_TYPE(int,                decltype(mbsinit(&mb)));
+ASSERT_SAME_TYPE(size_t,             decltype(mbrlen("", s, &mb)));
+ASSERT_SAME_TYPE(size_t,             decltype(mbrtowc(ws, "", s, &mb)));
+ASSERT_SAME_TYPE(size_t,             decltype(wcrtomb(ns, L' ', &mb)));
+ASSERT_SAME_TYPE(size_t,             decltype(mbsrtowcs(ws, (const char**)0, s, &mb)));
+ASSERT_SAME_TYPE(size_t,             decltype(wcsrtombs(ns, (const wchar_t**)0, s, &mb)));
+ASSERT_SAME_TYPE(wint_t,             decltype(getwchar()));
+ASSERT_SAME_TYPE(int,                decltype(vwscanf(L"", va)));
+ASSERT_SAME_TYPE(int,                decltype(wscanf(L"")));
+ASSERT_SAME_TYPE(wint_t,             decltype(putwchar(L' ')));
+ASSERT_SAME_TYPE(int,                decltype(vwprintf(L"", va)));
+ASSERT_SAME_TYPE(int,                decltype(wprintf(L"")));
diff --git a/libcxx/test/std/depr/depr.c.headers/wchar_h.pass.cpp b/libcxx/test/std/depr/depr.c.headers/wchar_h.pass.cpp
deleted file mode 100644 (file)
index 78716da..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// XFAIL: no-wide-characters
-
-// <wchar.h>
-
-#include <wchar.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <type_traits>
-
-#include "test_macros.h"
-
-#ifndef NULL
-#error NULL not defined
-#endif
-
-#ifndef WCHAR_MAX
-#error WCHAR_MAX not defined
-#endif
-
-#ifndef WCHAR_MIN
-#error WCHAR_MIN not defined
-#endif
-
-#ifndef WEOF
-#error WEOF not defined
-#endif
-
-int main(int, char**)
-{
-// mbstate_t comes from the underlying C library; it is defined (in C99) as:
-//    a complete object type other than an array type that can hold the conversion
-//    state information necessary to convert between sequences of multibyte
-//    characters and wide characters
-    mbstate_t mb = {};
-    size_t s = 0;
-    tm *tm = 0;
-    wint_t w = 0;
-    ::FILE* fp = 0;
-    ::va_list va;
-    char* ns = 0;
-    wchar_t* ws = 0;
-    const wchar_t* cws = 0;
-    wchar_t** wsp = 0;
-    ((void)mb); // Prevent unused warning
-    ((void)s); // Prevent unused warning
-    ((void)tm); // Prevent unused warning
-    ((void)w); // Prevent unused warning
-    ((void)fp); // Prevent unused warning
-    ((void)va); // Prevent unused warning
-    ((void)ns); // Prevent unused warning
-    ((void)ws); // Prevent unused warning
-    ((void)cws); // Prevent unused warning
-    ((void)wsp); // Prevent unused warning
-    ASSERT_SAME_TYPE(int,                decltype(fwprintf(fp, L"")));
-    ASSERT_SAME_TYPE(int,                decltype(fwscanf(fp, L"")));
-    ASSERT_SAME_TYPE(int,                decltype(swprintf(ws, s, L"")));
-    ASSERT_SAME_TYPE(int,                decltype(swscanf(L"", L"")));
-    ASSERT_SAME_TYPE(int,                decltype(vfwprintf(fp, L"", va)));
-    ASSERT_SAME_TYPE(int,                decltype(vfwscanf(fp, L"", va)));
-    ASSERT_SAME_TYPE(int,                decltype(vswprintf(ws, s, L"", va)));
-    ASSERT_SAME_TYPE(int,                decltype(vswscanf(L"", L"", va)));
-    ASSERT_SAME_TYPE(wint_t,             decltype(fgetwc(fp)));
-    ASSERT_SAME_TYPE(wchar_t*,           decltype(fgetws(ws, 0, fp)));
-    ASSERT_SAME_TYPE(wint_t,             decltype(fputwc(L' ', fp)));
-    ASSERT_SAME_TYPE(int,                decltype(fputws(L"", fp)));
-    ASSERT_SAME_TYPE(int,                decltype(fwide(fp, 0)));
-    ASSERT_SAME_TYPE(wint_t,             decltype(getwc(fp)));
-    ASSERT_SAME_TYPE(wint_t,             decltype(putwc(L' ', fp)));
-    ASSERT_SAME_TYPE(wint_t,             decltype(ungetwc(L' ', fp)));
-    ASSERT_SAME_TYPE(double,             decltype(wcstod(L"", wsp)));
-    ASSERT_SAME_TYPE(float,              decltype(wcstof(L"", wsp)));
-    ASSERT_SAME_TYPE(long double,        decltype(wcstold(L"", wsp)));
-    ASSERT_SAME_TYPE(long,               decltype(wcstol(L"", wsp, 0)));
-    ASSERT_SAME_TYPE(long long,          decltype(wcstoll(L"", wsp, 0)));
-    ASSERT_SAME_TYPE(unsigned long,      decltype(wcstoul(L"", wsp, 0)));
-    ASSERT_SAME_TYPE(unsigned long long, decltype(wcstoull(L"", wsp, 0)));
-    ASSERT_SAME_TYPE(wchar_t*,           decltype(wcscpy(ws, L"")));
-    ASSERT_SAME_TYPE(wchar_t*,           decltype(wcsncpy(ws, L"", s)));
-    ASSERT_SAME_TYPE(wchar_t*,           decltype(wcscat(ws, L"")));
-    ASSERT_SAME_TYPE(wchar_t*,           decltype(wcsncat(ws, L"", s)));
-    ASSERT_SAME_TYPE(int,                decltype(wcscmp(L"", L"")));
-    ASSERT_SAME_TYPE(int,                decltype(wcscoll(L"", L"")));
-    ASSERT_SAME_TYPE(int,                decltype(wcsncmp(L"", L"", s)));
-    ASSERT_SAME_TYPE(size_t,             decltype(wcsxfrm(ws, L"", s)));
-    ASSERT_SAME_TYPE(wchar_t*,           decltype(wcschr(ws, L' ')));
-    ASSERT_SAME_TYPE(const wchar_t*,     decltype(wcschr(cws, L' ')));
-    ASSERT_SAME_TYPE(size_t,             decltype(wcscspn(L"", L"")));
-    ASSERT_SAME_TYPE(size_t,             decltype(wcslen(L"")));
-    ASSERT_SAME_TYPE(wchar_t*,           decltype(wcspbrk(ws, L"")));
-    ASSERT_SAME_TYPE(const wchar_t*,     decltype(wcspbrk(cws, L"")));
-    ASSERT_SAME_TYPE(wchar_t*,           decltype(wcsrchr(ws, L' ')));
-    ASSERT_SAME_TYPE(const wchar_t*,     decltype(wcsrchr(cws, L' ')));
-    ASSERT_SAME_TYPE(size_t,             decltype(wcsspn(L"", L"")));
-    ASSERT_SAME_TYPE(wchar_t*,           decltype(wcsstr(ws, L"")));
-    ASSERT_SAME_TYPE(const wchar_t*,     decltype(wcsstr(cws, L"")));
-    ASSERT_SAME_TYPE(wchar_t*,           decltype(wcstok(ws, L"", wsp)));
-    ASSERT_SAME_TYPE(wchar_t*,           decltype(wmemchr(ws, L' ', s)));
-    ASSERT_SAME_TYPE(const wchar_t*,     decltype(wmemchr(cws, L' ', s)));
-    ASSERT_SAME_TYPE(int,                decltype(wmemcmp(L"", L"", s)));
-    ASSERT_SAME_TYPE(wchar_t*,           decltype(wmemcpy(ws, L"", s)));
-    ASSERT_SAME_TYPE(wchar_t*,           decltype(wmemmove(ws, L"", s)));
-    ASSERT_SAME_TYPE(wchar_t*,           decltype(wmemset(ws, L' ', s)));
-    ASSERT_SAME_TYPE(size_t,             decltype(wcsftime(ws, s, L"", tm)));
-    ASSERT_SAME_TYPE(wint_t,             decltype(btowc(0)));
-    ASSERT_SAME_TYPE(int,                decltype(wctob(w)));
-    ASSERT_SAME_TYPE(int,                decltype(mbsinit(&mb)));
-    ASSERT_SAME_TYPE(size_t,             decltype(mbrlen("", s, &mb)));
-    ASSERT_SAME_TYPE(size_t,             decltype(mbrtowc(ws, "", s, &mb)));
-    ASSERT_SAME_TYPE(size_t,             decltype(wcrtomb(ns, L' ', &mb)));
-    ASSERT_SAME_TYPE(size_t,             decltype(mbsrtowcs(ws, (const char**)0, s, &mb)));
-    ASSERT_SAME_TYPE(size_t,             decltype(wcsrtombs(ns, (const wchar_t**)0, s, &mb)));
-    ASSERT_SAME_TYPE(wint_t,             decltype(getwchar()));
-    ASSERT_SAME_TYPE(int,                decltype(vwscanf(L"", va)));
-    ASSERT_SAME_TYPE(int,                decltype(wscanf(L"")));
-    ASSERT_SAME_TYPE(wint_t,             decltype(putwchar(L' ')));
-    ASSERT_SAME_TYPE(int,                decltype(vwprintf(L"", va)));
-    ASSERT_SAME_TYPE(int,                decltype(wprintf(L"")));
-
-    return 0;
-}
diff --git a/libcxx/test/std/depr/depr.c.headers/wctype_h.compile.pass.cpp b/libcxx/test/std/depr/depr.c.headers/wctype_h.compile.pass.cpp
new file mode 100644 (file)
index 0000000..d9a175c
--- /dev/null
@@ -0,0 +1,114 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// XFAIL: no-wide-characters
+
+// <wctype.h>
+
+#include <wctype.h>
+#include <type_traits>
+
+#include "test_macros.h"
+
+#ifndef WEOF
+#error WEOF not defined
+#endif
+
+#ifdef iswalnum
+#error iswalnum defined
+#endif
+
+#ifdef iswalpha
+#error iswalpha defined
+#endif
+
+#ifdef iswblank
+#error iswblank defined
+#endif
+
+#ifdef iswcntrl
+#error iswcntrl defined
+#endif
+
+#ifdef iswdigit
+#error iswdigit defined
+#endif
+
+#ifdef iswgraph
+#error iswgraph defined
+#endif
+
+#ifdef iswlower
+#error iswlower defined
+#endif
+
+#ifdef iswprint
+#error iswprint defined
+#endif
+
+#ifdef iswpunct
+#error iswpunct defined
+#endif
+
+#ifdef iswspace
+#error iswspace defined
+#endif
+
+#ifdef iswupper
+#error iswupper defined
+#endif
+
+#ifdef iswxdigit
+#error iswxdigit defined
+#endif
+
+#ifdef iswctype
+#error iswctype defined
+#endif
+
+#ifdef wctype
+#error wctype defined
+#endif
+
+#ifdef towlower
+#error towlower defined
+#endif
+
+#ifdef towupper
+#error towupper defined
+#endif
+
+#ifdef towctrans
+#error towctrans defined
+#endif
+
+#ifdef wctrans
+#error wctrans defined
+#endif
+
+wint_t w = 0;
+wctrans_t wctr = 0;
+wctype_t wct = 0;
+static_assert((std::is_same<decltype(iswalnum(w)), int>::value), "");
+static_assert((std::is_same<decltype(iswalpha(w)), int>::value), "");
+static_assert((std::is_same<decltype(iswblank(w)), int>::value), "");
+static_assert((std::is_same<decltype(iswcntrl(w)), int>::value), "");
+static_assert((std::is_same<decltype(iswdigit(w)), int>::value), "");
+static_assert((std::is_same<decltype(iswgraph(w)), int>::value), "");
+static_assert((std::is_same<decltype(iswlower(w)), int>::value), "");
+static_assert((std::is_same<decltype(iswprint(w)), int>::value), "");
+static_assert((std::is_same<decltype(iswpunct(w)), int>::value), "");
+static_assert((std::is_same<decltype(iswspace(w)), int>::value), "");
+static_assert((std::is_same<decltype(iswupper(w)), int>::value), "");
+static_assert((std::is_same<decltype(iswxdigit(w)), int>::value), "");
+static_assert((std::is_same<decltype(iswctype(w, wct)), int>::value), "");
+static_assert((std::is_same<decltype(wctype("")), wctype_t>::value), "");
+static_assert((std::is_same<decltype(towlower(w)), wint_t>::value), "");
+static_assert((std::is_same<decltype(towupper(w)), wint_t>::value), "");
+static_assert((std::is_same<decltype(towctrans(w, wctr)), wint_t>::value), "");
+static_assert((std::is_same<decltype(wctrans("")), wctrans_t>::value), "");
diff --git a/libcxx/test/std/depr/depr.c.headers/wctype_h.pass.cpp b/libcxx/test/std/depr/depr.c.headers/wctype_h.pass.cpp
deleted file mode 100644 (file)
index c40623a..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// XFAIL: no-wide-characters
-
-// <wctype.h>
-
-#include <wctype.h>
-#include <type_traits>
-
-#include "test_macros.h"
-
-#ifndef WEOF
-#error WEOF not defined
-#endif
-
-#ifdef iswalnum
-#error iswalnum defined
-#endif
-
-#ifdef iswalpha
-#error iswalpha defined
-#endif
-
-#ifdef iswblank
-#error iswblank defined
-#endif
-
-#ifdef iswcntrl
-#error iswcntrl defined
-#endif
-
-#ifdef iswdigit
-#error iswdigit defined
-#endif
-
-#ifdef iswgraph
-#error iswgraph defined
-#endif
-
-#ifdef iswlower
-#error iswlower defined
-#endif
-
-#ifdef iswprint
-#error iswprint defined
-#endif
-
-#ifdef iswpunct
-#error iswpunct defined
-#endif
-
-#ifdef iswspace
-#error iswspace defined
-#endif
-
-#ifdef iswupper
-#error iswupper defined
-#endif
-
-#ifdef iswxdigit
-#error iswxdigit defined
-#endif
-
-#ifdef iswctype
-#error iswctype defined
-#endif
-
-#ifdef wctype
-#error wctype defined
-#endif
-
-#ifdef towlower
-#error towlower defined
-#endif
-
-#ifdef towupper
-#error towupper defined
-#endif
-
-#ifdef towctrans
-#error towctrans defined
-#endif
-
-#ifdef wctrans
-#error wctrans defined
-#endif
-
-int main(int, char**)
-{
-    wint_t w = 0;
-    wctrans_t wctr = 0;
-    wctype_t wct = 0;
-    static_assert((std::is_same<decltype(iswalnum(w)), int>::value), "");
-    static_assert((std::is_same<decltype(iswalpha(w)), int>::value), "");
-    static_assert((std::is_same<decltype(iswblank(w)), int>::value), "");
-    static_assert((std::is_same<decltype(iswcntrl(w)), int>::value), "");
-    static_assert((std::is_same<decltype(iswdigit(w)), int>::value), "");
-    static_assert((std::is_same<decltype(iswgraph(w)), int>::value), "");
-    static_assert((std::is_same<decltype(iswlower(w)), int>::value), "");
-    static_assert((std::is_same<decltype(iswprint(w)), int>::value), "");
-    static_assert((std::is_same<decltype(iswpunct(w)), int>::value), "");
-    static_assert((std::is_same<decltype(iswspace(w)), int>::value), "");
-    static_assert((std::is_same<decltype(iswupper(w)), int>::value), "");
-    static_assert((std::is_same<decltype(iswxdigit(w)), int>::value), "");
-    static_assert((std::is_same<decltype(iswctype(w, wct)), int>::value), "");
-    static_assert((std::is_same<decltype(wctype("")), wctype_t>::value), "");
-    static_assert((std::is_same<decltype(towlower(w)), wint_t>::value), "");
-    static_assert((std::is_same<decltype(towupper(w)), wint_t>::value), "");
-    static_assert((std::is_same<decltype(towctrans(w, wctr)), wint_t>::value), "");
-    static_assert((std::is_same<decltype(wctrans("")), wctrans_t>::value), "");
-
-  return 0;
-}