Move internal usages of `alignof`/`__alignof` to use `_LIBCPP_ALIGNOF`.
authorEric Fiselier <eric@efcs.ca>
Wed, 16 Jan 2019 01:51:12 +0000 (01:51 +0000)
committerEric Fiselier <eric@efcs.ca>
Wed, 16 Jan 2019 01:51:12 +0000 (01:51 +0000)
commitd108bf85b09e3f1355fea866d90e3dd2266d67b5
treebedceef58ed8c43730f187f8adfffc4fcf38881b
parentac855d3ea9cb53f8c34422f3ce43ac41113f6b7f
Move internal usages of `alignof`/`__alignof` to use `_LIBCPP_ALIGNOF`.

Summary:
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.

Reviewers: ldionne, EricWF

Reviewed By: ldionne, EricWF

Subscribers: jyknight, christof, libcxx-commits

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

llvm-svn: 351289
13 files changed:
libcxx/include/__config
libcxx/include/__sso_allocator
libcxx/include/experimental/coroutine
libcxx/include/experimental/memory_resource
libcxx/include/functional
libcxx/include/memory
libcxx/include/type_traits
libcxx/include/valarray
libcxx/test/libcxx/libcpp_alignof.pass.cpp [new file with mode: 0644]
libcxx/test/std/containers/sequences/array/size_and_alignment.pass.cpp
libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp
libcxx/test/std/utilities/meta/meta.unary.prop.query/alignment_of.pass.cpp
libcxx/test/support/test_macros.h