[PATCH] D47814: Teach libc++ to use native NetBSD's max_align_t

Kamil Rytarowski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 6 02:33:02 PDT 2018


krytarowski created this revision.
krytarowski added reviewers: chandlerc, dlj, EricWF, joerg.
Herald added a subscriber: llvm-commits.

The NetBSD headers ship with max_align_t, that is not
compatible with the fallback version in libc++.

There is no defined a compiler specific symbol in the headers like:

- __CLANG_MAX_ALIGN_T_DEFINED
- _GCC_MAX_ALIGN_T
- __DEFINED_max_align_t

Sponsored by <The NetBSD Foundation>


Repository:
  rL LLVM

https://reviews.llvm.org/D47814

Files:
  include/cstddef
  include/stddef.h


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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47814.150093.patch
Type: text/x-patch
Size: 872 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180606/a91d9f53/attachment.bin>


More information about the cfe-commits mailing list