[libcxx-commits] [libcxx] d5b40a3 - [libc++] Add missing annotations for TEST_HAS_NO_WIDE_CHARACTERS

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Mon Nov 1 11:10:40 PDT 2021


Author: Louis Dionne
Date: 2021-11-01T14:10:32-04:00
New Revision: d5b40a30b59ebe75a9da7b042d2c8e3990f99cff

URL: https://github.com/llvm/llvm-project/commit/d5b40a30b59ebe75a9da7b042d2c8e3990f99cff
DIFF: https://github.com/llvm/llvm-project/commit/d5b40a30b59ebe75a9da7b042d2c8e3990f99cff.diff

LOG: [libc++] Add missing annotations for TEST_HAS_NO_WIDE_CHARACTERS

Those tests would pass when run on a C Standard Library that actually
provides wide characters, but fail when run on top of one that doesn't.
It's really difficult to test this 100% perfectly in the CI without
introducing an actual platform that doesn't provide these declarations.

Differential Revision: https://reviews.llvm.org/D112937

Added: 
    

Modified: 
    libcxx/test/std/depr/depr.c.headers/inttypes_h.pass.cpp
    libcxx/test/std/depr/depr.c.headers/stdlib_h.pass.cpp
    libcxx/test/std/language.support/support.runtime/cstdlib.pass.cpp

Removed: 
    


################################################################################
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 e759a7d3c7564..b9f9a585ed8d3 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
@@ -927,8 +927,10 @@ int main(int, char**)
     static_assert((std::is_same<decltype(imaxdiv(i, i)), imaxdiv_t>::value), "");
     static_assert((std::is_same<decltype(strtoimax("", (char**)0, 0)), intmax_t>::value), "");
     static_assert((std::is_same<decltype(strtoumax("", (char**)0, 0)), uintmax_t>::value), "");
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
     static_assert((std::is_same<decltype(wcstoimax(L"", (wchar_t**)0, 0)), intmax_t>::value), "");
     static_assert((std::is_same<decltype(wcstoumax(L"", (wchar_t**)0, 0)), uintmax_t>::value), "");
+#endif
 
   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 83d17107fbbcc..978596b6f589e 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
@@ -155,6 +155,7 @@ int main(int, char**)
     static_assert((std::is_same<decltype(div(0,0)), div_t>::value), "");
     static_assert((std::is_same<decltype(ldiv(0L,0L)), ldiv_t>::value), "");
     static_assert((std::is_same<decltype(lldiv(0LL,0LL)), lldiv_t>::value), "");
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
     wchar_t* pw = 0;
     const wchar_t* pwc = 0;
     char* pc = 0;
@@ -163,6 +164,7 @@ int main(int, char**)
     static_assert((std::is_same<decltype(wctomb(pc,L' ')), int>::value), "");
     static_assert((std::is_same<decltype(mbstowcs(pw,"",0)), size_t>::value), "");
     static_assert((std::is_same<decltype(wcstombs(pc,pwc,0)), size_t>::value), "");
+#endif
 
     test_abs();
 

diff  --git a/libcxx/test/std/language.support/support.runtime/cstdlib.pass.cpp b/libcxx/test/std/language.support/support.runtime/cstdlib.pass.cpp
index 19d07503b9633..2900ee2b3262e 100644
--- a/libcxx/test/std/language.support/support.runtime/cstdlib.pass.cpp
+++ b/libcxx/test/std/language.support/support.runtime/cstdlib.pass.cpp
@@ -146,6 +146,7 @@ int main(int, char**)
     static_assert((std::is_same<decltype(std::div(0LL,0LL)), std::lldiv_t>::value), "");
     static_assert((std::is_same<decltype(std::ldiv(0L,0L)), std::ldiv_t>::value), "");
     static_assert((std::is_same<decltype(std::lldiv(0LL,0LL)), std::lldiv_t>::value), "");
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
     wchar_t* pw = 0;
     const wchar_t* pwc = 0;
     char* pc = 0;
@@ -154,6 +155,7 @@ int main(int, char**)
     static_assert((std::is_same<decltype(std::wctomb(pc,L' ')), int>::value), "");
     static_assert((std::is_same<decltype(std::mbstowcs(pw,"",0)), std::size_t>::value), "");
     static_assert((std::is_same<decltype(std::wcstombs(pc,pwc,0)), std::size_t>::value), "");
+#endif
 
     test_abs();
 


        


More information about the libcxx-commits mailing list