1From 917331c88bd2afce0cf0fdbcab55a64541b5bcf0 Mon Sep 17 00:00:00 2001
2From: "David L. Jones" <dlj@google.com>
3Date: Fri, 10 Feb 2017 01:27:42 +0000
4Subject: [PATCH] Check for musl-libc's max_align_t in addition to other
5 variants.
6
7Summary:
8Libcxx will define its own max_align_t when it is not available. However, the
9availability checks today only check for Clang's definition and GCC's
10definition. In particular, it does not check for musl's definition, which is the
11same as GCC's but guarded with a different macro.
12
13Reviewers: mclow.lists, EricWF
14
15Reviewed By: EricWF
16
17Subscribers: chandlerc, cfe-commits
18
19Differential Revision: https://reviews.llvm.org/D28478
20
21git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294683 91177308-0d34-0410-b5e6-96231b3b80d8
22---
23 include/cstddef | 3 ++-
24 include/stddef.h | 3 ++-
25 2 files changed, 4 insertions(+), 2 deletions(-)
26
27diff --git a/include/cstddef b/include/cstddef
28index edd106c00..103898b7d 100644
29--- a/include/cstddef
30+++ b/include/cstddef
31@@ -48,7 +48,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
32 using ::ptrdiff_t;
33 using ::size_t;
34
35-#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T)
36+#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T) || \
37+ defined(__DEFINED_max_align_t)
38 // Re-use the compiler's <stddef.h> max_align_t where possible.
39 using ::max_align_t;
40 #else
41diff --git a/include/stddef.h b/include/stddef.h
42index 8841bbea2..faf8552d8 100644
43--- a/include/stddef.h
44+++ b/include/stddef.h
45@@ -53,7 +53,8 @@ using std::nullptr_t;
46 }
47
48 // Re-use the compiler's <stddef.h> max_align_t where possible.
49-#if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T)
50+#if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T) && \
51+ !defined(__DEFINED_max_align_t)
52 typedef long double max_align_t;
53 #endif
54