stddef.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #ifndef _STDDEF_H
  2. #define _STDDEF_H
  3. typedef __SIZE_TYPE__ size_t;
  4. typedef __PTRDIFF_TYPE__ ssize_t;
  5. typedef __WCHAR_TYPE__ wchar_t;
  6. typedef __PTRDIFF_TYPE__ ptrdiff_t;
  7. typedef __PTRDIFF_TYPE__ intptr_t;
  8. typedef __SIZE_TYPE__ uintptr_t;
  9. #ifndef __int8_t_defined
  10. #define __int8_t_defined
  11. typedef signed char int8_t;
  12. typedef signed short int int16_t;
  13. typedef signed int int32_t;
  14. #ifdef __LP64__
  15. typedef signed long int int64_t;
  16. #else
  17. typedef signed long long int int64_t;
  18. #endif
  19. typedef unsigned char uint8_t;
  20. typedef unsigned short int uint16_t;
  21. typedef unsigned int uint32_t;
  22. #ifdef __LP64__
  23. typedef unsigned long int uint64_t;
  24. #else
  25. typedef unsigned long long int uint64_t;
  26. #endif
  27. #endif
  28. #ifndef NULL
  29. #define NULL ((void*)0)
  30. #endif
  31. #define offsetof(type, field) ((size_t)&((type *)0)->field)
  32. void *alloca(size_t size);
  33. #endif
  34. /* Older glibc require a wint_t from <stddef.h> (when requested
  35. by __need_wint_t, as otherwise stddef.h isn't allowed to
  36. define this type). Note that this must be outside the normal
  37. _STDDEF_H guard, so that it works even when we've included the file
  38. already (without requiring wint_t). Some other libs define _WINT_T
  39. if they've already provided that type, so we can use that as guard.
  40. TCC defines __WINT_TYPE__ for us. */
  41. #if defined (__need_wint_t)
  42. #ifndef _WINT_T
  43. #define _WINT_T
  44. typedef __WINT_TYPE__ wint_t;
  45. #endif
  46. #undef __need_wint_t
  47. #endif