stddef.h revision 221345
1193326Sed/*===---- stddef.h - Basic type definitions --------------------------------=== 2193326Sed * 3193326Sed * Copyright (c) 2008 Eli Friedman 4193326Sed * 5193326Sed * Permission is hereby granted, free of charge, to any person obtaining a copy 6193326Sed * of this software and associated documentation files (the "Software"), to deal 7193326Sed * in the Software without restriction, including without limitation the rights 8193326Sed * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9193326Sed * copies of the Software, and to permit persons to whom the Software is 10193326Sed * furnished to do so, subject to the following conditions: 11193326Sed * 12193326Sed * The above copyright notice and this permission notice shall be included in 13193326Sed * all copies or substantial portions of the Software. 14193326Sed * 15193326Sed * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16193326Sed * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17193326Sed * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18193326Sed * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19193326Sed * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20193326Sed * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21193326Sed * THE SOFTWARE. 22193326Sed * 23193326Sed *===-----------------------------------------------------------------------=== 24193326Sed */ 25193326Sed 26193326Sed#ifndef __STDDEF_H 27193326Sed#define __STDDEF_H 28193326Sed 29221345Sdim#ifndef _PTRDIFF_T 30221345Sdim#define _PTRDIFF_T 31193326Sedtypedef __typeof__(((int*)0)-((int*)0)) ptrdiff_t; 32221345Sdim#endif 33204962Srdivacky#ifndef _SIZE_T 34204962Srdivacky#define _SIZE_T 35193326Sedtypedef __typeof__(sizeof(int)) size_t; 36204962Srdivacky#endif 37193326Sed#ifndef __cplusplus 38204962Srdivacky#ifndef _WCHAR_T 39204962Srdivacky#define _WCHAR_T 40212904Sdimtypedef __WCHAR_TYPE__ wchar_t; 41193326Sed#endif 42204962Srdivacky#endif 43193326Sed 44204962Srdivacky#undef NULL 45193326Sed#ifdef __cplusplus 46212904Sdim#undef __null // VC++ hack. 47193326Sed#define NULL __null 48193326Sed#else 49193326Sed#define NULL ((void*)0) 50193326Sed#endif 51193326Sed 52193326Sed#define offsetof(t, d) __builtin_offsetof(t, d) 53193326Sed 54193326Sed#endif /* __STDDEF_H */ 55218893Sdim 56218893Sdim/* Some C libraries expect to see a wint_t here. Others (notably MinGW) will use 57221345Sdim__WINT_TYPE__ directly; accommodate both by requiring __need_wint_t */ 58218893Sdim#if defined(__need_wint_t) 59218893Sdim#if !defined(_WINT_T) 60218893Sdim#define _WINT_T 61218893Sdimtypedef __WINT_TYPE__ wint_t; 62218893Sdim#endif /* _WINT_T */ 63218893Sdim#undef __need_wint_t 64218893Sdim#endif /* __need_wint_t */ 65