4
0

stddef.in.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues.
  2. Copyright (C) 2009-2015 Free Software Foundation, Inc.
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 3, or (at your option)
  6. any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, see <http://www.gnu.org/licenses/>. */
  13. /* Written by Eric Blake. */
  14. /*
  15. * POSIX 2008 <stddef.h> for platforms that have issues.
  16. * <http://www.opengroup.org/susv3xbd/stddef.h.html>
  17. */
  18. #if __GNUC__ >= 3
  19. @PRAGMA_SYSTEM_HEADER@
  20. #endif
  21. @PRAGMA_COLUMNS@
  22. #if defined __need_wchar_t || defined __need_size_t \
  23. || defined __need_ptrdiff_t || defined __need_NULL \
  24. || defined __need_wint_t
  25. /* Special invocation convention inside gcc header files. In
  26. particular, gcc provides a version of <stddef.h> that blindly
  27. redefines NULL even when __need_wint_t was defined, even though
  28. wint_t is not normally provided by <stddef.h>. Hence, we must
  29. remember if special invocation has ever been used to obtain wint_t,
  30. in which case we need to clean up NULL yet again. */
  31. # if !(defined _@GUARD_PREFIX@_STDDEF_H && defined _GL_STDDEF_WINT_T)
  32. # ifdef __need_wint_t
  33. # define _GL_STDDEF_WINT_T
  34. # endif
  35. # @INCLUDE_NEXT@ @NEXT_STDDEF_H@
  36. # endif
  37. #else
  38. /* Normal invocation convention. */
  39. # ifndef _@GUARD_PREFIX@_STDDEF_H
  40. /* The include_next requires a split double-inclusion guard. */
  41. # @INCLUDE_NEXT@ @NEXT_STDDEF_H@
  42. /* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */
  43. # if (@REPLACE_NULL@ \
  44. && (!defined _@GUARD_PREFIX@_STDDEF_H || defined _GL_STDDEF_WINT_T))
  45. # undef NULL
  46. # ifdef __cplusplus
  47. /* ISO C++ says that the macro NULL must expand to an integer constant
  48. expression, hence '((void *) 0)' is not allowed in C++. */
  49. # if __GNUG__ >= 3
  50. /* GNU C++ has a __null macro that behaves like an integer ('int' or
  51. 'long') but has the same size as a pointer. Use that, to avoid
  52. warnings. */
  53. # define NULL __null
  54. # else
  55. # define NULL 0L
  56. # endif
  57. # else
  58. # define NULL ((void *) 0)
  59. # endif
  60. # endif
  61. # ifndef _@GUARD_PREFIX@_STDDEF_H
  62. # define _@GUARD_PREFIX@_STDDEF_H
  63. /* Some platforms lack wchar_t. */
  64. #if !@HAVE_WCHAR_T@
  65. # define wchar_t int
  66. #endif
  67. /* Some platforms lack max_align_t. */
  68. #if !@HAVE_MAX_ALIGN_T@
  69. typedef union
  70. {
  71. char *__p;
  72. double __d;
  73. long double __ld;
  74. long int __i;
  75. } max_align_t;
  76. #endif
  77. # endif /* _@GUARD_PREFIX@_STDDEF_H */
  78. # endif /* _@GUARD_PREFIX@_STDDEF_H */
  79. #endif /* __need_XXX */