stdlib.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
  2. /* A GNU-like <stdlib.h>.
  3. Copyright (C) 1995, 2001-2004, 2006-2007 Free Software Foundation, Inc.
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  14. #if defined __need_malloc_and_calloc
  15. /* Special invocation convention inside glibc header files. */
  16. #include_next <stdlib.h>
  17. #else
  18. /* Normal invocation convention. */
  19. #ifndef _GL_STDLIB_H
  20. /* The include_next requires a split double-inclusion guard. */
  21. #include_next <stdlib.h>
  22. #ifndef _GL_STDLIB_H
  23. #define _GL_STDLIB_H
  24. /* The definition of GL_LINK_WARNING is copied here. */
  25. /* GL_LINK_WARNING("literal string") arranges to emit the literal string as
  26. a linker warning on most glibc systems.
  27. We use a linker warning rather than a preprocessor warning, because
  28. #warning cannot be used inside macros. */
  29. #ifndef GL_LINK_WARNING
  30. /* This works on platforms with GNU ld and ELF object format.
  31. Testing __GLIBC__ is sufficient for asserting that GNU ld is in use.
  32. Testing __ELF__ guarantees the ELF object format.
  33. Testing __GNUC__ is necessary for the compound expression syntax. */
  34. # if defined __GLIBC__ && defined __ELF__ && defined __GNUC__
  35. # define GL_LINK_WARNING(message) \
  36. GL_LINK_WARNING1 (__FILE__, __LINE__, message)
  37. # define GL_LINK_WARNING1(file, line, message) \
  38. GL_LINK_WARNING2 (file, line, message) /* macroexpand file and line */
  39. # define GL_LINK_WARNING2(file, line, message) \
  40. GL_LINK_WARNING3 (file ":" #line ": warning: " message)
  41. # define GL_LINK_WARNING3(message) \
  42. ({ static const char warning[sizeof (message)] \
  43. __attribute__ ((__unused__, \
  44. __section__ (".gnu.warning"), \
  45. __aligned__ (1))) \
  46. = message "\n"; \
  47. (void)0; \
  48. })
  49. # else
  50. # define GL_LINK_WARNING(message) ((void) 0)
  51. # endif
  52. #endif
  53. /* Some systems do not define EXIT_*, despite otherwise supporting C89. */
  54. #ifndef EXIT_SUCCESS
  55. # define EXIT_SUCCESS 0
  56. #endif
  57. /* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere
  58. with proper operation of xargs. */
  59. #ifndef EXIT_FAILURE
  60. # define EXIT_FAILURE 1
  61. #elif EXIT_FAILURE != 1
  62. # undef EXIT_FAILURE
  63. # define EXIT_FAILURE 1
  64. #endif
  65. #ifdef __cplusplus
  66. extern "C" {
  67. #endif
  68. #if 1
  69. # if !1
  70. # undef malloc
  71. # define malloc rpl_malloc
  72. extern void * malloc (size_t size);
  73. # endif
  74. #elif defined GNULIB_POSIXCHECK
  75. # undef malloc
  76. # define malloc(s) \
  77. (GL_LINK_WARNING ("malloc is not POSIX compliant everywhere - " \
  78. "use gnulib module malloc-posix for portability"), \
  79. malloc (s))
  80. #endif
  81. #if 0
  82. # if !1
  83. # undef realloc
  84. # define realloc rpl_realloc
  85. extern void * realloc (void *ptr, size_t size);
  86. # endif
  87. #elif defined GNULIB_POSIXCHECK
  88. # undef realloc
  89. # define realloc(p,s) \
  90. (GL_LINK_WARNING ("realloc is not POSIX compliant everywhere - " \
  91. "use gnulib module realloc-posix for portability"), \
  92. realloc (p, s))
  93. #endif
  94. #if 0
  95. # if !1
  96. # undef calloc
  97. # define calloc rpl_calloc
  98. extern void * calloc (size_t nmemb, size_t size);
  99. # endif
  100. #elif defined GNULIB_POSIXCHECK
  101. # undef calloc
  102. # define calloc(n,s) \
  103. (GL_LINK_WARNING ("calloc is not POSIX compliant everywhere - " \
  104. "use gnulib module calloc-posix for portability"), \
  105. calloc (n, s))
  106. #endif
  107. #if 0
  108. /* Assuming *OPTIONP is a comma separated list of elements of the form
  109. "token" or "token=value", getsubopt parses the first of these elements.
  110. If the first element refers to a "token" that is member of the given
  111. NULL-terminated array of tokens:
  112. - It replaces the comma with a NUL byte, updates *OPTIONP to point past
  113. the first option and the comma, sets *VALUEP to the value of the
  114. element (or NULL if it doesn't contain an "=" sign),
  115. - It returns the index of the "token" in the given array of tokens.
  116. Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
  117. For more details see the POSIX:2001 specification.
  118. http://www.opengroup.org/susv3xsh/getsubopt.html */
  119. # if !1
  120. extern int getsubopt (char **optionp, char *const *tokens, char **valuep);
  121. # endif
  122. #elif defined GNULIB_POSIXCHECK
  123. # undef getsubopt
  124. # define getsubopt(o,t,v) \
  125. (GL_LINK_WARNING ("getsubopt is unportable - " \
  126. "use gnulib module getsubopt for portability"), \
  127. getsubopt (o, t, v))
  128. #endif
  129. #if 0
  130. # if !1
  131. /* Create a unique temporary directory from TEMPLATE.
  132. The last six characters of TEMPLATE must be "XXXXXX";
  133. they are replaced with a string that makes the directory name unique.
  134. Returns TEMPLATE, or a null pointer if it cannot get a unique name.
  135. The directory is created mode 700. */
  136. extern char * mkdtemp (char * /*template*/);
  137. # endif
  138. #elif defined GNULIB_POSIXCHECK
  139. # undef mkdtemp
  140. # define mkdtemp(t) \
  141. (GL_LINK_WARNING ("mkdtemp is unportable - " \
  142. "use gnulib module mkdtemp for portability"), \
  143. mkdtemp (t))
  144. #endif
  145. #if 0
  146. # if 0
  147. /* Create a unique temporary file from TEMPLATE.
  148. The last six characters of TEMPLATE must be "XXXXXX";
  149. they are replaced with a string that makes the file name unique.
  150. The file is then created, ensuring it didn't exist before.
  151. The file is created read-write (mask at least 0600 & ~umask), but it may be
  152. world-readable and world-writable (mask 0666 & ~umask), depending on the
  153. implementation.
  154. Returns the open file descriptor if successful, otherwise -1 and errno
  155. set. */
  156. # define mkstemp rpl_mkstemp
  157. extern int mkstemp (char * /*template*/);
  158. # else
  159. /* On MacOS X 10.3, only <unistd.h> declares mkstemp. */
  160. # include <unistd.h>
  161. # endif
  162. #elif defined GNULIB_POSIXCHECK
  163. # undef mkstemp
  164. # define mkstemp(t) \
  165. (GL_LINK_WARNING ("mkstemp is unportable - " \
  166. "use gnulib module mkstemp for portability"), \
  167. mkstemp (t))
  168. #endif
  169. #if 0
  170. # if 0
  171. # undef putenv
  172. # define putenv rpl_putenv
  173. extern int putenv (char *string);
  174. # endif
  175. #endif
  176. #if 0
  177. # if !1
  178. /* Set NAME to VALUE in the environment.
  179. If REPLACE is nonzero, overwrite an existing value. */
  180. extern int setenv (const char *name, const char *value, int replace);
  181. # endif
  182. #endif
  183. #if 0
  184. # if 1
  185. # if 0
  186. /* On some systems, unsetenv() returns void.
  187. This is the case for MacOS X 10.3, FreeBSD 4.8, NetBSD 1.6, OpenBSD 3.4. */
  188. # define unsetenv(name) ((unsetenv)(name), 0)
  189. # endif
  190. # else
  191. /* Remove the variable NAME from the environment. */
  192. extern int unsetenv (const char *name);
  193. # endif
  194. #endif
  195. #ifdef __cplusplus
  196. }
  197. #endif
  198. #endif /* _GL_STDLIB_H */
  199. #endif /* _GL_STDLIB_H */
  200. #endif