[PATCH] D28478: Check for musl-libc's max_align_t in addition to other variants.

David L. Jones via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 9 13:19:56 PST 2017

dlj created this revision.
dlj added a reviewer: mclow.lists.
dlj added a subscriber: cfe-commits.

Libcxx will define its own max_align_t when it is not available. However, the
availability checks today only check for Clang's definition and GCC's
definition. In particular, it does not check for musl's definition, which is the
same as GCC's but guarded with a different macro.



Index: include/stddef.h
--- include/stddef.h
+++ include/stddef.h
@@ -53,7 +53,8 @@
 // Re-use the compiler's <stddef.h> max_align_t where possible.
-#if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T)
+#if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T) && \
+    !defined(__DEFINED_max_align_t)
 typedef long double max_align_t;
Index: include/cstddef
--- include/cstddef
+++ include/cstddef
@@ -48,7 +48,8 @@
 using ::ptrdiff_t;
 using ::size_t;
-#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T)
+#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T) || \
+    defined(__DEFINED_max_align_t)
 // Re-use the compiler's <stddef.h> max_align_t where possible.
 using ::max_align_t;

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28478.83681.patch
Type: text/x-patch
Size: 919 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170109/7ea1898e/attachment.bin>

More information about the cfe-commits mailing list