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
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 @@ -17,6 +17,8 @@
#include <memory>
#include <cassert>

#include "test_macros.h"

__attribute__((noinline)) void call_something() { asm volatile(""); }

struct Base {
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions libcxx/test/support/msvc_stdlib_force_include.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions libcxx/test/support/test_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down