stdlib.in.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763
  1. /* A GNU-like <stdlib.h>.
  2. Copyright (C) 1995, 2001-2004, 2006-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 of the License, or
  6. (at your option) 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. #if __GNUC__ >= 3
  14. @PRAGMA_SYSTEM_HEADER@
  15. #endif
  16. @PRAGMA_COLUMNS@
  17. #if defined __need_malloc_and_calloc
  18. /* Special invocation convention inside glibc header files. */
  19. #@INCLUDE_NEXT@ @NEXT_STDLIB_H@
  20. #else
  21. /* Normal invocation convention. */
  22. #ifndef _@GUARD_PREFIX@_STDLIB_H
  23. /* The include_next requires a split double-inclusion guard. */
  24. #@INCLUDE_NEXT@ @NEXT_STDLIB_H@
  25. #ifndef _@GUARD_PREFIX@_STDLIB_H
  26. #define _@GUARD_PREFIX@_STDLIB_H
  27. /* NetBSD 5.0 mis-defines NULL. */
  28. #include <stddef.h>
  29. /* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>. */
  30. #if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS
  31. # include <sys/wait.h>
  32. #endif
  33. /* Solaris declares getloadavg() in <sys/loadavg.h>. */
  34. #if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@
  35. # include <sys/loadavg.h>
  36. #endif
  37. #if @GNULIB_RANDOM_R@
  38. /* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included
  39. from <stdlib.h> if _REENTRANT is defined. Include it whenever we need
  40. 'struct random_data'. */
  41. # if @HAVE_RANDOM_H@
  42. # include <random.h>
  43. # endif
  44. # if !@HAVE_STRUCT_RANDOM_DATA@ || !@HAVE_RANDOM_R@
  45. # include <stdint.h>
  46. # endif
  47. # if !@HAVE_STRUCT_RANDOM_DATA@
  48. /* Define 'struct random_data'.
  49. But allow multiple gnulib generated <stdlib.h> replacements to coexist. */
  50. # if !GNULIB_defined_struct_random_data
  51. struct random_data
  52. {
  53. int32_t *fptr; /* Front pointer. */
  54. int32_t *rptr; /* Rear pointer. */
  55. int32_t *state; /* Array of state values. */
  56. int rand_type; /* Type of random number generator. */
  57. int rand_deg; /* Degree of random number generator. */
  58. int rand_sep; /* Distance between front and rear. */
  59. int32_t *end_ptr; /* Pointer behind state table. */
  60. };
  61. # define GNULIB_defined_struct_random_data 1
  62. # endif
  63. # endif
  64. #endif
  65. #if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
  66. /* On MacOS X 10.3, only <unistd.h> declares mkstemp. */
  67. /* On MacOS X 10.5, only <unistd.h> declares mkstemps. */
  68. /* On Cygwin 1.7.1, only <unistd.h> declares getsubopt. */
  69. /* But avoid namespace pollution on glibc systems and native Windows. */
  70. # include <unistd.h>
  71. #endif
  72. /* The definition of _Noreturn is copied here. */
  73. /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
  74. /* The definition of _GL_ARG_NONNULL is copied here. */
  75. /* The definition of _GL_WARN_ON_USE is copied here. */
  76. /* Some systems do not define EXIT_*, despite otherwise supporting C89. */
  77. #ifndef EXIT_SUCCESS
  78. # define EXIT_SUCCESS 0
  79. #endif
  80. /* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere
  81. with proper operation of xargs. */
  82. #ifndef EXIT_FAILURE
  83. # define EXIT_FAILURE 1
  84. #elif EXIT_FAILURE != 1
  85. # undef EXIT_FAILURE
  86. # define EXIT_FAILURE 1
  87. #endif
  88. #if @GNULIB__EXIT@
  89. /* Terminate the current process with the given return code, without running
  90. the 'atexit' handlers. */
  91. # if !@HAVE__EXIT@
  92. _GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status));
  93. # endif
  94. _GL_CXXALIAS_SYS (_Exit, void, (int status));
  95. _GL_CXXALIASWARN (_Exit);
  96. #elif defined GNULIB_POSIXCHECK
  97. # undef _Exit
  98. # if HAVE_RAW_DECL__EXIT
  99. _GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
  100. "use gnulib module _Exit for portability");
  101. # endif
  102. #endif
  103. #if @GNULIB_ATOLL@
  104. /* Parse a signed decimal integer.
  105. Returns the value of the integer. Errors are not detected. */
  106. # if !@HAVE_ATOLL@
  107. _GL_FUNCDECL_SYS (atoll, long long, (const char *string) _GL_ARG_NONNULL ((1)));
  108. # endif
  109. _GL_CXXALIAS_SYS (atoll, long long, (const char *string));
  110. _GL_CXXALIASWARN (atoll);
  111. #elif defined GNULIB_POSIXCHECK
  112. # undef atoll
  113. # if HAVE_RAW_DECL_ATOLL
  114. _GL_WARN_ON_USE (atoll, "atoll is unportable - "
  115. "use gnulib module atoll for portability");
  116. # endif
  117. #endif
  118. #if @GNULIB_CALLOC_POSIX@
  119. # if @REPLACE_CALLOC@
  120. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  121. # undef calloc
  122. # define calloc rpl_calloc
  123. # endif
  124. _GL_FUNCDECL_RPL (calloc, void *, (size_t nmemb, size_t size));
  125. _GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size));
  126. # else
  127. _GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
  128. # endif
  129. _GL_CXXALIASWARN (calloc);
  130. #elif defined GNULIB_POSIXCHECK
  131. # undef calloc
  132. /* Assume calloc is always declared. */
  133. _GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - "
  134. "use gnulib module calloc-posix for portability");
  135. #endif
  136. #if @GNULIB_CANONICALIZE_FILE_NAME@
  137. # if @REPLACE_CANONICALIZE_FILE_NAME@
  138. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  139. # define canonicalize_file_name rpl_canonicalize_file_name
  140. # endif
  141. _GL_FUNCDECL_RPL (canonicalize_file_name, char *, (const char *name)
  142. _GL_ARG_NONNULL ((1)));
  143. _GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name));
  144. # else
  145. # if !@HAVE_CANONICALIZE_FILE_NAME@
  146. _GL_FUNCDECL_SYS (canonicalize_file_name, char *, (const char *name)
  147. _GL_ARG_NONNULL ((1)));
  148. # endif
  149. _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
  150. # endif
  151. _GL_CXXALIASWARN (canonicalize_file_name);
  152. #elif defined GNULIB_POSIXCHECK
  153. # undef canonicalize_file_name
  154. # if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
  155. _GL_WARN_ON_USE (canonicalize_file_name,
  156. "canonicalize_file_name is unportable - "
  157. "use gnulib module canonicalize-lgpl for portability");
  158. # endif
  159. #endif
  160. #if @GNULIB_GETLOADAVG@
  161. /* Store max(NELEM,3) load average numbers in LOADAVG[].
  162. The three numbers are the load average of the last 1 minute, the last 5
  163. minutes, and the last 15 minutes, respectively.
  164. LOADAVG is an array of NELEM numbers. */
  165. # if !@HAVE_DECL_GETLOADAVG@
  166. _GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem)
  167. _GL_ARG_NONNULL ((1)));
  168. # endif
  169. _GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem));
  170. _GL_CXXALIASWARN (getloadavg);
  171. #elif defined GNULIB_POSIXCHECK
  172. # undef getloadavg
  173. # if HAVE_RAW_DECL_GETLOADAVG
  174. _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
  175. "use gnulib module getloadavg for portability");
  176. # endif
  177. #endif
  178. #if @GNULIB_GETSUBOPT@
  179. /* Assuming *OPTIONP is a comma separated list of elements of the form
  180. "token" or "token=value", getsubopt parses the first of these elements.
  181. If the first element refers to a "token" that is member of the given
  182. NULL-terminated array of tokens:
  183. - It replaces the comma with a NUL byte, updates *OPTIONP to point past
  184. the first option and the comma, sets *VALUEP to the value of the
  185. element (or NULL if it doesn't contain an "=" sign),
  186. - It returns the index of the "token" in the given array of tokens.
  187. Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
  188. For more details see the POSIX:2001 specification.
  189. http://www.opengroup.org/susv3xsh/getsubopt.html */
  190. # if !@HAVE_GETSUBOPT@
  191. _GL_FUNCDECL_SYS (getsubopt, int,
  192. (char **optionp, char *const *tokens, char **valuep)
  193. _GL_ARG_NONNULL ((1, 2, 3)));
  194. # endif
  195. _GL_CXXALIAS_SYS (getsubopt, int,
  196. (char **optionp, char *const *tokens, char **valuep));
  197. _GL_CXXALIASWARN (getsubopt);
  198. #elif defined GNULIB_POSIXCHECK
  199. # undef getsubopt
  200. # if HAVE_RAW_DECL_GETSUBOPT
  201. _GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
  202. "use gnulib module getsubopt for portability");
  203. # endif
  204. #endif
  205. #if @GNULIB_GRANTPT@
  206. /* Change the ownership and access permission of the slave side of the
  207. pseudo-terminal whose master side is specified by FD. */
  208. # if !@HAVE_GRANTPT@
  209. _GL_FUNCDECL_SYS (grantpt, int, (int fd));
  210. # endif
  211. _GL_CXXALIAS_SYS (grantpt, int, (int fd));
  212. _GL_CXXALIASWARN (grantpt);
  213. #elif defined GNULIB_POSIXCHECK
  214. # undef grantpt
  215. # if HAVE_RAW_DECL_GRANTPT
  216. _GL_WARN_ON_USE (ptsname, "grantpt is not portable - "
  217. "use gnulib module grantpt for portability");
  218. # endif
  219. #endif
  220. /* If _GL_USE_STDLIB_ALLOC is nonzero, the including module does not
  221. rely on GNU or POSIX semantics for malloc and realloc (for example,
  222. by never specifying a zero size), so it does not need malloc or
  223. realloc to be redefined. */
  224. #if @GNULIB_MALLOC_POSIX@
  225. # if @REPLACE_MALLOC@
  226. # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
  227. || _GL_USE_STDLIB_ALLOC)
  228. # undef malloc
  229. # define malloc rpl_malloc
  230. # endif
  231. _GL_FUNCDECL_RPL (malloc, void *, (size_t size));
  232. _GL_CXXALIAS_RPL (malloc, void *, (size_t size));
  233. # else
  234. _GL_CXXALIAS_SYS (malloc, void *, (size_t size));
  235. # endif
  236. _GL_CXXALIASWARN (malloc);
  237. #elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
  238. # undef malloc
  239. /* Assume malloc is always declared. */
  240. _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
  241. "use gnulib module malloc-posix for portability");
  242. #endif
  243. /* Convert a multibyte character to a wide character. */
  244. #if @GNULIB_MBTOWC@
  245. # if @REPLACE_MBTOWC@
  246. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  247. # undef mbtowc
  248. # define mbtowc rpl_mbtowc
  249. # endif
  250. _GL_FUNCDECL_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
  251. _GL_CXXALIAS_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
  252. # else
  253. _GL_CXXALIAS_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
  254. # endif
  255. _GL_CXXALIASWARN (mbtowc);
  256. #endif
  257. #if @GNULIB_MKDTEMP@
  258. /* Create a unique temporary directory from TEMPLATE.
  259. The last six characters of TEMPLATE must be "XXXXXX";
  260. they are replaced with a string that makes the directory name unique.
  261. Returns TEMPLATE, or a null pointer if it cannot get a unique name.
  262. The directory is created mode 700. */
  263. # if !@HAVE_MKDTEMP@
  264. _GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1)));
  265. # endif
  266. _GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/));
  267. _GL_CXXALIASWARN (mkdtemp);
  268. #elif defined GNULIB_POSIXCHECK
  269. # undef mkdtemp
  270. # if HAVE_RAW_DECL_MKDTEMP
  271. _GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
  272. "use gnulib module mkdtemp for portability");
  273. # endif
  274. #endif
  275. #if @GNULIB_MKOSTEMP@
  276. /* Create a unique temporary file from TEMPLATE.
  277. The last six characters of TEMPLATE must be "XXXXXX";
  278. they are replaced with a string that makes the file name unique.
  279. The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
  280. and O_TEXT, O_BINARY (defined in "binary-io.h").
  281. The file is then created, with the specified flags, ensuring it didn't exist
  282. before.
  283. The file is created read-write (mask at least 0600 & ~umask), but it may be
  284. world-readable and world-writable (mask 0666 & ~umask), depending on the
  285. implementation.
  286. Returns the open file descriptor if successful, otherwise -1 and errno
  287. set. */
  288. # if !@HAVE_MKOSTEMP@
  289. _GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)
  290. _GL_ARG_NONNULL ((1)));
  291. # endif
  292. _GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/));
  293. _GL_CXXALIASWARN (mkostemp);
  294. #elif defined GNULIB_POSIXCHECK
  295. # undef mkostemp
  296. # if HAVE_RAW_DECL_MKOSTEMP
  297. _GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
  298. "use gnulib module mkostemp for portability");
  299. # endif
  300. #endif
  301. #if @GNULIB_MKOSTEMPS@
  302. /* Create a unique temporary file from TEMPLATE.
  303. The last six characters of TEMPLATE before a suffix of length
  304. SUFFIXLEN must be "XXXXXX";
  305. they are replaced with a string that makes the file name unique.
  306. The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
  307. and O_TEXT, O_BINARY (defined in "binary-io.h").
  308. The file is then created, with the specified flags, ensuring it didn't exist
  309. before.
  310. The file is created read-write (mask at least 0600 & ~umask), but it may be
  311. world-readable and world-writable (mask 0666 & ~umask), depending on the
  312. implementation.
  313. Returns the open file descriptor if successful, otherwise -1 and errno
  314. set. */
  315. # if !@HAVE_MKOSTEMPS@
  316. _GL_FUNCDECL_SYS (mkostemps, int,
  317. (char * /*template*/, int /*suffixlen*/, int /*flags*/)
  318. _GL_ARG_NONNULL ((1)));
  319. # endif
  320. _GL_CXXALIAS_SYS (mkostemps, int,
  321. (char * /*template*/, int /*suffixlen*/, int /*flags*/));
  322. _GL_CXXALIASWARN (mkostemps);
  323. #elif defined GNULIB_POSIXCHECK
  324. # undef mkostemps
  325. # if HAVE_RAW_DECL_MKOSTEMPS
  326. _GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
  327. "use gnulib module mkostemps for portability");
  328. # endif
  329. #endif
  330. #if @GNULIB_MKSTEMP@
  331. /* Create a unique temporary file from TEMPLATE.
  332. The last six characters of TEMPLATE must be "XXXXXX";
  333. they are replaced with a string that makes the file name unique.
  334. The file is then created, ensuring it didn't exist before.
  335. The file is created read-write (mask at least 0600 & ~umask), but it may be
  336. world-readable and world-writable (mask 0666 & ~umask), depending on the
  337. implementation.
  338. Returns the open file descriptor if successful, otherwise -1 and errno
  339. set. */
  340. # if @REPLACE_MKSTEMP@
  341. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  342. # define mkstemp rpl_mkstemp
  343. # endif
  344. _GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
  345. _GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/));
  346. # else
  347. # if ! @HAVE_MKSTEMP@
  348. _GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
  349. # endif
  350. _GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/));
  351. # endif
  352. _GL_CXXALIASWARN (mkstemp);
  353. #elif defined GNULIB_POSIXCHECK
  354. # undef mkstemp
  355. # if HAVE_RAW_DECL_MKSTEMP
  356. _GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
  357. "use gnulib module mkstemp for portability");
  358. # endif
  359. #endif
  360. #if @GNULIB_MKSTEMPS@
  361. /* Create a unique temporary file from TEMPLATE.
  362. The last six characters of TEMPLATE prior to a suffix of length
  363. SUFFIXLEN must be "XXXXXX";
  364. they are replaced with a string that makes the file name unique.
  365. The file is then created, ensuring it didn't exist before.
  366. The file is created read-write (mask at least 0600 & ~umask), but it may be
  367. world-readable and world-writable (mask 0666 & ~umask), depending on the
  368. implementation.
  369. Returns the open file descriptor if successful, otherwise -1 and errno
  370. set. */
  371. # if !@HAVE_MKSTEMPS@
  372. _GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)
  373. _GL_ARG_NONNULL ((1)));
  374. # endif
  375. _GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/));
  376. _GL_CXXALIASWARN (mkstemps);
  377. #elif defined GNULIB_POSIXCHECK
  378. # undef mkstemps
  379. # if HAVE_RAW_DECL_MKSTEMPS
  380. _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
  381. "use gnulib module mkstemps for portability");
  382. # endif
  383. #endif
  384. #if @GNULIB_PTSNAME@
  385. /* Return the pathname of the pseudo-terminal slave associated with
  386. the master FD is open on, or NULL on errors. */
  387. # if !@HAVE_PTSNAME@
  388. _GL_FUNCDECL_SYS (ptsname, char *, (int fd));
  389. # endif
  390. _GL_CXXALIAS_SYS (ptsname, char *, (int fd));
  391. _GL_CXXALIASWARN (ptsname);
  392. #elif defined GNULIB_POSIXCHECK
  393. # undef ptsname
  394. # if HAVE_RAW_DECL_PTSNAME
  395. _GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
  396. "use gnulib module ptsname for portability");
  397. # endif
  398. #endif
  399. #if @GNULIB_PUTENV@
  400. # if @REPLACE_PUTENV@
  401. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  402. # undef putenv
  403. # define putenv rpl_putenv
  404. # endif
  405. _GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1)));
  406. _GL_CXXALIAS_RPL (putenv, int, (char *string));
  407. # else
  408. _GL_CXXALIAS_SYS (putenv, int, (char *string));
  409. # endif
  410. _GL_CXXALIASWARN (putenv);
  411. #endif
  412. #if @GNULIB_RANDOM_R@
  413. # if !@HAVE_RANDOM_R@
  414. # ifndef RAND_MAX
  415. # define RAND_MAX 2147483647
  416. # endif
  417. # endif
  418. #endif
  419. #if @GNULIB_RANDOM_R@
  420. # if !@HAVE_RANDOM_R@
  421. _GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result)
  422. _GL_ARG_NONNULL ((1, 2)));
  423. # endif
  424. _GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
  425. _GL_CXXALIASWARN (random_r);
  426. #elif defined GNULIB_POSIXCHECK
  427. # undef random_r
  428. # if HAVE_RAW_DECL_RANDOM_R
  429. _GL_WARN_ON_USE (random_r, "random_r is unportable - "
  430. "use gnulib module random_r for portability");
  431. # endif
  432. #endif
  433. #if @GNULIB_RANDOM_R@
  434. # if !@HAVE_RANDOM_R@
  435. _GL_FUNCDECL_SYS (srandom_r, int,
  436. (unsigned int seed, struct random_data *rand_state)
  437. _GL_ARG_NONNULL ((2)));
  438. # endif
  439. _GL_CXXALIAS_SYS (srandom_r, int,
  440. (unsigned int seed, struct random_data *rand_state));
  441. _GL_CXXALIASWARN (srandom_r);
  442. #elif defined GNULIB_POSIXCHECK
  443. # undef srandom_r
  444. # if HAVE_RAW_DECL_SRANDOM_R
  445. _GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
  446. "use gnulib module random_r for portability");
  447. # endif
  448. #endif
  449. #if @GNULIB_RANDOM_R@
  450. # if !@HAVE_RANDOM_R@
  451. _GL_FUNCDECL_SYS (initstate_r, int,
  452. (unsigned int seed, char *buf, size_t buf_size,
  453. struct random_data *rand_state)
  454. _GL_ARG_NONNULL ((2, 4)));
  455. # endif
  456. _GL_CXXALIAS_SYS (initstate_r, int,
  457. (unsigned int seed, char *buf, size_t buf_size,
  458. struct random_data *rand_state));
  459. _GL_CXXALIASWARN (initstate_r);
  460. #elif defined GNULIB_POSIXCHECK
  461. # undef initstate_r
  462. # if HAVE_RAW_DECL_INITSTATE_R
  463. _GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
  464. "use gnulib module random_r for portability");
  465. # endif
  466. #endif
  467. #if @GNULIB_RANDOM_R@
  468. # if !@HAVE_RANDOM_R@
  469. _GL_FUNCDECL_SYS (setstate_r, int,
  470. (char *arg_state, struct random_data *rand_state)
  471. _GL_ARG_NONNULL ((1, 2)));
  472. # endif
  473. _GL_CXXALIAS_SYS (setstate_r, int,
  474. (char *arg_state, struct random_data *rand_state));
  475. _GL_CXXALIASWARN (setstate_r);
  476. #elif defined GNULIB_POSIXCHECK
  477. # undef setstate_r
  478. # if HAVE_RAW_DECL_SETSTATE_R
  479. _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
  480. "use gnulib module random_r for portability");
  481. # endif
  482. #endif
  483. #if @GNULIB_REALLOC_POSIX@
  484. # if @REPLACE_REALLOC@
  485. # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
  486. || _GL_USE_STDLIB_ALLOC)
  487. # undef realloc
  488. # define realloc rpl_realloc
  489. # endif
  490. _GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size));
  491. _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
  492. # else
  493. _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
  494. # endif
  495. _GL_CXXALIASWARN (realloc);
  496. #elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
  497. # undef realloc
  498. /* Assume realloc is always declared. */
  499. _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
  500. "use gnulib module realloc-posix for portability");
  501. #endif
  502. #if @GNULIB_REALPATH@
  503. # if @REPLACE_REALPATH@
  504. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  505. # define realpath rpl_realpath
  506. # endif
  507. _GL_FUNCDECL_RPL (realpath, char *, (const char *name, char *resolved)
  508. _GL_ARG_NONNULL ((1)));
  509. _GL_CXXALIAS_RPL (realpath, char *, (const char *name, char *resolved));
  510. # else
  511. # if !@HAVE_REALPATH@
  512. _GL_FUNCDECL_SYS (realpath, char *, (const char *name, char *resolved)
  513. _GL_ARG_NONNULL ((1)));
  514. # endif
  515. _GL_CXXALIAS_SYS (realpath, char *, (const char *name, char *resolved));
  516. # endif
  517. _GL_CXXALIASWARN (realpath);
  518. #elif defined GNULIB_POSIXCHECK
  519. # undef realpath
  520. # if HAVE_RAW_DECL_REALPATH
  521. _GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module "
  522. "canonicalize or canonicalize-lgpl for portability");
  523. # endif
  524. #endif
  525. #if @GNULIB_RPMATCH@
  526. /* Test a user response to a question.
  527. Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */
  528. # if !@HAVE_RPMATCH@
  529. _GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1)));
  530. # endif
  531. _GL_CXXALIAS_SYS (rpmatch, int, (const char *response));
  532. _GL_CXXALIASWARN (rpmatch);
  533. #elif defined GNULIB_POSIXCHECK
  534. # undef rpmatch
  535. # if HAVE_RAW_DECL_RPMATCH
  536. _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
  537. "use gnulib module rpmatch for portability");
  538. # endif
  539. #endif
  540. #if @GNULIB_SETENV@
  541. /* Set NAME to VALUE in the environment.
  542. If REPLACE is nonzero, overwrite an existing value. */
  543. # if @REPLACE_SETENV@
  544. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  545. # undef setenv
  546. # define setenv rpl_setenv
  547. # endif
  548. _GL_FUNCDECL_RPL (setenv, int,
  549. (const char *name, const char *value, int replace)
  550. _GL_ARG_NONNULL ((1)));
  551. _GL_CXXALIAS_RPL (setenv, int,
  552. (const char *name, const char *value, int replace));
  553. # else
  554. # if !@HAVE_DECL_SETENV@
  555. _GL_FUNCDECL_SYS (setenv, int,
  556. (const char *name, const char *value, int replace)
  557. _GL_ARG_NONNULL ((1)));
  558. # endif
  559. _GL_CXXALIAS_SYS (setenv, int,
  560. (const char *name, const char *value, int replace));
  561. # endif
  562. # if !(@REPLACE_SETENV@ && !@HAVE_DECL_SETENV@)
  563. _GL_CXXALIASWARN (setenv);
  564. # endif
  565. #elif defined GNULIB_POSIXCHECK
  566. # undef setenv
  567. # if HAVE_RAW_DECL_SETENV
  568. _GL_WARN_ON_USE (setenv, "setenv is unportable - "
  569. "use gnulib module setenv for portability");
  570. # endif
  571. #endif
  572. #if @GNULIB_STRTOD@
  573. /* Parse a double from STRING, updating ENDP if appropriate. */
  574. # if @REPLACE_STRTOD@
  575. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  576. # define strtod rpl_strtod
  577. # endif
  578. _GL_FUNCDECL_RPL (strtod, double, (const char *str, char **endp)
  579. _GL_ARG_NONNULL ((1)));
  580. _GL_CXXALIAS_RPL (strtod, double, (const char *str, char **endp));
  581. # else
  582. # if !@HAVE_STRTOD@
  583. _GL_FUNCDECL_SYS (strtod, double, (const char *str, char **endp)
  584. _GL_ARG_NONNULL ((1)));
  585. # endif
  586. _GL_CXXALIAS_SYS (strtod, double, (const char *str, char **endp));
  587. # endif
  588. _GL_CXXALIASWARN (strtod);
  589. #elif defined GNULIB_POSIXCHECK
  590. # undef strtod
  591. # if HAVE_RAW_DECL_STRTOD
  592. _GL_WARN_ON_USE (strtod, "strtod is unportable - "
  593. "use gnulib module strtod for portability");
  594. # endif
  595. #endif
  596. #if @GNULIB_STRTOLL@
  597. /* Parse a signed integer whose textual representation starts at STRING.
  598. The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
  599. it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
  600. "0x").
  601. If ENDPTR is not NULL, the address of the first byte after the integer is
  602. stored in *ENDPTR.
  603. Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
  604. to ERANGE. */
  605. # if !@HAVE_STRTOLL@
  606. _GL_FUNCDECL_SYS (strtoll, long long,
  607. (const char *string, char **endptr, int base)
  608. _GL_ARG_NONNULL ((1)));
  609. # endif
  610. _GL_CXXALIAS_SYS (strtoll, long long,
  611. (const char *string, char **endptr, int base));
  612. _GL_CXXALIASWARN (strtoll);
  613. #elif defined GNULIB_POSIXCHECK
  614. # undef strtoll
  615. # if HAVE_RAW_DECL_STRTOLL
  616. _GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
  617. "use gnulib module strtoll for portability");
  618. # endif
  619. #endif
  620. #if @GNULIB_STRTOULL@
  621. /* Parse an unsigned integer whose textual representation starts at STRING.
  622. The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
  623. it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
  624. "0x").
  625. If ENDPTR is not NULL, the address of the first byte after the integer is
  626. stored in *ENDPTR.
  627. Upon overflow, the return value is ULLONG_MAX, and errno is set to
  628. ERANGE. */
  629. # if !@HAVE_STRTOULL@
  630. _GL_FUNCDECL_SYS (strtoull, unsigned long long,
  631. (const char *string, char **endptr, int base)
  632. _GL_ARG_NONNULL ((1)));
  633. # endif
  634. _GL_CXXALIAS_SYS (strtoull, unsigned long long,
  635. (const char *string, char **endptr, int base));
  636. _GL_CXXALIASWARN (strtoull);
  637. #elif defined GNULIB_POSIXCHECK
  638. # undef strtoull
  639. # if HAVE_RAW_DECL_STRTOULL
  640. _GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
  641. "use gnulib module strtoull for portability");
  642. # endif
  643. #endif
  644. #if @GNULIB_UNLOCKPT@
  645. /* Unlock the slave side of the pseudo-terminal whose master side is specified
  646. by FD, so that it can be opened. */
  647. # if !@HAVE_UNLOCKPT@
  648. _GL_FUNCDECL_SYS (unlockpt, int, (int fd));
  649. # endif
  650. _GL_CXXALIAS_SYS (unlockpt, int, (int fd));
  651. _GL_CXXALIASWARN (unlockpt);
  652. #elif defined GNULIB_POSIXCHECK
  653. # undef unlockpt
  654. # if HAVE_RAW_DECL_UNLOCKPT
  655. _GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
  656. "use gnulib module unlockpt for portability");
  657. # endif
  658. #endif
  659. #if @GNULIB_UNSETENV@
  660. /* Remove the variable NAME from the environment. */
  661. # if @REPLACE_UNSETENV@
  662. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  663. # undef unsetenv
  664. # define unsetenv rpl_unsetenv
  665. # endif
  666. _GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
  667. _GL_CXXALIAS_RPL (unsetenv, int, (const char *name));
  668. # else
  669. # if !@HAVE_DECL_UNSETENV@
  670. _GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
  671. # endif
  672. _GL_CXXALIAS_SYS (unsetenv, int, (const char *name));
  673. # endif
  674. # if !(@REPLACE_UNSETENV@ && !@HAVE_DECL_UNSETENV@)
  675. _GL_CXXALIASWARN (unsetenv);
  676. # endif
  677. #elif defined GNULIB_POSIXCHECK
  678. # undef unsetenv
  679. # if HAVE_RAW_DECL_UNSETENV
  680. _GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
  681. "use gnulib module unsetenv for portability");
  682. # endif
  683. #endif
  684. /* Convert a wide character to a multibyte character. */
  685. #if @GNULIB_WCTOMB@
  686. # if @REPLACE_WCTOMB@
  687. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  688. # undef wctomb
  689. # define wctomb rpl_wctomb
  690. # endif
  691. _GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc));
  692. _GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc));
  693. # else
  694. _GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc));
  695. # endif
  696. _GL_CXXALIASWARN (wctomb);
  697. #endif
  698. #endif /* _@GUARD_PREFIX@_STDLIB_H */
  699. #endif /* _@GUARD_PREFIX@_STDLIB_H */
  700. #endif