[libcxx-commits] [libcxx] e0c7345 - [libc++][test] Replace uses of `_LIBCPP_ABI_MICROSOFT` in tests (#77233)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jan 10 18:55:56 PST 2024


Author: S. B. Tam
Date: 2024-01-11T10:55:52+08:00
New Revision: e0c734561d5b268f8d24e68c535df8aa41369690

URL: https://github.com/llvm/llvm-project/commit/e0c734561d5b268f8d24e68c535df8aa41369690
DIFF: https://github.com/llvm/llvm-project/commit/e0c734561d5b268f8d24e68c535df8aa41369690.diff

LOG: [libc++][test] Replace uses of `_LIBCPP_ABI_MICROSOFT` in tests (#77233)

Added: 
    

Modified: 
    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

Removed: 
    


################################################################################
diff  --git a/libcxx/test/libcxx/memory/trivial_abi/unique_ptr_destruction_order.pass.cpp b/libcxx/test/libcxx/memory/trivial_abi/unique_ptr_destruction_order.pass.cpp
index f8025f8ef57c5e..8752ba5a01d6ea 100644
--- a/libcxx/test/libcxx/memory/trivial_abi/unique_ptr_destruction_order.pass.cpp
+++ b/libcxx/test/libcxx/memory/trivial_abi/unique_ptr_destruction_order.pass.cpp
@@ -17,6 +17,8 @@
 #include <memory>
 #include <cassert>
 
+#include "test_macros.h"
+
 __attribute__((noinline)) void call_something() { asm volatile(""); }
 
 struct Base {
@@ -55,7 +57,7 @@ int main(int, char**) {
   func(A(shared_buf, &cur_idx), std::unique_ptr<B>(new B(shared_buf, &cur_idx)),
        C(shared_buf, &cur_idx));
 
-#if defined(_LIBCPP_ABI_MICROSOFT)
+#if defined(TEST_ABI_MICROSOFT)
   // On Microsoft ABI, the dtor order is always A,B,C (because callee-destroyed)
   assert(shared_buf[0] == 'A' && shared_buf[1] == 'B' && shared_buf[2] == 'C');
 #else

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 5ca4d611e1e415..fe68e13de6bcba 100644
--- a/libcxx/test/support/test_macros.h
+++ b/libcxx/test/support/test_macros.h
@@ -451,6 +451,10 @@ inline Tp const& 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.


        


More information about the libcxx-commits mailing list