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 --- a/libcxx/test/std/depr/depr.c.headers/ctype_h.pass.cpp +++ b/libcxx/test/std/depr/depr.c.headers/ctype_h.pass.cpp @@ -9,8 +9,8 @@ // #include -#include -#include + +#include "test_macros.h" #ifdef isalnum #error isalnum defined @@ -68,22 +68,24 @@ #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_SAME_TYPE(int, decltype(isalnum(0))); +ASSERT_SAME_TYPE(int, decltype(isalpha(0))); +ASSERT_SAME_TYPE(int, decltype(isblank(0))); +ASSERT_SAME_TYPE(int, decltype(iscntrl(0))); +ASSERT_SAME_TYPE(int, decltype(isdigit(0))); +ASSERT_SAME_TYPE(int, decltype(isgraph(0))); +ASSERT_SAME_TYPE(int, decltype(islower(0))); +ASSERT_SAME_TYPE(int, decltype(isprint(0))); +ASSERT_SAME_TYPE(int, decltype(ispunct(0))); +ASSERT_SAME_TYPE(int, decltype(isspace(0))); +ASSERT_SAME_TYPE(int, decltype(isupper(0))); +ASSERT_SAME_TYPE(int, decltype(isxdigit(0))); +ASSERT_SAME_TYPE(int, decltype(tolower(0))); +ASSERT_SAME_TYPE(int, decltype(toupper(0))); +#include + +int main(int, char**) { assert(isalnum('a')); assert(isalpha('a')); assert(isblank(' ')); diff --git a/libcxx/test/std/depr/depr.c.headers/fenv_h.compile.pass.cpp b/libcxx/test/std/depr/depr.c.headers/fenv_h.compile.pass.cpp --- a/libcxx/test/std/depr/depr.c.headers/fenv_h.compile.pass.cpp +++ b/libcxx/test/std/depr/depr.c.headers/fenv_h.compile.pass.cpp @@ -9,7 +9,8 @@ // #include -#include + +#include "test_macros.h" #ifndef FE_DIVBYZERO #error FE_DIVBYZERO not defined @@ -57,14 +58,14 @@ 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, ""); +ASSERT_SAME_TYPE(int, decltype(::feclearexcept(0))); +ASSERT_SAME_TYPE(int, decltype(::fegetexceptflag(&fex, 0))); +ASSERT_SAME_TYPE(int, decltype(::feraiseexcept(0))); +ASSERT_SAME_TYPE(int, decltype(::fesetexceptflag(&fex, 0))); +ASSERT_SAME_TYPE(int, decltype(::fetestexcept(0))); +ASSERT_SAME_TYPE(int, decltype(::fegetround())); +ASSERT_SAME_TYPE(int, decltype(::fesetround(0))); +ASSERT_SAME_TYPE(int, decltype(::fegetenv(&fenv))); +ASSERT_SAME_TYPE(int, decltype(::feholdexcept(&fenv))); +ASSERT_SAME_TYPE(int, decltype(::fesetenv(&fenv))); +ASSERT_SAME_TYPE(int, decltype(::feupdateenv(&fenv))); diff --git a/libcxx/test/std/depr/depr.c.headers/inttypes_h.pass.cpp b/libcxx/test/std/depr/depr.c.headers/inttypes_h.compile.pass.cpp rename from libcxx/test/std/depr/depr.c.headers/inttypes_h.pass.cpp rename to libcxx/test/std/depr/depr.c.headers/inttypes_h.compile.pass.cpp --- a/libcxx/test/std/depr/depr.c.headers/inttypes_h.pass.cpp +++ b/libcxx/test/std/depr/depr.c.headers/inttypes_h.compile.pass.cpp @@ -9,7 +9,6 @@ // test #include -#include #include "test_macros.h" @@ -873,63 +872,51 @@ #error SCNxPTR not defined #endif -template -void test() { - T t = 0; - ((void)t); // Prevent unused warning -} - -int main(int, char**) { - test(); - test(); - test(); - test(); - - test(); - test(); - test(); - test(); - - test(); - test(); - test(); - test(); - - test(); - test(); - test(); - test(); - - test(); - test(); - test(); - test(); - - test(); - test(); - test(); - test(); - - test(); - test(); - test(); - test(); - - { - imaxdiv_t i1 = {}; - ((void)i1); // Prevent unused warning - } - - intmax_t i = 0; - ((void)i); // Prevent unused warning - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void f() { + { int8_t x = 0; (void)x; } + { int16_t x = 0; (void)x; } + { int32_t x = 0; (void)x; } + { int64_t x = 0; (void)x; } + + { uint8_t x = 0; (void)x; } + { uint16_t x = 0; (void)x; } + { uint32_t x = 0; (void)x; } + { uint64_t x = 0; (void)x; } + + { int_least8_t x = 0; (void)x; } + { int_least16_t x = 0; (void)x; } + { int_least32_t x = 0; (void)x; } + { int_least64_t x = 0; (void)x; } + + { uint_least8_t x = 0; (void)x; } + { uint_least16_t x = 0; (void)x; } + { uint_least32_t x = 0; (void)x; } + { uint_least64_t x = 0; (void)x; } + + { int_fast8_t x = 0; (void)x; } + { int_fast16_t x = 0; (void)x; } + { int_fast32_t x = 0; (void)x; } + { int_fast64_t x = 0; (void)x; } + + { uint_fast8_t x = 0; (void)x; } + { uint_fast16_t x = 0; (void)x; } + { uint_fast32_t x = 0; (void)x; } + { uint_fast64_t x = 0; (void)x; } + + { intptr_t x = 0; (void)x; } + { uintptr_t x = 0; (void)x; } + { intmax_t x = 0; (void)x; } + { uintmax_t x = 0; (void)x; } + + { imaxdiv_t x = {}; (void)x; } + + intmax_t i = 0; (void)i; + ASSERT_SAME_TYPE(intmax_t, decltype(imaxabs(i))); + ASSERT_SAME_TYPE(imaxdiv_t, decltype(imaxdiv(i, i))); + ASSERT_SAME_TYPE(intmax_t, decltype(strtoimax("", (char**)0, 0))); + ASSERT_SAME_TYPE(uintmax_t, decltype(strtoumax("", (char**)0, 0))); #ifndef TEST_HAS_NO_WIDE_CHARACTERS - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(intmax_t, decltype(wcstoimax(L"", (wchar_t**)0, 0))); + ASSERT_SAME_TYPE(uintmax_t, decltype(wcstoumax(L"", (wchar_t**)0, 0))); #endif - - return 0; } diff --git a/libcxx/test/std/depr/depr.c.headers/locale_h.compile.pass.cpp b/libcxx/test/std/depr/depr.c.headers/locale_h.compile.pass.cpp --- a/libcxx/test/std/depr/depr.c.headers/locale_h.compile.pass.cpp +++ b/libcxx/test/std/depr/depr.c.headers/locale_h.compile.pass.cpp @@ -11,7 +11,8 @@ // #include -#include + +#include "test_macros.h" #ifndef LC_ALL #error LC_ALL not defined @@ -42,5 +43,5 @@ #endif lconv lc; -static_assert((std::is_same::value), ""); -static_assert((std::is_same::value), ""); +ASSERT_SAME_TYPE(char*, decltype(setlocale(0, ""))); +ASSERT_SAME_TYPE(lconv*, decltype(localeconv())); diff --git a/libcxx/test/std/depr/depr.c.headers/math_h.pass.cpp b/libcxx/test/std/depr/depr.c.headers/math_h.pass.cpp --- a/libcxx/test/std/depr/depr.c.headers/math_h.pass.cpp +++ b/libcxx/test/std/depr/depr.c.headers/math_h.pass.cpp @@ -107,26 +107,19 @@ template struct has_abs : decltype(has_abs_imp(0)) {}; -void test_abs() -{ +void test_abs() { TEST_DIAGNOSTIC_PUSH TEST_CLANG_DIAGNOSTIC_IGNORED("-Wabsolute-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_SAME_TYPE(decltype(abs((float)0)), float); + ASSERT_SAME_TYPE(decltype(abs((double)0)), double); + ASSERT_SAME_TYPE(decltype(abs((long double)0)), long double); + ASSERT_SAME_TYPE(decltype(abs((int)0)), int); + ASSERT_SAME_TYPE(decltype(abs((long)0)), long); + ASSERT_SAME_TYPE(decltype(abs((long long)0)), long long); + ASSERT_SAME_TYPE(decltype(abs((unsigned char)0)), int); + ASSERT_SAME_TYPE(decltype(abs((unsigned short)0)), int); + ASSERT_SAME_TYPE(decltype(abs(Ambiguous())), Ambiguous); static_assert(!has_abs::value, ""); static_assert(!has_abs::value, ""); @@ -137,260 +130,231 @@ assert(abs(-1.) == 1); } -void test_acos() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_acos() { + ASSERT_SAME_TYPE(decltype(acosf(0)), float); + ASSERT_SAME_TYPE(decltype(acosl(0)), long double); + ASSERT_SAME_TYPE(decltype(acos(Ambiguous())), Ambiguous); assert(acos(1) == 0); } -void test_asin() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_asin() { + ASSERT_SAME_TYPE(decltype(asinf(0)), float); + ASSERT_SAME_TYPE(decltype(asinl(0)), long double); + ASSERT_SAME_TYPE(decltype(asin(Ambiguous())), Ambiguous); assert(asin(0) == 0); } -void test_atan() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_atan() { + ASSERT_SAME_TYPE(decltype(atanf(0)), float); + ASSERT_SAME_TYPE(decltype(atanl(0)), long double); + ASSERT_SAME_TYPE(decltype(atan(Ambiguous())), Ambiguous); assert(atan(0) == 0); } -void test_atan2() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_atan2() { + ASSERT_SAME_TYPE(decltype(atan2f(0,0)), float); + ASSERT_SAME_TYPE(decltype(atan2l(0,0)), long double); + ASSERT_SAME_TYPE(decltype(atan2(Ambiguous(), Ambiguous())), Ambiguous); assert(atan2(0,1) == 0); } -void test_ceil() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_ceil() { + ASSERT_SAME_TYPE(decltype(ceilf(0)), float); + ASSERT_SAME_TYPE(decltype(ceill(0)), long double); + ASSERT_SAME_TYPE(decltype(ceil(Ambiguous())), Ambiguous); assert(ceil(0) == 0); } -void test_cos() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_cos() { + ASSERT_SAME_TYPE(decltype(cosf(0)), float); + ASSERT_SAME_TYPE(decltype(cosl(0)), long double); + ASSERT_SAME_TYPE(decltype(cos(Ambiguous())), Ambiguous); assert(cos(0) == 1); } -void test_cosh() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_cosh() { + ASSERT_SAME_TYPE(decltype(coshf(0)), float); + ASSERT_SAME_TYPE(decltype(coshl(0)), long double); + ASSERT_SAME_TYPE(decltype(cosh(Ambiguous())), Ambiguous); assert(cosh(0) == 1); } -void test_exp() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_exp() { + ASSERT_SAME_TYPE(decltype(expf(0)), float); + ASSERT_SAME_TYPE(decltype(expl(0)), long double); + ASSERT_SAME_TYPE(decltype(exp(Ambiguous())), Ambiguous); assert(exp(0) == 1); } -void test_fabs() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_fabs() { + ASSERT_SAME_TYPE(decltype(fabsf(0.0f)), float); + ASSERT_SAME_TYPE(decltype(fabsl(0.0L)), long double); + ASSERT_SAME_TYPE(decltype(fabs(Ambiguous())), Ambiguous); assert(fabs(-1) == 1); } -void test_floor() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_floor() { + ASSERT_SAME_TYPE(decltype(floorf(0)), float); + ASSERT_SAME_TYPE(decltype(floorl(0)), long double); + ASSERT_SAME_TYPE(decltype(floor(Ambiguous())), Ambiguous); assert(floor(1) == 1); } -void test_fmod() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_fmod() { + ASSERT_SAME_TYPE(decltype(fmodf(0,0)), float); + ASSERT_SAME_TYPE(decltype(fmodl(0,0)), long double); + ASSERT_SAME_TYPE(decltype(fmod(Ambiguous(), Ambiguous())), Ambiguous); assert(fmod(1.5,1) == .5); } -void test_frexp() -{ +void test_frexp() { int ip; - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(frexpf(0, &ip)), float); + ASSERT_SAME_TYPE(decltype(frexpl(0, &ip)), long double); + ASSERT_SAME_TYPE(decltype(frexp(Ambiguous(), &ip)), Ambiguous); assert(frexp(0, &ip) == 0); } -void test_ldexp() -{ +void test_ldexp() { int ip = 1; - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(ldexpf(0, ip)), float); + ASSERT_SAME_TYPE(decltype(ldexpl(0, ip)), long double); + ASSERT_SAME_TYPE(decltype(ldexp(Ambiguous(), ip)), Ambiguous); assert(ldexp(1, ip) == 2); } -void test_log() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_log() { + ASSERT_SAME_TYPE(decltype(logf(0)), float); + ASSERT_SAME_TYPE(decltype(logl(0)), long double); + ASSERT_SAME_TYPE(decltype(log(Ambiguous())), Ambiguous); assert(log(1) == 0); } -void test_log10() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_log10() { + ASSERT_SAME_TYPE(decltype(log10f(0)), float); + ASSERT_SAME_TYPE(decltype(log10l(0)), long double); + ASSERT_SAME_TYPE(decltype(log10(Ambiguous())), Ambiguous); assert(log10(1) == 0); } -void test_modf() -{ - 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), ""); +void test_modf() { + ASSERT_SAME_TYPE(decltype(modf((float)0, (float*)0)), float); + ASSERT_SAME_TYPE(decltype(modf((double)0, (double*)0)), double); + ASSERT_SAME_TYPE(decltype(modf((long double)0, (long double*)0)), long double); + ASSERT_SAME_TYPE(decltype(modff(0, (float*)0)), float); + ASSERT_SAME_TYPE(decltype(modfl(0, (long double*)0)), long double); + ASSERT_SAME_TYPE(decltype(modf(Ambiguous(), (Ambiguous*)0)), Ambiguous); double i; assert(modf(1., &i) == 0); } -void test_pow() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); -// static_assert((std::is_same(), (int)0)), double>::value), ""); -// static_assert((std::is_same(), (float)0)), long double>::value), ""); -// static_assert((std::is_same())), float>::value), ""); - static_assert((std::is_same::value), ""); +void test_pow() { + ASSERT_SAME_TYPE(decltype(powf(0,0)), float); + ASSERT_SAME_TYPE(decltype(powl(0,0)), long double); + ASSERT_SAME_TYPE(decltype(pow((int)0, (int)0)), double); + // ASSERT_SAME_TYPE(decltype(pow(Value(), (int)0)), double); + // ASSERT_SAME_TYPE(decltype(pow(Value(), (float)0)), long double); + // ASSERT_SAME_TYPE(decltype(pow((float) 0, Value())), float); + ASSERT_SAME_TYPE(decltype(pow(Ambiguous(), Ambiguous())), Ambiguous); assert(pow(1,1) == 1); -// assert(pow(Value(), Value()) == 1); -// assert(pow(1.0f, Value()) == 1); -// assert(pow(1.0, Value()) == 1); -// assert(pow(Value(), 1LL) == 1); + // assert(pow(Value(), Value()) == 1); + // assert(pow(1.0f, Value()) == 1); + // assert(pow(1.0, Value()) == 1); + // assert(pow(Value(), 1LL) == 1); } -void test_sin() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_sin() { + ASSERT_SAME_TYPE(decltype(sinf(0)), float); + ASSERT_SAME_TYPE(decltype(sinl(0)), long double); + ASSERT_SAME_TYPE(decltype(sin(Ambiguous())), Ambiguous); assert(sin(0) == 0); } -void test_sinh() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_sinh() { + ASSERT_SAME_TYPE(decltype(sinhf(0)), float); + ASSERT_SAME_TYPE(decltype(sinhl(0)), long double); + ASSERT_SAME_TYPE(decltype(sinh(Ambiguous())), Ambiguous); assert(sinh(0) == 0); } -void test_sqrt() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_sqrt() { + ASSERT_SAME_TYPE(decltype(sqrtf(0)), float); + ASSERT_SAME_TYPE(decltype(sqrtl(0)), long double); + ASSERT_SAME_TYPE(decltype(sqrt(Ambiguous())), Ambiguous); assert(sqrt(4) == 2); } -void test_tan() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_tan() { + ASSERT_SAME_TYPE(decltype(tanf(0)), float); + ASSERT_SAME_TYPE(decltype(tanl(0)), long double); + ASSERT_SAME_TYPE(decltype(tan(Ambiguous())), Ambiguous); assert(tan(0) == 0); } -void test_tanh() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_tanh() { + ASSERT_SAME_TYPE(decltype(tanhf(0)), float); + ASSERT_SAME_TYPE(decltype(tanhl(0)), long double); + ASSERT_SAME_TYPE(decltype(tanh(Ambiguous())), Ambiguous); assert(tanh(0) == 0); } -void test_signbit() -{ +void test_signbit() { #ifdef signbit #error signbit defined #endif - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(signbit(Ambiguous())), Ambiguous); assert(signbit(-1.0) == true); } -void test_fpclassify() -{ +void test_fpclassify() { #ifdef fpclassify #error fpclassify defined #endif - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(fpclassify(Ambiguous())), Ambiguous); assert(fpclassify(-1.0) == FP_NORMAL); } -void test_isfinite() -{ +void test_isfinite() { #ifdef isfinite #error isfinite defined #endif - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(isfinite(Ambiguous())), Ambiguous); assert(isfinite(-1.0) == true); } -void test_isnormal() -{ +void test_isnormal() { #ifdef isnormal #error isnormal defined #endif - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(isnormal(Ambiguous())), Ambiguous); assert(isnormal(-1.0) == true); } -void test_isgreater() -{ +void test_isgreater() { #ifdef isgreater #error isgreater defined #endif - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(isgreater(Ambiguous(), Ambiguous())), Ambiguous); assert(isgreater(-1.0, 0.F) == false); } -void test_isgreaterequal() -{ +void test_isgreaterequal() { #ifdef isgreaterequal #error isgreaterequal defined #endif - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(isgreaterequal(Ambiguous(), Ambiguous())), Ambiguous); assert(isgreaterequal(-1.0, 0.F) == false); } -void test_isinf() -{ +void test_isinf() { #ifdef isinf #error isinf defined #endif - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(isinf((float)0)), bool); typedef decltype(isinf((double)0)) DoubleRetType; #ifndef __linux__ - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(DoubleRetType, bool); #else // GLIBC < 2.26 defines 'isinf(double)' with a return type of 'int' in // all C++ dialects. The test should tolerate this. @@ -399,48 +363,44 @@ || std::is_same::value), ""); #endif - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(isinf(0)), bool); + ASSERT_SAME_TYPE(decltype(isinf((long double)0)), bool); assert(isinf(-1.0) == false); } -void test_isless() -{ +void test_isless() { #ifdef isless #error isless defined #endif - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(isless(Ambiguous(), Ambiguous())), Ambiguous); assert(isless(-1.0, 0.F) == true); } -void test_islessequal() -{ +void test_islessequal() { #ifdef islessequal #error islessequal defined #endif - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(islessequal(Ambiguous(), Ambiguous())), Ambiguous); assert(islessequal(-1.0, 0.F) == true); } -void test_islessgreater() -{ +void test_islessgreater() { #ifdef islessgreater #error islessgreater defined #endif - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(islessgreater(Ambiguous(), Ambiguous())), Ambiguous); assert(islessgreater(-1.0, 0.F) == true); } -void test_isnan() -{ +void test_isnan() { #ifdef isnan #error isnan defined #endif - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(isnan((float)0)), bool); typedef decltype(isnan((double)0)) DoubleRetType; #ifndef __linux__ - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(DoubleRetType, bool); #else // GLIBC < 2.26 defines 'isnan(double)' with a return type of 'int' in // all C++ dialects. The test should tolerate this. @@ -449,353 +409,316 @@ || std::is_same::value), ""); #endif - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(isnan(0)), bool); + ASSERT_SAME_TYPE(decltype(isnan((long double)0)), bool); assert(isnan(-1.0) == false); } -void test_isunordered() -{ +void test_isunordered() { #ifdef isunordered #error isunordered defined #endif - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(isunordered(Ambiguous(), Ambiguous())), Ambiguous); assert(isunordered(-1.0, 0.F) == false); } -void test_acosh() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_acosh() { + ASSERT_SAME_TYPE(decltype(acoshf(0)), float); + ASSERT_SAME_TYPE(decltype(acoshl(0)), long double); + ASSERT_SAME_TYPE(decltype(acosh(Ambiguous())), Ambiguous); assert(acosh(1) == 0); } -void test_asinh() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_asinh() { + ASSERT_SAME_TYPE(decltype(asinhf(0)), float); + ASSERT_SAME_TYPE(decltype(asinhl(0)), long double); + ASSERT_SAME_TYPE(decltype(asinh(Ambiguous())), Ambiguous); assert(asinh(0) == 0); } -void test_atanh() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_atanh() { + ASSERT_SAME_TYPE(decltype(atanhf(0)), float); + ASSERT_SAME_TYPE(decltype(atanhl(0)), long double); + ASSERT_SAME_TYPE(decltype(atanh(Ambiguous())), Ambiguous); assert(atanh(0) == 0); } void test_cbrt() { - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), - ""); + ASSERT_SAME_TYPE(decltype(cbrtf(0)), float); + ASSERT_SAME_TYPE(decltype(cbrtl(0)), long double); + ASSERT_SAME_TYPE(decltype(cbrt(Ambiguous())), Ambiguous); assert(truncate_fp(cbrt(1)) == 1); - } -void test_copysign() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_copysign() { + ASSERT_SAME_TYPE(decltype(copysignf(0,0)), float); + ASSERT_SAME_TYPE(decltype(copysignl(0,0)), long double); + ASSERT_SAME_TYPE(decltype(copysign((int)0, (int)0)), double); + ASSERT_SAME_TYPE(decltype(copysign(Ambiguous(), Ambiguous())), Ambiguous); assert(copysign(1,1) == 1); } -void test_erf() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_erf() { + ASSERT_SAME_TYPE(decltype(erff(0)), float); + ASSERT_SAME_TYPE(decltype(erfl(0)), long double); + ASSERT_SAME_TYPE(decltype(erf(Ambiguous())), Ambiguous); assert(erf(0) == 0); } -void test_erfc() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_erfc() { + ASSERT_SAME_TYPE(decltype(erfcf(0)), float); + ASSERT_SAME_TYPE(decltype(erfcl(0)), long double); + ASSERT_SAME_TYPE(decltype(erfc(Ambiguous())), Ambiguous); assert(erfc(0) == 1); } -void test_exp2() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_exp2() { + ASSERT_SAME_TYPE(decltype(exp2f(0)), float); + ASSERT_SAME_TYPE(decltype(exp2l(0)), long double); + ASSERT_SAME_TYPE(decltype(exp2(Ambiguous())), Ambiguous); assert(exp2(1) == 2); } -void test_expm1() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_expm1() { + ASSERT_SAME_TYPE(decltype(expm1f(0)), float); + ASSERT_SAME_TYPE(decltype(expm1l(0)), long double); + ASSERT_SAME_TYPE(decltype(expm1(Ambiguous())), Ambiguous); assert(expm1(0) == 0); } -void test_fdim() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_fdim() { + ASSERT_SAME_TYPE(decltype(fdimf(0,0)), float); + ASSERT_SAME_TYPE(decltype(fdiml(0,0)), long double); + ASSERT_SAME_TYPE(decltype(fdim((int)0, (int)0)), double); + ASSERT_SAME_TYPE(decltype(fdim(Ambiguous(), Ambiguous())), Ambiguous); assert(fdim(1,0) == 1); } -void test_fma() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_fma() { + ASSERT_SAME_TYPE(decltype(fma((bool)0, (float)0, (float)0)), double); + ASSERT_SAME_TYPE(decltype(fma((float)0, (float)0, (double)0)), double); + ASSERT_SAME_TYPE(decltype(fma((float)0, (float)0, (long double)0)), long double); + ASSERT_SAME_TYPE(decltype(fma((float)0, (float)0, (float)0)), float); - 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_SAME_TYPE(decltype(fma((bool)0, (double)0, (double)0)), double); + ASSERT_SAME_TYPE(decltype(fma((double)0, (double)0, (float)0)), double); + ASSERT_SAME_TYPE(decltype(fma((double)0, (double)0, (long double)0)), long double); + ASSERT_SAME_TYPE(decltype(fma((double)0, (double)0, (double)0)), double); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(fma((long double)0, (long double)0, (float)0)), long double); + ASSERT_SAME_TYPE(decltype(fma((double)0, (long double)0, (long double)0)), long double); + ASSERT_SAME_TYPE(decltype(fma((long double)0, (long double)0, (long double)0)), long double); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(fmaf(0,0,0)), float); + ASSERT_SAME_TYPE(decltype(fmal(0,0,0)), long double); + ASSERT_SAME_TYPE(decltype(fma(Ambiguous(), Ambiguous(), Ambiguous())), Ambiguous); assert(fma(1,1,1) == 2); } -void test_fmax() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_fmax() { + ASSERT_SAME_TYPE(decltype(fmaxf(0,0)), float); + ASSERT_SAME_TYPE(decltype(fmaxl(0,0)), long double); + ASSERT_SAME_TYPE(decltype(fmax((int)0, (int)0)), double); + ASSERT_SAME_TYPE(decltype(fmax(Ambiguous(), Ambiguous())), Ambiguous); assert(fmax(1,0) == 1); } -void test_fmin() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_fmin() { + ASSERT_SAME_TYPE(decltype(fminf(0,0)), float); + ASSERT_SAME_TYPE(decltype(fminl(0,0)), long double); + ASSERT_SAME_TYPE(decltype(fmin((int)0, (int)0)), double); + ASSERT_SAME_TYPE(decltype(fmin(Ambiguous(), Ambiguous())), Ambiguous); assert(fmin(1,0) == 0); } -void test_hypot() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_hypot() { + ASSERT_SAME_TYPE(decltype(hypotf(0,0)), float); + ASSERT_SAME_TYPE(decltype(hypotl(0,0)), long double); + ASSERT_SAME_TYPE(decltype(hypot((int)0, (int)0)), double); + ASSERT_SAME_TYPE(decltype(hypot(Ambiguous(), Ambiguous())), Ambiguous); assert(hypot(3,4) == 5); } -void test_ilogb() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_ilogb() { + ASSERT_SAME_TYPE(decltype(ilogbf(0)), int); + ASSERT_SAME_TYPE(decltype(ilogbl(0)), int); + ASSERT_SAME_TYPE(decltype(ilogb(Ambiguous())), Ambiguous); assert(ilogb(1) == 0); } -void test_lgamma() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_lgamma() { + ASSERT_SAME_TYPE(decltype(lgammaf(0)), float); + ASSERT_SAME_TYPE(decltype(lgammal(0)), long double); + ASSERT_SAME_TYPE(decltype(lgamma(Ambiguous())), Ambiguous); assert(lgamma(1) == 0); } -void test_llrint() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_llrint() { + ASSERT_SAME_TYPE(decltype(llrintf(0)), long long); + ASSERT_SAME_TYPE(decltype(llrintl(0)), long long); + ASSERT_SAME_TYPE(decltype(llrint(Ambiguous())), Ambiguous); assert(llrint(1) == 1LL); } -void test_llround() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_llround() { + ASSERT_SAME_TYPE(decltype(llroundf(0)), long long); + ASSERT_SAME_TYPE(decltype(llroundl(0)), long long); + ASSERT_SAME_TYPE(decltype(llround(Ambiguous())), Ambiguous); assert(llround(1) == 1LL); } -void test_log1p() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_log1p() { + ASSERT_SAME_TYPE(decltype(log1pf(0)), float); + ASSERT_SAME_TYPE(decltype(log1pl(0)), long double); + ASSERT_SAME_TYPE(decltype(log1p(Ambiguous())), Ambiguous); assert(log1p(0) == 0); } -void test_log2() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_log2() { + ASSERT_SAME_TYPE(decltype(log2f(0)), float); + ASSERT_SAME_TYPE(decltype(log2l(0)), long double); + ASSERT_SAME_TYPE(decltype(log2(Ambiguous())), Ambiguous); assert(log2(1) == 0); } -void test_logb() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_logb() { + ASSERT_SAME_TYPE(decltype(logbf(0)), float); + ASSERT_SAME_TYPE(decltype(logbl(0)), long double); + ASSERT_SAME_TYPE(decltype(logb(Ambiguous())), Ambiguous); assert(logb(1) == 0); } -void test_lrint() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_lrint() { + ASSERT_SAME_TYPE(decltype(lrintf(0)), long); + ASSERT_SAME_TYPE(decltype(lrintl(0)), long); + ASSERT_SAME_TYPE(decltype(lrint(Ambiguous())), Ambiguous); assert(lrint(1) == 1L); } -void test_lround() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_lround() { + ASSERT_SAME_TYPE(decltype(lroundf(0)), long); + ASSERT_SAME_TYPE(decltype(lroundl(0)), long); + ASSERT_SAME_TYPE(decltype(lround(Ambiguous())), Ambiguous); assert(lround(1) == 1L); } -void test_nan() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_nan() { + ASSERT_SAME_TYPE(decltype(nan("")), double); + ASSERT_SAME_TYPE(decltype(nanf("")), float); + ASSERT_SAME_TYPE(decltype(nanl("")), long double); } -void test_nearbyint() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_nearbyint() { + ASSERT_SAME_TYPE(decltype(nearbyintf(0)), float); + ASSERT_SAME_TYPE(decltype(nearbyintl(0)), long double); + ASSERT_SAME_TYPE(decltype(nearbyint(Ambiguous())), Ambiguous); assert(nearbyint(1) == 1); } -void test_nextafter() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_nextafter() { + ASSERT_SAME_TYPE(decltype(nextafterf(0,0)), float); + ASSERT_SAME_TYPE(decltype(nextafterl(0,0)), long double); + ASSERT_SAME_TYPE(decltype(nextafter((int)0, (int)0)), double); + ASSERT_SAME_TYPE(decltype(nextafter(Ambiguous(), Ambiguous())), Ambiguous); assert(nextafter(0,1) == hexfloat(0x1, 0, -1074)); } -void test_nexttoward() -{ - 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), ""); +void test_nexttoward() { + ASSERT_SAME_TYPE(decltype(nexttoward((float)0, (long double)0)), float); + ASSERT_SAME_TYPE(decltype(nexttoward((bool)0, (long double)0)), double); + ASSERT_SAME_TYPE(decltype(nexttoward((unsigned short)0, (long double)0)), double); + ASSERT_SAME_TYPE(decltype(nexttoward((int)0, (long double)0)), double); + ASSERT_SAME_TYPE(decltype(nexttoward((unsigned int)0, (long double)0)), double); + ASSERT_SAME_TYPE(decltype(nexttoward((long)0, (long double)0)), double); + ASSERT_SAME_TYPE(decltype(nexttoward((unsigned long)0, (long double)0)), double); + ASSERT_SAME_TYPE(decltype(nexttoward((long long)0, (long double)0)), double); + ASSERT_SAME_TYPE(decltype(nexttoward((unsigned long long)0, (long double)0)), double); + ASSERT_SAME_TYPE(decltype(nexttoward((double)0, (long double)0)), double); + ASSERT_SAME_TYPE(decltype(nexttoward((long double)0, (long double)0)), long double); + ASSERT_SAME_TYPE(decltype(nexttowardf(0, (long double)0)), float); + ASSERT_SAME_TYPE(decltype(nexttowardl(0, (long double)0)), long double); + ASSERT_SAME_TYPE(decltype(nexttoward(Ambiguous(), Ambiguous())), Ambiguous); assert(nexttoward(0, 1) == hexfloat(0x1, 0, -1074)); } -void test_remainder() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_remainder() { + ASSERT_SAME_TYPE(decltype(remainderf(0,0)), float); + ASSERT_SAME_TYPE(decltype(remainderl(0,0)), long double); + ASSERT_SAME_TYPE(decltype(remainder((int)0, (int)0)), double); + ASSERT_SAME_TYPE(decltype(remainder(Ambiguous(), Ambiguous())), Ambiguous); assert(remainder(0.5,1) == 0.5); } -void test_remquo() -{ +void test_remquo() { int ip; - 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_SAME_TYPE(decltype(remquof(0,0, &ip)), float); + ASSERT_SAME_TYPE(decltype(remquol(0,0, &ip)), long double); + ASSERT_SAME_TYPE(decltype(remquo((int)0, (int)0, &ip)), double); + ASSERT_SAME_TYPE(decltype(remquo(Ambiguous(), Ambiguous(), &ip)), Ambiguous); assert(remquo(0.5,1, &ip) == 0.5); } -void test_rint() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_rint() { + ASSERT_SAME_TYPE(decltype(rintf(0)), float); + ASSERT_SAME_TYPE(decltype(rintl(0)), long double); + ASSERT_SAME_TYPE(decltype(rint(Ambiguous())), Ambiguous); assert(rint(1) == 1); } -void test_round() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_round() { + ASSERT_SAME_TYPE(decltype(roundf(0)), float); + ASSERT_SAME_TYPE(decltype(roundl(0)), long double); + ASSERT_SAME_TYPE(decltype(round(Ambiguous())), Ambiguous); assert(round(1) == 1); } -void test_scalbln() -{ - 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), ""); +void test_scalbln() { + ASSERT_SAME_TYPE(decltype(scalbln((float)0, (long)0)), float); + ASSERT_SAME_TYPE(decltype(scalbln((bool)0, (long)0)), double); + ASSERT_SAME_TYPE(decltype(scalbln((unsigned short)0, (long)0)), double); + ASSERT_SAME_TYPE(decltype(scalbln((int)0, (long)0)), double); + ASSERT_SAME_TYPE(decltype(scalbln((unsigned int)0, (long)0)), double); + ASSERT_SAME_TYPE(decltype(scalbln((long)0, (long)0)), double); + ASSERT_SAME_TYPE(decltype(scalbln((unsigned long)0, (long)0)), double); + ASSERT_SAME_TYPE(decltype(scalbln((long long)0, (long)0)), double); + ASSERT_SAME_TYPE(decltype(scalbln((unsigned long long)0, (long)0)), double); + ASSERT_SAME_TYPE(decltype(scalbln((double)0, (long)0)), double); + ASSERT_SAME_TYPE(decltype(scalbln((long double)0, (long)0)), long double); + ASSERT_SAME_TYPE(decltype(scalblnf(0, (long)0)), float); + ASSERT_SAME_TYPE(decltype(scalblnl(0, (long)0)), long double); + ASSERT_SAME_TYPE(decltype(scalbln(Ambiguous(), Ambiguous())), Ambiguous); assert(scalbln(1, 1) == 2); } -void test_scalbn() -{ - 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), ""); +void test_scalbn() { + ASSERT_SAME_TYPE(decltype(scalbn((float)0, (int)0)), float); + ASSERT_SAME_TYPE(decltype(scalbn((bool)0, (int)0)), double); + ASSERT_SAME_TYPE(decltype(scalbn((unsigned short)0, (int)0)), double); + ASSERT_SAME_TYPE(decltype(scalbn((int)0, (int)0)), double); + ASSERT_SAME_TYPE(decltype(scalbn((unsigned int)0, (int)0)), double); + ASSERT_SAME_TYPE(decltype(scalbn((long)0, (int)0)), double); + ASSERT_SAME_TYPE(decltype(scalbn((unsigned long)0, (int)0)), double); + ASSERT_SAME_TYPE(decltype(scalbn((long long)0, (int)0)), double); + ASSERT_SAME_TYPE(decltype(scalbn((unsigned long long)0, (int)0)), double); + ASSERT_SAME_TYPE(decltype(scalbn((double)0, (int)0)), double); + ASSERT_SAME_TYPE(decltype(scalbn((long double)0, (int)0)), long double); + ASSERT_SAME_TYPE(decltype(scalbnf(0, (int)0)), float); + ASSERT_SAME_TYPE(decltype(scalbnl(0, (int)0)), long double); + ASSERT_SAME_TYPE(decltype(scalbn(Ambiguous(), Ambiguous())), Ambiguous); assert(scalbn(1, 1) == 2); } -void test_tgamma() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_tgamma() { + ASSERT_SAME_TYPE(decltype(tgammaf(0)), float); + ASSERT_SAME_TYPE(decltype(tgammal(0)), long double); + ASSERT_SAME_TYPE(decltype(tgamma(Ambiguous())), Ambiguous); assert(tgamma(1) == 1); } -void test_trunc() -{ - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +void test_trunc() { + ASSERT_SAME_TYPE(decltype(truncf(0)), float); + ASSERT_SAME_TYPE(decltype(truncl(0)), long double); + ASSERT_SAME_TYPE(decltype(trunc(Ambiguous())), Ambiguous); assert(trunc(1) == 1); } @@ -803,94 +726,94 @@ struct test_single_arg { template void operator()() { - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::acos(T())), PromoteResult); (void)::acos(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::asin(T())), PromoteResult); (void)::asin(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::atan(T())), PromoteResult); (void)::atan(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::ceil(T())), PromoteResult); (void)::ceil(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::cos(T())), PromoteResult); (void)::cos(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::cosh(T())), PromoteResult); (void)::cosh(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::exp(T())), PromoteResult); (void)::exp(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::fabs(T())), PromoteResult); (void)::fabs(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::floor(T())), PromoteResult); (void)::floor(T()); int ip; - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::frexp(T(), &ip)), PromoteResult); (void)::frexp(T(), &ip); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::ldexp(T(), ip)), PromoteResult); (void)::ldexp(T(), ip); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::log(T())), PromoteResult); (void)::log(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::log10(T())), PromoteResult); (void)::log10(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::sin(T())), PromoteResult); (void)::sin(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::sinh(T())), PromoteResult); (void)::sinh(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::sqrt(T())), PromoteResult); (void)::sqrt(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::tan(T())), PromoteResult); (void)::tan(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::tanh(T())), PromoteResult); (void)::tanh(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::signbit(T())), bool); (void)::signbit(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::fpclassify(T())), int); (void)::fpclassify(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::isfinite(T())), bool); (void)::isfinite(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::isnormal(T())), bool); (void)::isnormal(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::acosh(T())), PromoteResult); (void)::acosh(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::asinh(T())), PromoteResult); (void)::asinh(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::atanh(T())), PromoteResult); (void)::atanh(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::cbrt(T())), PromoteResult); (void)::cbrt(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::erf(T())), PromoteResult); (void)::erf(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::erfc(T())), PromoteResult); (void)::erfc(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::exp2(T())), PromoteResult); (void)::exp2(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::expm1(T())), PromoteResult); (void)::expm1(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::ilogb(T())), int); (void)::ilogb(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::lgamma(T())), PromoteResult); (void)::lgamma(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::llrint(T())), long long); (void)::llrint(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::llround(T())), long long); (void)::llround(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::log1p(T())), PromoteResult); (void)::log1p(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::log2(T())), PromoteResult); (void)::log2(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::logb(T())), PromoteResult); (void)::logb(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::lrint(T())), long); (void)::lrint(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::lround(T())), long); (void)::lround(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::nearbyint(T())), PromoteResult); (void)::nearbyint(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::rint(T())), PromoteResult); (void)::rint(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::round(T())), PromoteResult); (void)::round(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::trunc(T())), PromoteResult); (void)::trunc(T()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::tgamma(T())), PromoteResult); (void)::tgamma(T()); } }; @@ -899,40 +822,40 @@ struct test_two_args { template void operator()() { - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::atan2(T(), U())), PromoteResult); (void)::atan2(T(), U()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::fmod(T(), U())), PromoteResult); (void)::fmod(T(), U()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::pow(T(), U())), PromoteResult); (void)::pow(T(), U()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::isgreater(T(), U())), bool); (void)::isgreater(T(), U()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::isgreaterequal(T(), U())), bool); (void)::isgreaterequal(T(), U()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::isless(T(), U())), bool); (void)::isless(T(), U()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::islessequal(T(), U())), bool); (void)::islessequal(T(), U()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::islessgreater(T(), U())), bool); (void)::islessgreater(T(), U()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::isunordered(T(), U())), bool); (void)::isunordered(T(), U()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::copysign(T(), U())), PromoteResult); (void)::copysign(T(), U()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::fdim(T(), U())), PromoteResult); (void)::fdim(T(), U()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::fmax(T(), U())), PromoteResult); (void)::fmax(T(), U()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::fmin(T(), U())), PromoteResult); (void)::fmin(T(), U()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::hypot(T(), U())), PromoteResult); (void)::hypot(T(), U()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::nextafter(T(), U())), PromoteResult); (void)::nextafter(T(), U()); - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::remainder(T(), U())), PromoteResult); (void)::remainder(T(), U()); int ip; - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::remquo(T(), U(), &ip)), PromoteResult); ::remquo(T(), U(), &ip); } }; @@ -941,7 +864,7 @@ struct test_three_args { template void operator()() { - static_assert((std::is_same::value), ""); + ASSERT_SAME_TYPE(decltype(::fma(T(), U(), V())), PromoteResult); (void)::fma(T(), U(), V()); } }; @@ -974,8 +897,7 @@ } }; -int main(int, char**) -{ +int main(int, char**) { types::for_each(types::integral_types(), test_single_arg()); test_single_arg(); test_single_arg(); diff --git a/libcxx/test/std/depr/depr.c.headers/setjmp_h.compile.pass.cpp b/libcxx/test/std/depr/depr.c.headers/setjmp_h.compile.pass.cpp --- a/libcxx/test/std/depr/depr.c.headers/setjmp_h.compile.pass.cpp +++ b/libcxx/test/std/depr/depr.c.headers/setjmp_h.compile.pass.cpp @@ -9,11 +9,12 @@ // test #include -#include + +#include "test_macros.h" #ifndef setjmp #error setjmp not defined #endif jmp_buf jb; -static_assert(std::is_same::value, ""); +ASSERT_SAME_TYPE(void, decltype(longjmp(jb, 0))); diff --git a/libcxx/test/std/depr/depr.c.headers/signal_h.compile.pass.cpp b/libcxx/test/std/depr/depr.c.headers/signal_h.compile.pass.cpp --- a/libcxx/test/std/depr/depr.c.headers/signal_h.compile.pass.cpp +++ b/libcxx/test/std/depr/depr.c.headers/signal_h.compile.pass.cpp @@ -9,7 +9,8 @@ // test #include -#include + +#include "test_macros.h" #ifndef SIG_DFL #error SIG_DFL not defined @@ -49,5 +50,5 @@ sig_atomic_t sig; typedef void (*func)(int); -static_assert((std::is_same::value), ""); -static_assert((std::is_same::value), ""); +ASSERT_SAME_TYPE(func, decltype(signal(0, (func)0))); +ASSERT_SAME_TYPE(int, decltype(raise(0))); diff --git a/libcxx/test/std/depr/depr.c.headers/stddef_h.compile.pass.cpp b/libcxx/test/std/depr/depr.c.headers/stddef_h.compile.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/depr/depr.c.headers/stddef_h.compile.pass.cpp @@ -0,0 +1,55 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// + +#include + +#include "test_macros.h" + +void use() { + // Make sure we can use the following types without including anything else + (void)sizeof(size_t); + (void)sizeof(ptrdiff_t); +#if TEST_STD_VER >= 11 + (void)sizeof(nullptr); + (void)sizeof(nullptr_t); + (void)sizeof(max_align_t); +#endif +} + +#ifndef NULL +#error NULL not defined +#endif + +#ifndef offsetof +#error offsetof not defined +#endif + +#include + +static_assert(sizeof(size_t) == sizeof(void*), ""); +static_assert(std::is_unsigned::value, ""); +static_assert(std::is_integral::value, ""); +static_assert(sizeof(ptrdiff_t) == sizeof(void*), ""); +static_assert(std::is_signed::value, ""); +static_assert(std::is_integral::value, ""); +static_assert((std::is_same::value), ""); +static_assert(sizeof(nullptr_t) == sizeof(void*), ""); +#if TEST_STD_VER >= 11 +# if TEST_STD_VER >= 20 +// P0767 +static_assert(std::is_trivial::value, ""); +static_assert(std::is_standard_layout::value, ""); +# else +static_assert(std::is_pod::value, ""); +# endif +static_assert(std::alignment_of::value >= std::alignment_of::value, ""); +static_assert(std::alignment_of::value >= std::alignment_of::value, ""); +static_assert(std::alignment_of::value >= std::alignment_of::value, ""); +#endif // TEST_STD_VER >= 11 diff --git a/libcxx/test/std/depr/depr.c.headers/setjmp_h.compile.pass.cpp b/libcxx/test/std/depr/depr.c.headers/stddef_h.nullptr.pass.cpp copy from libcxx/test/std/depr/depr.c.headers/setjmp_h.compile.pass.cpp copy to libcxx/test/std/depr/depr.c.headers/stddef_h.nullptr.pass.cpp --- a/libcxx/test/std/depr/depr.c.headers/setjmp_h.compile.pass.cpp +++ b/libcxx/test/std/depr/depr.c.headers/stddef_h.nullptr.pass.cpp @@ -6,14 +6,20 @@ // //===----------------------------------------------------------------------===// -// test +// -#include -#include +#include +#include -#ifndef setjmp -#error setjmp not defined -#endif +int main(int, char**) { + { + void *p = NULL; + assert(!p); + } + { + void *p = nullptr; + assert(!p); + } -jmp_buf jb; -static_assert(std::is_same::value, ""); + 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 deleted file mode 100644 --- a/libcxx/test/std/depr/depr.c.headers/stddef_h.pass.cpp +++ /dev/null @@ -1,71 +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 -// -//===----------------------------------------------------------------------===// - -// - -#include -#include -#include - -#include "test_macros.h" - -#ifndef NULL -#error NULL not defined -#endif - -#ifndef offsetof -#error offsetof not defined -#endif - -int main(int, char**) { - void *p = NULL; - assert(!p); - - static_assert(sizeof(size_t) == sizeof(void*), - "sizeof(size_t) == sizeof(void*)"); - static_assert(std::is_unsigned::value, - "std::is_unsigned::value"); - static_assert(std::is_integral::value, - "std::is_integral::value"); - static_assert(sizeof(ptrdiff_t) == sizeof(void*), - "sizeof(ptrdiff_t) == sizeof(void*)"); - static_assert(std::is_signed::value, - "std::is_signed::value"); - static_assert(std::is_integral::value, - "std::is_integral::value"); - static_assert((std::is_same::value), - "decltype(nullptr) == nullptr_t"); - static_assert(sizeof(nullptr_t) == sizeof(void*), - "sizeof(nullptr_t) == sizeof(void*)"); -#if TEST_STD_VER >= 11 -#if TEST_STD_VER > 17 -// P0767 - static_assert(std::is_trivial::value, - "std::is_trivial::value"); - static_assert(std::is_standard_layout::value, - "std::is_standard_layout::value"); -#else - static_assert(std::is_pod::value, - "std::is_pod::value"); -#endif - static_assert((std::alignment_of::value >= - std::alignment_of::value), - "std::alignment_of::value >= " - "std::alignment_of::value"); - static_assert(std::alignment_of::value >= - std::alignment_of::value, - "std::alignment_of::value >= " - "std::alignment_of::value"); - static_assert(std::alignment_of::value >= - std::alignment_of::value, - "std::alignment_of::value >= " - "std::alignment_of::value"); -#endif - - 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 --- a/libcxx/test/std/depr/depr.c.headers/stdint_h.pass.cpp +++ b/libcxx/test/std/depr/depr.c.headers/stdint_h.pass.cpp @@ -9,6 +9,45 @@ // test #include + +void use() { + // Make sure we can use the following types without including anything else + (void)sizeof(int8_t); + (void)sizeof(int16_t); + (void)sizeof(int32_t); + (void)sizeof(int64_t); + + (void)sizeof(uint8_t); + (void)sizeof(uint16_t); + (void)sizeof(uint32_t); + (void)sizeof(uint64_t); + + (void)sizeof(int_least8_t); + (void)sizeof(int_least16_t); + (void)sizeof(int_least32_t); + (void)sizeof(int_least64_t); + + (void)sizeof(uint_least8_t); + (void)sizeof(uint_least16_t); + (void)sizeof(uint_least32_t); + (void)sizeof(uint_least64_t); + + (void)sizeof(int_fast8_t); + (void)sizeof(int_fast16_t); + (void)sizeof(int_fast32_t); + (void)sizeof(int_fast64_t); + + (void)sizeof(uint_fast8_t); + (void)sizeof(uint_fast16_t); + (void)sizeof(uint_fast32_t); + (void)sizeof(uint_fast64_t); + + (void)sizeof(intptr_t); + (void)sizeof(uintptr_t); + (void)sizeof(intmax_t); + (void)sizeof(uintmax_t); +} + #include #include #include @@ -24,188 +63,132 @@ int main(int, char**) { // typedef int8_t - static_assert(sizeof(int8_t)*CHAR_BIT == 8, - "sizeof(int8_t)*CHAR_BIT == 8"); - static_assert(std::is_signed::value, - "std::is_signed::value"); + static_assert(sizeof(int8_t)*CHAR_BIT == 8, ""); + static_assert(std::is_signed::value, ""); // typedef int16_t - static_assert(sizeof(int16_t)*CHAR_BIT == 16, - "sizeof(int16_t)*CHAR_BIT == 16"); - static_assert(std::is_signed::value, - "std::is_signed::value"); + static_assert(sizeof(int16_t)*CHAR_BIT == 16, ""); + static_assert(std::is_signed::value, ""); // typedef int32_t - static_assert(sizeof(int32_t)*CHAR_BIT == 32, - "sizeof(int32_t)*CHAR_BIT == 32"); - static_assert(std::is_signed::value, - "std::is_signed::value"); + static_assert(sizeof(int32_t)*CHAR_BIT == 32, ""); + static_assert(std::is_signed::value, ""); // typedef int64_t - static_assert(sizeof(int64_t)*CHAR_BIT == 64, - "sizeof(int64_t)*CHAR_BIT == 64"); - static_assert(std::is_signed::value, - "std::is_signed::value"); + static_assert(sizeof(int64_t)*CHAR_BIT == 64, ""); + static_assert(std::is_signed::value, ""); // typedef uint8_t - static_assert(sizeof(uint8_t)*CHAR_BIT == 8, - "sizeof(uint8_t)*CHAR_BIT == 8"); - static_assert(std::is_unsigned::value, - "std::is_unsigned::value"); + static_assert(sizeof(uint8_t)*CHAR_BIT == 8, ""); + static_assert(std::is_unsigned::value, ""); // typedef uint16_t - static_assert(sizeof(uint16_t)*CHAR_BIT == 16, - "sizeof(uint16_t)*CHAR_BIT == 16"); - static_assert(std::is_unsigned::value, - "std::is_unsigned::value"); + static_assert(sizeof(uint16_t)*CHAR_BIT == 16, ""); + static_assert(std::is_unsigned::value, ""); // typedef uint32_t - static_assert(sizeof(uint32_t)*CHAR_BIT == 32, - "sizeof(uint32_t)*CHAR_BIT == 32"); - static_assert(std::is_unsigned::value, - "std::is_unsigned::value"); + static_assert(sizeof(uint32_t)*CHAR_BIT == 32, ""); + static_assert(std::is_unsigned::value, ""); // typedef uint64_t - static_assert(sizeof(uint64_t)*CHAR_BIT == 64, - "sizeof(uint64_t)*CHAR_BIT == 64"); - static_assert(std::is_unsigned::value, - "std::is_unsigned::value"); + static_assert(sizeof(uint64_t)*CHAR_BIT == 64, ""); + static_assert(std::is_unsigned::value, ""); // typedef int_least8_t - static_assert(sizeof(int_least8_t)*CHAR_BIT >= 8, - "sizeof(int_least8_t)*CHAR_BIT >= 8"); - static_assert(std::is_signed::value, - "std::is_signed::value"); + static_assert(sizeof(int_least8_t)*CHAR_BIT >= 8, ""); + static_assert(std::is_signed::value, ""); // typedef int_least16_t - static_assert(sizeof(int_least16_t)*CHAR_BIT >= 16, - "sizeof(int_least16_t)*CHAR_BIT >= 16"); - static_assert(std::is_signed::value, - "std::is_signed::value"); + static_assert(sizeof(int_least16_t)*CHAR_BIT >= 16, ""); + static_assert(std::is_signed::value, ""); // typedef int_least32_t - static_assert(sizeof(int_least32_t)*CHAR_BIT >= 32, - "sizeof(int_least32_t)*CHAR_BIT >= 32"); - static_assert(std::is_signed::value, - "std::is_signed::value"); + static_assert(sizeof(int_least32_t)*CHAR_BIT >= 32, ""); + static_assert(std::is_signed::value, ""); // typedef int_least64_t - static_assert(sizeof(int_least64_t)*CHAR_BIT >= 64, - "sizeof(int_least64_t)*CHAR_BIT >= 64"); - static_assert(std::is_signed::value, - "std::is_signed::value"); + static_assert(sizeof(int_least64_t)*CHAR_BIT >= 64, ""); + static_assert(std::is_signed::value, ""); // typedef uint_least8_t - static_assert(sizeof(uint_least8_t)*CHAR_BIT >= 8, - "sizeof(uint_least8_t)*CHAR_BIT >= 8"); - static_assert(std::is_unsigned::value, - "std::is_unsigned::value"); + static_assert(sizeof(uint_least8_t)*CHAR_BIT >= 8, ""); + static_assert(std::is_unsigned::value, ""); // typedef uint_least16_t - static_assert(sizeof(uint_least16_t)*CHAR_BIT >= 16, - "sizeof(uint_least16_t)*CHAR_BIT >= 16"); - static_assert(std::is_unsigned::value, - "std::is_unsigned::value"); + static_assert(sizeof(uint_least16_t)*CHAR_BIT >= 16, ""); + static_assert(std::is_unsigned::value, ""); // typedef uint_least32_t - static_assert(sizeof(uint_least32_t)*CHAR_BIT >= 32, - "sizeof(uint_least32_t)*CHAR_BIT >= 32"); - static_assert(std::is_unsigned::value, - "std::is_unsigned::value"); + static_assert(sizeof(uint_least32_t)*CHAR_BIT >= 32, ""); + static_assert(std::is_unsigned::value, ""); // typedef uint_least64_t - static_assert(sizeof(uint_least64_t)*CHAR_BIT >= 64, - "sizeof(uint_least64_t)*CHAR_BIT >= 64"); - static_assert(std::is_unsigned::value, - "std::is_unsigned::value"); + static_assert(sizeof(uint_least64_t)*CHAR_BIT >= 64, ""); + static_assert(std::is_unsigned::value, ""); // typedef int_fast8_t - static_assert(sizeof(int_fast8_t)*CHAR_BIT >= 8, - "sizeof(int_fast8_t)*CHAR_BIT >= 8"); - static_assert(std::is_signed::value, - "std::is_signed::value"); + static_assert(sizeof(int_fast8_t)*CHAR_BIT >= 8, ""); + static_assert(std::is_signed::value, ""); // typedef int_fast16_t - static_assert(sizeof(int_fast16_t)*CHAR_BIT >= 16, - "sizeof(int_fast16_t)*CHAR_BIT >= 16"); - static_assert(std::is_signed::value, - "std::is_signed::value"); + static_assert(sizeof(int_fast16_t)*CHAR_BIT >= 16, ""); + static_assert(std::is_signed::value, ""); // typedef int_fast32_t - static_assert(sizeof(int_fast32_t)*CHAR_BIT >= 32, - "sizeof(int_fast32_t)*CHAR_BIT >= 32"); - static_assert(std::is_signed::value, - "std::is_signed::value"); + static_assert(sizeof(int_fast32_t)*CHAR_BIT >= 32, ""); + static_assert(std::is_signed::value, ""); // typedef int_fast64_t - static_assert(sizeof(int_fast64_t)*CHAR_BIT >= 64, - "sizeof(int_fast64_t)*CHAR_BIT >= 64"); - static_assert(std::is_signed::value, - "std::is_signed::value"); + static_assert(sizeof(int_fast64_t)*CHAR_BIT >= 64, ""); + static_assert(std::is_signed::value, ""); // typedef uint_fast8_t - static_assert(sizeof(uint_fast8_t)*CHAR_BIT >= 8, - "sizeof(uint_fast8_t)*CHAR_BIT >= 8"); - static_assert(std::is_unsigned::value, - "std::is_unsigned::value"); + static_assert(sizeof(uint_fast8_t)*CHAR_BIT >= 8, ""); + static_assert(std::is_unsigned::value, ""); // typedef uint_fast16_t - static_assert(sizeof(uint_fast16_t)*CHAR_BIT >= 16, - "sizeof(uint_fast16_t)*CHAR_BIT >= 16"); - static_assert(std::is_unsigned::value, - "std::is_unsigned::value"); + static_assert(sizeof(uint_fast16_t)*CHAR_BIT >= 16, ""); + static_assert(std::is_unsigned::value, ""); // typedef uint_fast32_t - static_assert(sizeof(uint_fast32_t)*CHAR_BIT >= 32, - "sizeof(uint_fast32_t)*CHAR_BIT >= 32"); - static_assert(std::is_unsigned::value, - "std::is_unsigned::value"); + static_assert(sizeof(uint_fast32_t)*CHAR_BIT >= 32, ""); + static_assert(std::is_unsigned::value, ""); // typedef uint_fast64_t - static_assert(sizeof(uint_fast64_t)*CHAR_BIT >= 64, - "sizeof(uint_fast64_t)*CHAR_BIT >= 64"); - static_assert(std::is_unsigned::value, - "std::is_unsigned::value"); + static_assert(sizeof(uint_fast64_t)*CHAR_BIT >= 64, ""); + static_assert(std::is_unsigned::value, ""); // typedef intptr_t - static_assert(sizeof(intptr_t) >= sizeof(void*), - "sizeof(intptr_t) >= sizeof(void*)"); - static_assert(std::is_signed::value, - "std::is_signed::value"); + static_assert(sizeof(intptr_t) >= sizeof(void*), ""); + static_assert(std::is_signed::value, ""); // typedef uintptr_t - static_assert(sizeof(uintptr_t) >= sizeof(void*), - "sizeof(uintptr_t) >= sizeof(void*)"); - static_assert(std::is_unsigned::value, - "std::is_unsigned::value"); + static_assert(sizeof(uintptr_t) >= sizeof(void*), ""); + static_assert(std::is_unsigned::value, ""); // typedef intmax_t - static_assert(sizeof(intmax_t) >= sizeof(long long), - "sizeof(intmax_t) >= sizeof(long long)"); - static_assert(std::is_signed::value, - "std::is_signed::value"); + static_assert(sizeof(intmax_t) >= sizeof(long long), ""); + static_assert(std::is_signed::value, ""); // typedef uintmax_t - static_assert(sizeof(uintmax_t) >= sizeof(unsigned long long), - "sizeof(uintmax_t) >= sizeof(unsigned long long)"); - static_assert(std::is_unsigned::value, - "std::is_unsigned::value"); + static_assert(sizeof(uintmax_t) >= sizeof(unsigned long long), ""); + static_assert(std::is_unsigned::value, ""); // INTN_MIN - static_assert(INT8_MIN == -128, "INT8_MIN == -128"); - static_assert(INT16_MIN == -32768, "INT16_MIN == -32768"); - static_assert(INT32_MIN == -2147483647 - 1, "INT32_MIN == -2147483648"); - static_assert(INT64_MIN == -9223372036854775807LL - 1, "INT64_MIN == -9223372036854775808LL"); + static_assert(INT8_MIN == -128, ""); + static_assert(INT16_MIN == -32768, ""); + static_assert(INT32_MIN == -2147483647 - 1, ""); + static_assert(INT64_MIN == -9223372036854775807LL - 1, ""); // INTN_MAX - static_assert(INT8_MAX == 127, "INT8_MAX == 127"); - static_assert(INT16_MAX == 32767, "INT16_MAX == 32767"); - static_assert(INT32_MAX == 2147483647, "INT32_MAX == 2147483647"); - static_assert(INT64_MAX == 9223372036854775807LL, "INT64_MAX == 9223372036854775807LL"); + static_assert(INT8_MAX == 127, ""); + static_assert(INT16_MAX == 32767, ""); + static_assert(INT32_MAX == 2147483647, ""); + static_assert(INT64_MAX == 9223372036854775807LL, ""); // UINTN_MAX - static_assert(UINT8_MAX == 255, "UINT8_MAX == 255"); - static_assert(UINT16_MAX == 65535, "UINT16_MAX == 65535"); - static_assert(UINT32_MAX == 4294967295U, "UINT32_MAX == 4294967295"); - static_assert(UINT64_MAX == 18446744073709551615ULL, "UINT64_MAX == 18446744073709551615ULL"); + static_assert(UINT8_MAX == 255, ""); + static_assert(UINT16_MAX == 65535, ""); + static_assert(UINT32_MAX == 4294967295U, ""); + static_assert(UINT64_MAX == 18446744073709551615ULL, ""); // INT_FASTN_MIN - static_assert(INT_FAST8_MIN <= -128, "INT_FAST8_MIN <= -128"); - static_assert(INT_FAST16_MIN <= -32768, "INT_FAST16_MIN <= -32768"); - static_assert(INT_FAST32_MIN <= -2147483647 - 1, "INT_FAST32_MIN <= -2147483648"); - static_assert(INT_FAST64_MIN <= -9223372036854775807LL - 1, "INT_FAST64_MIN <= -9223372036854775808LL"); + static_assert(INT_FAST8_MIN <= -128, ""); + static_assert(INT_FAST16_MIN <= -32768, ""); + static_assert(INT_FAST32_MIN <= -2147483647 - 1, ""); + static_assert(INT_FAST64_MIN <= -9223372036854775807LL - 1, ""); // INT_FASTN_MAX - static_assert(INT_FAST8_MAX >= 127, "INT_FAST8_MAX >= 127"); - static_assert(INT_FAST16_MAX >= 32767, "INT_FAST16_MAX >= 32767"); - static_assert(INT_FAST32_MAX >= 2147483647, "INT_FAST32_MAX >= 2147483647"); - static_assert(INT_FAST64_MAX >= 9223372036854775807LL, "INT_FAST64_MAX >= 9223372036854775807LL"); + static_assert(INT_FAST8_MAX >= 127, ""); + static_assert(INT_FAST16_MAX >= 32767, ""); + static_assert(INT_FAST32_MAX >= 2147483647, ""); + static_assert(INT_FAST64_MAX >= 9223372036854775807LL, ""); // UINT_FASTN_MAX - static_assert(UINT_FAST8_MAX >= 255, "UINT_FAST8_MAX >= 255"); - static_assert(UINT_FAST16_MAX >= 65535, "UINT_FAST16_MAX >= 65535"); - static_assert(UINT_FAST32_MAX >= 4294967295U, "UINT_FAST32_MAX >= 4294967295"); - static_assert(UINT_FAST64_MAX >= 18446744073709551615ULL, "UINT_FAST64_MAX >= 18446744073709551615ULL"); + static_assert(UINT_FAST8_MAX >= 255, ""); + static_assert(UINT_FAST16_MAX >= 65535, ""); + static_assert(UINT_FAST32_MAX >= 4294967295U, ""); + static_assert(UINT_FAST64_MAX >= 18446744073709551615ULL, ""); // INTPTR_MIN assert(INTPTR_MIN == std::numeric_limits::min()); diff --git a/libcxx/test/std/depr/depr.c.headers/stdio_h.compile.pass.cpp b/libcxx/test/std/depr/depr.c.headers/stdio_h.compile.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/depr/depr.c.headers/stdio_h.compile.pass.cpp @@ -0,0 +1,176 @@ +//===----------------------------------------------------------------------===// +// +// 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" + +#ifdef getc +#error getc is defined +#endif + +#ifdef putc +#error putc is defined +#endif + +#ifdef clearerr +#error clearerr is defined +#endif + +#ifdef feof +#error feof is defined +#endif + +#ifdef ferror +#error ferror is defined +#endif + +#ifndef BUFSIZ +#error BUFSIZ not defined +#endif + +#ifndef EOF +#error EOF not defined +#endif + +#ifndef FILENAME_MAX +#error FILENAME_MAX not defined +#endif + +#ifndef FOPEN_MAX +#error FOPEN_MAX not defined +#endif + +#ifndef L_tmpnam +#error L_tmpnam not defined +#endif + +#ifndef NULL +#error NULL not defined +#endif + +#ifndef SEEK_CUR +#error SEEK_CUR not defined +#endif + +#ifndef SEEK_END +#error SEEK_END not defined +#endif + +#ifndef SEEK_SET +#error SEEK_SET not defined +#endif + +#ifndef TMP_MAX +#error TMP_MAX not defined +#endif + +#ifndef _IOFBF +#error _IOFBF not defined +#endif + +#ifndef _IOLBF +#error _IOLBF not defined +#endif + +#ifndef _IONBF +#error _IONBF not defined +#endif + +#ifndef stderr +#error stderr not defined +#endif + +#ifndef stdin +#error stdin not defined +#endif + +#ifndef stdout +#error stdout not defined +#endif + +TEST_CLANG_DIAGNOSTIC_IGNORED("-Wformat-zero-length") +TEST_GCC_DIAGNOSTIC_IGNORED("-Wformat-zero-length") + +FILE* fp = 0; +fpos_t fpos = fpos_t(); +size_t s = 0; +char* cp = 0; +char arr[] = {'a', 'b'}; +va_list va; +ASSERT_SAME_TYPE(int, decltype(remove(""))); +ASSERT_SAME_TYPE(int, decltype(rename("",""))); +ASSERT_SAME_TYPE(FILE*, decltype(tmpfile())); +TEST_DIAGNOSTIC_PUSH +TEST_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations") +TEST_GCC_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations") +ASSERT_SAME_TYPE(char*, decltype(tmpnam(cp))); +TEST_DIAGNOSTIC_POP +ASSERT_SAME_TYPE(int, decltype(fclose(fp))); +ASSERT_SAME_TYPE(int, decltype(fflush(fp))); +ASSERT_SAME_TYPE(FILE*, decltype(fopen("", ""))); +ASSERT_SAME_TYPE(FILE*, decltype(freopen("", "", fp))); +ASSERT_SAME_TYPE(void, decltype(setbuf(fp,cp))); +ASSERT_SAME_TYPE(int, decltype(vfprintf(fp,"",va))); +ASSERT_SAME_TYPE(int, decltype(fprintf(fp," "))); +ASSERT_SAME_TYPE(int, decltype(fscanf(fp,""))); +ASSERT_SAME_TYPE(int, decltype(printf("\n"))); +ASSERT_SAME_TYPE(int, decltype(scanf("\n"))); +ASSERT_SAME_TYPE(int, decltype(snprintf(cp,0,"p"))); +TEST_DIAGNOSTIC_PUSH +TEST_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations") +TEST_GCC_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations") +ASSERT_SAME_TYPE(int, decltype(sprintf(cp," "))); +TEST_DIAGNOSTIC_POP +ASSERT_SAME_TYPE(int, decltype(sscanf("",""))); +ASSERT_SAME_TYPE(int, decltype(vfprintf(fp,"",va))); +ASSERT_SAME_TYPE(int, decltype(vfscanf(fp,"",va))); +ASSERT_SAME_TYPE(int, decltype(vprintf(" ",va))); +ASSERT_SAME_TYPE(int, decltype(vscanf("",va))); +ASSERT_SAME_TYPE(int, decltype(vsnprintf(cp,0," ",va))); +TEST_DIAGNOSTIC_PUSH +TEST_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations") +TEST_GCC_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations") +ASSERT_SAME_TYPE(int, decltype(vsprintf(cp," ",va))); +TEST_DIAGNOSTIC_POP +ASSERT_SAME_TYPE(int, decltype(vsscanf("","",va))); +ASSERT_SAME_TYPE(int, decltype(fgetc(fp))); +ASSERT_SAME_TYPE(char*, decltype(fgets(cp,0,fp))); +ASSERT_SAME_TYPE(int, decltype(fputc(0,fp))); +ASSERT_SAME_TYPE(int, decltype(fputs("",fp))); +ASSERT_SAME_TYPE(int, decltype(getc(fp))); +ASSERT_SAME_TYPE(int, decltype(getchar())); +#if TEST_STD_VER < 14 +TEST_DIAGNOSTIC_PUSH +TEST_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations") +TEST_GCC_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations") +ASSERT_SAME_TYPE(char*, decltype(gets(cp))); +TEST_DIAGNOSTIC_POP +#endif +ASSERT_SAME_TYPE(int, decltype(putc(0,fp))); +ASSERT_SAME_TYPE(int, decltype(putchar(0))); +ASSERT_SAME_TYPE(int, decltype(puts(""))); +ASSERT_SAME_TYPE(int, decltype(ungetc(0,fp))); +ASSERT_SAME_TYPE(size_t, decltype(fread((void*)0,0,0,fp))); +ASSERT_SAME_TYPE(size_t, decltype(fwrite((const void*)arr,1,0,fp))); +#ifndef TEST_HAS_NO_FGETPOS_FSETPOS +ASSERT_SAME_TYPE(int, decltype(fgetpos(fp, &fpos))); +#endif +ASSERT_SAME_TYPE(int, decltype(fseek(fp, 0,0))); +#ifndef TEST_HAS_NO_FGETPOS_FSETPOS +ASSERT_SAME_TYPE(int, decltype(fsetpos(fp, &fpos))); +#endif +ASSERT_SAME_TYPE(long, decltype(ftell(fp))); +ASSERT_SAME_TYPE(void, decltype(rewind(fp))); +ASSERT_SAME_TYPE(void, decltype(clearerr(fp))); +ASSERT_SAME_TYPE(int, decltype(feof(fp))); +ASSERT_SAME_TYPE(int, decltype(ferror(fp))); +ASSERT_SAME_TYPE(void, decltype(perror(""))); 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 deleted file mode 100644 --- a/libcxx/test/std/depr/depr.c.headers/stdio_h.pass.cpp +++ /dev/null @@ -1,187 +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" - -#ifdef getc -#error getc is defined -#endif - -#ifdef putc -#error putc is defined -#endif - -#ifdef clearerr -#error clearerr is defined -#endif - -#ifdef feof -#error feof is defined -#endif - -#ifdef ferror -#error ferror is defined -#endif - -#ifndef BUFSIZ -#error BUFSIZ not defined -#endif - -#ifndef EOF -#error EOF not defined -#endif - -#ifndef FILENAME_MAX -#error FILENAME_MAX not defined -#endif - -#ifndef FOPEN_MAX -#error FOPEN_MAX not defined -#endif - -#ifndef L_tmpnam -#error L_tmpnam not defined -#endif - -#ifndef NULL -#error NULL not defined -#endif - -#ifndef SEEK_CUR -#error SEEK_CUR not defined -#endif - -#ifndef SEEK_END -#error SEEK_END not defined -#endif - -#ifndef SEEK_SET -#error SEEK_SET not defined -#endif - -#ifndef TMP_MAX -#error TMP_MAX not defined -#endif - -#ifndef _IOFBF -#error _IOFBF not defined -#endif - -#ifndef _IOLBF -#error _IOLBF not defined -#endif - -#ifndef _IONBF -#error _IONBF not defined -#endif - -#ifndef stderr -#error stderr not defined -#endif - -#ifndef stdin -#error stdin not defined -#endif - -#ifndef stdout -#error stdout not defined -#endif - -#include - -TEST_CLANG_DIAGNOSTIC_IGNORED("-Wformat-zero-length") -TEST_GCC_DIAGNOSTIC_IGNORED("-Wformat-zero-length") - -int main(int, char**) { - FILE* fp = 0; - fpos_t fpos = fpos_t(); - size_t s = 0; - char* cp = 0; - char arr[] = {'a', 'b'}; - va_list va; - ((void)fp); // Prevent unused warning - ((void)fpos); // Prevent unused warning - ((void)s); // Prevent unused warning - ((void)cp); // Prevent unused warning - ((void)arr); // Prevent unused warning - ((void)va); // Prevent unused warning - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - TEST_DIAGNOSTIC_PUSH - TEST_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations") - TEST_GCC_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations") - static_assert((std::is_same::value), ""); - TEST_DIAGNOSTIC_POP - 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), ""); - TEST_DIAGNOSTIC_PUSH - TEST_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations") - TEST_GCC_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations") - static_assert((std::is_same::value), ""); - TEST_DIAGNOSTIC_POP - 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), ""); - TEST_DIAGNOSTIC_PUSH - TEST_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations") - TEST_GCC_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations") - static_assert((std::is_same::value), ""); - TEST_DIAGNOSTIC_POP - 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), ""); -#if TEST_STD_VER < 14 - TEST_DIAGNOSTIC_PUSH - TEST_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations") - TEST_GCC_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations") - static_assert((std::is_same::value), ""); - TEST_DIAGNOSTIC_POP -#endif - 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), ""); -#ifndef TEST_HAS_NO_FGETPOS_FSETPOS - static_assert((std::is_same::value), ""); -#endif - static_assert((std::is_same::value), ""); -#ifndef TEST_HAS_NO_FGETPOS_FSETPOS - static_assert((std::is_same::value), ""); -#endif - 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; -} 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 --- a/libcxx/test/std/depr/depr.c.headers/stdlib_h.pass.cpp +++ b/libcxx/test/std/depr/depr.c.headers/stdlib_h.pass.cpp @@ -69,26 +69,18 @@ void test_abs() { TEST_DIAGNOSTIC_PUSH TEST_CLANG_DIAGNOSTIC_IGNORED("-Wabsolute-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_SAME_TYPE(float, decltype(abs((float)0))); + ASSERT_SAME_TYPE(double, decltype(abs((double)0))); + ASSERT_SAME_TYPE(long double, decltype(abs((long double)0))); + ASSERT_SAME_TYPE(int, decltype(abs((int)0))); + ASSERT_SAME_TYPE(long, decltype(abs((long)0))); + ASSERT_SAME_TYPE(long long, decltype(abs((long long)0))); + ASSERT_SAME_TYPE(int, decltype(abs((unsigned char)0))); + ASSERT_SAME_TYPE(int, decltype(abs((unsigned short)0))); + ASSERT_SAME_TYPE(int, decltype(abs((signed char)0))); + ASSERT_SAME_TYPE(int, decltype(abs((short)0))); + ASSERT_SAME_TYPE(int, decltype(abs((unsigned char)0))); + ASSERT_SAME_TYPE(int, decltype(abs((char)0))); static_assert(!has_abs::value, ""); static_assert(!has_abs::value, ""); @@ -106,53 +98,53 @@ ldiv_t ld; ((void)ld); lldiv_t lld; ((void)lld); char** endptr = 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), ""); + ASSERT_SAME_TYPE(double, decltype(atof(""))); + ASSERT_SAME_TYPE(int, decltype(atoi(""))); + ASSERT_SAME_TYPE(long, decltype(atol(""))); + ASSERT_SAME_TYPE(long long, decltype(atoll(""))); + ASSERT_SAME_TYPE(char*, decltype(getenv(""))); + ASSERT_SAME_TYPE(double, decltype(strtod("", endptr))); + ASSERT_SAME_TYPE(float, decltype(strtof("", endptr))); + ASSERT_SAME_TYPE(long double, decltype(strtold("", endptr))); + ASSERT_SAME_TYPE(long, decltype(strtol("", endptr,0))); + ASSERT_SAME_TYPE(long long, decltype(strtoll("", endptr,0))); + ASSERT_SAME_TYPE(unsigned long, decltype(strtoul("", endptr,0))); + ASSERT_SAME_TYPE(unsigned long long, decltype(strtoull("", endptr,0))); + ASSERT_SAME_TYPE(int, decltype(rand())); + ASSERT_SAME_TYPE(void, decltype(srand(0))); // aligned_alloc tested in stdlib_h.aligned_alloc.compile.pass.cpp void* pv = 0; void (*handler)() = 0; int (*comp)(void const*, void const*) = 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), ""); + ASSERT_SAME_TYPE(void*, decltype(calloc(0,0))); + ASSERT_SAME_TYPE(void, decltype(free(0))); + ASSERT_SAME_TYPE(void*, decltype(malloc(0))); + ASSERT_SAME_TYPE(void*, decltype(realloc(0,0))); + ASSERT_SAME_TYPE(void, decltype(abort())); + ASSERT_SAME_TYPE(int, decltype(atexit(handler))); + ASSERT_SAME_TYPE(void, decltype(exit(0))); + ASSERT_SAME_TYPE(void, decltype(_Exit(0))); + ASSERT_SAME_TYPE(char*, decltype(getenv(""))); + ASSERT_SAME_TYPE(int, decltype(system(""))); + ASSERT_SAME_TYPE(void*, decltype(bsearch(pv,pv,0,0,comp))); + ASSERT_SAME_TYPE(void, decltype(qsort(pv,0,0,comp))); + ASSERT_SAME_TYPE(int, decltype(abs(0))); + ASSERT_SAME_TYPE(long, decltype(labs((long)0))); + ASSERT_SAME_TYPE(long long, decltype(llabs((long long)0))); + ASSERT_SAME_TYPE(div_t, decltype(div(0,0))); + ASSERT_SAME_TYPE(ldiv_t, decltype(ldiv(0L,0L))); + ASSERT_SAME_TYPE(lldiv_t, decltype(lldiv(0LL,0LL))); #ifndef TEST_HAS_NO_WIDE_CHARACTERS wchar_t* pw = 0; const wchar_t* pwc = 0; char* pc = 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), ""); + ASSERT_SAME_TYPE(int, decltype(mblen("",0))); + ASSERT_SAME_TYPE(int, decltype(mbtowc(pw,"",0))); + ASSERT_SAME_TYPE(int, decltype(wctomb(pc,L' '))); + ASSERT_SAME_TYPE(size_t, decltype(mbstowcs(pw,"",0))); + ASSERT_SAME_TYPE(size_t, decltype(wcstombs(pc,pwc,0))); #endif test_abs(); 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 --- a/libcxx/test/std/depr/depr.c.headers/string_h.pass.cpp +++ b/libcxx/test/std/depr/depr.c.headers/string_h.pass.cpp @@ -10,7 +10,6 @@ #include #include -#include #include "test_macros.h" 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 --- 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 @@ -9,7 +9,8 @@ // test #include -#include + +#include "test_macros.h" #ifndef NULL #error NULL not defined @@ -23,14 +24,14 @@ 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), ""); +ASSERT_SAME_TYPE(clock_t, decltype(clock())); +ASSERT_SAME_TYPE(double, decltype(difftime(t, t))); +ASSERT_SAME_TYPE(time_t, decltype(mktime(&tmv))); +ASSERT_SAME_TYPE(time_t, decltype(time(&t))); +ASSERT_SAME_TYPE(char*, decltype(asctime(&tmv))); +ASSERT_SAME_TYPE(char*, decltype(ctime(&t))); +ASSERT_SAME_TYPE(tm*, decltype(gmtime(&t))); +ASSERT_SAME_TYPE(tm*, decltype(localtime(&t))); +ASSERT_SAME_TYPE(size_t, decltype(strftime(c1, s, c2, &tmv))); 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 --- 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 @@ -11,7 +11,6 @@ // #include -#include #include "test_macros.h" @@ -94,21 +93,21 @@ 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), ""); +ASSERT_SAME_TYPE(int, decltype(iswalnum(w))); +ASSERT_SAME_TYPE(int, decltype(iswalpha(w))); +ASSERT_SAME_TYPE(int, decltype(iswblank(w))); +ASSERT_SAME_TYPE(int, decltype(iswcntrl(w))); +ASSERT_SAME_TYPE(int, decltype(iswdigit(w))); +ASSERT_SAME_TYPE(int, decltype(iswgraph(w))); +ASSERT_SAME_TYPE(int, decltype(iswlower(w))); +ASSERT_SAME_TYPE(int, decltype(iswprint(w))); +ASSERT_SAME_TYPE(int, decltype(iswpunct(w))); +ASSERT_SAME_TYPE(int, decltype(iswspace(w))); +ASSERT_SAME_TYPE(int, decltype(iswupper(w))); +ASSERT_SAME_TYPE(int, decltype(iswxdigit(w))); +ASSERT_SAME_TYPE(int, decltype(iswctype(w, wct))); +ASSERT_SAME_TYPE(wctype_t, decltype(wctype(""))); +ASSERT_SAME_TYPE(wint_t, decltype(towlower(w))); +ASSERT_SAME_TYPE(wint_t, decltype(towupper(w))); +ASSERT_SAME_TYPE(wint_t, decltype(towctrans(w, wctr))); +ASSERT_SAME_TYPE(wctrans_t, decltype(wctrans("")));