stddef.in.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues.
  2. Copyright (C) 2009-2011 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, write to the Free Software Foundation,
  13. Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
  14. /* Written by Eric Blake. */
  15. /*
  16. * POSIX 2008 <stddef.h> for platforms that have issues.
  17. * <http://www.opengroup.org/susv3xbd/stddef.h.html>
  18. */
  19. #if __GNUC__ >= 3
  20. @PRAGMA_SYSTEM_HEADER@
  21. #endif
  22. @PRAGMA_COLUMNS@
  23. #if defined __need_wchar_t || defined __need_size_t \
  24. || defined __need_ptrdiff_t || defined __need_NULL \
  25. || defined __need_wint_t
  26. /* Special invocation convention inside gcc header files. In
  27. particular, gcc provides a version of <stddef.h> that blindly
  28. redefines NULL even when __need_wint_t was defined, even though
  29. wint_t is not normally provided by <stddef.h>. Hence, we must
  30. remember if special invocation has ever been used to obtain wint_t,
  31. in which case we need to clean up NULL yet again. */
  32. # if !(defined _@GUARD_PREFIX@_STDDEF_H && defined _GL_STDDEF_WINT_T)
  33. # ifdef __need_wint_t
  34. # undef _@GUARD_PREFIX@_STDDEF_H
  35. # define _GL_STDDEF_WINT_T
  36. # endif
  37. # @INCLUDE_NEXT@ @NEXT_STDDEF_H@
  38. # endif
  39. #else
  40. /* Normal invocation convention. */
  41. # ifndef _@GUARD_PREFIX@_STDDEF_H
  42. /* The include_next requires a split double-inclusion guard. */
  43. # @INCLUDE_NEXT@ @NEXT_STDDEF_H@
  44. # ifndef _@GUARD_PREFIX@_STDDEF_H
  45. # define _@GUARD_PREFIX@_STDDEF_H
  46. /* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */
  47. #if @REPLACE_NULL@
  48. # undef NULL
  49. # ifdef __cplusplus
  50. /* ISO C++ says that the macro NULL must expand to an integer constant
  51. expression, hence '((void *) 0)' is not allowed in C++. */
  52. # if __GNUG__ >= 3
  53. /* GNU C++ has a __null macro that behaves like an integer ('int' or
  54. 'long') but has the same size as a pointer. Use that, to avoid
  55. warnings. */
  56. # define NULL __null
  57. # else
  58. # define NULL 0L
  59. # endif
  60. # else
  61. # define NULL ((void *) 0)
  62. # endif
  63. #endif
  64. /* Some platforms lack wchar_t. */
  65. #if !@HAVE_WCHAR_T@
  66. # define wchar_t int
  67. #endif
  68. # endif /* _@GUARD_PREFIX@_STDDEF_H */
  69. # endif /* _@GUARD_PREFIX@_STDDEF_H */
  70. #endif /* __need_XXX */