Skip to content

Commit 559282f

Browse files
committed
Only do ASSERT_WITH_LIBRARY_INTERNAL_ALLOCATIONS in count_new.h for specific tests
1 parent 0687b22 commit 559282f

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
// These tests require locale for non-char paths
1313
// UNSUPPORTED: no-localization
1414

15+
// In MinGW mode, with optimizations enabled with a DLL, the number of counted
16+
// allocations mismatches, as some ctor/dtor calls are generated in the
17+
// calling code, and some are called from the DLL.
18+
// ADDITIONAL_COMPILE_FLAGS: -DALLOW_MISMATCHING_LIBRRARY_INTERNAL_ALLOCATIONS
19+
1520
// <filesystem>
1621

1722
// class path

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
// These tests require locale for non-char paths
1313
// UNSUPPORTED: no-localization
1414

15+
// In MinGW mode, with optimizations enabled with a DLL, the number of counted
16+
// allocations mismatches, as some ctor/dtor calls are generated in the
17+
// calling code, and some are called from the DLL.
18+
// ADDITIONAL_COMPILE_FLAGS: -DALLOW_MISMATCHING_LIBRRARY_INTERNAL_ALLOCATIONS
19+
1520
// <filesystem>
1621

1722
// class path

libcxx/test/support/count_new.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,11 @@ struct RequireAllocationGuard {
626626
void requireExactly(std::size_t N) { m_req_alloc = N; m_exactly = true; }
627627

628628
~RequireAllocationGuard() {
629+
#ifdef ALLOW_MISMATCHING_LIBRRARY_INTERNAL_ALLOCATIONS
629630
ASSERT_WITH_LIBRARY_INTERNAL_ALLOCATIONS(globalMemCounter.checkOutstandingNewEq(static_cast<int>(m_outstanding_new_on_init)));
631+
#else
632+
assert(globalMemCounter.checkOutstandingNewEq(static_cast<int>(m_outstanding_new_on_init)));
633+
#endif
630634
std::size_t Expect = m_new_count_on_init + m_req_alloc;
631635
assert(globalMemCounter.checkNewCalledEq(static_cast<int>(Expect)) ||
632636
(!m_exactly && globalMemCounter.checkNewCalledGreaterThan(static_cast<int>(Expect))));

0 commit comments

Comments
 (0)