cstddef revision 276792
1227825Stheraven// -*- C++ -*- 2227825Stheraven//===--------------------------- cstddef ----------------------------------===// 3227825Stheraven// 4227825Stheraven// The LLVM Compiler Infrastructure 5227825Stheraven// 6227825Stheraven// This file is dual licensed under the MIT and the University of Illinois Open 7227825Stheraven// Source Licenses. See LICENSE.TXT for details. 8227825Stheraven// 9227825Stheraven//===----------------------------------------------------------------------===// 10227825Stheraven 11227825Stheraven#ifndef _LIBCPP_CSTDDEF 12227825Stheraven#define _LIBCPP_CSTDDEF 13227825Stheraven 14227825Stheraven/* 15227825Stheraven cstddef synopsis 16227825Stheraven 17227825StheravenMacros: 18227825Stheraven 19227825Stheraven offsetof(type,member-designator) 20227825Stheraven NULL 21227825Stheraven 22227825Stheravennamespace std 23227825Stheraven{ 24227825Stheraven 25227825StheravenTypes: 26227825Stheraven 27227825Stheraven ptrdiff_t 28227825Stheraven size_t 29227825Stheraven max_align_t 30227825Stheraven nullptr_t 31227825Stheraven 32227825Stheraven} // std 33227825Stheraven 34227825Stheraven*/ 35227825Stheraven 36227825Stheraven#include <__config> 37227825Stheraven 38227825Stheraven#include <stddef.h> 39227825Stheraven 40227825Stheraven#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 41227825Stheraven#pragma GCC system_header 42227825Stheraven#endif 43227825Stheraven 44227825Stheraven_LIBCPP_BEGIN_NAMESPACE_STD 45227825Stheraven 46227825Stheravenusing ::ptrdiff_t; 47227825Stheravenusing ::size_t; 48227825Stheraven 49276792Sdim#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T) 50276792Sdim// Re-use the compiler's <stddef.h> max_align_t where possible. 51276792Sdimusing ::max_align_t; 52276792Sdim#else 53227825Stheraventypedef long double max_align_t; 54276792Sdim#endif 55227825Stheraven 56227825Stheraven#ifdef _LIBCPP_HAS_NO_NULLPTR 57227825Stheraven 58261272Sdimstruct _LIBCPP_TYPE_VIS_ONLY nullptr_t 59227825Stheraven{ 60242939Stheraven void* __lx; 61227825Stheraven 62227825Stheraven struct __nat {int __for_bool_;}; 63227825Stheraven 64242939Stheraven _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t() : __lx(0) {} 65242939Stheraven _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t(int __nat::*) : __lx(0) {} 66227825Stheraven 67241900Sdim _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR operator int __nat::*() const {return 0;} 68227825Stheraven 69227825Stheraven template <class _Tp> 70241900Sdim _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR 71227825Stheraven operator _Tp* () const {return 0;} 72227825Stheraven 73227825Stheraven template <class _Tp, class _Up> 74227825Stheraven _LIBCPP_ALWAYS_INLINE 75227825Stheraven operator _Tp _Up::* () const {return 0;} 76227825Stheraven 77241900Sdim friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator==(nullptr_t, nullptr_t) {return true;} 78241900Sdim friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator!=(nullptr_t, nullptr_t) {return false;} 79241900Sdim friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<(nullptr_t, nullptr_t) {return false;} 80241900Sdim friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<=(nullptr_t, nullptr_t) {return true;} 81241900Sdim friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>(nullptr_t, nullptr_t) {return false;} 82241900Sdim friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>=(nullptr_t, nullptr_t) {return true;} 83227825Stheraven}; 84227825Stheraven 85241900Sdiminline _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t __get_nullptr_t() {return nullptr_t(0);} 86227825Stheraven 87227825Stheraven#define nullptr _VSTD::__get_nullptr_t() 88227825Stheraven 89227825Stheraven#endif // _LIBCPP_HAS_NO_NULLPTR 90227825Stheraven 91227825Stheraven_LIBCPP_END_NAMESPACE_STD 92227825Stheraven 93227825Stheraven#ifndef _LIBCPP_HAS_NO_NULLPTR 94227825Stheraven 95227825Stheravennamespace std 96227825Stheraven{ 97227825Stheraven typedef decltype(nullptr) nullptr_t; 98227825Stheraven} 99227825Stheraven 100227825Stheraven#endif // _LIBCPP_HAS_NO_NULLPTR 101227825Stheraven 102227825Stheraven#endif // _LIBCPP_CSTDDEF 103