stdlib.in.h 24 KB

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