Skip to content

[libc++][test] Replace uses of _LIBCPP_ABI_MICROSOFT in tests #77233

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 3 commits into from
Jan 11, 2024

Conversation

cpplearner
Copy link
Contributor

No functional change for libc++. But this allows MSVC STL to pass the tests.

@cpplearner cpplearner requested a review from a team as a code owner January 7, 2024 10:45
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Jan 7, 2024
@llvmbot
Copy link
Member

llvmbot commented Jan 7, 2024

@llvm/pr-subscribers-libcxx

Author: S. B. Tam (cpplearner)

Changes

No functional change for libc++. But this allows MSVC STL to pass the tests.


Full diff: https://github.com/llvm/llvm-project/pull/77233.diff

4 Files Affected:

  • (modified) libcxx/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp (+1-1)
  • (modified) libcxx/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp (+1-1)
  • (modified) libcxx/test/support/msvc_stdlib_force_include.h (+1)
  • (modified) libcxx/test/support/test_macros.h (+4)
diff --git a/libcxx/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp b/libcxx/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp
index e97b15adc50a65..8290b874db6479 100644
--- a/libcxx/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp
+++ b/libcxx/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp
@@ -39,7 +39,7 @@ int main(int, char**)
         }
         catch (const A& a)
         {
-#ifndef _LIBCPP_ABI_MICROSOFT
+#ifndef TEST_ABI_MICROSOFT
             assert(A::constructed == 1);
 #else
             // On Windows exception_ptr copies the exception
diff --git a/libcxx/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp b/libcxx/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp
index d109f98fbc2131..57e1e8e90caa2c 100644
--- a/libcxx/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp
+++ b/libcxx/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp
@@ -47,7 +47,7 @@ int main(int, char**)
         }
         catch (const A& a)
         {
-#ifndef _LIBCPP_ABI_MICROSOFT
+#ifndef TEST_ABI_MICROSOFT
             assert(A::constructed == 1);
 #else
             // On Windows the exception_ptr copies the exception
diff --git a/libcxx/test/support/msvc_stdlib_force_include.h b/libcxx/test/support/msvc_stdlib_force_include.h
index c027dc5c851e56..6c26085e72c45f 100644
--- a/libcxx/test/support/msvc_stdlib_force_include.h
+++ b/libcxx/test/support/msvc_stdlib_force_include.h
@@ -101,6 +101,7 @@ const AssertionDialogAvoider assertion_dialog_avoider{};
 #endif
 
 #define TEST_SHORT_WCHAR
+#define TEST_ABI_MICROSOFT
 
 #define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
 
diff --git a/libcxx/test/support/test_macros.h b/libcxx/test/support/test_macros.h
index ea289f0432e686..2203b900f94546 100644
--- a/libcxx/test/support/test_macros.h
+++ b/libcxx/test/support/test_macros.h
@@ -443,6 +443,10 @@ inline void DoNotOptimize(Tp const& value) {
 #  define TEST_SHORT_WCHAR
 #endif
 
+#ifdef _LIBCPP_ABI_MICROSOFT
+#  define TEST_ABI_MICROSOFT
+#endif
+
 // This is a temporary workaround for user-defined `operator new` definitions
 // not being picked up on Apple platforms in some circumstances. This is under
 // investigation and should be short-lived.

Copy link

github-actions bot commented Jan 7, 2024

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff 4c8dbb68138959477d9fccbae3669663260dfe31 2f53554c3b0628ad79618ad91ad1d5563bfc9baa -- libcxx/test/libcxx/memory/trivial_abi/unique_ptr_destruction_order.pass.cpp libcxx/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp libcxx/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp libcxx/test/support/msvc_stdlib_force_include.h libcxx/test/support/test_macros.h
View the diff from clang-format here.
diff --git a/libcxx/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp b/libcxx/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp
index 8290b874db..0c96e8fa4b 100644
--- a/libcxx/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp
+++ b/libcxx/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp
@@ -40,7 +40,7 @@ int main(int, char**)
         catch (const A& a)
         {
 #ifndef TEST_ABI_MICROSOFT
-            assert(A::constructed == 1);
+          assert(A::constructed == 1);
 #else
             // On Windows exception_ptr copies the exception
             assert(A::constructed == 2);
diff --git a/libcxx/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp b/libcxx/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp
index 57e1e8e90c..af5ac863e3 100644
--- a/libcxx/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp
+++ b/libcxx/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp
@@ -48,7 +48,7 @@ int main(int, char**)
         catch (const A& a)
         {
 #ifndef TEST_ABI_MICROSOFT
-            assert(A::constructed == 1);
+          assert(A::constructed == 1);
 #else
             // On Windows the exception_ptr copies the exception
             assert(A::constructed == 2);

Copy link
Member

@mordante mordante left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM modulo one nit.

@mordante
Copy link
Member

Feel free to land this patch, the GCC CI issue is unrelated.

@cpplearner cpplearner merged commit e0c7345 into llvm:main Jan 11, 2024
@cpplearner cpplearner deleted the libcxx-test branch January 12, 2024 06:17
justinfargnoli pushed a commit to justinfargnoli/llvm-project that referenced this pull request Jan 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants