stdlib.in.h 24 KB

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