[PATCH] D45015: [Preprocessor] Allow libc++ to detect when aligned allocation is unavailable.

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 23 16:37:55 PDT 2018

rsmith added a comment.

In https://reviews.llvm.org/D45015#1109049, @ahatanak wrote:

> - Currently clang errors out when aligned operator new is selected but the OS's version is too old to support it. What's the reason we want to change this now to be a warning rather than an error?

I think it's fine to leave it as a `DefaultError` warning. I think it'd also be fine to change it to simply be an error (rather than an error-with-warning-flag) and remove the error recovery, and that actually seems a bit better: then our behavior under -faligned-alloc-unavailable would be equivalent to treating the implicit aligned forms of operator new/delete as if they had an availability attribute on them by default, which I think seems very reasonable.

> - So clang no longer needs to define macro `__ALIGNED_ALLOCATION_UNAVAILABLE__` and libc++ will use `__cpp_aligned_new` (I think you meant `__cpp_aligned_new`, not `__cpp_aligned_allocation`?) to determine whether aligned allocation functions should be defined or made available in the header?

Yes, that's the idea. `__cpp_aligned_new` exists to allow code to conditionally use aligned new if it's available, and we should do our best to honor that.

  rC Clang


More information about the cfe-commits mailing list