diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-10-08 22:25:27 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-10-08 22:25:27 +0000 |
commit | d6cffc4fe067f4fbfbaed8b514df89a3323e33fc (patch) | |
tree | 2facc78ab6be225506e7a210903269d88747b31d /libcxx/test/std/depr/depr.c.headers | |
parent | e3c2626aa44c65fb0f3606e5c906570757c9711e (diff) | |
download | bcm5719-llvm-d6cffc4fe067f4fbfbaed8b514df89a3323e33fc.tar.gz bcm5719-llvm-d6cffc4fe067f4fbfbaed8b514df89a3323e33fc.zip |
Split <stddef.h> out of <cstddef>.
There are a bunch of macros (__need_size_t etc) that request just one piece of
<stddef.h>; if any one of these is defined, we just directly include the
underlying header.
Note that <stddef.h> provides a ::nullptr_t. We don't want that available to
includers of <cstddef>, so instead of following the usual pattern where <cfoo>
includes <foo.h> then pulls things from :: into std:: with using-declarations,
we implement <stddef.h> and <cstddef> separately; both include <__nullptr> for
the definition of std::nullptr_t.
llvm-svn: 249761
Diffstat (limited to 'libcxx/test/std/depr/depr.c.headers')
-rw-r--r-- | libcxx/test/std/depr/depr.c.headers/stddef_h.pass.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/libcxx/test/std/depr/depr.c.headers/stddef_h.pass.cpp b/libcxx/test/std/depr/depr.c.headers/stddef_h.pass.cpp index 140c91b53e6..c03c314e3bc 100644 --- a/libcxx/test/std/depr/depr.c.headers/stddef_h.pass.cpp +++ b/libcxx/test/std/depr/depr.c.headers/stddef_h.pass.cpp @@ -10,6 +10,7 @@ // <stddef.h> #include <stddef.h> +#include <cassert> #include <type_traits> #ifndef NULL @@ -22,6 +23,9 @@ int main() { + void *p = NULL; + assert(!p); + static_assert(sizeof(size_t) == sizeof(void*), "sizeof(size_t) == sizeof(void*)"); static_assert(std::is_unsigned<size_t>::value, @@ -34,4 +38,22 @@ int main() "std::is_signed<ptrdiff_t>::value"); static_assert(std::is_integral<ptrdiff_t>::value, "std::is_integral<ptrdiff_t>::value"); + static_assert(std::is_same<decltype(nullptr), nullptr_t>::value, + "decltype(nullptr) == nullptr_t"); + static_assert(sizeof(nullptr_t) == sizeof(void*), + "sizeof(nullptr_t) == sizeof(void*)"); + static_assert(std::is_pod<max_align_t>::value, + "std::is_pod<max_align_t>::value"); + static_assert((std::alignment_of<max_align_t>::value >= + std::alignment_of<long long>::value), + "std::alignment_of<max_align_t>::value >= " + "std::alignment_of<long long>::value"); + static_assert(std::alignment_of<max_align_t>::value >= + std::alignment_of<long double>::value, + "std::alignment_of<max_align_t>::value >= " + "std::alignment_of<long double>::value"); + static_assert(std::alignment_of<max_align_t>::value >= + std::alignment_of<void*>::value, + "std::alignment_of<max_align_t>::value >= " + "std::alignment_of<void*>::value"); } |