[libcxx-commits] [PATCH] D119642: [libc++][nfc] Add TEST_HAS_NO_FILESYSTEM_LIBRARY.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Feb 12 11:09:27 PST 2022


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

This avoids using an libc++ internal macro in our tests.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119642

Files:
  libcxx/test/std/iterators/iterator.primitives/iterator.traits/cxx20_iterator_traits.compile.pass.cpp
  libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/types.compile.pass.cpp
  libcxx/test/support/test_macros.h


Index: libcxx/test/support/test_macros.h
===================================================================
--- libcxx/test/support/test_macros.h
+++ libcxx/test/support/test_macros.h
@@ -388,6 +388,10 @@
 #  define TEST_HAS_NO_THREADS
 #endif
 
+#if defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY)
+#  define TEST_HAS_NO_FILESYSTEM_LIBRARY
+#endif
+
 #if defined(__GNUC__)
 #pragma GCC diagnostic pop
 #endif
Index: libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/types.compile.pass.cpp
===================================================================
--- libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/types.compile.pass.cpp
+++ libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/types.compile.pass.cpp
@@ -23,9 +23,6 @@
 #include <complex>
 #include <concepts>
 #include <deque>
-#ifndef _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY
-#  include <filesystem>
-#endif
 #include <format>
 #include <forward_list>
 #include <list>
@@ -45,6 +42,9 @@
 
 #include "test_macros.h"
 
+#ifndef TEST_HAS_NO_FILESYSTEM_LIBRARY
+#  include <filesystem>
+#endif
 #ifndef TEST_HAS_NO_LOCALIZATION
 #  include <regex>
 #endif
@@ -210,7 +210,7 @@
   assert_formatter_is_disabled<std::bitset<42>, CharT>();
   assert_formatter_is_disabled<std::complex<double>, CharT>();
   assert_formatter_is_disabled<std::error_code, CharT>();
-#ifndef _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY
+#ifndef TEST_HAS_NO_FILESYSTEM_LIBRARY
   assert_formatter_is_disabled<std::filesystem::path, CharT>();
 #endif
   assert_formatter_is_disabled<std::shared_ptr<int>, CharT>();
Index: libcxx/test/std/iterators/iterator.primitives/iterator.traits/cxx20_iterator_traits.compile.pass.cpp
===================================================================
--- libcxx/test/std/iterators/iterator.primitives/iterator.traits/cxx20_iterator_traits.compile.pass.cpp
+++ libcxx/test/std/iterators/iterator.primitives/iterator.traits/cxx20_iterator_traits.compile.pass.cpp
@@ -41,11 +41,10 @@
 #  include <istream>
 #endif
 
-#ifndef _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY
-# include <filesystem>
+#ifndef TEST_HAS_NO_FILESYSTEM_LIBRARY
+#  include <filesystem>
 #endif
 
-#include "test_macros.h"
 #include "test_iterators.h"
 #include "iterator_traits_cpp17_iterators.h"
 
@@ -210,7 +209,7 @@
 static_assert(testConstWithoutConcept<std::cregex_token_iterator, std::csub_match, std::forward_iterator_tag>());
 #endif // !TEST_HAS_NO_LOCALIZATION
 
-#ifndef _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY
+#ifndef TEST_HAS_NO_FILESYSTEM_LIBRARY
 static_assert(testWithoutConcept<std::filesystem::directory_iterator, std::filesystem::directory_entry, std::ptrdiff_t,
                                  const std::filesystem::directory_entry&, const std::filesystem::directory_entry*,
                                  std::input_iterator_tag>());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119642.408199.patch
Type: text/x-patch
Size: 2833 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220212/ce4cbb4f/attachment.bin>


More information about the libcxx-commits mailing list