[libcxx-commits] [PATCH] D98398: [libcxx] [test] Disable allocation checks in class.path tests on windows

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Mar 11 06:33:33 PST 2021

mstorsjo added inline comments.

Comment at: libcxx/test/support/test_macros.h:378
+#define NOT_WIN(...) __VA_ARGS__
Quuxplusone wrote:
> I think this macro's name needs to start with `TEST_`.
> Orthogonally, I think `WIN` should be `WIN32`, for greppability.
> So perhaps `#define TEST_NOT_WIN32(...)`? I wanted to say `TEST_EXCEPT_ON_WIN32`, except that I think someone might misread "EXCEPT" as having something to do with C++ exceptions.
> Alternatively, introduce a specific type `DisableAllocationGuardExceptOnWin32` and use that instead of `DisableAllocationGuard` in certain places.
> (Really `DisableAllocation` was a bad name in the first place — it doesn't //disable// the allocation guard, it //is// the allocation guard! — and what's meant is more like `ExpectNoAllocations`, `ExpectNoAllocationsExceptOnWin32`. Blech.)
I kinda intentionally left out the "test" prefix of the macro, designing it similar to the `LIBCPP_ONLY()` macro, but inverted. And it's not so much a "test this"-macro but more generically just a more convenient ifdef. (In some cases, a macro like `IF_WIN32_ELSE(win, else)` macro also would be convenient, but probably not worth it, and it'd be less clear.)

`WIN32` for greppability sounds good.

Agree about `DisableAllocation` being a non-ideal name, `ExpectNoAllocations` sounds good. I'm not entirely sold on making an ExceptOnWin32 variant though, as the exact condition for where/when to disable things (ie require that no allocations are done) varies, see e.g. the current modifications in string_alloc.pass.cpp.

  rG LLVM Github Monorepo



More information about the libcxx-commits mailing list