1*fdd8201dSApple OSS Distributions /*===---- stddef.h - Basic type definitions --------------------------------=== 2*fdd8201dSApple OSS Distributions * 3*fdd8201dSApple OSS Distributions * Copyright (c) 2008 Eli Friedman 4*fdd8201dSApple OSS Distributions * 5*fdd8201dSApple OSS Distributions * Permission is hereby granted, free of charge, to any person obtaining a copy 6*fdd8201dSApple OSS Distributions * of this software and associated documentation files (the "Software"), to deal 7*fdd8201dSApple OSS Distributions * in the Software without restriction, including without limitation the rights 8*fdd8201dSApple OSS Distributions * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9*fdd8201dSApple OSS Distributions * copies of the Software, and to permit persons to whom the Software is 10*fdd8201dSApple OSS Distributions * furnished to do so, subject to the following conditions: 11*fdd8201dSApple OSS Distributions * 12*fdd8201dSApple OSS Distributions * The above copyright notice and this permission notice shall be included in 13*fdd8201dSApple OSS Distributions * all copies or substantial portions of the Software. 14*fdd8201dSApple OSS Distributions * 15*fdd8201dSApple OSS Distributions * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16*fdd8201dSApple OSS Distributions * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17*fdd8201dSApple OSS Distributions * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18*fdd8201dSApple OSS Distributions * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19*fdd8201dSApple OSS Distributions * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20*fdd8201dSApple OSS Distributions * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21*fdd8201dSApple OSS Distributions * THE SOFTWARE. 22*fdd8201dSApple OSS Distributions * 23*fdd8201dSApple OSS Distributions *===-----------------------------------------------------------------------=== 24*fdd8201dSApple OSS Distributions */ 25*fdd8201dSApple OSS Distributions 26*fdd8201dSApple OSS Distributions #ifndef __STDDEF_H 27*fdd8201dSApple OSS Distributions #define __STDDEF_H 28*fdd8201dSApple OSS Distributions 29*fdd8201dSApple OSS Distributions #undef NULL 30*fdd8201dSApple OSS Distributions #ifdef __cplusplus 31*fdd8201dSApple OSS Distributions #if __cplusplus >= 201103L 32*fdd8201dSApple OSS Distributions #define NULL nullptr 33*fdd8201dSApple OSS Distributions #else 34*fdd8201dSApple OSS Distributions #undef __null // VC++ hack. 35*fdd8201dSApple OSS Distributions #define NULL __null 36*fdd8201dSApple OSS Distributions #endif 37*fdd8201dSApple OSS Distributions #elif defined(__has_feature) && __has_feature(bounds_attributes) 38*fdd8201dSApple OSS Distributions #define NULL __unsafe_forge_single(void *, 0) 39*fdd8201dSApple OSS Distributions #else 40*fdd8201dSApple OSS Distributions #define NULL ((void*)0) 41*fdd8201dSApple OSS Distributions #endif 42*fdd8201dSApple OSS Distributions 43*fdd8201dSApple OSS Distributions #ifndef _PTRDIFF_T 44*fdd8201dSApple OSS Distributions #define _PTRDIFF_T 45*fdd8201dSApple OSS Distributions typedef __typeof__(((int*)NULL)-((int*)NULL)) ptrdiff_t; 46*fdd8201dSApple OSS Distributions #endif 47*fdd8201dSApple OSS Distributions #ifndef _SIZE_T 48*fdd8201dSApple OSS Distributions #define _SIZE_T 49*fdd8201dSApple OSS Distributions typedef __typeof__(sizeof(int)) size_t; 50*fdd8201dSApple OSS Distributions #endif 51*fdd8201dSApple OSS Distributions #ifndef __cplusplus 52*fdd8201dSApple OSS Distributions #ifndef _WCHAR_T 53*fdd8201dSApple OSS Distributions #define _WCHAR_T 54*fdd8201dSApple OSS Distributions typedef __WCHAR_TYPE__ wchar_t; 55*fdd8201dSApple OSS Distributions #endif 56*fdd8201dSApple OSS Distributions #endif 57*fdd8201dSApple OSS Distributions 58*fdd8201dSApple OSS Distributions #ifndef offsetof 59*fdd8201dSApple OSS Distributions #define offsetof(t, d) __builtin_offsetof(t, d) 60*fdd8201dSApple OSS Distributions #endif 61*fdd8201dSApple OSS Distributions 62*fdd8201dSApple OSS Distributions #endif /* __STDDEF_H */ 63*fdd8201dSApple OSS Distributions 64*fdd8201dSApple OSS Distributions /* Some C libraries expect to see a wint_t here. Others (notably MinGW) will use 65*fdd8201dSApple OSS Distributions __WINT_TYPE__ directly; accommodate both by requiring __need_wint_t */ 66*fdd8201dSApple OSS Distributions #if defined(__need_wint_t) 67*fdd8201dSApple OSS Distributions #if !defined(_WINT_T) 68*fdd8201dSApple OSS Distributions #define _WINT_T 69*fdd8201dSApple OSS Distributions typedef __WINT_TYPE__ wint_t; 70*fdd8201dSApple OSS Distributions #endif /* _WINT_T */ 71*fdd8201dSApple OSS Distributions #undef __need_wint_t 72*fdd8201dSApple OSS Distributions #endif /* __need_wint_t */ 73