stdlib.in.h 52 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518
  1. /* A GNU-like <stdlib.h>.
  2. Copyright (C) 1995, 2001-2004, 2006-2021 Free Software Foundation, Inc.
  3. This file is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU Lesser General Public License as
  5. published by the Free Software Foundation; either version 2.1 of the
  6. License, or (at your option) any later version.
  7. This file 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 <https://www.gnu.org/licenses/>. */
  13. #if __GNUC__ >= 3
  14. @PRAGMA_SYSTEM_HEADER@
  15. #endif
  16. @PRAGMA_COLUMNS@
  17. #if defined __need_system_stdlib_h || defined __need_malloc_and_calloc
  18. /* Special invocation conventions inside some gnulib header files,
  19. and inside some glibc header files, respectively. */
  20. #@INCLUDE_NEXT@ @NEXT_STDLIB_H@
  21. #else
  22. /* Normal invocation convention. */
  23. #ifndef _@GUARD_PREFIX@_STDLIB_H
  24. /* The include_next requires a split double-inclusion guard. */
  25. #@INCLUDE_NEXT@ @NEXT_STDLIB_H@
  26. #ifndef _@GUARD_PREFIX@_STDLIB_H
  27. #define _@GUARD_PREFIX@_STDLIB_H
  28. /* NetBSD 5.0 mis-defines NULL. */
  29. #include <stddef.h>
  30. /* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>. */
  31. #if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS
  32. # include <sys/wait.h>
  33. #endif
  34. /* Solaris declares getloadavg() in <sys/loadavg.h>. */
  35. #if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@
  36. /* OpenIndiana has a bug: <sys/time.h> must be included before
  37. <sys/loadavg.h>. */
  38. # include <sys/time.h>
  39. # include <sys/loadavg.h>
  40. #endif
  41. /* Native Windows platforms declare _mktemp() in <io.h>. */
  42. #if defined _WIN32 && !defined __CYGWIN__
  43. # include <io.h>
  44. #endif
  45. #if @GNULIB_RANDOM_R@
  46. /* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included
  47. from <stdlib.h> if _REENTRANT is defined. Include it whenever we need
  48. 'struct random_data'. */
  49. # if @HAVE_RANDOM_H@
  50. # include <random.h>
  51. # endif
  52. # if !@HAVE_STRUCT_RANDOM_DATA@ || @REPLACE_RANDOM_R@ || !@HAVE_RANDOM_R@
  53. # include <stdint.h>
  54. # endif
  55. # if !@HAVE_STRUCT_RANDOM_DATA@
  56. /* Define 'struct random_data'.
  57. But allow multiple gnulib generated <stdlib.h> replacements to coexist. */
  58. # if !GNULIB_defined_struct_random_data
  59. struct random_data
  60. {
  61. int32_t *fptr; /* Front pointer. */
  62. int32_t *rptr; /* Rear pointer. */
  63. int32_t *state; /* Array of state values. */
  64. int rand_type; /* Type of random number generator. */
  65. int rand_deg; /* Degree of random number generator. */
  66. int rand_sep; /* Distance between front and rear. */
  67. int32_t *end_ptr; /* Pointer behind state table. */
  68. };
  69. # define GNULIB_defined_struct_random_data 1
  70. # endif
  71. # endif
  72. #endif
  73. #if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_MKOSTEMP@ || @GNULIB_MKOSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !(defined _WIN32 && ! defined __CYGWIN__)
  74. /* On Mac OS X 10.3, only <unistd.h> declares mkstemp. */
  75. /* On Mac OS X 10.5, only <unistd.h> declares mkstemps. */
  76. /* On Mac OS X 10.13, only <unistd.h> declares mkostemp and mkostemps. */
  77. /* On Cygwin 1.7.1, only <unistd.h> declares getsubopt. */
  78. /* But avoid namespace pollution on glibc systems and native Windows. */
  79. # include <unistd.h>
  80. #endif
  81. /* The __attribute__ feature is available in gcc versions 2.5 and later.
  82. The attribute __pure__ was added in gcc 2.96. */
  83. #ifndef _GL_ATTRIBUTE_PURE
  84. # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
  85. # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
  86. # else
  87. # define _GL_ATTRIBUTE_PURE /* empty */
  88. # endif
  89. #endif
  90. /* The definition of _Noreturn is copied here. */
  91. /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
  92. /* The definition of _GL_ARG_NONNULL is copied here. */
  93. /* The definition of _GL_WARN_ON_USE is copied here. */
  94. /* Some systems do not define EXIT_*, despite otherwise supporting C89. */
  95. #ifndef EXIT_SUCCESS
  96. # define EXIT_SUCCESS 0
  97. #endif
  98. /* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere
  99. with proper operation of xargs. */
  100. #ifndef EXIT_FAILURE
  101. # define EXIT_FAILURE 1
  102. #elif EXIT_FAILURE != 1
  103. # undef EXIT_FAILURE
  104. # define EXIT_FAILURE 1
  105. #endif
  106. #if @GNULIB__EXIT@
  107. /* Terminate the current process with the given return code, without running
  108. the 'atexit' handlers. */
  109. # if !@HAVE__EXIT@
  110. _GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status));
  111. # endif
  112. _GL_CXXALIAS_SYS (_Exit, void, (int status));
  113. _GL_CXXALIASWARN (_Exit);
  114. #elif defined GNULIB_POSIXCHECK
  115. # undef _Exit
  116. # if HAVE_RAW_DECL__EXIT
  117. _GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
  118. "use gnulib module _Exit for portability");
  119. # endif
  120. #endif
  121. #if @GNULIB_FREE_POSIX@
  122. # if @REPLACE_FREE@
  123. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  124. # undef free
  125. # define free rpl_free
  126. # endif
  127. _GL_FUNCDECL_RPL (free, void, (void *ptr));
  128. _GL_CXXALIAS_RPL (free, void, (void *ptr));
  129. # else
  130. _GL_CXXALIAS_SYS (free, void, (void *ptr));
  131. # endif
  132. # if __GLIBC__ >= 2
  133. _GL_CXXALIASWARN (free);
  134. # endif
  135. #elif defined GNULIB_POSIXCHECK
  136. # undef free
  137. /* Assume free is always declared. */
  138. _GL_WARN_ON_USE (free, "free is not future POSIX compliant everywhere - "
  139. "use gnulib module free for portability");
  140. #endif
  141. /* Allocate memory with indefinite extent and specified alignment. */
  142. #if @GNULIB_ALIGNED_ALLOC@
  143. # if @REPLACE_ALIGNED_ALLOC@
  144. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  145. # undef aligned_alloc
  146. # define aligned_alloc rpl_aligned_alloc
  147. # endif
  148. _GL_FUNCDECL_RPL (aligned_alloc, void *,
  149. (size_t alignment, size_t size)
  150. _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
  151. _GL_CXXALIAS_RPL (aligned_alloc, void *, (size_t alignment, size_t size));
  152. # else
  153. # if @HAVE_ALIGNED_ALLOC@
  154. # if __GNUC__ >= 11
  155. /* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */
  156. _GL_FUNCDECL_SYS (aligned_alloc, void *,
  157. (size_t alignment, size_t size)
  158. _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
  159. # endif
  160. _GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size));
  161. # endif
  162. # endif
  163. # if @HAVE_ALIGNED_ALLOC@
  164. _GL_CXXALIASWARN (aligned_alloc);
  165. # endif
  166. #else
  167. # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined aligned_alloc
  168. /* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */
  169. _GL_FUNCDECL_SYS (aligned_alloc, void *,
  170. (size_t alignment, size_t size)
  171. _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
  172. # endif
  173. # if defined GNULIB_POSIXCHECK
  174. # undef aligned_alloc
  175. # if HAVE_RAW_DECL_ALIGNED_ALLOC
  176. _GL_WARN_ON_USE (aligned_alloc, "aligned_alloc is not portable - "
  177. "use gnulib module aligned_alloc for portability");
  178. # endif
  179. # endif
  180. #endif
  181. #if @GNULIB_ATOLL@
  182. /* Parse a signed decimal integer.
  183. Returns the value of the integer. Errors are not detected. */
  184. # if !@HAVE_ATOLL@
  185. _GL_FUNCDECL_SYS (atoll, long long, (const char *string)
  186. _GL_ATTRIBUTE_PURE
  187. _GL_ARG_NONNULL ((1)));
  188. # endif
  189. _GL_CXXALIAS_SYS (atoll, long long, (const char *string));
  190. _GL_CXXALIASWARN (atoll);
  191. #elif defined GNULIB_POSIXCHECK
  192. # undef atoll
  193. # if HAVE_RAW_DECL_ATOLL
  194. _GL_WARN_ON_USE (atoll, "atoll is unportable - "
  195. "use gnulib module atoll for portability");
  196. # endif
  197. #endif
  198. #if @GNULIB_CALLOC_POSIX@
  199. # if @REPLACE_CALLOC@
  200. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  201. # undef calloc
  202. # define calloc rpl_calloc
  203. # endif
  204. _GL_FUNCDECL_RPL (calloc, void *,
  205. (size_t nmemb, size_t size)
  206. _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
  207. _GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size));
  208. # else
  209. # if __GNUC__ >= 11
  210. /* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */
  211. _GL_FUNCDECL_SYS (calloc, void *,
  212. (size_t nmemb, size_t size)
  213. _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
  214. # endif
  215. _GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
  216. # endif
  217. # if __GLIBC__ >= 2
  218. _GL_CXXALIASWARN (calloc);
  219. # endif
  220. #else
  221. # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined calloc
  222. /* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */
  223. _GL_FUNCDECL_SYS (calloc, void *,
  224. (size_t nmemb, size_t size)
  225. _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
  226. # endif
  227. # if defined GNULIB_POSIXCHECK
  228. # undef calloc
  229. /* Assume calloc is always declared. */
  230. _GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - "
  231. "use gnulib module calloc-posix for portability");
  232. # endif
  233. #endif
  234. #if @GNULIB_CANONICALIZE_FILE_NAME@
  235. # if @REPLACE_CANONICALIZE_FILE_NAME@
  236. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  237. # define canonicalize_file_name rpl_canonicalize_file_name
  238. # endif
  239. _GL_FUNCDECL_RPL (canonicalize_file_name, char *,
  240. (const char *name)
  241. _GL_ARG_NONNULL ((1))
  242. _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
  243. _GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name));
  244. # else
  245. # if !@HAVE_CANONICALIZE_FILE_NAME@ || __GNUC__ >= 11
  246. _GL_FUNCDECL_SYS (canonicalize_file_name, char *,
  247. (const char *name)
  248. _GL_ARG_NONNULL ((1))
  249. _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
  250. # endif
  251. _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
  252. # endif
  253. # ifndef GNULIB_defined_canonicalize_file_name
  254. # define GNULIB_defined_canonicalize_file_name \
  255. (!@HAVE_CANONICALIZE_FILE_NAME@ || @REPLACE_CANONICALIZE_FILE_NAME@)
  256. # endif
  257. _GL_CXXALIASWARN (canonicalize_file_name);
  258. #else
  259. # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined canonicalize_file_name
  260. /* For -Wmismatched-dealloc: Associate canonicalize_file_name with free or
  261. rpl_free. */
  262. _GL_FUNCDECL_SYS (canonicalize_file_name, char *,
  263. (const char *name)
  264. _GL_ARG_NONNULL ((1))
  265. _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
  266. # endif
  267. # if defined GNULIB_POSIXCHECK
  268. # undef canonicalize_file_name
  269. # if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
  270. _GL_WARN_ON_USE (canonicalize_file_name,
  271. "canonicalize_file_name is unportable - "
  272. "use gnulib module canonicalize-lgpl for portability");
  273. # endif
  274. # endif
  275. #endif
  276. #if @GNULIB_MDA_ECVT@
  277. /* On native Windows, map 'ecvt' to '_ecvt', so that -loldnames is not
  278. required. In C++ with GNULIB_NAMESPACE, avoid differences between
  279. platforms by defining GNULIB_NAMESPACE::ecvt on all platforms that have
  280. it. */
  281. # if defined _WIN32 && !defined __CYGWIN__
  282. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  283. # undef ecvt
  284. # define ecvt _ecvt
  285. # endif
  286. _GL_CXXALIAS_MDA (ecvt, char *,
  287. (double number, int ndigits, int *decptp, int *signp));
  288. # else
  289. # if @HAVE_DECL_ECVT@
  290. _GL_CXXALIAS_SYS (ecvt, char *,
  291. (double number, int ndigits, int *decptp, int *signp));
  292. # endif
  293. # endif
  294. # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_ECVT@
  295. _GL_CXXALIASWARN (ecvt);
  296. # endif
  297. #endif
  298. #if @GNULIB_MDA_FCVT@
  299. /* On native Windows, map 'fcvt' to '_fcvt', so that -loldnames is not
  300. required. In C++ with GNULIB_NAMESPACE, avoid differences between
  301. platforms by defining GNULIB_NAMESPACE::fcvt on all platforms that have
  302. it. */
  303. # if defined _WIN32 && !defined __CYGWIN__
  304. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  305. # undef fcvt
  306. # define fcvt _fcvt
  307. # endif
  308. _GL_CXXALIAS_MDA (fcvt, char *,
  309. (double number, int ndigits, int *decptp, int *signp));
  310. # else
  311. # if @HAVE_DECL_FCVT@
  312. _GL_CXXALIAS_SYS (fcvt, char *,
  313. (double number, int ndigits, int *decptp, int *signp));
  314. # endif
  315. # endif
  316. # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_FCVT@
  317. _GL_CXXALIASWARN (fcvt);
  318. # endif
  319. #endif
  320. #if @GNULIB_MDA_GCVT@
  321. /* On native Windows, map 'gcvt' to '_gcvt', so that -loldnames is not
  322. required. In C++ with GNULIB_NAMESPACE, avoid differences between
  323. platforms by defining GNULIB_NAMESPACE::gcvt on all platforms that have
  324. it. */
  325. # if defined _WIN32 && !defined __CYGWIN__
  326. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  327. # undef gcvt
  328. # define gcvt _gcvt
  329. # endif
  330. _GL_CXXALIAS_MDA (gcvt, char *, (double number, int ndigits, char *buf));
  331. # else
  332. # if @HAVE_DECL_GCVT@
  333. _GL_CXXALIAS_SYS (gcvt, char *, (double number, int ndigits, char *buf));
  334. # endif
  335. # endif
  336. # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_GCVT@
  337. _GL_CXXALIASWARN (gcvt);
  338. # endif
  339. #endif
  340. #if @GNULIB_GETLOADAVG@
  341. /* Store max(NELEM,3) load average numbers in LOADAVG[].
  342. The three numbers are the load average of the last 1 minute, the last 5
  343. minutes, and the last 15 minutes, respectively.
  344. LOADAVG is an array of NELEM numbers. */
  345. # if !@HAVE_DECL_GETLOADAVG@
  346. _GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem)
  347. _GL_ARG_NONNULL ((1)));
  348. # endif
  349. _GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem));
  350. _GL_CXXALIASWARN (getloadavg);
  351. #elif defined GNULIB_POSIXCHECK
  352. # undef getloadavg
  353. # if HAVE_RAW_DECL_GETLOADAVG
  354. _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
  355. "use gnulib module getloadavg for portability");
  356. # endif
  357. #endif
  358. #if @GNULIB_GETSUBOPT@
  359. /* Assuming *OPTIONP is a comma separated list of elements of the form
  360. "token" or "token=value", getsubopt parses the first of these elements.
  361. If the first element refers to a "token" that is member of the given
  362. NULL-terminated array of tokens:
  363. - It replaces the comma with a NUL byte, updates *OPTIONP to point past
  364. the first option and the comma, sets *VALUEP to the value of the
  365. element (or NULL if it doesn't contain an "=" sign),
  366. - It returns the index of the "token" in the given array of tokens.
  367. Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
  368. For more details see the POSIX specification.
  369. https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsubopt.html */
  370. # if !@HAVE_GETSUBOPT@
  371. _GL_FUNCDECL_SYS (getsubopt, int,
  372. (char **optionp, char *const *tokens, char **valuep)
  373. _GL_ARG_NONNULL ((1, 2, 3)));
  374. # endif
  375. _GL_CXXALIAS_SYS (getsubopt, int,
  376. (char **optionp, char *const *tokens, char **valuep));
  377. _GL_CXXALIASWARN (getsubopt);
  378. #elif defined GNULIB_POSIXCHECK
  379. # undef getsubopt
  380. # if HAVE_RAW_DECL_GETSUBOPT
  381. _GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
  382. "use gnulib module getsubopt for portability");
  383. # endif
  384. #endif
  385. #if @GNULIB_GRANTPT@
  386. /* Change the ownership and access permission of the slave side of the
  387. pseudo-terminal whose master side is specified by FD. */
  388. # if !@HAVE_GRANTPT@
  389. _GL_FUNCDECL_SYS (grantpt, int, (int fd));
  390. # endif
  391. _GL_CXXALIAS_SYS (grantpt, int, (int fd));
  392. _GL_CXXALIASWARN (grantpt);
  393. #elif defined GNULIB_POSIXCHECK
  394. # undef grantpt
  395. # if HAVE_RAW_DECL_GRANTPT
  396. _GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
  397. "use gnulib module grantpt for portability");
  398. # endif
  399. #endif
  400. /* If _GL_USE_STDLIB_ALLOC is nonzero, the including module does not
  401. rely on GNU or POSIX semantics for malloc and realloc (for example,
  402. by never specifying a zero size), so it does not need malloc or
  403. realloc to be redefined. */
  404. #if @GNULIB_MALLOC_POSIX@
  405. # if @REPLACE_MALLOC@
  406. # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
  407. || _GL_USE_STDLIB_ALLOC)
  408. # undef malloc
  409. # define malloc rpl_malloc
  410. # endif
  411. _GL_FUNCDECL_RPL (malloc, void *,
  412. (size_t size)
  413. _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
  414. _GL_CXXALIAS_RPL (malloc, void *, (size_t size));
  415. # else
  416. # if __GNUC__ >= 11
  417. /* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */
  418. _GL_FUNCDECL_SYS (malloc, void *,
  419. (size_t size)
  420. _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
  421. # endif
  422. _GL_CXXALIAS_SYS (malloc, void *, (size_t size));
  423. # endif
  424. # if __GLIBC__ >= 2
  425. _GL_CXXALIASWARN (malloc);
  426. # endif
  427. #else
  428. # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined malloc
  429. /* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */
  430. _GL_FUNCDECL_SYS (malloc, void *,
  431. (size_t size)
  432. _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
  433. # endif
  434. # if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
  435. # undef malloc
  436. /* Assume malloc is always declared. */
  437. _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
  438. "use gnulib module malloc-posix for portability");
  439. # endif
  440. #endif
  441. /* Convert a multibyte character to a wide character. */
  442. #if @GNULIB_MBTOWC@
  443. # if @REPLACE_MBTOWC@
  444. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  445. # undef mbtowc
  446. # define mbtowc rpl_mbtowc
  447. # endif
  448. _GL_FUNCDECL_RPL (mbtowc, int,
  449. (wchar_t *restrict pwc, const char *restrict s, size_t n));
  450. _GL_CXXALIAS_RPL (mbtowc, int,
  451. (wchar_t *restrict pwc, const char *restrict s, size_t n));
  452. # else
  453. # if !@HAVE_MBTOWC@
  454. _GL_FUNCDECL_SYS (mbtowc, int,
  455. (wchar_t *restrict pwc, const char *restrict s, size_t n));
  456. # endif
  457. _GL_CXXALIAS_SYS (mbtowc, int,
  458. (wchar_t *restrict pwc, const char *restrict s, size_t n));
  459. # endif
  460. # if __GLIBC__ >= 2
  461. _GL_CXXALIASWARN (mbtowc);
  462. # endif
  463. #elif defined GNULIB_POSIXCHECK
  464. # undef mbtowc
  465. # if HAVE_RAW_DECL_MBTOWC
  466. _GL_WARN_ON_USE (mbtowc, "mbtowc is not portable - "
  467. "use gnulib module mbtowc for portability");
  468. # endif
  469. #endif
  470. #if @GNULIB_MKDTEMP@
  471. /* Create a unique temporary directory from TEMPLATE.
  472. The last six characters of TEMPLATE must be "XXXXXX";
  473. they are replaced with a string that makes the directory name unique.
  474. Returns TEMPLATE, or a null pointer if it cannot get a unique name.
  475. The directory is created mode 700. */
  476. # if !@HAVE_MKDTEMP@
  477. _GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1)));
  478. # endif
  479. _GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/));
  480. _GL_CXXALIASWARN (mkdtemp);
  481. #elif defined GNULIB_POSIXCHECK
  482. # undef mkdtemp
  483. # if HAVE_RAW_DECL_MKDTEMP
  484. _GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
  485. "use gnulib module mkdtemp for portability");
  486. # endif
  487. #endif
  488. #if @GNULIB_MKOSTEMP@
  489. /* Create a unique temporary file from TEMPLATE.
  490. The last six characters of TEMPLATE must be "XXXXXX";
  491. they are replaced with a string that makes the file name unique.
  492. The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
  493. and O_TEXT, O_BINARY (defined in "binary-io.h").
  494. The file is then created, with the specified flags, ensuring it didn't exist
  495. before.
  496. The file is created read-write (mask at least 0600 & ~umask), but it may be
  497. world-readable and world-writable (mask 0666 & ~umask), depending on the
  498. implementation.
  499. Returns the open file descriptor if successful, otherwise -1 and errno
  500. set. */
  501. # if !@HAVE_MKOSTEMP@
  502. _GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)
  503. _GL_ARG_NONNULL ((1)));
  504. # endif
  505. _GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/));
  506. _GL_CXXALIASWARN (mkostemp);
  507. #elif defined GNULIB_POSIXCHECK
  508. # undef mkostemp
  509. # if HAVE_RAW_DECL_MKOSTEMP
  510. _GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
  511. "use gnulib module mkostemp for portability");
  512. # endif
  513. #endif
  514. #if @GNULIB_MKOSTEMPS@
  515. /* Create a unique temporary file from TEMPLATE.
  516. The last six characters of TEMPLATE before a suffix of length
  517. SUFFIXLEN must be "XXXXXX";
  518. they are replaced with a string that makes the file name unique.
  519. The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
  520. and O_TEXT, O_BINARY (defined in "binary-io.h").
  521. The file is then created, with the specified flags, ensuring it didn't exist
  522. before.
  523. The file is created read-write (mask at least 0600 & ~umask), but it may be
  524. world-readable and world-writable (mask 0666 & ~umask), depending on the
  525. implementation.
  526. Returns the open file descriptor if successful, otherwise -1 and errno
  527. set. */
  528. # if !@HAVE_MKOSTEMPS@
  529. _GL_FUNCDECL_SYS (mkostemps, int,
  530. (char * /*template*/, int /*suffixlen*/, int /*flags*/)
  531. _GL_ARG_NONNULL ((1)));
  532. # endif
  533. _GL_CXXALIAS_SYS (mkostemps, int,
  534. (char * /*template*/, int /*suffixlen*/, int /*flags*/));
  535. _GL_CXXALIASWARN (mkostemps);
  536. #elif defined GNULIB_POSIXCHECK
  537. # undef mkostemps
  538. # if HAVE_RAW_DECL_MKOSTEMPS
  539. _GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
  540. "use gnulib module mkostemps for portability");
  541. # endif
  542. #endif
  543. #if @GNULIB_MKSTEMP@
  544. /* Create a unique temporary file from TEMPLATE.
  545. The last six characters of TEMPLATE must be "XXXXXX";
  546. they are replaced with a string that makes the file name unique.
  547. The file is then created, ensuring it didn't exist before.
  548. The file is created read-write (mask at least 0600 & ~umask), but it may be
  549. world-readable and world-writable (mask 0666 & ~umask), depending on the
  550. implementation.
  551. Returns the open file descriptor if successful, otherwise -1 and errno
  552. set. */
  553. # if @REPLACE_MKSTEMP@
  554. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  555. # define mkstemp rpl_mkstemp
  556. # endif
  557. _GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
  558. _GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/));
  559. # else
  560. # if ! @HAVE_MKSTEMP@
  561. _GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
  562. # endif
  563. _GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/));
  564. # endif
  565. _GL_CXXALIASWARN (mkstemp);
  566. #elif defined GNULIB_POSIXCHECK
  567. # undef mkstemp
  568. # if HAVE_RAW_DECL_MKSTEMP
  569. _GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
  570. "use gnulib module mkstemp for portability");
  571. # endif
  572. #endif
  573. #if @GNULIB_MKSTEMPS@
  574. /* Create a unique temporary file from TEMPLATE.
  575. The last six characters of TEMPLATE prior to a suffix of length
  576. SUFFIXLEN must be "XXXXXX";
  577. they are replaced with a string that makes the file name unique.
  578. The file is then created, ensuring it didn't exist before.
  579. The file is created read-write (mask at least 0600 & ~umask), but it may be
  580. world-readable and world-writable (mask 0666 & ~umask), depending on the
  581. implementation.
  582. Returns the open file descriptor if successful, otherwise -1 and errno
  583. set. */
  584. # if !@HAVE_MKSTEMPS@
  585. _GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)
  586. _GL_ARG_NONNULL ((1)));
  587. # endif
  588. _GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/));
  589. _GL_CXXALIASWARN (mkstemps);
  590. #elif defined GNULIB_POSIXCHECK
  591. # undef mkstemps
  592. # if HAVE_RAW_DECL_MKSTEMPS
  593. _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
  594. "use gnulib module mkstemps for portability");
  595. # endif
  596. #endif
  597. #if @GNULIB_MDA_MKTEMP@
  598. /* On native Windows, map 'mktemp' to '_mktemp', so that -loldnames is not
  599. required. In C++ with GNULIB_NAMESPACE, avoid differences between
  600. platforms by defining GNULIB_NAMESPACE::mktemp always. */
  601. # if defined _WIN32 && !defined __CYGWIN__
  602. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  603. # undef mktemp
  604. # define mktemp _mktemp
  605. # endif
  606. _GL_CXXALIAS_MDA (mktemp, char *, (char * /*template*/));
  607. # else
  608. _GL_CXXALIAS_SYS (mktemp, char *, (char * /*template*/));
  609. # endif
  610. _GL_CXXALIASWARN (mktemp);
  611. #endif
  612. /* Allocate memory with indefinite extent and specified alignment. */
  613. #if @GNULIB_POSIX_MEMALIGN@
  614. # if @REPLACE_POSIX_MEMALIGN@
  615. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  616. # undef posix_memalign
  617. # define posix_memalign rpl_posix_memalign
  618. # endif
  619. _GL_FUNCDECL_RPL (posix_memalign, int,
  620. (void **memptr, size_t alignment, size_t size)
  621. _GL_ARG_NONNULL ((1)));
  622. _GL_CXXALIAS_RPL (posix_memalign, int,
  623. (void **memptr, size_t alignment, size_t size));
  624. # else
  625. # if @HAVE_POSIX_MEMALIGN@
  626. _GL_CXXALIAS_SYS (posix_memalign, int,
  627. (void **memptr, size_t alignment, size_t size));
  628. # endif
  629. # endif
  630. # if @HAVE_POSIX_MEMALIGN@
  631. _GL_CXXALIASWARN (posix_memalign);
  632. # endif
  633. #elif defined GNULIB_POSIXCHECK
  634. # undef posix_memalign
  635. # if HAVE_RAW_DECL_POSIX_MEMALIGN
  636. _GL_WARN_ON_USE (posix_memalign, "posix_memalign is not portable - "
  637. "use gnulib module posix_memalign for portability");
  638. # endif
  639. #endif
  640. #if @GNULIB_POSIX_OPENPT@
  641. /* Return an FD open to the master side of a pseudo-terminal. Flags should
  642. include O_RDWR, and may also include O_NOCTTY. */
  643. # if !@HAVE_POSIX_OPENPT@
  644. _GL_FUNCDECL_SYS (posix_openpt, int, (int flags));
  645. # endif
  646. _GL_CXXALIAS_SYS (posix_openpt, int, (int flags));
  647. _GL_CXXALIASWARN (posix_openpt);
  648. #elif defined GNULIB_POSIXCHECK
  649. # undef posix_openpt
  650. # if HAVE_RAW_DECL_POSIX_OPENPT
  651. _GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - "
  652. "use gnulib module posix_openpt for portability");
  653. # endif
  654. #endif
  655. #if @GNULIB_PTSNAME@
  656. /* Return the pathname of the pseudo-terminal slave associated with
  657. the master FD is open on, or NULL on errors. */
  658. # if @REPLACE_PTSNAME@
  659. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  660. # undef ptsname
  661. # define ptsname rpl_ptsname
  662. # endif
  663. _GL_FUNCDECL_RPL (ptsname, char *, (int fd));
  664. _GL_CXXALIAS_RPL (ptsname, char *, (int fd));
  665. # else
  666. # if !@HAVE_PTSNAME@
  667. _GL_FUNCDECL_SYS (ptsname, char *, (int fd));
  668. # endif
  669. _GL_CXXALIAS_SYS (ptsname, char *, (int fd));
  670. # endif
  671. _GL_CXXALIASWARN (ptsname);
  672. #elif defined GNULIB_POSIXCHECK
  673. # undef ptsname
  674. # if HAVE_RAW_DECL_PTSNAME
  675. _GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
  676. "use gnulib module ptsname for portability");
  677. # endif
  678. #endif
  679. #if @GNULIB_PTSNAME_R@
  680. /* Set the pathname of the pseudo-terminal slave associated with
  681. the master FD is open on and return 0, or set errno and return
  682. non-zero on errors. */
  683. # if @REPLACE_PTSNAME_R@
  684. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  685. # undef ptsname_r
  686. # define ptsname_r rpl_ptsname_r
  687. # endif
  688. _GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
  689. _GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
  690. # else
  691. # if !@HAVE_PTSNAME_R@
  692. _GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
  693. # endif
  694. _GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
  695. # endif
  696. # ifndef GNULIB_defined_ptsname_r
  697. # define GNULIB_defined_ptsname_r (!@HAVE_PTSNAME_R@ || @REPLACE_PTSNAME_R@)
  698. # endif
  699. _GL_CXXALIASWARN (ptsname_r);
  700. #elif defined GNULIB_POSIXCHECK
  701. # undef ptsname_r
  702. # if HAVE_RAW_DECL_PTSNAME_R
  703. _GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - "
  704. "use gnulib module ptsname_r for portability");
  705. # endif
  706. #endif
  707. #if @GNULIB_PUTENV@
  708. # if @REPLACE_PUTENV@
  709. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  710. # undef putenv
  711. # define putenv rpl_putenv
  712. # endif
  713. _GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1)));
  714. _GL_CXXALIAS_RPL (putenv, int, (char *string));
  715. # elif defined _WIN32 && !defined __CYGWIN__
  716. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  717. # undef putenv
  718. # define putenv _putenv
  719. # endif
  720. _GL_CXXALIAS_MDA (putenv, int, (char *string));
  721. # else
  722. _GL_CXXALIAS_SYS (putenv, int, (char *string));
  723. # endif
  724. _GL_CXXALIASWARN (putenv);
  725. #elif @GNULIB_MDA_PUTENV@
  726. /* On native Windows, map 'putenv' to '_putenv', so that -loldnames is not
  727. required. In C++ with GNULIB_NAMESPACE, avoid differences between
  728. platforms by defining GNULIB_NAMESPACE::putenv always. */
  729. # if defined _WIN32 && !defined __CYGWIN__
  730. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  731. # undef putenv
  732. # define putenv _putenv
  733. # endif
  734. /* Need to cast, because on mingw, the parameter is either
  735. 'const char *string' or 'char *string'. */
  736. _GL_CXXALIAS_MDA_CAST (putenv, int, (char *string));
  737. # else
  738. _GL_CXXALIAS_SYS (putenv, int, (char *string));
  739. # endif
  740. _GL_CXXALIASWARN (putenv);
  741. #endif
  742. #if @GNULIB_QSORT_R@
  743. /* Sort an array of NMEMB elements, starting at address BASE, each element
  744. occupying SIZE bytes, in ascending order according to the comparison
  745. function COMPARE. */
  746. # if @REPLACE_QSORT_R@
  747. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  748. # undef qsort_r
  749. # define qsort_r rpl_qsort_r
  750. # endif
  751. _GL_FUNCDECL_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
  752. int (*compare) (void const *, void const *,
  753. void *),
  754. void *arg) _GL_ARG_NONNULL ((1, 4)));
  755. _GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
  756. int (*compare) (void const *, void const *,
  757. void *),
  758. void *arg));
  759. # else
  760. # if !@HAVE_QSORT_R@
  761. _GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
  762. int (*compare) (void const *, void const *,
  763. void *),
  764. void *arg) _GL_ARG_NONNULL ((1, 4)));
  765. # endif
  766. _GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
  767. int (*compare) (void const *, void const *,
  768. void *),
  769. void *arg));
  770. # endif
  771. _GL_CXXALIASWARN (qsort_r);
  772. #elif defined GNULIB_POSIXCHECK
  773. # undef qsort_r
  774. # if HAVE_RAW_DECL_QSORT_R
  775. _GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - "
  776. "use gnulib module qsort_r for portability");
  777. # endif
  778. #endif
  779. #if @GNULIB_RANDOM_R@
  780. # if !@HAVE_RANDOM_R@
  781. # ifndef RAND_MAX
  782. # define RAND_MAX 2147483647
  783. # endif
  784. # endif
  785. #endif
  786. #if @GNULIB_RANDOM@
  787. # if @REPLACE_RANDOM@
  788. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  789. # undef random
  790. # define random rpl_random
  791. # endif
  792. _GL_FUNCDECL_RPL (random, long, (void));
  793. _GL_CXXALIAS_RPL (random, long, (void));
  794. # else
  795. # if !@HAVE_RANDOM@
  796. _GL_FUNCDECL_SYS (random, long, (void));
  797. # endif
  798. /* Need to cast, because on Haiku, the return type is
  799. int. */
  800. _GL_CXXALIAS_SYS_CAST (random, long, (void));
  801. # endif
  802. _GL_CXXALIASWARN (random);
  803. #elif defined GNULIB_POSIXCHECK
  804. # undef random
  805. # if HAVE_RAW_DECL_RANDOM
  806. _GL_WARN_ON_USE (random, "random is unportable - "
  807. "use gnulib module random for portability");
  808. # endif
  809. #endif
  810. #if @GNULIB_RANDOM@
  811. # if @REPLACE_RANDOM@
  812. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  813. # undef srandom
  814. # define srandom rpl_srandom
  815. # endif
  816. _GL_FUNCDECL_RPL (srandom, void, (unsigned int seed));
  817. _GL_CXXALIAS_RPL (srandom, void, (unsigned int seed));
  818. # else
  819. # if !@HAVE_RANDOM@
  820. _GL_FUNCDECL_SYS (srandom, void, (unsigned int seed));
  821. # endif
  822. /* Need to cast, because on FreeBSD, the first parameter is
  823. unsigned long seed. */
  824. _GL_CXXALIAS_SYS_CAST (srandom, void, (unsigned int seed));
  825. # endif
  826. _GL_CXXALIASWARN (srandom);
  827. #elif defined GNULIB_POSIXCHECK
  828. # undef srandom
  829. # if HAVE_RAW_DECL_SRANDOM
  830. _GL_WARN_ON_USE (srandom, "srandom is unportable - "
  831. "use gnulib module random for portability");
  832. # endif
  833. #endif
  834. #if @GNULIB_RANDOM@
  835. # if @REPLACE_INITSTATE@
  836. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  837. # undef initstate
  838. # define initstate rpl_initstate
  839. # endif
  840. _GL_FUNCDECL_RPL (initstate, char *,
  841. (unsigned int seed, char *buf, size_t buf_size)
  842. _GL_ARG_NONNULL ((2)));
  843. _GL_CXXALIAS_RPL (initstate, char *,
  844. (unsigned int seed, char *buf, size_t buf_size));
  845. # else
  846. # if !@HAVE_INITSTATE@ || !@HAVE_DECL_INITSTATE@
  847. _GL_FUNCDECL_SYS (initstate, char *,
  848. (unsigned int seed, char *buf, size_t buf_size)
  849. _GL_ARG_NONNULL ((2)));
  850. # endif
  851. /* Need to cast, because on FreeBSD, the first parameter is
  852. unsigned long seed. */
  853. _GL_CXXALIAS_SYS_CAST (initstate, char *,
  854. (unsigned int seed, char *buf, size_t buf_size));
  855. # endif
  856. _GL_CXXALIASWARN (initstate);
  857. #elif defined GNULIB_POSIXCHECK
  858. # undef initstate
  859. # if HAVE_RAW_DECL_INITSTATE
  860. _GL_WARN_ON_USE (initstate, "initstate is unportable - "
  861. "use gnulib module random for portability");
  862. # endif
  863. #endif
  864. #if @GNULIB_RANDOM@
  865. # if @REPLACE_SETSTATE@
  866. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  867. # undef setstate
  868. # define setstate rpl_setstate
  869. # endif
  870. _GL_FUNCDECL_RPL (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
  871. _GL_CXXALIAS_RPL (setstate, char *, (char *arg_state));
  872. # else
  873. # if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@
  874. _GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
  875. # endif
  876. /* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter
  877. is const char *arg_state. */
  878. _GL_CXXALIAS_SYS_CAST (setstate, char *, (char *arg_state));
  879. # endif
  880. _GL_CXXALIASWARN (setstate);
  881. #elif defined GNULIB_POSIXCHECK
  882. # undef setstate
  883. # if HAVE_RAW_DECL_SETSTATE
  884. _GL_WARN_ON_USE (setstate, "setstate is unportable - "
  885. "use gnulib module random for portability");
  886. # endif
  887. #endif
  888. #if @GNULIB_RANDOM_R@
  889. # if @REPLACE_RANDOM_R@
  890. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  891. # undef random_r
  892. # define random_r rpl_random_r
  893. # endif
  894. _GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result)
  895. _GL_ARG_NONNULL ((1, 2)));
  896. _GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result));
  897. # else
  898. # if !@HAVE_RANDOM_R@
  899. _GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result)
  900. _GL_ARG_NONNULL ((1, 2)));
  901. # endif
  902. _GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
  903. # endif
  904. _GL_CXXALIASWARN (random_r);
  905. #elif defined GNULIB_POSIXCHECK
  906. # undef random_r
  907. # if HAVE_RAW_DECL_RANDOM_R
  908. _GL_WARN_ON_USE (random_r, "random_r is unportable - "
  909. "use gnulib module random_r for portability");
  910. # endif
  911. #endif
  912. #if @GNULIB_RANDOM_R@
  913. # if @REPLACE_RANDOM_R@
  914. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  915. # undef srandom_r
  916. # define srandom_r rpl_srandom_r
  917. # endif
  918. _GL_FUNCDECL_RPL (srandom_r, int,
  919. (unsigned int seed, struct random_data *rand_state)
  920. _GL_ARG_NONNULL ((2)));
  921. _GL_CXXALIAS_RPL (srandom_r, int,
  922. (unsigned int seed, struct random_data *rand_state));
  923. # else
  924. # if !@HAVE_RANDOM_R@
  925. _GL_FUNCDECL_SYS (srandom_r, int,
  926. (unsigned int seed, struct random_data *rand_state)
  927. _GL_ARG_NONNULL ((2)));
  928. # endif
  929. _GL_CXXALIAS_SYS (srandom_r, int,
  930. (unsigned int seed, struct random_data *rand_state));
  931. # endif
  932. _GL_CXXALIASWARN (srandom_r);
  933. #elif defined GNULIB_POSIXCHECK
  934. # undef srandom_r
  935. # if HAVE_RAW_DECL_SRANDOM_R
  936. _GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
  937. "use gnulib module random_r for portability");
  938. # endif
  939. #endif
  940. #if @GNULIB_RANDOM_R@
  941. # if @REPLACE_RANDOM_R@
  942. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  943. # undef initstate_r
  944. # define initstate_r rpl_initstate_r
  945. # endif
  946. _GL_FUNCDECL_RPL (initstate_r, int,
  947. (unsigned int seed, char *buf, size_t buf_size,
  948. struct random_data *rand_state)
  949. _GL_ARG_NONNULL ((2, 4)));
  950. _GL_CXXALIAS_RPL (initstate_r, int,
  951. (unsigned int seed, char *buf, size_t buf_size,
  952. struct random_data *rand_state));
  953. # else
  954. # if !@HAVE_RANDOM_R@
  955. _GL_FUNCDECL_SYS (initstate_r, int,
  956. (unsigned int seed, char *buf, size_t buf_size,
  957. struct random_data *rand_state)
  958. _GL_ARG_NONNULL ((2, 4)));
  959. # endif
  960. /* Need to cast, because on Haiku, the third parameter is
  961. unsigned long buf_size. */
  962. _GL_CXXALIAS_SYS_CAST (initstate_r, int,
  963. (unsigned int seed, char *buf, size_t buf_size,
  964. struct random_data *rand_state));
  965. # endif
  966. _GL_CXXALIASWARN (initstate_r);
  967. #elif defined GNULIB_POSIXCHECK
  968. # undef initstate_r
  969. # if HAVE_RAW_DECL_INITSTATE_R
  970. _GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
  971. "use gnulib module random_r for portability");
  972. # endif
  973. #endif
  974. #if @GNULIB_RANDOM_R@
  975. # if @REPLACE_RANDOM_R@
  976. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  977. # undef setstate_r
  978. # define setstate_r rpl_setstate_r
  979. # endif
  980. _GL_FUNCDECL_RPL (setstate_r, int,
  981. (char *arg_state, struct random_data *rand_state)
  982. _GL_ARG_NONNULL ((1, 2)));
  983. _GL_CXXALIAS_RPL (setstate_r, int,
  984. (char *arg_state, struct random_data *rand_state));
  985. # else
  986. # if !@HAVE_RANDOM_R@
  987. _GL_FUNCDECL_SYS (setstate_r, int,
  988. (char *arg_state, struct random_data *rand_state)
  989. _GL_ARG_NONNULL ((1, 2)));
  990. # endif
  991. /* Need to cast, because on Haiku, the first parameter is
  992. void *arg_state. */
  993. _GL_CXXALIAS_SYS_CAST (setstate_r, int,
  994. (char *arg_state, struct random_data *rand_state));
  995. # endif
  996. _GL_CXXALIASWARN (setstate_r);
  997. #elif defined GNULIB_POSIXCHECK
  998. # undef setstate_r
  999. # if HAVE_RAW_DECL_SETSTATE_R
  1000. _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
  1001. "use gnulib module random_r for portability");
  1002. # endif
  1003. #endif
  1004. #if @GNULIB_REALLOC_POSIX@
  1005. # if @REPLACE_REALLOC@
  1006. # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
  1007. || _GL_USE_STDLIB_ALLOC)
  1008. # undef realloc
  1009. # define realloc rpl_realloc
  1010. # endif
  1011. _GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size)
  1012. _GL_ATTRIBUTE_DEALLOC_FREE);
  1013. _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
  1014. # else
  1015. # if __GNUC__ >= 11
  1016. /* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */
  1017. _GL_FUNCDECL_SYS (realloc, void *, (void *ptr, size_t size)
  1018. _GL_ATTRIBUTE_DEALLOC_FREE);
  1019. # endif
  1020. _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
  1021. # endif
  1022. # if __GLIBC__ >= 2
  1023. _GL_CXXALIASWARN (realloc);
  1024. # endif
  1025. #else
  1026. # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined realloc
  1027. /* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */
  1028. _GL_FUNCDECL_SYS (realloc, void *, (void *ptr, size_t size)
  1029. _GL_ATTRIBUTE_DEALLOC_FREE);
  1030. # endif
  1031. # if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
  1032. # undef realloc
  1033. /* Assume realloc is always declared. */
  1034. _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
  1035. "use gnulib module realloc-posix for portability");
  1036. # endif
  1037. #endif
  1038. #if @GNULIB_REALLOCARRAY@
  1039. # if @REPLACE_REALLOCARRAY@
  1040. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1041. # undef reallocarray
  1042. # define reallocarray rpl_reallocarray
  1043. # endif
  1044. _GL_FUNCDECL_RPL (reallocarray, void *,
  1045. (void *ptr, size_t nmemb, size_t size));
  1046. _GL_CXXALIAS_RPL (reallocarray, void *,
  1047. (void *ptr, size_t nmemb, size_t size));
  1048. # else
  1049. # if ! @HAVE_REALLOCARRAY@
  1050. _GL_FUNCDECL_SYS (reallocarray, void *,
  1051. (void *ptr, size_t nmemb, size_t size));
  1052. # endif
  1053. _GL_CXXALIAS_SYS (reallocarray, void *,
  1054. (void *ptr, size_t nmemb, size_t size));
  1055. # endif
  1056. _GL_CXXALIASWARN (reallocarray);
  1057. #elif defined GNULIB_POSIXCHECK
  1058. # undef reallocarray
  1059. # if HAVE_RAW_DECL_REALLOCARRAY
  1060. _GL_WARN_ON_USE (reallocarray, "reallocarray is not portable - "
  1061. "use gnulib module reallocarray for portability");
  1062. # endif
  1063. #endif
  1064. #if @GNULIB_REALPATH@
  1065. # if @REPLACE_REALPATH@
  1066. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1067. # define realpath rpl_realpath
  1068. # endif
  1069. _GL_FUNCDECL_RPL (realpath, char *,
  1070. (const char *restrict name, char *restrict resolved)
  1071. _GL_ARG_NONNULL ((1)));
  1072. _GL_CXXALIAS_RPL (realpath, char *,
  1073. (const char *restrict name, char *restrict resolved));
  1074. # else
  1075. # if !@HAVE_REALPATH@
  1076. _GL_FUNCDECL_SYS (realpath, char *,
  1077. (const char *restrict name, char *restrict resolved)
  1078. _GL_ARG_NONNULL ((1)));
  1079. # endif
  1080. _GL_CXXALIAS_SYS (realpath, char *,
  1081. (const char *restrict name, char *restrict resolved));
  1082. # endif
  1083. _GL_CXXALIASWARN (realpath);
  1084. #elif defined GNULIB_POSIXCHECK
  1085. # undef realpath
  1086. # if HAVE_RAW_DECL_REALPATH
  1087. _GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module "
  1088. "canonicalize or canonicalize-lgpl for portability");
  1089. # endif
  1090. #endif
  1091. #if @GNULIB_RPMATCH@
  1092. /* Test a user response to a question.
  1093. Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */
  1094. # if !@HAVE_RPMATCH@
  1095. _GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1)));
  1096. # endif
  1097. _GL_CXXALIAS_SYS (rpmatch, int, (const char *response));
  1098. _GL_CXXALIASWARN (rpmatch);
  1099. #elif defined GNULIB_POSIXCHECK
  1100. # undef rpmatch
  1101. # if HAVE_RAW_DECL_RPMATCH
  1102. _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
  1103. "use gnulib module rpmatch for portability");
  1104. # endif
  1105. #endif
  1106. #if @GNULIB_SECURE_GETENV@
  1107. /* Look up NAME in the environment, returning 0 in insecure situations. */
  1108. # if !@HAVE_SECURE_GETENV@
  1109. _GL_FUNCDECL_SYS (secure_getenv, char *,
  1110. (char const *name) _GL_ARG_NONNULL ((1)));
  1111. # endif
  1112. _GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name));
  1113. _GL_CXXALIASWARN (secure_getenv);
  1114. #elif defined GNULIB_POSIXCHECK
  1115. # undef secure_getenv
  1116. # if HAVE_RAW_DECL_SECURE_GETENV
  1117. _GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - "
  1118. "use gnulib module secure_getenv for portability");
  1119. # endif
  1120. #endif
  1121. #if @GNULIB_SETENV@
  1122. /* Set NAME to VALUE in the environment.
  1123. If REPLACE is nonzero, overwrite an existing value. */
  1124. # if @REPLACE_SETENV@
  1125. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1126. # undef setenv
  1127. # define setenv rpl_setenv
  1128. # endif
  1129. _GL_FUNCDECL_RPL (setenv, int,
  1130. (const char *name, const char *value, int replace)
  1131. _GL_ARG_NONNULL ((1)));
  1132. _GL_CXXALIAS_RPL (setenv, int,
  1133. (const char *name, const char *value, int replace));
  1134. # else
  1135. # if !@HAVE_DECL_SETENV@
  1136. _GL_FUNCDECL_SYS (setenv, int,
  1137. (const char *name, const char *value, int replace)
  1138. _GL_ARG_NONNULL ((1)));
  1139. # endif
  1140. _GL_CXXALIAS_SYS (setenv, int,
  1141. (const char *name, const char *value, int replace));
  1142. # endif
  1143. # if !(@REPLACE_SETENV@ && !@HAVE_DECL_SETENV@)
  1144. _GL_CXXALIASWARN (setenv);
  1145. # endif
  1146. #elif defined GNULIB_POSIXCHECK
  1147. # undef setenv
  1148. # if HAVE_RAW_DECL_SETENV
  1149. _GL_WARN_ON_USE (setenv, "setenv is unportable - "
  1150. "use gnulib module setenv for portability");
  1151. # endif
  1152. #endif
  1153. #if @GNULIB_STRTOD@
  1154. /* Parse a double from STRING, updating ENDP if appropriate. */
  1155. # if @REPLACE_STRTOD@
  1156. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1157. # define strtod rpl_strtod
  1158. # endif
  1159. # define GNULIB_defined_strtod_function 1
  1160. _GL_FUNCDECL_RPL (strtod, double,
  1161. (const char *restrict str, char **restrict endp)
  1162. _GL_ARG_NONNULL ((1)));
  1163. _GL_CXXALIAS_RPL (strtod, double,
  1164. (const char *restrict str, char **restrict endp));
  1165. # else
  1166. # if !@HAVE_STRTOD@
  1167. _GL_FUNCDECL_SYS (strtod, double,
  1168. (const char *restrict str, char **restrict endp)
  1169. _GL_ARG_NONNULL ((1)));
  1170. # endif
  1171. _GL_CXXALIAS_SYS (strtod, double,
  1172. (const char *restrict str, char **restrict endp));
  1173. # endif
  1174. # if __GLIBC__ >= 2
  1175. _GL_CXXALIASWARN (strtod);
  1176. # endif
  1177. #elif defined GNULIB_POSIXCHECK
  1178. # undef strtod
  1179. # if HAVE_RAW_DECL_STRTOD
  1180. _GL_WARN_ON_USE (strtod, "strtod is unportable - "
  1181. "use gnulib module strtod for portability");
  1182. # endif
  1183. #endif
  1184. #if @GNULIB_STRTOLD@
  1185. /* Parse a 'long double' from STRING, updating ENDP if appropriate. */
  1186. # if @REPLACE_STRTOLD@
  1187. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1188. # define strtold rpl_strtold
  1189. # endif
  1190. # define GNULIB_defined_strtold_function 1
  1191. _GL_FUNCDECL_RPL (strtold, long double,
  1192. (const char *restrict str, char **restrict endp)
  1193. _GL_ARG_NONNULL ((1)));
  1194. _GL_CXXALIAS_RPL (strtold, long double,
  1195. (const char *restrict str, char **restrict endp));
  1196. # else
  1197. # if !@HAVE_STRTOLD@
  1198. _GL_FUNCDECL_SYS (strtold, long double,
  1199. (const char *restrict str, char **restrict endp)
  1200. _GL_ARG_NONNULL ((1)));
  1201. # endif
  1202. _GL_CXXALIAS_SYS (strtold, long double,
  1203. (const char *restrict str, char **restrict endp));
  1204. # endif
  1205. _GL_CXXALIASWARN (strtold);
  1206. #elif defined GNULIB_POSIXCHECK
  1207. # undef strtold
  1208. # if HAVE_RAW_DECL_STRTOLD
  1209. _GL_WARN_ON_USE (strtold, "strtold is unportable - "
  1210. "use gnulib module strtold for portability");
  1211. # endif
  1212. #endif
  1213. #if @GNULIB_STRTOL@
  1214. /* Parse a signed integer whose textual representation starts at STRING.
  1215. The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
  1216. it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
  1217. "0x").
  1218. If ENDPTR is not NULL, the address of the first byte after the integer is
  1219. stored in *ENDPTR.
  1220. Upon overflow, the return value is LONG_MAX or LONG_MIN, and errno is set
  1221. to ERANGE. */
  1222. # if @REPLACE_STRTOL@
  1223. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1224. # define strtol rpl_strtol
  1225. # endif
  1226. # define GNULIB_defined_strtol_function 1
  1227. _GL_FUNCDECL_RPL (strtol, long,
  1228. (const char *restrict string, char **restrict endptr,
  1229. int base)
  1230. _GL_ARG_NONNULL ((1)));
  1231. _GL_CXXALIAS_RPL (strtol, long,
  1232. (const char *restrict string, char **restrict endptr,
  1233. int base));
  1234. # else
  1235. # if !@HAVE_STRTOL@
  1236. _GL_FUNCDECL_SYS (strtol, long,
  1237. (const char *restrict string, char **restrict endptr,
  1238. int base)
  1239. _GL_ARG_NONNULL ((1)));
  1240. # endif
  1241. _GL_CXXALIAS_SYS (strtol, long,
  1242. (const char *restrict string, char **restrict endptr,
  1243. int base));
  1244. # endif
  1245. _GL_CXXALIASWARN (strtol);
  1246. #elif defined GNULIB_POSIXCHECK
  1247. # undef strtol
  1248. # if HAVE_RAW_DECL_STRTOL
  1249. _GL_WARN_ON_USE (strtol, "strtol is unportable - "
  1250. "use gnulib module strtol for portability");
  1251. # endif
  1252. #endif
  1253. #if @GNULIB_STRTOLL@
  1254. /* Parse a signed integer whose textual representation starts at STRING.
  1255. The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
  1256. it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
  1257. "0x").
  1258. If ENDPTR is not NULL, the address of the first byte after the integer is
  1259. stored in *ENDPTR.
  1260. Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
  1261. to ERANGE. */
  1262. # if @REPLACE_STRTOLL@
  1263. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1264. # define strtoll rpl_strtoll
  1265. # endif
  1266. # define GNULIB_defined_strtoll_function 1
  1267. _GL_FUNCDECL_RPL (strtoll, long long,
  1268. (const char *restrict string, char **restrict endptr,
  1269. int base)
  1270. _GL_ARG_NONNULL ((1)));
  1271. _GL_CXXALIAS_RPL (strtoll, long long,
  1272. (const char *restrict string, char **restrict endptr,
  1273. int base));
  1274. # else
  1275. # if !@HAVE_STRTOLL@
  1276. _GL_FUNCDECL_SYS (strtoll, long long,
  1277. (const char *restrict string, char **restrict endptr,
  1278. int base)
  1279. _GL_ARG_NONNULL ((1)));
  1280. # endif
  1281. _GL_CXXALIAS_SYS (strtoll, long long,
  1282. (const char *restrict string, char **restrict endptr,
  1283. int base));
  1284. # endif
  1285. _GL_CXXALIASWARN (strtoll);
  1286. #elif defined GNULIB_POSIXCHECK
  1287. # undef strtoll
  1288. # if HAVE_RAW_DECL_STRTOLL
  1289. _GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
  1290. "use gnulib module strtoll for portability");
  1291. # endif
  1292. #endif
  1293. #if @GNULIB_STRTOUL@
  1294. /* Parse an unsigned integer whose textual representation starts at STRING.
  1295. The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
  1296. it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
  1297. "0x").
  1298. If ENDPTR is not NULL, the address of the first byte after the integer is
  1299. stored in *ENDPTR.
  1300. Upon overflow, the return value is ULONG_MAX, and errno is set to ERANGE. */
  1301. # if @REPLACE_STRTOUL@
  1302. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1303. # define strtoul rpl_strtoul
  1304. # endif
  1305. # define GNULIB_defined_strtoul_function 1
  1306. _GL_FUNCDECL_RPL (strtoul, unsigned long,
  1307. (const char *restrict string, char **restrict endptr,
  1308. int base)
  1309. _GL_ARG_NONNULL ((1)));
  1310. _GL_CXXALIAS_RPL (strtoul, unsigned long,
  1311. (const char *restrict string, char **restrict endptr,
  1312. int base));
  1313. # else
  1314. # if !@HAVE_STRTOUL@
  1315. _GL_FUNCDECL_SYS (strtoul, unsigned long,
  1316. (const char *restrict string, char **restrict endptr,
  1317. int base)
  1318. _GL_ARG_NONNULL ((1)));
  1319. # endif
  1320. _GL_CXXALIAS_SYS (strtoul, unsigned long,
  1321. (const char *restrict string, char **restrict endptr,
  1322. int base));
  1323. # endif
  1324. _GL_CXXALIASWARN (strtoul);
  1325. #elif defined GNULIB_POSIXCHECK
  1326. # undef strtoul
  1327. # if HAVE_RAW_DECL_STRTOUL
  1328. _GL_WARN_ON_USE (strtoul, "strtoul is unportable - "
  1329. "use gnulib module strtoul for portability");
  1330. # endif
  1331. #endif
  1332. #if @GNULIB_STRTOULL@
  1333. /* Parse an unsigned integer whose textual representation starts at STRING.
  1334. The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
  1335. it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
  1336. "0x").
  1337. If ENDPTR is not NULL, the address of the first byte after the integer is
  1338. stored in *ENDPTR.
  1339. Upon overflow, the return value is ULLONG_MAX, and errno is set to
  1340. ERANGE. */
  1341. # if @REPLACE_STRTOULL@
  1342. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1343. # define strtoull rpl_strtoull
  1344. # endif
  1345. # define GNULIB_defined_strtoull_function 1
  1346. _GL_FUNCDECL_RPL (strtoull, unsigned long long,
  1347. (const char *restrict string, char **restrict endptr,
  1348. int base)
  1349. _GL_ARG_NONNULL ((1)));
  1350. _GL_CXXALIAS_RPL (strtoull, unsigned long long,
  1351. (const char *restrict string, char **restrict endptr,
  1352. int base));
  1353. # else
  1354. # if !@HAVE_STRTOULL@
  1355. _GL_FUNCDECL_SYS (strtoull, unsigned long long,
  1356. (const char *restrict string, char **restrict endptr,
  1357. int base)
  1358. _GL_ARG_NONNULL ((1)));
  1359. # endif
  1360. _GL_CXXALIAS_SYS (strtoull, unsigned long long,
  1361. (const char *restrict string, char **restrict endptr,
  1362. int base));
  1363. # endif
  1364. _GL_CXXALIASWARN (strtoull);
  1365. #elif defined GNULIB_POSIXCHECK
  1366. # undef strtoull
  1367. # if HAVE_RAW_DECL_STRTOULL
  1368. _GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
  1369. "use gnulib module strtoull for portability");
  1370. # endif
  1371. #endif
  1372. #if @GNULIB_UNLOCKPT@
  1373. /* Unlock the slave side of the pseudo-terminal whose master side is specified
  1374. by FD, so that it can be opened. */
  1375. # if !@HAVE_UNLOCKPT@
  1376. _GL_FUNCDECL_SYS (unlockpt, int, (int fd));
  1377. # endif
  1378. _GL_CXXALIAS_SYS (unlockpt, int, (int fd));
  1379. _GL_CXXALIASWARN (unlockpt);
  1380. #elif defined GNULIB_POSIXCHECK
  1381. # undef unlockpt
  1382. # if HAVE_RAW_DECL_UNLOCKPT
  1383. _GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
  1384. "use gnulib module unlockpt for portability");
  1385. # endif
  1386. #endif
  1387. #if @GNULIB_UNSETENV@
  1388. /* Remove the variable NAME from the environment. */
  1389. # if @REPLACE_UNSETENV@
  1390. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1391. # undef unsetenv
  1392. # define unsetenv rpl_unsetenv
  1393. # endif
  1394. _GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
  1395. _GL_CXXALIAS_RPL (unsetenv, int, (const char *name));
  1396. # else
  1397. # if !@HAVE_DECL_UNSETENV@
  1398. _GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
  1399. # endif
  1400. _GL_CXXALIAS_SYS (unsetenv, int, (const char *name));
  1401. # endif
  1402. # if !(@REPLACE_UNSETENV@ && !@HAVE_DECL_UNSETENV@)
  1403. _GL_CXXALIASWARN (unsetenv);
  1404. # endif
  1405. #elif defined GNULIB_POSIXCHECK
  1406. # undef unsetenv
  1407. # if HAVE_RAW_DECL_UNSETENV
  1408. _GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
  1409. "use gnulib module unsetenv for portability");
  1410. # endif
  1411. #endif
  1412. /* Convert a wide character to a multibyte character. */
  1413. #if @GNULIB_WCTOMB@
  1414. # if @REPLACE_WCTOMB@
  1415. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1416. # undef wctomb
  1417. # define wctomb rpl_wctomb
  1418. # endif
  1419. _GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc));
  1420. _GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc));
  1421. # else
  1422. _GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc));
  1423. # endif
  1424. # if __GLIBC__ >= 2
  1425. _GL_CXXALIASWARN (wctomb);
  1426. # endif
  1427. #endif
  1428. #endif /* _@GUARD_PREFIX@_STDLIB_H */
  1429. #endif /* _@GUARD_PREFIX@_STDLIB_H */
  1430. #endif