Skip to content

Commit e404e22

Browse files
committed
[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
1 parent 27166e9 commit e404e22

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

libcxx/test/std/iterators/iterator.primitives/iterator.traits/cxx20_iterator_traits.compile.pass.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,10 @@
4141
# include <istream>
4242
#endif
4343

44-
#ifndef _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY
45-
# include <filesystem>
44+
#ifndef TEST_HAS_NO_FILESYSTEM_LIBRARY
45+
# include <filesystem>
4646
#endif
4747

48-
#include "test_macros.h"
4948
#include "test_iterators.h"
5049
#include "iterator_traits_cpp17_iterators.h"
5150

@@ -210,7 +209,7 @@ static_assert(testConstWithoutConcept<std::cregex_iterator, std::cmatch, std::fo
210209
static_assert(testConstWithoutConcept<std::cregex_token_iterator, std::csub_match, std::forward_iterator_tag>());
211210
#endif // !TEST_HAS_NO_LOCALIZATION
212211

213-
#ifndef _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY
212+
#ifndef TEST_HAS_NO_FILESYSTEM_LIBRARY
214213
static_assert(testWithoutConcept<std::filesystem::directory_iterator, std::filesystem::directory_entry, std::ptrdiff_t,
215214
const std::filesystem::directory_entry&, const std::filesystem::directory_entry*,
216215
std::input_iterator_tag>());

libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/types.compile.pass.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323
#include <complex>
2424
#include <concepts>
2525
#include <deque>
26-
#ifndef _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY
27-
# include <filesystem>
28-
#endif
2926
#include <format>
3027
#include <forward_list>
3128
#include <list>
@@ -45,6 +42,9 @@
4542

4643
#include "test_macros.h"
4744

45+
#ifndef TEST_HAS_NO_FILESYSTEM_LIBRARY
46+
# include <filesystem>
47+
#endif
4848
#ifndef TEST_HAS_NO_LOCALIZATION
4949
# include <regex>
5050
#endif
@@ -210,7 +210,7 @@ void test_P1636() {
210210
assert_formatter_is_disabled<std::bitset<42>, CharT>();
211211
assert_formatter_is_disabled<std::complex<double>, CharT>();
212212
assert_formatter_is_disabled<std::error_code, CharT>();
213-
#ifndef _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY
213+
#ifndef TEST_HAS_NO_FILESYSTEM_LIBRARY
214214
assert_formatter_is_disabled<std::filesystem::path, CharT>();
215215
#endif
216216
assert_formatter_is_disabled<std::shared_ptr<int>, CharT>();

libcxx/test/support/test_macros.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,10 @@ inline void DoNotOptimize(Tp const& value) {
388388
# define TEST_HAS_NO_THREADS
389389
#endif
390390

391+
#if defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY)
392+
# define TEST_HAS_NO_FILESYSTEM_LIBRARY
393+
#endif
394+
391395
#if defined(__GNUC__)
392396
#pragma GCC diagnostic pop
393397
#endif

0 commit comments

Comments
 (0)