[PATCH] D54814: Move internal usages of `alignof`/`__alignof` to use `_LIBCPP_ALIGNOF`.

Eric Fiselier via Phabricator reviews at reviews.llvm.org
Wed Nov 21 14:39:37 PST 2018


EricWF created this revision.
EricWF added a reviewer: ldionne.
Herald added a subscriber: christof.

Starting in Clang 8.0 and GCC 8.0, `alignof` and `__alignof` return different values in same cases. Specifically `alignof` and `_Alignof` return the minimum alignment for a type, where as `__alignof` returns the preferred alignment. libc++ currently uses `__alignof` but means to use `alignof`. See  llvm.org/PR39713

This patch introduces the macro `_LIBCPP_ALIGNOF` so we can control which spelling gets used.

This patch does not introduce any ABI guard to provide the old behavior with newer compilers. However, if we decide that is needed, this patch makes it trivial to implement.

I think we should commit this change immediately, and decide what we want to do about the ABI afterwards.


Repository:
  rCXX libc++

https://reviews.llvm.org/D54814

Files:
  include/__config
  include/__sso_allocator
  include/experimental/coroutine
  include/experimental/dynarray
  include/memory
  include/type_traits
  include/valarray
  test/libcxx/libcpp_alignof.pass.cpp
  test/std/containers/sequences/array/size_and_alignment.pass.cpp
  test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp
  test/support/test_macros.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54814.174984.patch
Type: text/x-patch
Size: 19526 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20181121/d933b6ec/attachment-0001.bin>


More information about the libcxx-commits mailing list