clang API Documentation
00001 /*===---- stddef.h - Basic type definitions --------------------------------=== 00002 * 00003 * Copyright (c) 2008 Eli Friedman 00004 * 00005 * Permission is hereby granted, free of charge, to any person obtaining a copy 00006 * of this software and associated documentation files (the "Software"), to deal 00007 * in the Software without restriction, including without limitation the rights 00008 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00009 * copies of the Software, and to permit persons to whom the Software is 00010 * furnished to do so, subject to the following conditions: 00011 * 00012 * The above copyright notice and this permission notice shall be included in 00013 * all copies or substantial portions of the Software. 00014 * 00015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00016 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00017 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00018 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00019 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00020 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00021 * THE SOFTWARE. 00022 * 00023 *===-----------------------------------------------------------------------=== 00024 */ 00025 00026 #ifndef __STDDEF_H 00027 #define __STDDEF_H 00028 00029 #ifndef _PTRDIFF_T 00030 #define _PTRDIFF_T 00031 typedef __typeof__(((int*)0)-((int*)0)) ptrdiff_t; 00032 #endif 00033 #ifndef _SIZE_T 00034 #define _SIZE_T 00035 typedef __typeof__(sizeof(int)) size_t; 00036 #endif 00037 #ifndef __cplusplus 00038 #ifndef _WCHAR_T 00039 #define _WCHAR_T 00040 typedef __WCHAR_TYPE__ wchar_t; 00041 #endif 00042 #endif 00043 00044 #undef NULL 00045 #ifdef __cplusplus 00046 # if !defined(__MINGW32__) && !defined(_MSC_VER) 00047 # define NULL __null 00048 # else 00049 # define NULL 0 00050 # endif 00051 #else 00052 # define NULL ((void*)0) 00053 #endif 00054 00055 #define offsetof(t, d) __builtin_offsetof(t, d) 00056 00057 #endif /* __STDDEF_H */ 00058 00059 /* Some C libraries expect to see a wint_t here. Others (notably MinGW) will use 00060 __WINT_TYPE__ directly; accommodate both by requiring __need_wint_t */ 00061 #if defined(__need_wint_t) 00062 #if !defined(_WINT_T) 00063 #define _WINT_T 00064 typedef __WINT_TYPE__ wint_t; 00065 #endif /* _WINT_T */ 00066 #undef __need_wint_t 00067 #endif /* __need_wint_t */