xref: /minix3/external/bsd/libc++/dist/libcxx/include/cstddef (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
14684ddb6SLionel Sambuc// -*- C++ -*-
24684ddb6SLionel Sambuc//===--------------------------- cstddef ----------------------------------===//
34684ddb6SLionel Sambuc//
44684ddb6SLionel Sambuc//                     The LLVM Compiler Infrastructure
54684ddb6SLionel Sambuc//
64684ddb6SLionel Sambuc// This file is dual licensed under the MIT and the University of Illinois Open
74684ddb6SLionel Sambuc// Source Licenses. See LICENSE.TXT for details.
84684ddb6SLionel Sambuc//
94684ddb6SLionel Sambuc//===----------------------------------------------------------------------===//
104684ddb6SLionel Sambuc
114684ddb6SLionel Sambuc#ifndef _LIBCPP_CSTDDEF
124684ddb6SLionel Sambuc#define _LIBCPP_CSTDDEF
134684ddb6SLionel Sambuc
144684ddb6SLionel Sambuc/*
154684ddb6SLionel Sambuc    cstddef synopsis
164684ddb6SLionel Sambuc
174684ddb6SLionel SambucMacros:
184684ddb6SLionel Sambuc
194684ddb6SLionel Sambuc    offsetof(type,member-designator)
204684ddb6SLionel Sambuc    NULL
214684ddb6SLionel Sambuc
224684ddb6SLionel Sambucnamespace std
234684ddb6SLionel Sambuc{
244684ddb6SLionel Sambuc
254684ddb6SLionel SambucTypes:
264684ddb6SLionel Sambuc
274684ddb6SLionel Sambuc    ptrdiff_t
284684ddb6SLionel Sambuc    size_t
294684ddb6SLionel Sambuc    max_align_t
304684ddb6SLionel Sambuc    nullptr_t
314684ddb6SLionel Sambuc
324684ddb6SLionel Sambuc}  // std
334684ddb6SLionel Sambuc
344684ddb6SLionel Sambuc*/
354684ddb6SLionel Sambuc
364684ddb6SLionel Sambuc#include <__config>
374684ddb6SLionel Sambuc
384684ddb6SLionel Sambuc#include <stddef.h>
394684ddb6SLionel Sambuc
404684ddb6SLionel Sambuc#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
414684ddb6SLionel Sambuc#pragma GCC system_header
424684ddb6SLionel Sambuc#endif
434684ddb6SLionel Sambuc
444684ddb6SLionel Sambuc_LIBCPP_BEGIN_NAMESPACE_STD
454684ddb6SLionel Sambuc
464684ddb6SLionel Sambucusing ::ptrdiff_t;
474684ddb6SLionel Sambucusing ::size_t;
484684ddb6SLionel Sambuc
49*0a6a1f1dSLionel Sambuc#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T)
50*0a6a1f1dSLionel Sambuc// Re-use the compiler's <stddef.h> max_align_t where possible.
51*0a6a1f1dSLionel Sambucusing ::max_align_t;
52*0a6a1f1dSLionel Sambuc#else
534684ddb6SLionel Sambuctypedef long double max_align_t;
54*0a6a1f1dSLionel Sambuc#endif
554684ddb6SLionel Sambuc
564684ddb6SLionel Sambuc#ifdef _LIBCPP_HAS_NO_NULLPTR
574684ddb6SLionel Sambuc
584684ddb6SLionel Sambucstruct _LIBCPP_TYPE_VIS_ONLY nullptr_t
594684ddb6SLionel Sambuc{
604684ddb6SLionel Sambuc    void* __lx;
614684ddb6SLionel Sambuc
624684ddb6SLionel Sambuc    struct __nat {int __for_bool_;};
634684ddb6SLionel Sambuc
644684ddb6SLionel Sambuc    _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t() : __lx(0) {}
654684ddb6SLionel Sambuc    _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t(int __nat::*) : __lx(0) {}
664684ddb6SLionel Sambuc
674684ddb6SLionel Sambuc    _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR operator int __nat::*() const {return 0;}
684684ddb6SLionel Sambuc
694684ddb6SLionel Sambuc    template <class _Tp>
704684ddb6SLionel Sambuc        _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR
714684ddb6SLionel Sambuc        operator _Tp* () const {return 0;}
724684ddb6SLionel Sambuc
734684ddb6SLionel Sambuc    template <class _Tp, class _Up>
744684ddb6SLionel Sambuc        _LIBCPP_ALWAYS_INLINE
754684ddb6SLionel Sambuc        operator _Tp _Up::* () const {return 0;}
764684ddb6SLionel Sambuc
774684ddb6SLionel Sambuc    friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator==(nullptr_t, nullptr_t) {return true;}
784684ddb6SLionel Sambuc    friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator!=(nullptr_t, nullptr_t) {return false;}
794684ddb6SLionel Sambuc    friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<(nullptr_t, nullptr_t) {return false;}
804684ddb6SLionel Sambuc    friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<=(nullptr_t, nullptr_t) {return true;}
814684ddb6SLionel Sambuc    friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>(nullptr_t, nullptr_t) {return false;}
824684ddb6SLionel Sambuc    friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>=(nullptr_t, nullptr_t) {return true;}
834684ddb6SLionel Sambuc};
844684ddb6SLionel Sambuc
854684ddb6SLionel Sambucinline _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t __get_nullptr_t() {return nullptr_t(0);}
864684ddb6SLionel Sambuc
874684ddb6SLionel Sambuc#define nullptr _VSTD::__get_nullptr_t()
884684ddb6SLionel Sambuc
894684ddb6SLionel Sambuc#endif  // _LIBCPP_HAS_NO_NULLPTR
904684ddb6SLionel Sambuc
914684ddb6SLionel Sambuc_LIBCPP_END_NAMESPACE_STD
924684ddb6SLionel Sambuc
934684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_NULLPTR
944684ddb6SLionel Sambuc
954684ddb6SLionel Sambucnamespace std
964684ddb6SLionel Sambuc{
974684ddb6SLionel Sambuc    typedef decltype(nullptr) nullptr_t;
984684ddb6SLionel Sambuc}
994684ddb6SLionel Sambuc
1004684ddb6SLionel Sambuc#endif  // _LIBCPP_HAS_NO_NULLPTR
1014684ddb6SLionel Sambuc
1024684ddb6SLionel Sambuc#endif  // _LIBCPP_CSTDDEF
103