diff --git a/libcxx/test/std/depr/depr.c.headers/assert_h.pass.cpp b/libcxx/test/std/depr/depr.c.headers/assert_h.pass.cpp index 364e931dc89248..8d1b8834c1769a 100644 --- a/libcxx/test/std/depr/depr.c.headers/assert_h.pass.cpp +++ b/libcxx/test/std/depr/depr.c.headers/assert_h.pass.cpp @@ -10,14 +10,12 @@ #include -#include "test_macros.h" - #ifndef assert #error assert not defined #endif -int main(int, char**) -{ +int main(int, char**) { + assert(true); return 0; } diff --git a/libcxx/test/std/depr/depr.c.headers/ciso646.pass.cpp b/libcxx/test/std/depr/depr.c.headers/ciso646.compile.pass.cpp similarity index 85% rename from libcxx/test/std/depr/depr.c.headers/ciso646.pass.cpp rename to libcxx/test/std/depr/depr.c.headers/ciso646.compile.pass.cpp index b619499a5dee7c..4dff57f84f202c 100644 --- a/libcxx/test/std/depr/depr.c.headers/ciso646.pass.cpp +++ b/libcxx/test/std/depr/depr.c.headers/ciso646.compile.pass.cpp @@ -9,11 +9,3 @@ // #include - -#include "test_macros.h" - -int main(int, char**) -{ - - return 0; -} diff --git a/libcxx/test/std/depr/depr.c.headers/complex.h.pass.cpp b/libcxx/test/std/depr/depr.c.headers/complex_h.compile.pass.cpp similarity index 79% rename from libcxx/test/std/depr/depr.c.headers/complex.h.pass.cpp rename to libcxx/test/std/depr/depr.c.headers/complex_h.compile.pass.cpp index 92dc58c2df0cf9..00118a6fb6898b 100644 --- a/libcxx/test/std/depr/depr.c.headers/complex.h.pass.cpp +++ b/libcxx/test/std/depr/depr.c.headers/complex_h.compile.pass.cpp @@ -10,12 +10,4 @@ #include -#include "test_macros.h" - -int main(int, char**) -{ - std::complex d; - (void)d; - - return 0; -} +std::complex d; diff --git a/libcxx/test/std/depr/depr.c.headers/ctype_h.pass.cpp b/libcxx/test/std/depr/depr.c.headers/ctype_h.pass.cpp index b5deeee7ae215c..94bff2e1d8ef0f 100644 --- a/libcxx/test/std/depr/depr.c.headers/ctype_h.pass.cpp +++ b/libcxx/test/std/depr/depr.c.headers/ctype_h.pass.cpp @@ -12,8 +12,6 @@ #include #include -#include "test_macros.h" - #ifdef isalnum #error isalnum defined #endif @@ -70,37 +68,36 @@ #error toupper defined #endif -int main(int, char**) -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::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::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::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; } diff --git a/libcxx/test/std/depr/depr.c.headers/errno_h.pass.cpp b/libcxx/test/std/depr/depr.c.headers/errno_h.compile.pass.cpp similarity index 90% rename from libcxx/test/std/depr/depr.c.headers/errno_h.pass.cpp rename to libcxx/test/std/depr/depr.c.headers/errno_h.compile.pass.cpp index faa2c82ab7584d..c2cc69ecd90b5f 100644 --- a/libcxx/test/std/depr/depr.c.headers/errno_h.pass.cpp +++ b/libcxx/test/std/depr/depr.c.headers/errno_h.compile.pass.cpp @@ -10,8 +10,6 @@ #include -#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; -} diff --git a/libcxx/test/std/depr/depr.c.headers/fenv_h.pass.cpp b/libcxx/test/std/depr/depr.c.headers/fenv_h.compile.pass.cpp similarity index 51% rename from libcxx/test/std/depr/depr.c.headers/fenv_h.pass.cpp rename to libcxx/test/std/depr/depr.c.headers/fenv_h.compile.pass.cpp index 28985391dbea31..da030e12835002 100644 --- a/libcxx/test/std/depr/depr.c.headers/fenv_h.pass.cpp +++ b/libcxx/test/std/depr/depr.c.headers/fenv_h.compile.pass.cpp @@ -11,8 +11,6 @@ #include #include -#include "test_macros.h" - #ifndef FE_DIVBYZERO #error FE_DIVBYZERO not defined #endif @@ -57,21 +55,16 @@ #error FE_DFL_ENV not defined #endif -int main(int, char**) -{ - fenv_t fenv = {}; - fexcept_t fex = 0; - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - - return 0; -} +fenv_t fenv = {}; +fexcept_t fex = 0; +static_assert(std::is_same::value, ""); +static_assert(std::is_same::value, ""); +static_assert(std::is_same::value, ""); +static_assert(std::is_same::value, ""); +static_assert(std::is_same::value, ""); +static_assert(std::is_same::value, ""); +static_assert(std::is_same::value, ""); +static_assert(std::is_same::value, ""); +static_assert(std::is_same::value, ""); +static_assert(std::is_same::value, ""); +static_assert(std::is_same::value, ""); diff --git a/libcxx/test/std/depr/depr.c.headers/float_h.pass.cpp b/libcxx/test/std/depr/depr.c.headers/float_h.compile.pass.cpp similarity index 98% rename from libcxx/test/std/depr/depr.c.headers/float_h.pass.cpp rename to libcxx/test/std/depr/depr.c.headers/float_h.compile.pass.cpp index b3f42303e8814c..8a02934350f453 100644 --- a/libcxx/test/std/depr/depr.c.headers/float_h.pass.cpp +++ b/libcxx/test/std/depr/depr.c.headers/float_h.compile.pass.cpp @@ -177,9 +177,3 @@ #error LDBL_TRUE_MIN not defined #endif #endif - -int main(int, char**) -{ - - return 0; -} diff --git a/libcxx/test/std/depr/depr.c.headers/inttypes_h.pass.cpp b/libcxx/test/std/depr/depr.c.headers/inttypes_h.pass.cpp index b9f9a585ed8d3c..dc47114b620da6 100644 --- a/libcxx/test/std/depr/depr.c.headers/inttypes_h.pass.cpp +++ b/libcxx/test/std/depr/depr.c.headers/inttypes_h.pass.cpp @@ -873,14 +873,13 @@ #error SCNxPTR not defined #endif -template void test() -{ +template +void test() { T t = 0; ((void)t); // Prevent unused warning } -int main(int, char**) -{ +int main(int, char**) { test(); test(); test(); @@ -917,8 +916,8 @@ int main(int, char**) test(); { - 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::value), ""); #endif - return 0; + return 0; } diff --git a/libcxx/test/std/depr/depr.c.headers/iso646_h.pass.cpp b/libcxx/test/std/depr/depr.c.headers/iso646_h.compile.pass.cpp similarity index 81% rename from libcxx/test/std/depr/depr.c.headers/iso646_h.pass.cpp rename to libcxx/test/std/depr/depr.c.headers/iso646_h.compile.pass.cpp index 61510feb3c0662..4531ce36e25448 100644 --- a/libcxx/test/std/depr/depr.c.headers/iso646_h.pass.cpp +++ b/libcxx/test/std/depr/depr.c.headers/iso646_h.compile.pass.cpp @@ -9,12 +9,3 @@ // #include - -#include "test_macros.h" - -int main(int, char**) -{ - // Nothing to test - - return 0; -} diff --git a/libcxx/test/std/depr/depr.c.headers/limits_h.pass.cpp b/libcxx/test/std/depr/depr.c.headers/limits_h.compile.pass.cpp similarity index 95% rename from libcxx/test/std/depr/depr.c.headers/limits_h.pass.cpp rename to libcxx/test/std/depr/depr.c.headers/limits_h.compile.pass.cpp index bd0c7b9e0f5354..4738cc4028cf95 100644 --- a/libcxx/test/std/depr/depr.c.headers/limits_h.pass.cpp +++ b/libcxx/test/std/depr/depr.c.headers/limits_h.compile.pass.cpp @@ -10,8 +10,6 @@ #include -#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; -} diff --git a/libcxx/test/std/depr/depr.c.headers/locale_h.pass.cpp b/libcxx/test/std/depr/depr.c.headers/locale_h.compile.pass.cpp similarity index 76% rename from libcxx/test/std/depr/depr.c.headers/locale_h.pass.cpp rename to libcxx/test/std/depr/depr.c.headers/locale_h.compile.pass.cpp index 9848f07a6d0d83..5b87cf29fcdc5a 100644 --- a/libcxx/test/std/depr/depr.c.headers/locale_h.pass.cpp +++ b/libcxx/test/std/depr/depr.c.headers/locale_h.compile.pass.cpp @@ -13,8 +13,6 @@ #include #include -#include "test_macros.h" - #ifndef LC_ALL #error LC_ALL not defined #endif @@ -43,11 +41,6 @@ #error NULL not defined #endif -int main(int, char**) -{ - lconv lc; ((void)lc); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - - return 0; -} +lconv lc; +static_assert((std::is_same::value), ""); +static_assert((std::is_same::value), ""); diff --git a/libcxx/test/std/depr/depr.c.headers/setjmp_h.pass.cpp b/libcxx/test/std/depr/depr.c.headers/setjmp_h.compile.pass.cpp similarity index 64% rename from libcxx/test/std/depr/depr.c.headers/setjmp_h.pass.cpp rename to libcxx/test/std/depr/depr.c.headers/setjmp_h.compile.pass.cpp index 3c938012bdf53b..c8d50be3b414f3 100644 --- a/libcxx/test/std/depr/depr.c.headers/setjmp_h.pass.cpp +++ b/libcxx/test/std/depr/depr.c.headers/setjmp_h.compile.pass.cpp @@ -11,18 +11,9 @@ #include #include -#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::value), - "std::is_same::value"); - - return 0; -} +jmp_buf jb; +static_assert(std::is_same::value, ""); diff --git a/libcxx/test/std/depr/depr.c.headers/signal_h.pass.cpp b/libcxx/test/std/depr/depr.c.headers/signal_h.compile.pass.cpp similarity index 75% rename from libcxx/test/std/depr/depr.c.headers/signal_h.pass.cpp rename to libcxx/test/std/depr/depr.c.headers/signal_h.compile.pass.cpp index 07a729eee69d48..9b18e768e8275a 100644 --- a/libcxx/test/std/depr/depr.c.headers/signal_h.pass.cpp +++ b/libcxx/test/std/depr/depr.c.headers/signal_h.compile.pass.cpp @@ -11,8 +11,6 @@ #include #include -#include "test_macros.h" - #ifndef SIG_DFL #error SIG_DFL not defined #endif @@ -49,12 +47,7 @@ #error SIGTERM not defined #endif -int main(int, char**) -{ - sig_atomic_t sig; ((void)sig); - typedef void (*func)(int); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - - return 0; -} +sig_atomic_t sig; +typedef void (*func)(int); +static_assert((std::is_same::value), ""); +static_assert((std::is_same::value), ""); diff --git a/libcxx/test/std/depr/depr.c.headers/stdarg_h.pass.cpp b/libcxx/test/std/depr/depr.c.headers/stdarg_h.compile.pass.cpp similarity index 90% rename from libcxx/test/std/depr/depr.c.headers/stdarg_h.pass.cpp rename to libcxx/test/std/depr/depr.c.headers/stdarg_h.compile.pass.cpp index feb9c4a460f38e..8ded0f9f987d48 100644 --- a/libcxx/test/std/depr/depr.c.headers/stdarg_h.pass.cpp +++ b/libcxx/test/std/depr/depr.c.headers/stdarg_h.compile.pass.cpp @@ -30,10 +30,4 @@ #error va_start not defined #endif -int main(int, char**) -{ - va_list va; - ((void)va); - - return 0; -} +va_list va; diff --git a/libcxx/test/std/depr/depr.c.headers/stdbool_h.pass.cpp b/libcxx/test/std/depr/depr.c.headers/stdbool_h.compile.pass.cpp similarity index 91% rename from libcxx/test/std/depr/depr.c.headers/stdbool_h.pass.cpp rename to libcxx/test/std/depr/depr.c.headers/stdbool_h.compile.pass.cpp index ca580a8db8e996..79d8b51b8f9905 100644 --- a/libcxx/test/std/depr/depr.c.headers/stdbool_h.pass.cpp +++ b/libcxx/test/std/depr/depr.c.headers/stdbool_h.compile.pass.cpp @@ -10,8 +10,6 @@ #include -#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; -} diff --git a/libcxx/test/std/depr/depr.c.headers/stddef_h.pass.cpp b/libcxx/test/std/depr/depr.c.headers/stddef_h.pass.cpp index 1fe48b5e0a08d7..43db797d2f5eeb 100644 --- a/libcxx/test/std/depr/depr.c.headers/stddef_h.pass.cpp +++ b/libcxx/test/std/depr/depr.c.headers/stddef_h.pass.cpp @@ -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::value"); #endif - return 0; + return 0; } diff --git a/libcxx/test/std/depr/depr.c.headers/stdint_h.pass.cpp b/libcxx/test/std/depr/depr.c.headers/stdint_h.pass.cpp index 37945eea6c40af..9a5faadbb8fd3e 100644 --- a/libcxx/test/std/depr/depr.c.headers/stdint_h.pass.cpp +++ b/libcxx/test/std/depr/depr.c.headers/stdint_h.pass.cpp @@ -22,8 +22,7 @@ # include #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; } diff --git a/libcxx/test/std/depr/depr.c.headers/stdio_h.pass.cpp b/libcxx/test/std/depr/depr.c.headers/stdio_h.pass.cpp index effb633b596aac..293b0944a99283 100644 --- a/libcxx/test/std/depr/depr.c.headers/stdio_h.pass.cpp +++ b/libcxx/test/std/depr/depr.c.headers/stdio_h.pass.cpp @@ -101,8 +101,7 @@ 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::value), ""); static_assert((std::is_same::value), ""); - return 0; + return 0; } diff --git a/libcxx/test/std/depr/depr.c.headers/stdlib_h.pass.cpp b/libcxx/test/std/depr/depr.c.headers/stdlib_h.pass.cpp index 9d60f941b6412f..3fd615d9c7708c 100644 --- a/libcxx/test/std/depr/depr.c.headers/stdlib_h.pass.cpp +++ b/libcxx/test/std/depr/depr.c.headers/stdlib_h.pass.cpp @@ -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); diff --git a/libcxx/test/std/depr/depr.c.headers/string_h.pass.cpp b/libcxx/test/std/depr/depr.c.headers/string_h.pass.cpp index 5ccccd43af8bac..068aa1915e4fc6 100644 --- a/libcxx/test/std/depr/depr.c.headers/string_h.pass.cpp +++ b/libcxx/test/std/depr/depr.c.headers/string_h.pass.cpp @@ -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; diff --git a/libcxx/test/std/depr/depr.c.headers/tgmath_h.pass.cpp b/libcxx/test/std/depr/depr.c.headers/tgmath_h.pass.cpp index 88e42fb3fefda4..e29c1a742e74a6 100644 --- a/libcxx/test/std/depr/depr.c.headers/tgmath_h.pass.cpp +++ b/libcxx/test/std/depr/depr.c.headers/tgmath_h.pass.cpp @@ -10,14 +10,11 @@ #include -#include "test_macros.h" - -int main(int, char**) -{ +int main(int, char**) { std::complex 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 index 00000000000000..724991106770dd --- /dev/null +++ b/libcxx/test/std/depr/depr.c.headers/time_h.compile.pass.cpp @@ -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 + +#include +#include + +#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::value), ""); +static_assert((std::is_same::value), ""); +static_assert((std::is_same::value), ""); +static_assert((std::is_same::value), ""); +static_assert((std::is_same::value), ""); +static_assert((std::is_same::value), ""); +static_assert((std::is_same::value), ""); +static_assert((std::is_same::value), ""); +char* c1 = 0; +const char* c2 = 0; +static_assert((std::is_same::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 index 31aff19c535f01..00000000000000 --- a/libcxx/test/std/depr/depr.c.headers/time_h.pass.cpp +++ /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 - -#include -#include - -#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::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - char* c1 = 0; - const char* c2 = 0; - static_assert((std::is_same::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 index 00000000000000..ae08ebd6ad8215 --- /dev/null +++ b/libcxx/test/std/depr/depr.c.headers/wchar_h.compile.pass.cpp @@ -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 + +// + +#include +#include +#include +#include + +#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 index 78716da2cbd675..00000000000000 --- a/libcxx/test/std/depr/depr.c.headers/wchar_h.pass.cpp +++ /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 - -// - -#include -#include -#include -#include - -#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 index 00000000000000..d9a175cc262810 --- /dev/null +++ b/libcxx/test/std/depr/depr.c.headers/wctype_h.compile.pass.cpp @@ -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 + +// + +#include +#include + +#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::value), ""); +static_assert((std::is_same::value), ""); +static_assert((std::is_same::value), ""); +static_assert((std::is_same::value), ""); +static_assert((std::is_same::value), ""); +static_assert((std::is_same::value), ""); +static_assert((std::is_same::value), ""); +static_assert((std::is_same::value), ""); +static_assert((std::is_same::value), ""); +static_assert((std::is_same::value), ""); +static_assert((std::is_same::value), ""); +static_assert((std::is_same::value), ""); +static_assert((std::is_same::value), ""); +static_assert((std::is_same::value), ""); +static_assert((std::is_same::value), ""); +static_assert((std::is_same::value), ""); +static_assert((std::is_same::value), ""); +static_assert((std::is_same::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 index c40623a9dcacce..00000000000000 --- a/libcxx/test/std/depr/depr.c.headers/wctype_h.pass.cpp +++ /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 - -// - -#include -#include - -#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::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - - return 0; -}