Sigrid Solveig Haflínudóttirstddef.h: guard base typedefs with __DEFINED_<type>ac3386910 months agoHistory
57 lines · 1.4 KB · C
RawDownload
#ifndef _STDDEF_H#define _STDDEF_H #ifndef __DEFINED_size_ttypedef __SIZE_TYPE__ size_t;#define __DEFINED_size_t#endif#ifndef __DEFINED_ssize_ttypedef __PTRDIFF_TYPE__ ssize_t;#define __DEFINED_ssize_t#endif#ifndef __DEFINED_wchar_ttypedef __WCHAR_TYPE__ wchar_t;#define __DEFINED_wchar_t#endif#ifndef __DEFINED_ptrdiff_ttypedef __PTRDIFF_TYPE__ ptrdiff_t;#define __DEFINED_ptrdiff_t#endif#ifndef __DEFINED_intptr_ttypedef __PTRDIFF_TYPE__ intptr_t;#define __DEFINED_intptr_t#endif#ifndef __DEFINED_uintptr_ttypedef __SIZE_TYPE__ uintptr_t;#define __DEFINED_uintptr_t#endif #if __STDC_VERSION__ >= 201112Ltypedef union { long long __ll; long double __ld; } max_align_t;#endif #ifndef NULL#define NULL ((void*)0)#endif #undef offsetof#define offsetof(type, field) __builtin_offsetof(type, field) void *alloca(size_t size); #endif /* Older glibc require a wint_t from <stddef.h> (when requested   by __need_wint_t, as otherwise stddef.h isn't allowed to   define this type).   Note that this must be outside the normal   _STDDEF_H guard, so that it works even when we've included the file   already (without requiring wint_t).  Some other libs define _WINT_T   if they've already provided that type, so we can use that as guard.   TCC defines __WINT_TYPE__ for us.  */#if defined (__need_wint_t)#ifndef _WINT_T#define _WINT_Ttypedef __WINT_TYPE__ wint_t;#endif#undef __need_wint_t#endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t