[libcxx-commits] [PATCH] D124403: [libc++] Refactor max_size.pass.cpp

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Apr 25 09:51:42 PDT 2022


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

Don't error out when we don't recognize the architecture. Some folks
may be testing libc++ on non-mainstream architectures, and the test
should not fail.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D124403

Files:
  libcxx/test/libcxx/strings/basic.string/string.capacity/max_size.pass.cpp


Index: libcxx/test/libcxx/strings/basic.string/string.capacity/max_size.pass.cpp
===================================================================
--- libcxx/test/libcxx/strings/basic.string/string.capacity/max_size.pass.cpp
+++ libcxx/test/libcxx/strings/basic.string/string.capacity/max_size.pass.cpp
@@ -6,12 +6,12 @@
 //
 //===----------------------------------------------------------------------===//
 
-// UNSUPPORTED:
-
 // <string>
 
 // This test ensures that the correct max_size() is returned depending on the platform.
 
+// REQUIRES: libcpp-abi-version=1
+
 #include <algorithm>
 #include <cassert>
 #include <cstddef>
@@ -67,49 +67,18 @@
 }
 
 bool test() {
-#if _LIBCPP_ABI_VERSION == 1
-#ifdef __APPLE__
-
-#  ifdef __aarch64__
-  half_size();
-#  elif defined(__x86_64__)
+#if defined(__x86_64__)
   full_size();
-#  else
-#    error "Your target system seems to be unsupported."
-#  endif
-
-#elif defined(__linux__)
-
-#  ifdef  __x86_64__
-  full_size();
-#  elif defined(__arm__) || defined(__aarch64__)
-#    ifdef __BIG_ENDIAN__
+#elif defined(__APPLE__) && defined(__aarch64__)
   half_size();
-#    else
-  full_size();
-#    endif
-
-#  else
-#    error "Your target system seems to be unsupported."
-#  endif
-
-#elif defined(__powerpc__)
-  half_size();
-#elif defined(__powepc64__)
+#elif defined(__arm__) || defined(__aarch64__)
+# ifdef __BIG_ENDIAN__
   half_size();
-
-#elif defined(_WIN64)
-
-#  ifdef __x86_64__
+# else
   full_size();
-#  else
-#    error "Your target system seems to be unsupported."
-#  endif
-
-#else
-#  error "Your target system seems to be unsupported."
-#endif
-
+# endif
+#elif defined(__powerpc__) || defined(__powerpc64__)
+  half_size();
 #endif
 
   return true;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124403.424949.patch
Type: text/x-patch
Size: 1731 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220425/595fd5cd/attachment.bin>


More information about the libcxx-commits mailing list