[libcxx-commits] [libcxx] e404e22 - [libc++][nfc] Add TEST_HAS_NO_FILESYSTEM_LIBRARY.
Mark de Wever via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Feb 14 09:41:01 PST 2022
Author: Mark de Wever
Date: 2022-02-14T18:40:55+01:00
New Revision: e404e22587867a1bbdac125e8419440c6929daa0
URL: https://github.com/llvm/llvm-project/commit/e404e22587867a1bbdac125e8419440c6929daa0
DIFF: https://github.com/llvm/llvm-project/commit/e404e22587867a1bbdac125e8419440c6929daa0.diff
LOG: [libc++][nfc] Add TEST_HAS_NO_FILESYSTEM_LIBRARY.
This avoids using an libc++ internal macro in our tests.
Reviewed By: #libc, philnik, ldionne
Differential Revision: https://reviews.llvm.org/D119642
Added:
Modified:
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
Removed:
################################################################################
diff --git a/libcxx/test/std/iterators/iterator.primitives/iterator.traits/cxx20_iterator_traits.compile.pass.cpp b/libcxx/test/std/iterators/iterator.primitives/iterator.traits/cxx20_iterator_traits.compile.pass.cpp
index 15c2793d7dae6..ed0b4210b95c2 100644
--- a/libcxx/test/std/iterators/iterator.primitives/iterator.traits/cxx20_iterator_traits.compile.pass.cpp
+++ b/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_iterator, std::cmatch, std::fo
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::ptr
diff _t,
const std::filesystem::directory_entry&, const std::filesystem::directory_entry*,
std::input_iterator_tag>());
diff --git a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/types.compile.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/types.compile.pass.cpp
index 458beb5831ff3..9a050a4a06604 100644
--- a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/types.compile.pass.cpp
+++ b/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 @@ void test_P1636() {
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>();
diff --git a/libcxx/test/support/test_macros.h b/libcxx/test/support/test_macros.h
index b5d768bff4843..d4b6c495965fd 100644
--- a/libcxx/test/support/test_macros.h
+++ b/libcxx/test/support/test_macros.h
@@ -388,6 +388,10 @@ inline void DoNotOptimize(Tp const& value) {
# 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
More information about the libcxx-commits
mailing list