[libcxx] r201843 - Teach libc++ to use the compiler-provided C-compatible ::max_align_t

Chandler Carruth chandlerc at gmail.com
Fri Feb 21 00:37:30 PST 2014


Author: chandlerc
Date: Fri Feb 21 02:37:30 2014
New Revision: 201843

URL: http://llvm.org/viewvc/llvm-project?rev=201843&view=rev
Log:
Teach libc++ to use the compiler-provided C-compatible ::max_align_t
rather than its own type for std::max_align_t. This is particularly
relevant as the types may not be ABI compatible despite users expecting
them to be.

Modified:
    libcxx/trunk/include/cstddef

Modified: libcxx/trunk/include/cstddef
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cstddef?rev=201843&r1=201842&r2=201843&view=diff
==============================================================================
--- libcxx/trunk/include/cstddef (original)
+++ libcxx/trunk/include/cstddef Fri Feb 21 02:37:30 2014
@@ -52,7 +52,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 using ::ptrdiff_t;
 using ::size_t;
 
+#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T)
+// Re-use the compiler's <stddef.h> max_align_t where possible.
+using ::max_align_t;
+#else
 typedef long double max_align_t;
+#endif
 
 #ifdef _LIBCPP_HAS_NO_NULLPTR
 





More information about the cfe-commits mailing list