Skip to content

[libc++][test] Avoid preprocessor directives in macro argument lists #73440

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,8 @@ static void test_read_only() {
TEST_VALIDATE_EXCEPTION(
std::system_error,
[&]([[maybe_unused]] const std::system_error& e) {
#ifdef _AIX
[[maybe_unused]] std::string_view what{"failed to write formatted output: Broken pipe"};
#else
[[maybe_unused]] std::string_view what{"failed to write formatted output: Operation not permitted"};
#endif
[[maybe_unused]] std::string_view what{
"failed to write formatted output: " TEST_IF_AIX("Broken pipe", "Operation not permitted")};
TEST_LIBCPP_REQUIRE(
e.what() == what,
TEST_WRITE_CONCATENATED("\nExpected exception ", what, "\nActual exception ", e.what(), '\n'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,8 @@ static void test_read_only() {
TEST_VALIDATE_EXCEPTION(
std::system_error,
[&]([[maybe_unused]] const std::system_error& e) {
#ifdef _AIX
[[maybe_unused]] std::string_view what{"failed to write formatted output: Broken pipe"};
#else
[[maybe_unused]] std::string_view what{"failed to write formatted output: Operation not permitted"};
#endif
[[maybe_unused]] std::string_view what{
"failed to write formatted output: " TEST_IF_AIX("Broken pipe", "Operation not permitted")};
TEST_LIBCPP_REQUIRE(
e.what() == what,
TEST_WRITE_CONCATENATED("\nExpected exception ", what, "\nActual exception ", e.what(), '\n'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,8 @@ static void test_read_only() {
TEST_VALIDATE_EXCEPTION(
std::system_error,
[&]([[maybe_unused]] const std::system_error& e) {
#ifdef _AIX
[[maybe_unused]] std::string_view what{"failed to write formatted output: Broken pipe"};
#else
[[maybe_unused]] std::string_view what{"failed to write formatted output: Operation not permitted"};
#endif
[[maybe_unused]] std::string_view what{
"failed to write formatted output: " TEST_IF_AIX("Broken pipe", "Operation not permitted")};
TEST_LIBCPP_REQUIRE(
e.what() == what,
TEST_WRITE_CONCATENATED("\nExpected exception ", what, "\nActual exception ", e.what(), '\n'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,8 @@ static void test_read_only() {
TEST_VALIDATE_EXCEPTION(
std::system_error,
[&]([[maybe_unused]] const std::system_error& e) {
#ifdef _AIX
[[maybe_unused]] std::string_view what{"failed to write formatted output: Broken pipe"};
#else
[[maybe_unused]] std::string_view what{"failed to write formatted output: Operation not permitted"};
#endif
[[maybe_unused]] std::string_view what{
"failed to write formatted output: " TEST_IF_AIX("Broken pipe", "Operation not permitted")};
TEST_LIBCPP_REQUIRE(
e.what() == what,
TEST_WRITE_CONCATENATED("\nExpected exception ", what, "\nActual exception ", e.what(), '\n'));
Expand Down
6 changes: 6 additions & 0 deletions libcxx/test/support/test_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -443,4 +443,10 @@ inline void DoNotOptimize(Tp const& value) {
# define TEST_WORKAROUND_BUG_109234844_WEAK /* nothing */
#endif

#ifdef _AIX
# define TEST_IF_AIX(arg_true, arg_false) arg_true
#else
# define TEST_IF_AIX(arg_true, arg_false) arg_false
#endif

#endif // SUPPORT_TEST_MACROS_HPP