[libcxx-commits] [PATCH] D118190: [libcxx] [test] Fix mismatches between _aligned_malloc and free() on Windows
Martin Storsjö via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jan 25 14:04:02 PST 2022
mstorsjo created this revision.
mstorsjo added a reviewer: ldionne.
mstorsjo requested review of this revision.
Herald added a project: libc++.
Herald added a reviewer: libc++.
This allows getting rid of one case of LIBCXX-WINDOWS-FIXME. The fixme
comment was inaccurate; these functions are provided these days, but the
test kept failing as it was using mismatched allocation and free
functions.
A similar issue was fixed earlier, in
6596778b46ba69517191e7397289228168064ff4 <https://reviews.llvm.org/rG6596778b46ba69517191e7397289228168064ff4>. That test was fixed by
overriding the aligned `operator new` too, and returning a dummy fixed
allocation instead. As this test is libcxx specific, it can use the
internal `std::__libcpp_aligned_free()` instead, to match libcxx's
internal aligned `operator new`.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D118190
Files:
libcxx/test/libcxx/language.support/support.dynamic/libcpp_deallocate.sh.cpp
Index: libcxx/test/libcxx/language.support/support.dynamic/libcpp_deallocate.sh.cpp
===================================================================
--- libcxx/test/libcxx/language.support/support.dynamic/libcpp_deallocate.sh.cpp
+++ libcxx/test/libcxx/language.support/support.dynamic/libcpp_deallocate.sh.cpp
@@ -9,10 +9,6 @@
// test libc++'s implementation of align_val_t, and the relevant new/delete
// overloads in all dialects when -faligned-allocation is present.
-// Libc++ defers to the underlying MSVC library to provide the new/delete
-// definitions, which does not yet provide aligned allocation
-// XFAIL: LIBCXX-WINDOWS-FIXME
-
// XFAIL: LIBCXX-AIX-FIXME
// The dylibs shipped before macosx10.13 do not contain the aligned allocation
@@ -115,14 +111,14 @@
#ifndef NO_ALIGN
void operator delete(void* p, std::align_val_t a)TEST_NOEXCEPT {
- ::free(p);
+ std::__libcpp_aligned_free(p);
stats.aligned_called++;
stats.last_align = static_cast<int>(a);
stats.last_size = -1;
}
void operator delete(void* p, size_t n, std::align_val_t a)TEST_NOEXCEPT {
- ::free(p);
+ std::__libcpp_aligned_free(p);
stats.aligned_sized_called++;
stats.last_align = static_cast<int>(a);
stats.last_size = n;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118190.403033.patch
Type: text/x-patch
Size: 1240 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220125/981d3434/attachment.bin>
More information about the libcxx-commits
mailing list