Skip to content

Commit fde04e6

Browse files
[libc++][test] Cleanup LIBCPP_ONLY(meow_assert(...)) to LIBCPP_MEOW_ASSERT(...) (#74967)
This is a syntax cleanup, not needed for running libc++'s tests with MSVC's STL. While changing `libcxx/test/std/input.output/filesystems/fs.enum/enum.path.format.pass.cpp` in #74965, I noticed that libc++'s tests almost always use the special-purpose macros for "this is a libc++-specific `static_assert` etc." defined by: https://github.com/llvm/llvm-project/blob/b85f1f9b182234ba366d78ae2174a149e44d08c1/libcxx/test/support/test_macros.h#L240-L253 However, there were a very small number of occurrences that were using the general-purpose `LIBCPP_ONLY` macro when they could have been using the special-purpose macros. I believe that they should be cleaned up, to make it easier to search for usage, and to make it clearer when the full power of `LIBCPP_ONLY` is necessary. This is a pure regex replacement from `LIBCPP_ONLY\((assert|static_assert|ASSERT_NOEXCEPT|ASSERT_NOT_NOEXCEPT)\((.*)\)\);` to `LIBCPP_\U$1($2);` using the power of [VSCode's case changing in regex replace](https://code.visualstudio.com/docs/editor/codebasics#_case-changing-in-regex-replace). To avoid merge conflicts, this isn't changing the line in `libcxx/test/std/input.output/filesystems/fs.enum/enum.path.format.pass.cpp` that #74965 is already changing to use `LIBCPP_STATIC_ASSERT`.
1 parent 69a10e0 commit fde04e6

File tree

10 files changed

+12
-12
lines changed

10 files changed

+12
-12
lines changed

libcxx/test/std/input.output/filesystems/class.path/path.member/path.assign/source.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ void RunStringMoveTest(const fs::path::value_type* Expect) {
230230
assert(p == Expect);
231231
{
232232
// Signature test
233-
LIBCPP_ONLY(ASSERT_NOEXCEPT(p = std::move(ss)));
233+
LIBCPP_ASSERT_NOEXCEPT(p = std::move(ss));
234234
}
235235
}
236236

libcxx/test/std/input.output/filesystems/fs.enum/enum.copy_options.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ int main(int, char**) {
3030
typedef std::underlying_type<E>::type UT;
3131
static_assert(!std::is_convertible<E, UT>::value, "");
3232

33-
LIBCPP_ONLY(static_assert(std::is_same<UT, unsigned short>::value, "")); // Implementation detail
33+
LIBCPP_STATIC_ASSERT(std::is_same<UT, unsigned short>::value, ""); // Implementation detail
3434

3535
typedef check_bitmask_type<E, E::skip_existing, E::update_existing> BitmaskTester;
3636
assert(BitmaskTester::check());

libcxx/test/std/input.output/filesystems/fs.enum/enum.directory_options.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ int main(int, char**) {
2929
// Check that E is a scoped enum by checking for conversions.
3030
typedef std::underlying_type<E>::type UT;
3131
static_assert(!std::is_convertible<E, UT>::value, "");
32-
LIBCPP_ONLY(static_assert(std::is_same<UT, unsigned char>::value, ""));
32+
LIBCPP_STATIC_ASSERT(std::is_same<UT, unsigned char>::value, "");
3333

3434
typedef check_bitmask_type<E, E::follow_directory_symlink, E::skip_permission_denied> BitmaskTester;
3535
assert(BitmaskTester::check());

libcxx/test/std/input.output/filesystems/fs.enum/enum.file_type.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ int main(int, char**) {
2929
typedef std::underlying_type<E>::type UT;
3030
static_assert(!std::is_convertible<E, UT>::value, "");
3131

32-
LIBCPP_ONLY(static_assert(std::is_same<UT, signed char>::value, "")); // Implementation detail
32+
LIBCPP_STATIC_ASSERT(std::is_same<UT, signed char>::value, ""); // Implementation detail
3333

3434
// The standard doesn't specify the numeric values of the enum.
3535
LIBCPP_STATIC_ASSERT(

libcxx/test/std/input.output/filesystems/fs.enum/enum.perm_options.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ int main(int, char**) {
3232
typedef std::underlying_type<E>::type UT;
3333
static_assert(!std::is_convertible<E, UT>::value, "");
3434

35-
LIBCPP_ONLY(static_assert(std::is_same<UT, unsigned char >::value, "")); // Implementation detail
35+
LIBCPP_STATIC_ASSERT(std::is_same<UT, unsigned char >::value, ""); // Implementation detail
3636

3737
typedef check_bitmask_type<E, E::replace, E::nofollow> BitmaskTester;
3838
assert(BitmaskTester::check());

libcxx/test/std/input.output/filesystems/fs.enum/enum.perms.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ int main(int, char**) {
3030
typedef std::underlying_type<E>::type UT;
3131
static_assert(!std::is_convertible<E, UT>::value, "");
3232

33-
LIBCPP_ONLY(static_assert(std::is_same<UT, unsigned >::value, "")); // Implementation detail
33+
LIBCPP_STATIC_ASSERT(std::is_same<UT, unsigned >::value, ""); // Implementation detail
3434

3535
typedef check_bitmask_type<E, E::group_all, E::owner_all> BitmaskTester;
3636
assert(BitmaskTester::check());

libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.absolute/absolute.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ static void basic_test()
5151
assert(!ec);
5252
assert(ret.is_absolute());
5353
assert(PathEqIgnoreSep(ret, TC.expect));
54-
LIBCPP_ONLY(assert(PathEq(ret, TC.expect)));
54+
LIBCPP_ASSERT(PathEq(ret, TC.expect));
5555
}
5656
}
5757

libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.canonical/canonical.pass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,15 @@ static void test_exception_contains_paths()
104104
} catch (filesystem_error const& err) {
105105
assert(err.path1() == p);
106106
// libc++ provides the current path as the second path in the exception
107-
LIBCPP_ONLY(assert(err.path2() == current_path()));
107+
LIBCPP_ASSERT(err.path2() == current_path());
108108
}
109109
fs::current_path(static_env.Dir);
110110
try {
111111
(void)canonical(p);
112112
assert(false);
113113
} catch (filesystem_error const& err) {
114114
assert(err.path1() == p);
115-
LIBCPP_ONLY(assert(err.path2() == static_env.Dir));
115+
LIBCPP_ASSERT(err.path2() == static_env.Dir);
116116
}
117117
#endif
118118
}

libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.permissions/permissions.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ static void test_signatures()
4040
ASSERT_NOT_NOEXCEPT(fs::permissions(p, pr));
4141
ASSERT_NOT_NOEXCEPT(fs::permissions(p, pr, opts));
4242
ASSERT_NOEXCEPT(fs::permissions(p, pr, ec));
43-
LIBCPP_ONLY(ASSERT_NOT_NOEXCEPT(fs::permissions(p, pr, opts, ec)));
43+
LIBCPP_ASSERT_NOT_NOEXCEPT(fs::permissions(p, pr, opts, ec));
4444
}
4545

4646
static void test_error_reporting()

libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ static void basic_tests()
9595
PutEnv(TC.name, dne);
9696
ec = GetTestEC();
9797
ret = temp_directory_path(ec);
98-
LIBCPP_ONLY(assert(ErrorIs(ec, expect_errc)));
98+
LIBCPP_ASSERT(ErrorIs(ec, expect_errc));
9999
assert(ec != GetTestEC());
100100
assert(ec);
101101
assert(ret == "");
@@ -104,7 +104,7 @@ static void basic_tests()
104104
PutEnv(TC.name, file);
105105
ec = GetTestEC();
106106
ret = temp_directory_path(ec);
107-
LIBCPP_ONLY(assert(ErrorIs(ec, expect_errc)));
107+
LIBCPP_ASSERT(ErrorIs(ec, expect_errc));
108108
assert(ec != GetTestEC());
109109
assert(ec);
110110
assert(ret == "");

0 commit comments

Comments
 (0)