[libcxx-commits] [PATCH] D112937: [libc++] Add missing annotations for TEST_HAS_NO_WIDE_CHARACTERS

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Nov 1 09:12:42 PDT 2021


ldionne created this revision.
ldionne requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D112937

Files:
  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


Index: libcxx/test/std/language.support/support.runtime/cstdlib.pass.cpp
===================================================================
--- libcxx/test/std/language.support/support.runtime/cstdlib.pass.cpp
+++ libcxx/test/std/language.support/support.runtime/cstdlib.pass.cpp
@@ -146,6 +146,7 @@
     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 @@
     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();
 
Index: libcxx/test/std/depr/depr.c.headers/stdlib_h.pass.cpp
===================================================================
--- libcxx/test/std/depr/depr.c.headers/stdlib_h.pass.cpp
+++ libcxx/test/std/depr/depr.c.headers/stdlib_h.pass.cpp
@@ -155,6 +155,7 @@
     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 @@
     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();
 
Index: libcxx/test/std/depr/depr.c.headers/inttypes_h.pass.cpp
===================================================================
--- libcxx/test/std/depr/depr.c.headers/inttypes_h.pass.cpp
+++ libcxx/test/std/depr/depr.c.headers/inttypes_h.pass.cpp
@@ -927,8 +927,10 @@
     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;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112937.383816.patch
Type: text/x-patch
Size: 2715 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20211101/03e64c8c/attachment-0001.bin>


More information about the libcxx-commits mailing list