stdlib.in.h 54 KB

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