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