[all-commits] [llvm/llvm-project] 659677: [libcxx] [test] Fix mismatches between aligned ope...

Martin Storsjö via All-commits all-commits at lists.llvm.org
Thu Jul 15 13:38:51 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6596778b46ba69517191e7397289228168064ff4
      https://github.com/llvm/llvm-project/commit/6596778b46ba69517191e7397289228168064ff4
  Author: Martin Storsjö <martin at martin.st>
  Date:   2021-07-15 (Thu, 15 Jul 2021)

  Changed paths:
    M libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp
    M libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp

  Log Message:
  -----------
  [libcxx] [test] Fix mismatches between aligned operator new and std::free

The XFAIL comments about VCRuntime not providing aligned operator new
are outdated; these days VCRuntime does provide them.

However, the tests used to fail on Windows, as the pointers allocated
with an aligned operator new (which is implemented with _aligned_malloc
on Windows) can't be freed using std::free() on Windows (but they need
to be freed with the corresponding function _aligned_free instead).

Instead override the aligned operator new to return a dummy suitably
aligned pointer instead, like other tests that override aligned operator
new.

Also override `operator delete[]` instead of plain `operator delete`
in the array testcase; the fallback from `operator delete[]` to
user defined `operator delete` doesn't work in all DLL build
configurations on Windows.

Also expand the TEST_NOEXCEPT macros, as these tests only are built
in C++17 mode.

By providing the aligned operator new within the tests, this also makes
these test cases pass when testing back deployment on macOS 10.9.

Differential Revision: https://reviews.llvm.org/D105962




More information about the All-commits mailing list