cstddef revision 242945
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#ifdef __GLIBC__ 39227825Stheraven#define __need_NULL 40227825Stheraven#define __need_ptrdiff_t 41227825Stheraven#define __need_size_t 42227825Stheraven#endif // __GLIBC__ 43227825Stheraven 44227825Stheraven#include <stddef.h> 45227825Stheraven 46227825Stheraven#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 47227825Stheraven#pragma GCC system_header 48227825Stheraven#endif 49227825Stheraven 50227825Stheraven_LIBCPP_BEGIN_NAMESPACE_STD 51227825Stheraven 52227825Stheravenusing ::ptrdiff_t; 53227825Stheravenusing ::size_t; 54227825Stheraven 55227825Stheraventypedef long double max_align_t; 56227825Stheraven 57227825Stheraven#ifdef _LIBCPP_HAS_NO_NULLPTR 58227825Stheraven 59227825Stheravenstruct _LIBCPP_VISIBLE nullptr_t 60227825Stheraven{ 61242945Stheraven void* __lx; 62227825Stheraven 63227825Stheraven struct __nat {int __for_bool_;}; 64227825Stheraven 65242945Stheraven _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t() : __lx(0) {} 66242945Stheraven _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t(int __nat::*) : __lx(0) {} 67227825Stheraven 68241903Sdim _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR operator int __nat::*() const {return 0;} 69227825Stheraven 70227825Stheraven template <class _Tp> 71241903Sdim _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR 72227825Stheraven operator _Tp* () const {return 0;} 73227825Stheraven 74227825Stheraven template <class _Tp, class _Up> 75227825Stheraven _LIBCPP_ALWAYS_INLINE 76227825Stheraven operator _Tp _Up::* () const {return 0;} 77227825Stheraven 78241903Sdim friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator==(nullptr_t, nullptr_t) {return true;} 79241903Sdim friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator!=(nullptr_t, nullptr_t) {return false;} 80241903Sdim friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<(nullptr_t, nullptr_t) {return false;} 81241903Sdim friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<=(nullptr_t, nullptr_t) {return true;} 82241903Sdim friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>(nullptr_t, nullptr_t) {return false;} 83241903Sdim friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>=(nullptr_t, nullptr_t) {return true;} 84227825Stheraven}; 85227825Stheraven 86241903Sdiminline _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t __get_nullptr_t() {return nullptr_t(0);} 87227825Stheraven 88227825Stheraven#define nullptr _VSTD::__get_nullptr_t() 89227825Stheraven 90227825Stheraven#endif // _LIBCPP_HAS_NO_NULLPTR 91227825Stheraven 92227825Stheraven_LIBCPP_END_NAMESPACE_STD 93227825Stheraven 94227825Stheraven#ifndef _LIBCPP_HAS_NO_NULLPTR 95227825Stheraven 96227825Stheravennamespace std 97227825Stheraven{ 98227825Stheraven typedef decltype(nullptr) nullptr_t; 99227825Stheraven} 100227825Stheraven 101227825Stheraven#endif // _LIBCPP_HAS_NO_NULLPTR 102227825Stheraven 103227825Stheraven#endif // _LIBCPP_CSTDDEF 104