Debian Codegraph @

gnulib/stdlib.in.h

raw symbols SCIP
1 /* A GNU-like <stdlib.h>.
2
3 Copyright (C) 1995, 2001-2004, 2006-2024 Free Software Foundation, Inc.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file 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 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18 #if __GNUC__ >= 3
19 @PRAGMA_SYSTEM_HEADER@
20 #endif
21 @PRAGMA_COLUMNS@
22
23 #if ((defined __need_system_stdlib_h && !defined _GLIBCXX_STDLIB_H) \
24 || defined __need_malloc_and_calloc) \
25 && !defined __SUNPRO_CC
26 /* Special invocation conventions inside some gnulib header files,
27 and inside some glibc header files, respectively.
28 Do not recognize this special invocation convention when GCC's
29 c++/11/stdlib.h is being included or has been included. This is needed
30 to support the use of clang+llvm binaries on Ubuntu 22.04 with
31 CXX="$clangdir/bin/clang++ -I/usr/include/c++/11 \
32 -I/usr/include/x86_64-linux-gnu/c++/11
33 -L/usr/lib/gcc/x86_64-linux-gnu/11
34 -Wl,-rpath,$clangdir/lib"
35 because in this case /usr/include/c++/11/stdlib.h (which does not support
36 the convention) is seen before the gnulib-generated stdlib.h. */
37
38 #@INCLUDE_NEXT@ @NEXT_STDLIB_H@
39
40 /* Make sure that the macros that indicate the special invocation convention
41 get undefined. This is needed at least on CentOS 7. */
42 #undef __need_malloc_and_calloc
43
44 #else
45 /* Normal invocation convention. */
46
47 #ifndef _@GUARD_PREFIX@_STDLIB_H
48
49 /* The include_next requires a split double-inclusion guard. */
50 #@INCLUDE_NEXT@ @NEXT_STDLIB_H@
51
52 #ifndef _@GUARD_PREFIX@_STDLIB_H
53 #define _@GUARD_PREFIX@_STDLIB_H
54
55 /* This file uses _Noreturn, _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_MALLOC,
56 _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PURE, GNULIB_POSIXCHECK,
57 HAVE_RAW_DECL_*. */
58 #if !_GL_CONFIG_H_INCLUDED
59 #error "Please include config.h first."
60 #endif
61
62 /* NetBSD 5.0 mis-defines NULL. */
63 #include <stddef.h>
64
65 /* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>. */
66 #if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS
67 # include <sys/wait.h>
68 #endif
69
70 /* Solaris declares getloadavg() in <sys/loadavg.h>. */
71 #if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@
72 /* OpenIndiana has a bug: <sys/time.h> must be included before
73 <sys/loadavg.h>. */
74 # include <sys/time.h>
75 # include <sys/loadavg.h>
76 #endif
77
78 /* Native Windows platforms declare _mktemp() in <io.h>. */
79 #if defined _WIN32 && !defined __CYGWIN__
80 # include <io.h>
81 #endif
82
83 #if @GNULIB_RANDOM_R@
84
85 /* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included
86 from <stdlib.h> if _REENTRANT is defined. Include it whenever we need
87 'struct random_data'. */
88 # if @HAVE_RANDOM_H@
89 # include <random.h>
90 # endif
91
92 # include <stdint.h>
93
94 # if !@HAVE_STRUCT_RANDOM_DATA@
95 /* Define 'struct random_data'.
96 But allow multiple gnulib generated <stdlib.h> replacements to coexist. */
97 # if !GNULIB_defined_struct_random_data
98 struct random_data
99 {
100 int32_t *fptr; /* Front pointer. */
101 int32_t *rptr; /* Rear pointer. */
102 int32_t *state; /* Array of state values. */
103 int rand_type; /* Type of random number generator. */
104 int rand_deg; /* Degree of random number generator. */
105 int rand_sep; /* Distance between front and rear. */
106 int32_t *end_ptr; /* Pointer behind state table. */
107 };
108 # define GNULIB_defined_struct_random_data 1
109 # endif
110 # endif
111 #endif
112
113 #if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_MKOSTEMP@ || @GNULIB_MKOSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !(defined _WIN32 && ! defined __CYGWIN__)
114 /* On Mac OS X 10.3, only <unistd.h> declares mkstemp. */
115 /* On Mac OS X 10.5, only <unistd.h> declares mkstemps. */
116 /* On Mac OS X 10.13, only <unistd.h> declares mkostemp and mkostemps. */
117 /* On Cygwin 1.7.1, only <unistd.h> declares getsubopt. */
118 /* But avoid namespace pollution on glibc systems and native Windows. */
119 # include <unistd.h>
120 #endif
121
122 #if ((@GNULIB_STRTOL@ && @REPLACE_STRTOL@) || (@GNULIB_STRTOLL@ && @REPLACE_STRTOLL@) || (@GNULIB_STRTOUL@ && @REPLACE_STRTOUL@) || (@GNULIB_STRTOULL@ && @REPLACE_STRTOULL@)) && defined __cplusplus && !defined GNULIB_NAMESPACE && defined __GNUG__ && !defined __clang__ && defined __sun
123 /* When strtol, strtoll, strtoul, or strtoull is going to be defined as a macro
124 below, this may cause compilation errors later in the libstdc++ header files
125 (that are part of GCC), such as:
126 error: 'rpl_strtol' is not a member of 'std'
127 To avoid this, include the relevant header files here, before these symbols
128 get defined as macros. But do so only on Solaris 11 (where it is needed),
129 not on mingw (where it would cause other compilation errors). */
130 # include <string>
131 #endif
132
133 /* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
134 that can be freed by passing them as the Ith argument to the
135 function F. */
136 #ifndef _GL_ATTRIBUTE_DEALLOC
137 # if __GNUC__ >= 11 && !defined __clang__
138 # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
139 # else
140 # define _GL_ATTRIBUTE_DEALLOC(f, i)
141 # endif
142 #endif
143
144 /* _GL_ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that
145 can be freed via 'free'; it can be used only after declaring 'free'. */
146 /* Applies to: functions. Cannot be used on inline functions. */
147 #ifndef _GL_ATTRIBUTE_DEALLOC_FREE
148 # define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (free, 1)
149 #endif
150
151 /* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly
152 allocated memory. */
153 /* Applies to: functions. */
154 #ifndef _GL_ATTRIBUTE_MALLOC
155 # if __GNUC__ >= 3 || defined __clang__
156 # define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
157 # else
158 # define _GL_ATTRIBUTE_MALLOC
159 # endif
160 #endif
161
162 /* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions.
163 */
164 #ifndef _GL_ATTRIBUTE_NOTHROW
165 # if defined __cplusplus
166 # if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4
167 # if __cplusplus >= 201103L
168 # define _GL_ATTRIBUTE_NOTHROW noexcept (true)
169 # else
170 # define _GL_ATTRIBUTE_NOTHROW throw ()
171 # endif
172 # else
173 # define _GL_ATTRIBUTE_NOTHROW
174 # endif
175 # else
176 # if (__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__
177 # define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__))
178 # else
179 # define _GL_ATTRIBUTE_NOTHROW
180 # endif
181 # endif
182 #endif
183
184 /* The __attribute__ feature is available in gcc versions 2.5 and later.
185 The attribute __pure__ was added in gcc 2.96. */
186 #ifndef _GL_ATTRIBUTE_PURE
187 # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
188 # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
189 # else
190 # define _GL_ATTRIBUTE_PURE /* empty */
191 # endif
192 #endif
193
194 /* The definition of _Noreturn is copied here. */
195
196 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
197
198 /* The definition of _GL_ARG_NONNULL is copied here. */
199
200 /* The definition of _GL_WARN_ON_USE is copied here. */
201
202
203 /* Some systems do not define EXIT_*, despite otherwise supporting C89. */
204 #ifndef EXIT_SUCCESS
205 # define EXIT_SUCCESS 0
206 #endif
207 /* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere
208 with proper operation of xargs. */
209 #ifndef EXIT_FAILURE
210 # define EXIT_FAILURE 1
211 #elif EXIT_FAILURE != 1
212 # undef EXIT_FAILURE
213 # define EXIT_FAILURE 1
214 #endif
215
216
217 #if @GNULIB__EXIT@
218 /* Terminate the current process with the given return code, without running
219 the 'atexit' handlers. */
220 # if @REPLACE__EXIT@
221 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
222 # undef _Exit
223 # define _Exit rpl__Exit
224 # endif
225 _GL_FUNCDECL_RPL (_Exit, _Noreturn void, (int status));
226 _GL_CXXALIAS_RPL (_Exit, void, (int status));
227 # else
228 # if !@HAVE__EXIT@
229 _GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status));
230 # endif
231 _GL_CXXALIAS_SYS (_Exit, void, (int status));
232 # endif
233 # if __GLIBC__ >= 2
234 _GL_CXXALIASWARN (_Exit);
235 # endif
236 #elif defined GNULIB_POSIXCHECK
237 # undef _Exit
238 # if HAVE_RAW_DECL__EXIT
239 _GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
240 "use gnulib module _Exit for portability");
241 # endif
242 #endif
243
244
245 #if @GNULIB_ABORT_DEBUG@
246 # if @REPLACE_ABORT@
247 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
248 # undef abort
249 # define abort rpl_abort
250 # endif
251 _GL_FUNCDECL_RPL (abort, _Noreturn void, (void));
252 _GL_CXXALIAS_RPL (abort, void, (void));
253 # else
254 _GL_CXXALIAS_SYS (abort, void, (void));
255 # endif
256 # if __GLIBC__ >= 2
257 _GL_CXXALIASWARN (abort);
258 # endif
259 #endif
260 #if @GNULIB_ABORT_DEBUG@ && @REPLACE_ABORT@
261 _GL_EXTERN_C void _gl_pre_abort (void);
262 #else
263 # if !GNULIB_defined_gl_pre_abort
264 # define _gl_pre_abort() /* nothing */
265 # define GNULIB_defined_gl_pre_abort 1
266 # endif
267 #endif
268
269
270 #if @GNULIB_FREE_POSIX@
271 # if @REPLACE_FREE@
272 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
273 # undef free
274 # define free rpl_free
275 # endif
276 # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
277 _GL_FUNCDECL_RPL (free, void, (void *ptr) _GL_ATTRIBUTE_NOTHROW);
278 # else
279 _GL_FUNCDECL_RPL (free, void, (void *ptr));
280 # endif
281 _GL_CXXALIAS_RPL (free, void, (void *ptr));
282 # else
283 _GL_CXXALIAS_SYS (free, void, (void *ptr));
284 # endif
285 # if __GLIBC__ >= 2
286 _GL_CXXALIASWARN (free);
287 # endif
288 #elif defined GNULIB_POSIXCHECK
289 # undef free
290 /* Assume free is always declared. */
291 _GL_WARN_ON_USE (free, "free is not future POSIX compliant everywhere - "
292 "use gnulib module free for portability");
293 #endif
294
295
296 /* Allocate memory with indefinite extent and specified alignment. */
297 #if @GNULIB_ALIGNED_ALLOC@
298 # if @REPLACE_ALIGNED_ALLOC@
299 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
300 # undef aligned_alloc
301 # define aligned_alloc rpl_aligned_alloc
302 # endif
303 _GL_FUNCDECL_RPL (aligned_alloc, void *,
304 (size_t alignment, size_t size)
305 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
306 _GL_CXXALIAS_RPL (aligned_alloc, void *, (size_t alignment, size_t size));
307 # else
308 # if @HAVE_ALIGNED_ALLOC@
309 # if __GNUC__ >= 11 && !defined __clang__
310 /* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */
311 # if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2
312 _GL_FUNCDECL_SYS (aligned_alloc, void *,
313 (size_t alignment, size_t size)
314 _GL_ATTRIBUTE_NOTHROW
315 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
316 # else
317 _GL_FUNCDECL_SYS (aligned_alloc, void *,
318 (size_t alignment, size_t size)
319 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
320 # endif
321 # endif
322 _GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size));
323 # endif
324 # endif
325 # if (__GLIBC__ >= 2) && @HAVE_ALIGNED_ALLOC@
326 _GL_CXXALIASWARN (aligned_alloc);
327 # endif
328 #else
329 # if @GNULIB_FREE_POSIX@ \
330 && (__GNUC__ >= 11 && !defined __clang__) && !defined aligned_alloc
331 /* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */
332 # if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2
333 _GL_FUNCDECL_SYS (aligned_alloc, void *,
334 (size_t alignment, size_t size)
335 _GL_ATTRIBUTE_NOTHROW
336 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
337 # else
338 _GL_FUNCDECL_SYS (aligned_alloc, void *,
339 (size_t alignment, size_t size)
340 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
341 # endif
342 # endif
343 # if defined GNULIB_POSIXCHECK
344 # undef aligned_alloc
345 # if HAVE_RAW_DECL_ALIGNED_ALLOC
346 _GL_WARN_ON_USE (aligned_alloc, "aligned_alloc is not portable - "
347 "use gnulib module aligned_alloc for portability");
348 # endif
349 # endif
350 #endif
351
352 #if @GNULIB_ATOLL@
353 /* Parse a signed decimal integer.
354 Returns the value of the integer. Errors are not detected. */
355 # if !@HAVE_ATOLL@
356 _GL_FUNCDECL_SYS (atoll, long long, (const char *string)
357 _GL_ATTRIBUTE_PURE
358 _GL_ARG_NONNULL ((1)));
359 # endif
360 _GL_CXXALIAS_SYS (atoll, long long, (const char *string));
361 _GL_CXXALIASWARN (atoll);
362 #elif defined GNULIB_POSIXCHECK
363 # undef atoll
364 # if HAVE_RAW_DECL_ATOLL
365 _GL_WARN_ON_USE (atoll, "atoll is unportable - "
366 "use gnulib module atoll for portability");
367 # endif
368 #endif
369
370 #if @GNULIB_CALLOC_POSIX@
371 # if (@GNULIB_CALLOC_POSIX@ && @REPLACE_CALLOC_FOR_CALLOC_POSIX@) \
372 || (@GNULIB_CALLOC_GNU@ && @REPLACE_CALLOC_FOR_CALLOC_GNU@)
373 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
374 # undef calloc
375 # define calloc rpl_calloc
376 # endif
377 _GL_FUNCDECL_RPL (calloc, void *,
378 (size_t nmemb, size_t size)
379 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
380 _GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size));
381 # else
382 # if __GNUC__ >= 11 && !defined __clang__
383 /* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */
384 # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
385 _GL_FUNCDECL_SYS (calloc, void *,
386 (size_t nmemb, size_t size)
387 _GL_ATTRIBUTE_NOTHROW
388 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
389 # else
390 _GL_FUNCDECL_SYS (calloc, void *,
391 (size_t nmemb, size_t size)
392 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
393 # endif
394 # endif
395 _GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
396 # endif
397 # if __GLIBC__ >= 2
398 _GL_CXXALIASWARN (calloc);
399 # endif
400 #else
401 # if @GNULIB_FREE_POSIX@ \
402 && (__GNUC__ >= 11 && !defined __clang__) && !defined calloc
403 /* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */
404 # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
405 _GL_FUNCDECL_SYS (calloc, void *,
406 (size_t nmemb, size_t size)
407 _GL_ATTRIBUTE_NOTHROW
408 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
409 # else
410 _GL_FUNCDECL_SYS (calloc, void *,
411 (size_t nmemb, size_t size)
412 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
413 # endif
414 # endif
415 # if defined GNULIB_POSIXCHECK
416 # undef calloc
417 /* Assume calloc is always declared. */
418 _GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - "
419 "use gnulib module calloc-posix for portability");
420 # endif
421 #endif
422
423 #if @GNULIB_CANONICALIZE_FILE_NAME@
424 # if @REPLACE_CANONICALIZE_FILE_NAME@
425 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
426 # define canonicalize_file_name rpl_canonicalize_file_name
427 # endif
428 _GL_FUNCDECL_RPL (canonicalize_file_name, char *,
429 (const char *name)
430 _GL_ARG_NONNULL ((1))
431 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
432 _GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name));
433 # else
434 # if !@HAVE_CANONICALIZE_FILE_NAME@ || (__GNUC__ >= 11 && !defined __clang__)
435 # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
436 _GL_FUNCDECL_SYS (canonicalize_file_name, char *,
437 (const char *name)
438 _GL_ATTRIBUTE_NOTHROW
439 _GL_ARG_NONNULL ((1))
440 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
441 # else
442 _GL_FUNCDECL_SYS (canonicalize_file_name, char *,
443 (const char *name)
444 _GL_ARG_NONNULL ((1))
445 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
446 # endif
447 # endif
448 _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
449 # endif
450 # ifndef GNULIB_defined_canonicalize_file_name
451 # define GNULIB_defined_canonicalize_file_name \
452 (!@HAVE_CANONICALIZE_FILE_NAME@ || @REPLACE_CANONICALIZE_FILE_NAME@)
453 # endif
454 _GL_CXXALIASWARN (canonicalize_file_name);
455 #else
456 # if @GNULIB_FREE_POSIX@ \
457 && (__GNUC__ >= 11 && !defined __clang__) && !defined canonicalize_file_name
458 /* For -Wmismatched-dealloc: Associate canonicalize_file_name with free or
459 rpl_free. */
460 # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
461 _GL_FUNCDECL_SYS (canonicalize_file_name, char *,
462 (const char *name)
463 _GL_ATTRIBUTE_NOTHROW
464 _GL_ARG_NONNULL ((1))
465 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
466 # else
467 _GL_FUNCDECL_SYS (canonicalize_file_name, char *,
468 (const char *name)
469 _GL_ARG_NONNULL ((1))
470 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
471 # endif
472 # endif
473 # if defined GNULIB_POSIXCHECK
474 # undef canonicalize_file_name
475 # if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
476 _GL_WARN_ON_USE (canonicalize_file_name,
477 "canonicalize_file_name is unportable - "
478 "use gnulib module canonicalize-lgpl for portability");
479 # endif
480 # endif
481 #endif
482
483 #if @GNULIB_MDA_ECVT@
484 /* On native Windows, map 'ecvt' to '_ecvt', so that -loldnames is not
485 required. In C++ with GNULIB_NAMESPACE, avoid differences between
486 platforms by defining GNULIB_NAMESPACE::ecvt on all platforms that have
487 it. */
488 # if defined _WIN32 && !defined __CYGWIN__
489 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
490 # undef ecvt
491 # define ecvt _ecvt
492 # endif
493 _GL_CXXALIAS_MDA (ecvt, char *,
494 (double number, int ndigits, int *decptp, int *signp));
495 # else
496 # if @HAVE_DECL_ECVT@
497 _GL_CXXALIAS_SYS (ecvt, char *,
498 (double number, int ndigits, int *decptp, int *signp));
499 # endif
500 # endif
501 # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_ECVT@
502 _GL_CXXALIASWARN (ecvt);
503 # endif
504 #endif
505
506 #if @GNULIB_MDA_FCVT@
507 /* On native Windows, map 'fcvt' to '_fcvt', so that -loldnames is not
508 required. In C++ with GNULIB_NAMESPACE, avoid differences between
509 platforms by defining GNULIB_NAMESPACE::fcvt on all platforms that have
510 it. */
511 # if defined _WIN32 && !defined __CYGWIN__
512 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
513 # undef fcvt
514 # define fcvt _fcvt
515 # endif
516 _GL_CXXALIAS_MDA (fcvt, char *,
517 (double number, int ndigits, int *decptp, int *signp));
518 # else
519 # if @HAVE_DECL_FCVT@
520 _GL_CXXALIAS_SYS (fcvt, char *,
521 (double number, int ndigits, int *decptp, int *signp));
522 # endif
523 # endif
524 # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_FCVT@
525 _GL_CXXALIASWARN (fcvt);
526 # endif
527 #endif
528
529 #if @GNULIB_MDA_GCVT@
530 /* On native Windows, map 'gcvt' to '_gcvt', so that -loldnames is not
531 required. In C++ with GNULIB_NAMESPACE, avoid differences between
532 platforms by defining GNULIB_NAMESPACE::gcvt on all platforms that have
533 it. */
534 # if defined _WIN32 && !defined __CYGWIN__
535 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
536 # undef gcvt
537 # define gcvt _gcvt
538 # endif
539 _GL_CXXALIAS_MDA (gcvt, char *, (double number, int ndigits, char *buf));
540 # else
541 # if @HAVE_DECL_GCVT@
542 _GL_CXXALIAS_SYS (gcvt, char *, (double number, int ndigits, char *buf));
543 # endif
544 # endif
545 # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_GCVT@
546 _GL_CXXALIASWARN (gcvt);
547 # endif
548 #endif
549
550 #if @GNULIB_GETLOADAVG@
551 /* Store max(NELEM,3) load average numbers in LOADAVG[].
552 The three numbers are the load average of the last 1 minute, the last 5
553 minutes, and the last 15 minutes, respectively.
554 LOADAVG is an array of NELEM numbers. */
555 # if @REPLACE_GETLOADAVG@
556 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
557 # undef getloadavg
558 # define getloadavg rpl_getloadavg
559 # endif
560 _GL_FUNCDECL_RPL (getloadavg, int, (double loadavg[], int nelem)
561 _GL_ARG_NONNULL ((1)));
562 _GL_CXXALIAS_RPL (getloadavg, int, (double loadavg[], int nelem));
563 # else
564 # if !@HAVE_DECL_GETLOADAVG@
565 _GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem)
566 _GL_ARG_NONNULL ((1)));
567 # endif
568 _GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem));
569 # endif
570 # if __GLIBC__ >= 2
571 _GL_CXXALIASWARN (getloadavg);
572 # endif
573 #elif defined GNULIB_POSIXCHECK
574 # undef getloadavg
575 # if HAVE_RAW_DECL_GETLOADAVG
576 _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
577 "use gnulib module getloadavg for portability");
578 # endif
579 #endif
580
581 #if @GNULIB_GETPROGNAME@
582 /* Return the base name of the executing program.
583 On native Windows this will usually end in ".exe" or ".EXE". */
584 # if @REPLACE_GETPROGNAME@
585 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
586 # undef getprogname
587 # define getprogname rpl_getprogname
588 # endif
589 # if @HAVE_DECL_PROGRAM_INVOCATION_NAME@
590 _GL_FUNCDECL_RPL (getprogname, const char *, (void) _GL_ATTRIBUTE_PURE);
591 # else
592 _GL_FUNCDECL_RPL (getprogname, const char *, (void));
593 # endif
594 _GL_CXXALIAS_RPL (getprogname, const char *, (void));
595 # else
596 # if !@HAVE_GETPROGNAME@
597 # if @HAVE_DECL_PROGRAM_INVOCATION_NAME@
598 _GL_FUNCDECL_SYS (getprogname, const char *, (void) _GL_ATTRIBUTE_PURE);
599 # else
600 _GL_FUNCDECL_SYS (getprogname, const char *, (void));
601 # endif
602 # endif
603 _GL_CXXALIAS_SYS (getprogname, const char *, (void));
604 # endif
605 # if __GLIBC__ >= 2
606 _GL_CXXALIASWARN (getprogname);
607 # endif
608 #elif defined GNULIB_POSIXCHECK
609 # undef getprogname
610 # if HAVE_RAW_DECL_GETPROGNAME
611 _GL_WARN_ON_USE (getprogname, "getprogname is unportable - "
612 "use gnulib module getprogname for portability");
613 # endif
614 #endif
615
616 #if @GNULIB_GETSUBOPT@
617 /* Assuming *OPTIONP is a comma separated list of elements of the form
618 "token" or "token=value", getsubopt parses the first of these elements.
619 If the first element refers to a "token" that is member of the given
620 NULL-terminated array of tokens:
621 - It replaces the comma with a NUL byte, updates *OPTIONP to point past
622 the first option and the comma, sets *VALUEP to the value of the
623 element (or NULL if it doesn't contain an "=" sign),
624 - It returns the index of the "token" in the given array of tokens.
625 Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
626 For more details see the POSIX specification.
627 https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsubopt.html */
628 # if @REPLACE_GETSUBOPT@
629 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
630 # undef getsubopt
631 # define getsubopt rpl_getsubopt
632 # endif
633 _GL_FUNCDECL_RPL (getsubopt, int,
634 (char **optionp, char *const *tokens, char **valuep)
635 _GL_ARG_NONNULL ((1, 2, 3)));
636 _GL_CXXALIAS_RPL (getsubopt, int,
637 (char **optionp, char *const *tokens, char **valuep));
638 # else
639 # if !@HAVE_GETSUBOPT@
640 _GL_FUNCDECL_SYS (getsubopt, int,
641 (char **optionp, char *const *tokens, char **valuep)
642 _GL_ARG_NONNULL ((1, 2, 3)));
643 # endif
644 _GL_CXXALIAS_SYS (getsubopt, int,
645 (char **optionp, char *const *tokens, char **valuep));
646 # endif
647 # if __GLIBC__ >= 2
648 _GL_CXXALIASWARN (getsubopt);
649 # endif
650 #elif defined GNULIB_POSIXCHECK
651 # undef getsubopt
652 # if HAVE_RAW_DECL_GETSUBOPT
653 _GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
654 "use gnulib module getsubopt for portability");
655 # endif
656 #endif
657
658 #if @GNULIB_GRANTPT@
659 /* Change the ownership and access permission of the slave side of the
660 pseudo-terminal whose master side is specified by FD. */
661 # if !@HAVE_GRANTPT@
662 _GL_FUNCDECL_SYS (grantpt, int, (int fd));
663 # endif
664 _GL_CXXALIAS_SYS (grantpt, int, (int fd));
665 _GL_CXXALIASWARN (grantpt);
666 #elif defined GNULIB_POSIXCHECK
667 # undef grantpt
668 # if HAVE_RAW_DECL_GRANTPT
669 _GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
670 "use gnulib module grantpt for portability");
671 # endif
672 #endif
673
674 /* If _GL_USE_STDLIB_ALLOC is nonzero, the including module does not
675 rely on GNU or POSIX semantics for malloc and realloc (for example,
676 by never specifying a zero size), so it does not need malloc or
677 realloc to be redefined. */
678 #if @GNULIB_MALLOC_POSIX@
679 # if (@GNULIB_MALLOC_POSIX@ && @REPLACE_MALLOC_FOR_MALLOC_POSIX@) \
680 || (@GNULIB_MALLOC_GNU@ && @REPLACE_MALLOC_FOR_MALLOC_GNU@)
681 # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
682 || _GL_USE_STDLIB_ALLOC)
683 # undef malloc
684 # define malloc rpl_malloc
685 # endif
686 _GL_FUNCDECL_RPL (malloc, void *,
687 (size_t size)
688 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
689 _GL_CXXALIAS_RPL (malloc, void *, (size_t size));
690 # else
691 # if __GNUC__ >= 11 && !defined __clang__
692 /* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */
693 # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
694 _GL_FUNCDECL_SYS (malloc, void *,
695 (size_t size)
696 _GL_ATTRIBUTE_NOTHROW
697 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
698 # else
699 _GL_FUNCDECL_SYS (malloc, void *,
700 (size_t size)
701 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
702 # endif
703 # endif
704 _GL_CXXALIAS_SYS (malloc, void *, (size_t size));
705 # endif
706 # if __GLIBC__ >= 2
707 _GL_CXXALIASWARN (malloc);
708 # endif
709 #else
710 # if @GNULIB_FREE_POSIX@ \
711 && (__GNUC__ >= 11 && !defined __clang__) && !defined malloc
712 /* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */
713 # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
714 _GL_FUNCDECL_SYS (malloc, void *,
715 (size_t size)
716 _GL_ATTRIBUTE_NOTHROW
717 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
718 # else
719 _GL_FUNCDECL_SYS (malloc, void *,
720 (size_t size)
721 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
722 # endif
723 # endif
724 # if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
725 # undef malloc
726 /* Assume malloc is always declared. */
727 _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
728 "use gnulib module malloc-posix for portability");
729 # endif
730 #endif
731
732 /* Return maximum number of bytes of a multibyte character. */
733 #if @REPLACE_MB_CUR_MAX@
734 # if !GNULIB_defined_MB_CUR_MAX
735 static inline
736 int gl_MB_CUR_MAX (void)
737 {
738 /* Turn the value 3 to the value 4, as needed for the UTF-8 encoding. */
739 return MB_CUR_MAX + (MB_CUR_MAX == 3);
740 }
741 # undef MB_CUR_MAX
742 # define MB_CUR_MAX gl_MB_CUR_MAX ()
743 # define GNULIB_defined_MB_CUR_MAX 1
744 # endif
745 #endif
746
747 /* Convert a string to a wide string. */
748 #if @GNULIB_MBSTOWCS@
749 # if @REPLACE_MBSTOWCS@
750 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
751 # undef mbstowcs
752 # define mbstowcs rpl_mbstowcs
753 # endif
754 _GL_FUNCDECL_RPL (mbstowcs, size_t,
755 (wchar_t *restrict dest, const char *restrict src,
756 size_t len)
757 _GL_ARG_NONNULL ((2)));
758 _GL_CXXALIAS_RPL (mbstowcs, size_t,
759 (wchar_t *restrict dest, const char *restrict src,
760 size_t len));
761 # else
762 _GL_CXXALIAS_SYS (mbstowcs, size_t,
763 (wchar_t *restrict dest, const char *restrict src,
764 size_t len));
765 # endif
766 # if __GLIBC__ >= 2
767 _GL_CXXALIASWARN (mbstowcs);
768 # endif
769 #elif defined GNULIB_POSIXCHECK
770 # undef mbstowcs
771 # if HAVE_RAW_DECL_MBSTOWCS
772 _GL_WARN_ON_USE (mbstowcs, "mbstowcs is unportable - "
773 "use gnulib module mbstowcs for portability");
774 # endif
775 #endif
776
777 /* Convert a multibyte character to a wide character. */
778 #if @GNULIB_MBTOWC@
779 # if @REPLACE_MBTOWC@
780 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
781 # undef mbtowc
782 # define mbtowc rpl_mbtowc
783 # endif
784 _GL_FUNCDECL_RPL (mbtowc, int,
785 (wchar_t *restrict pwc, const char *restrict s, size_t n));
786 _GL_CXXALIAS_RPL (mbtowc, int,
787 (wchar_t *restrict pwc, const char *restrict s, size_t n));
788 # else
789 # if !@HAVE_MBTOWC@
790 _GL_FUNCDECL_SYS (mbtowc, int,
791 (wchar_t *restrict pwc, const char *restrict s, size_t n));
792 # endif
793 _GL_CXXALIAS_SYS (mbtowc, int,
794 (wchar_t *restrict pwc, const char *restrict s, size_t n));
795 # endif
796 # if __GLIBC__ >= 2
797 _GL_CXXALIASWARN (mbtowc);
798 # endif
799 #elif defined GNULIB_POSIXCHECK
800 # undef mbtowc
801 # if HAVE_RAW_DECL_MBTOWC
802 _GL_WARN_ON_USE (mbtowc, "mbtowc is not portable - "
803 "use gnulib module mbtowc for portability");
804 # endif
805 #endif
806
807 #if @GNULIB_MKDTEMP@
808 /* Create a unique temporary directory from TEMPLATE.
809 The last six characters of TEMPLATE must be "XXXXXX";
810 they are replaced with a string that makes the directory name unique.
811 Returns TEMPLATE, or a null pointer if it cannot get a unique name.
812 The directory is created mode 700. */
813 # if !@HAVE_MKDTEMP@
814 _GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1)));
815 # endif
816 _GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/));
817 _GL_CXXALIASWARN (mkdtemp);
818 #elif defined GNULIB_POSIXCHECK
819 # undef mkdtemp
820 # if HAVE_RAW_DECL_MKDTEMP
821 _GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
822 "use gnulib module mkdtemp for portability");
823 # endif
824 #endif
825
826 #if @GNULIB_MKOSTEMP@
827 /* Create a unique temporary file from TEMPLATE.
828 The last six characters of TEMPLATE must be "XXXXXX";
829 they are replaced with a string that makes the file name unique.
830 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
831 and O_TEXT, O_BINARY (defined in "binary-io.h").
832 The file is then created, with the specified flags, ensuring it didn't exist
833 before.
834 The file is created read-write (mask at least 0600 & ~umask), but it may be
835 world-readable and world-writable (mask 0666 & ~umask), depending on the
836 implementation.
837 Returns the open file descriptor if successful, otherwise -1 and errno
838 set. */
839 # if @REPLACE_MKOSTEMP@
840 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
841 # undef mkostemp
842 # define mkostemp rpl_mkostemp
843 # endif
844 _GL_FUNCDECL_RPL (mkostemp, int, (char * /*template*/, int /*flags*/)
845 _GL_ARG_NONNULL ((1)));
846 _GL_CXXALIAS_RPL (mkostemp, int, (char * /*template*/, int /*flags*/));
847 # else
848 # if !@HAVE_MKOSTEMP@
849 _GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)
850 _GL_ARG_NONNULL ((1)));
851 # endif
852 _GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/));
853 # endif
854 # if __GLIBC__ >= 2
855 _GL_CXXALIASWARN (mkostemp);
856 # endif
857 #elif defined GNULIB_POSIXCHECK
858 # undef mkostemp
859 # if HAVE_RAW_DECL_MKOSTEMP
860 _GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
861 "use gnulib module mkostemp for portability");
862 # endif
863 #endif
864
865 #if @GNULIB_MKOSTEMPS@
866 /* Create a unique temporary file from TEMPLATE.
867 The last six characters of TEMPLATE before a suffix of length
868 SUFFIXLEN must be "XXXXXX";
869 they are replaced with a string that makes the file name unique.
870 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
871 and O_TEXT, O_BINARY (defined in "binary-io.h").
872 The file is then created, with the specified flags, ensuring it didn't exist
873 before.
874 The file is created read-write (mask at least 0600 & ~umask), but it may be
875 world-readable and world-writable (mask 0666 & ~umask), depending on the
876 implementation.
877 Returns the open file descriptor if successful, otherwise -1 and errno
878 set. */
879 # if @REPLACE_MKOSTEMPS@
880 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
881 # undef mkostemps
882 # define mkostemps rpl_mkostemps
883 # endif
884 _GL_FUNCDECL_RPL (mkostemps, int,
885 (char * /*template*/, int /*suffixlen*/, int /*flags*/)
886 _GL_ARG_NONNULL ((1)));
887 _GL_CXXALIAS_RPL (mkostemps, int,
888 (char * /*template*/, int /*suffixlen*/, int /*flags*/));
889 # else
890 # if !@HAVE_MKOSTEMPS@
891 _GL_FUNCDECL_SYS (mkostemps, int,
892 (char * /*template*/, int /*suffixlen*/, int /*flags*/)
893 _GL_ARG_NONNULL ((1)));
894 # endif
895 _GL_CXXALIAS_SYS (mkostemps, int,
896 (char * /*template*/, int /*suffixlen*/, int /*flags*/));
897 # endif
898 # if __GLIBC__ >= 2
899 _GL_CXXALIASWARN (mkostemps);
900 # endif
901 #elif defined GNULIB_POSIXCHECK
902 # undef mkostemps
903 # if HAVE_RAW_DECL_MKOSTEMPS
904 _GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
905 "use gnulib module mkostemps for portability");
906 # endif
907 #endif
908
909 #if @GNULIB_MKSTEMP@
910 /* Create a unique temporary file from TEMPLATE.
911 The last six characters of TEMPLATE must be "XXXXXX";
912 they are replaced with a string that makes the file name unique.
913 The file is then created, ensuring it didn't exist before.
914 The file is created read-write (mask at least 0600 & ~umask), but it may be
915 world-readable and world-writable (mask 0666 & ~umask), depending on the
916 implementation.
917 Returns the open file descriptor if successful, otherwise -1 and errno
918 set. */
919 # if @REPLACE_MKSTEMP@
920 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
921 # define mkstemp rpl_mkstemp
922 # endif
923 _GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
924 _GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/));
925 # else
926 # if ! @HAVE_MKSTEMP@
927 _GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
928 # endif
929 _GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/));
930 # endif
931 _GL_CXXALIASWARN (mkstemp);
932 #elif defined GNULIB_POSIXCHECK
933 # undef mkstemp
934 # if HAVE_RAW_DECL_MKSTEMP
935 _GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
936 "use gnulib module mkstemp for portability");
937 # endif
938 #endif
939
940 #if @GNULIB_MKSTEMPS@
941 /* Create a unique temporary file from TEMPLATE.
942 The last six characters of TEMPLATE prior to a suffix of length
943 SUFFIXLEN must be "XXXXXX";
944 they are replaced with a string that makes the file name unique.
945 The file is then created, ensuring it didn't exist before.
946 The file is created read-write (mask at least 0600 & ~umask), but it may be
947 world-readable and world-writable (mask 0666 & ~umask), depending on the
948 implementation.
949 Returns the open file descriptor if successful, otherwise -1 and errno
950 set. */
951 # if !@HAVE_MKSTEMPS@
952 _GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)
953 _GL_ARG_NONNULL ((1)));
954 # endif
955 _GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/));
956 _GL_CXXALIASWARN (mkstemps);
957 #elif defined GNULIB_POSIXCHECK
958 # undef mkstemps
959 # if HAVE_RAW_DECL_MKSTEMPS
960 _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
961 "use gnulib module mkstemps for portability");
962 # endif
963 #endif
964
965 #if @GNULIB_MDA_MKTEMP@
966 /* On native Windows, map 'mktemp' to '_mktemp', so that -loldnames is not
967 required. In C++ with GNULIB_NAMESPACE, avoid differences between
968 platforms by defining GNULIB_NAMESPACE::mktemp always. */
969 # if defined _WIN32 && !defined __CYGWIN__
970 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
971 # undef mktemp
972 # define mktemp _mktemp
973 # endif
974 _GL_CXXALIAS_MDA (mktemp, char *, (char * /*template*/));
975 # else
976 _GL_CXXALIAS_SYS (mktemp, char *, (char * /*template*/));
977 # endif
978 _GL_CXXALIASWARN (mktemp);
979 #endif
980
981 /* Allocate memory with indefinite extent and specified alignment. */
982 #if @GNULIB_POSIX_MEMALIGN@
983 # if @REPLACE_POSIX_MEMALIGN@
984 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
985 # undef posix_memalign
986 # define posix_memalign rpl_posix_memalign
987 # endif
988 _GL_FUNCDECL_RPL (posix_memalign, int,
989 (void **memptr, size_t alignment, size_t size)
990 _GL_ARG_NONNULL ((1)));
991 _GL_CXXALIAS_RPL (posix_memalign, int,
992 (void **memptr, size_t alignment, size_t size));
993 # else
994 # if @HAVE_POSIX_MEMALIGN@
995 _GL_CXXALIAS_SYS (posix_memalign, int,
996 (void **memptr, size_t alignment, size_t size));
997 # endif
998 # endif
999 # if __GLIBC__ >= 2 && @HAVE_POSIX_MEMALIGN@
1000 _GL_CXXALIASWARN (posix_memalign);
1001 # endif
1002 #elif defined GNULIB_POSIXCHECK
1003 # undef posix_memalign
1004 # if HAVE_RAW_DECL_POSIX_MEMALIGN
1005 _GL_WARN_ON_USE (posix_memalign, "posix_memalign is not portable - "
1006 "use gnulib module posix_memalign for portability");
1007 # endif
1008 #endif
1009
1010 #if @GNULIB_POSIX_OPENPT@
1011 /* Return an FD open to the master side of a pseudo-terminal. Flags should
1012 include O_RDWR, and may also include O_NOCTTY. */
1013 # if @REPLACE_POSIX_OPENPT@
1014 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1015 # undef posix_openpt
1016 # define posix_openpt rpl_posix_openpt
1017 # endif
1018 _GL_FUNCDECL_RPL (posix_openpt, int, (int flags));
1019 _GL_CXXALIAS_RPL (posix_openpt, int, (int flags));
1020 # else
1021 # if !@HAVE_POSIX_OPENPT@
1022 _GL_FUNCDECL_SYS (posix_openpt, int, (int flags));
1023 # endif
1024 _GL_CXXALIAS_SYS (posix_openpt, int, (int flags));
1025 # endif
1026 # if __GLIBC__ >= 2
1027 _GL_CXXALIASWARN (posix_openpt);
1028 # endif
1029 #elif defined GNULIB_POSIXCHECK
1030 # undef posix_openpt
1031 # if HAVE_RAW_DECL_POSIX_OPENPT
1032 _GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - "
1033 "use gnulib module posix_openpt for portability");
1034 # endif
1035 #endif
1036
1037 #if @GNULIB_PTSNAME@
1038 /* Return the pathname of the pseudo-terminal slave associated with
1039 the master FD is open on, or NULL on errors. */
1040 # if @REPLACE_PTSNAME@
1041 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1042 # undef ptsname
1043 # define ptsname rpl_ptsname
1044 # endif
1045 _GL_FUNCDECL_RPL (ptsname, char *, (int fd));
1046 _GL_CXXALIAS_RPL (ptsname, char *, (int fd));
1047 # else
1048 # if !@HAVE_PTSNAME@
1049 _GL_FUNCDECL_SYS (ptsname, char *, (int fd));
1050 # endif
1051 _GL_CXXALIAS_SYS (ptsname, char *, (int fd));
1052 # endif
1053 _GL_CXXALIASWARN (ptsname);
1054 #elif defined GNULIB_POSIXCHECK
1055 # undef ptsname
1056 # if HAVE_RAW_DECL_PTSNAME
1057 _GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
1058 "use gnulib module ptsname for portability");
1059 # endif
1060 #endif
1061
1062 #if @GNULIB_PTSNAME_R@
1063 /* Set the pathname of the pseudo-terminal slave associated with
1064 the master FD is open on and return 0, or set errno and return
1065 non-zero on errors. */
1066 # if @REPLACE_PTSNAME_R@
1067 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1068 # undef ptsname_r
1069 # define ptsname_r rpl_ptsname_r
1070 # endif
1071 _GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
1072 _GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
1073 # else
1074 # if !@HAVE_PTSNAME_R@
1075 _GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
1076 # endif
1077 _GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
1078 # endif
1079 # ifndef GNULIB_defined_ptsname_r
1080 # define GNULIB_defined_ptsname_r (!@HAVE_PTSNAME_R@ || @REPLACE_PTSNAME_R@)
1081 # endif
1082 _GL_CXXALIASWARN (ptsname_r);
1083 #elif defined GNULIB_POSIXCHECK
1084 # undef ptsname_r
1085 # if HAVE_RAW_DECL_PTSNAME_R
1086 _GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - "
1087 "use gnulib module ptsname_r for portability");
1088 # endif
1089 #endif
1090
1091 #if @GNULIB_PUTENV@
1092 # if @REPLACE_PUTENV@
1093 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1094 # undef putenv
1095 # define putenv rpl_putenv
1096 # endif
1097 _GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1)));
1098 _GL_CXXALIAS_RPL (putenv, int, (char *string));
1099 # elif defined _WIN32 && !defined __CYGWIN__
1100 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1101 # undef putenv
1102 # define putenv _putenv
1103 # endif
1104 _GL_CXXALIAS_MDA (putenv, int, (char *string));
1105 # elif defined __KLIBC__
1106 /* Need to cast, because on OS/2 kLIBC, the first parameter is
1107 const char *string. */
1108 _GL_CXXALIAS_SYS_CAST (putenv, int, (char *string));
1109 # else
1110 _GL_CXXALIAS_SYS (putenv, int, (char *string));
1111 # endif
1112 _GL_CXXALIASWARN (putenv);
1113 #elif @GNULIB_MDA_PUTENV@
1114 /* On native Windows, map 'putenv' to '_putenv', so that -loldnames is not
1115 required. In C++ with GNULIB_NAMESPACE, avoid differences between
1116 platforms by defining GNULIB_NAMESPACE::putenv always. */
1117 # if defined _WIN32 && !defined __CYGWIN__
1118 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1119 # undef putenv
1120 # define putenv _putenv
1121 # endif
1122 /* Need to cast, because on mingw, the parameter is either
1123 'const char *string' or 'char *string'. */
1124 _GL_CXXALIAS_MDA_CAST (putenv, int, (char *string));
1125 # elif defined __KLIBC__
1126 /* Need to cast, because on OS/2 kLIBC, the first parameter is
1127 const char *string. */
1128 _GL_CXXALIAS_SYS_CAST (putenv, int, (char *string));
1129 # else
1130 _GL_CXXALIAS_SYS (putenv, int, (char *string));
1131 # endif
1132 _GL_CXXALIASWARN (putenv);
1133 #endif
1134
1135 #if @GNULIB_QSORT_R@
1136 /* Sort an array of NMEMB elements, starting at address BASE, each element
1137 occupying SIZE bytes, in ascending order according to the comparison
1138 function COMPARE. */
1139 # ifdef __cplusplus
1140 extern "C" {
1141 # endif
1142 # if !GNULIB_defined_qsort_r_fn_types
1143 typedef int (*_gl_qsort_r_compar_fn) (void const *, void const *, void *);
1144 # define GNULIB_defined_qsort_r_fn_types 1
1145 # endif
1146 # ifdef __cplusplus
1147 }
1148 # endif
1149 # if @REPLACE_QSORT_R@
1150 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1151 # undef qsort_r
1152 # define qsort_r rpl_qsort_r
1153 # endif
1154 _GL_FUNCDECL_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
1155 _gl_qsort_r_compar_fn compare,
1156 void *arg) _GL_ARG_NONNULL ((1, 4)));
1157 _GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
1158 _gl_qsort_r_compar_fn compare,
1159 void *arg));
1160 # else
1161 # if !@HAVE_QSORT_R@
1162 _GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
1163 _gl_qsort_r_compar_fn compare,
1164 void *arg) _GL_ARG_NONNULL ((1, 4)));
1165 # endif
1166 _GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
1167 _gl_qsort_r_compar_fn compare,
1168 void *arg));
1169 # endif
1170 # if __GLIBC__ >= 2
1171 _GL_CXXALIASWARN (qsort_r);
1172 # endif
1173 #elif defined GNULIB_POSIXCHECK
1174 # undef qsort_r
1175 # if HAVE_RAW_DECL_QSORT_R
1176 _GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - "
1177 "use gnulib module qsort_r for portability");
1178 # endif
1179 #endif
1180
1181
1182 #if @GNULIB_RAND@ || (@GNULIB_RANDOM_R@ && !@HAVE_RANDOM_R@)
1183 # ifndef RAND_MAX
1184 # define RAND_MAX 2147483647
1185 # endif
1186 #endif
1187
1188
1189 #if @GNULIB_RAND@
1190 # if @REPLACE_RAND@
1191 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1192 # undef rand
1193 # define rand rpl_rand
1194 # endif
1195 _GL_FUNCDECL_RPL (rand, int, (void));
1196 _GL_CXXALIAS_RPL (rand, int, (void));
1197 # else
1198 _GL_CXXALIAS_SYS (rand, int, (void));
1199 # endif
1200 # if __GLIBC__ >= 2
1201 _GL_CXXALIASWARN (rand);
1202 # endif
1203 #endif
1204
1205
1206 #if @GNULIB_RANDOM@
1207 # if @REPLACE_RANDOM@
1208 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1209 # undef random
1210 # define random rpl_random
1211 # endif
1212 _GL_FUNCDECL_RPL (random, long, (void));
1213 _GL_CXXALIAS_RPL (random, long, (void));
1214 # else
1215 # if !@HAVE_RANDOM@
1216 _GL_FUNCDECL_SYS (random, long, (void));
1217 # endif
1218 /* Need to cast, because on Haiku, the return type is
1219 int. */
1220 _GL_CXXALIAS_SYS_CAST (random, long, (void));
1221 # endif
1222 # if __GLIBC__ >= 2
1223 _GL_CXXALIASWARN (random);
1224 # endif
1225 #elif defined GNULIB_POSIXCHECK
1226 # undef random
1227 # if HAVE_RAW_DECL_RANDOM
1228 _GL_WARN_ON_USE (random, "random is unportable - "
1229 "use gnulib module random for portability");
1230 # endif
1231 #endif
1232
1233 #if @GNULIB_RANDOM@
1234 # if @REPLACE_RANDOM@
1235 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1236 # undef srandom
1237 # define srandom rpl_srandom
1238 # endif
1239 _GL_FUNCDECL_RPL (srandom, void, (unsigned int seed));
1240 _GL_CXXALIAS_RPL (srandom, void, (unsigned int seed));
1241 # else
1242 # if !@HAVE_RANDOM@
1243 _GL_FUNCDECL_SYS (srandom, void, (unsigned int seed));
1244 # endif
1245 /* Need to cast, because on FreeBSD, the first parameter is
1246 unsigned long seed. */
1247 _GL_CXXALIAS_SYS_CAST (srandom, void, (unsigned int seed));
1248 # endif
1249 # if __GLIBC__ >= 2
1250 _GL_CXXALIASWARN (srandom);
1251 # endif
1252 #elif defined GNULIB_POSIXCHECK
1253 # undef srandom
1254 # if HAVE_RAW_DECL_SRANDOM
1255 _GL_WARN_ON_USE (srandom, "srandom is unportable - "
1256 "use gnulib module random for portability");
1257 # endif
1258 #endif
1259
1260 #if @GNULIB_RANDOM@
1261 # if @REPLACE_INITSTATE@
1262 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1263 # undef initstate
1264 # define initstate rpl_initstate
1265 # endif
1266 _GL_FUNCDECL_RPL (initstate, char *,
1267 (unsigned int seed, char *buf, size_t buf_size)
1268 _GL_ARG_NONNULL ((2)));
1269 _GL_CXXALIAS_RPL (initstate, char *,
1270 (unsigned int seed, char *buf, size_t buf_size));
1271 # else
1272 # if !@HAVE_INITSTATE@ || !@HAVE_DECL_INITSTATE@
1273 _GL_FUNCDECL_SYS (initstate, char *,
1274 (unsigned int seed, char *buf, size_t buf_size)
1275 _GL_ARG_NONNULL ((2)));
1276 # endif
1277 /* Need to cast, because on FreeBSD, the first parameter is
1278 unsigned long seed. */
1279 _GL_CXXALIAS_SYS_CAST (initstate, char *,
1280 (unsigned int seed, char *buf, size_t buf_size));
1281 # endif
1282 # if __GLIBC__ >= 2
1283 _GL_CXXALIASWARN (initstate);
1284 # endif
1285 #elif defined GNULIB_POSIXCHECK
1286 # undef initstate
1287 # if HAVE_RAW_DECL_INITSTATE
1288 _GL_WARN_ON_USE (initstate, "initstate is unportable - "
1289 "use gnulib module random for portability");
1290 # endif
1291 #endif
1292
1293 #if @GNULIB_RANDOM@
1294 # if @REPLACE_SETSTATE@
1295 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1296 # undef setstate
1297 # define setstate rpl_setstate
1298 # endif
1299 _GL_FUNCDECL_RPL (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
1300 _GL_CXXALIAS_RPL (setstate, char *, (char *arg_state));
1301 # else
1302 # if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@
1303 _GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
1304 # endif
1305 /* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter
1306 is const char *arg_state. */
1307 _GL_CXXALIAS_SYS_CAST (setstate, char *, (char *arg_state));
1308 # endif
1309 # if __GLIBC__ >= 2
1310 _GL_CXXALIASWARN (setstate);
1311 # endif
1312 #elif defined GNULIB_POSIXCHECK
1313 # undef setstate
1314 # if HAVE_RAW_DECL_SETSTATE
1315 _GL_WARN_ON_USE (setstate, "setstate is unportable - "
1316 "use gnulib module random for portability");
1317 # endif
1318 #endif
1319
1320
1321 #if @GNULIB_RANDOM_R@
1322 # if @REPLACE_RANDOM_R@
1323 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1324 # undef random_r
1325 # define random_r rpl_random_r
1326 # endif
1327 _GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result)
1328 _GL_ARG_NONNULL ((1, 2)));
1329 _GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result));
1330 # else
1331 # if !@HAVE_RANDOM_R@
1332 _GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result)
1333 _GL_ARG_NONNULL ((1, 2)));
1334 # endif
1335 _GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
1336 # endif
1337 _GL_CXXALIASWARN (random_r);
1338 #elif defined GNULIB_POSIXCHECK
1339 # undef random_r
1340 # if HAVE_RAW_DECL_RANDOM_R
1341 _GL_WARN_ON_USE (random_r, "random_r is unportable - "
1342 "use gnulib module random_r for portability");
1343 # endif
1344 #endif
1345
1346 #if @GNULIB_RANDOM_R@
1347 # if @REPLACE_RANDOM_R@
1348 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1349 # undef srandom_r
1350 # define srandom_r rpl_srandom_r
1351 # endif
1352 _GL_FUNCDECL_RPL (srandom_r, int,
1353 (unsigned int seed, struct random_data *rand_state)
1354 _GL_ARG_NONNULL ((2)));
1355 _GL_CXXALIAS_RPL (srandom_r, int,
1356 (unsigned int seed, struct random_data *rand_state));
1357 # else
1358 # if !@HAVE_RANDOM_R@
1359 _GL_FUNCDECL_SYS (srandom_r, int,
1360 (unsigned int seed, struct random_data *rand_state)
1361 _GL_ARG_NONNULL ((2)));
1362 # endif
1363 _GL_CXXALIAS_SYS (srandom_r, int,
1364 (unsigned int seed, struct random_data *rand_state));
1365 # endif
1366 _GL_CXXALIASWARN (srandom_r);
1367 #elif defined GNULIB_POSIXCHECK
1368 # undef srandom_r
1369 # if HAVE_RAW_DECL_SRANDOM_R
1370 _GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
1371 "use gnulib module random_r for portability");
1372 # endif
1373 #endif
1374
1375 #if @GNULIB_RANDOM_R@
1376 # if @REPLACE_RANDOM_R@
1377 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1378 # undef initstate_r
1379 # define initstate_r rpl_initstate_r
1380 # endif
1381 _GL_FUNCDECL_RPL (initstate_r, int,
1382 (unsigned int seed, char *buf, size_t buf_size,
1383 struct random_data *rand_state)
1384 _GL_ARG_NONNULL ((2, 4)));
1385 _GL_CXXALIAS_RPL (initstate_r, int,
1386 (unsigned int seed, char *buf, size_t buf_size,
1387 struct random_data *rand_state));
1388 # else
1389 # if !@HAVE_RANDOM_R@
1390 _GL_FUNCDECL_SYS (initstate_r, int,
1391 (unsigned int seed, char *buf, size_t buf_size,
1392 struct random_data *rand_state)
1393 _GL_ARG_NONNULL ((2, 4)));
1394 # endif
1395 /* Need to cast, because on Haiku, the third parameter is
1396 unsigned long buf_size. */
1397 _GL_CXXALIAS_SYS_CAST (initstate_r, int,
1398 (unsigned int seed, char *buf, size_t buf_size,
1399 struct random_data *rand_state));
1400 # endif
1401 _GL_CXXALIASWARN (initstate_r);
1402 #elif defined GNULIB_POSIXCHECK
1403 # undef initstate_r
1404 # if HAVE_RAW_DECL_INITSTATE_R
1405 _GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
1406 "use gnulib module random_r for portability");
1407 # endif
1408 #endif
1409
1410 #if @GNULIB_RANDOM_R@
1411 # if @REPLACE_RANDOM_R@
1412 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1413 # undef setstate_r
1414 # define setstate_r rpl_setstate_r
1415 # endif
1416 _GL_FUNCDECL_RPL (setstate_r, int,
1417 (char *arg_state, struct random_data *rand_state)
1418 _GL_ARG_NONNULL ((1, 2)));
1419 _GL_CXXALIAS_RPL (setstate_r, int,
1420 (char *arg_state, struct random_data *rand_state));
1421 # else
1422 # if !@HAVE_RANDOM_R@
1423 _GL_FUNCDECL_SYS (setstate_r, int,
1424 (char *arg_state, struct random_data *rand_state)
1425 _GL_ARG_NONNULL ((1, 2)));
1426 # endif
1427 /* Need to cast, because on Haiku, the first parameter is
1428 void *arg_state. */
1429 _GL_CXXALIAS_SYS_CAST (setstate_r, int,
1430 (char *arg_state, struct random_data *rand_state));
1431 # endif
1432 _GL_CXXALIASWARN (setstate_r);
1433 #elif defined GNULIB_POSIXCHECK
1434 # undef setstate_r
1435 # if HAVE_RAW_DECL_SETSTATE_R
1436 _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
1437 "use gnulib module random_r for portability");
1438 # endif
1439 #endif
1440
1441
1442 #if @GNULIB_REALLOC_POSIX@
1443 # if (@GNULIB_REALLOC_POSIX@ && @REPLACE_REALLOC_FOR_REALLOC_POSIX@) \
1444 || (@GNULIB_REALLOC_GNU@ && @REPLACE_REALLOC_FOR_REALLOC_GNU@)
1445 # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
1446 || _GL_USE_STDLIB_ALLOC)
1447 # undef realloc
1448 # define realloc rpl_realloc
1449 # endif
1450 _GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size)
1451 _GL_ATTRIBUTE_DEALLOC_FREE);
1452 _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
1453 # else
1454 # if __GNUC__ >= 11 && !defined __clang__
1455 /* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */
1456 # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
1457 _GL_FUNCDECL_SYS (realloc, void *,
1458 (void *ptr, size_t size)
1459 _GL_ATTRIBUTE_NOTHROW
1460 _GL_ATTRIBUTE_DEALLOC_FREE);
1461 # else
1462 _GL_FUNCDECL_SYS (realloc, void *,
1463 (void *ptr, size_t size)
1464 _GL_ATTRIBUTE_DEALLOC_FREE);
1465 # endif
1466 # endif
1467 _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
1468 # endif
1469 # if __GLIBC__ >= 2
1470 _GL_CXXALIASWARN (realloc);
1471 # endif
1472 #else
1473 # if @GNULIB_FREE_POSIX@ \
1474 && (__GNUC__ >= 11 && !defined __clang__) && !defined realloc
1475 /* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */
1476 # if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
1477 _GL_FUNCDECL_SYS (realloc, void *,
1478 (void *ptr, size_t size)
1479 _GL_ATTRIBUTE_NOTHROW
1480 _GL_ATTRIBUTE_DEALLOC_FREE);
1481 # else
1482 _GL_FUNCDECL_SYS (realloc, void *,
1483 (void *ptr, size_t size)
1484 _GL_ATTRIBUTE_DEALLOC_FREE);
1485 # endif
1486 # endif
1487 # if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
1488 # undef realloc
1489 /* Assume realloc is always declared. */
1490 _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
1491 "use gnulib module realloc-posix for portability");
1492 # endif
1493 #endif
1494
1495
1496 #if @GNULIB_REALLOCARRAY@
1497 # if @REPLACE_REALLOCARRAY@
1498 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1499 # undef reallocarray
1500 # define reallocarray rpl_reallocarray
1501 # endif
1502 _GL_FUNCDECL_RPL (reallocarray, void *,
1503 (void *ptr, size_t nmemb, size_t size));
1504 _GL_CXXALIAS_RPL (reallocarray, void *,
1505 (void *ptr, size_t nmemb, size_t size));
1506 # else
1507 # if ! @HAVE_REALLOCARRAY@
1508 _GL_FUNCDECL_SYS (reallocarray, void *,
1509 (void *ptr, size_t nmemb, size_t size));
1510 # endif
1511 _GL_CXXALIAS_SYS (reallocarray, void *,
1512 (void *ptr, size_t nmemb, size_t size));
1513 # endif
1514 # if __GLIBC__ >= 2
1515 _GL_CXXALIASWARN (reallocarray);
1516 # endif
1517 #elif defined GNULIB_POSIXCHECK
1518 # undef reallocarray
1519 # if HAVE_RAW_DECL_REALLOCARRAY
1520 _GL_WARN_ON_USE (reallocarray, "reallocarray is not portable - "
1521 "use gnulib module reallocarray for portability");
1522 # endif
1523 #endif
1524
1525 #if @GNULIB_REALPATH@
1526 # if @REPLACE_REALPATH@
1527 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1528 # define realpath rpl_realpath
1529 # endif
1530 _GL_FUNCDECL_RPL (realpath, char *,
1531 (const char *restrict name, char *restrict resolved)
1532 _GL_ARG_NONNULL ((1)));
1533 _GL_CXXALIAS_RPL (realpath, char *,
1534 (const char *restrict name, char *restrict resolved));
1535 # else
1536 # if !@HAVE_REALPATH@
1537 _GL_FUNCDECL_SYS (realpath, char *,
1538 (const char *restrict name, char *restrict resolved)
1539 _GL_ARG_NONNULL ((1)));
1540 # endif
1541 _GL_CXXALIAS_SYS (realpath, char *,
1542 (const char *restrict name, char *restrict resolved));
1543 # endif
1544 _GL_CXXALIASWARN (realpath);
1545 #elif defined GNULIB_POSIXCHECK
1546 # undef realpath
1547 # if HAVE_RAW_DECL_REALPATH
1548 _GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module "
1549 "canonicalize or canonicalize-lgpl for portability");
1550 # endif
1551 #endif
1552
1553 #if @GNULIB_RPMATCH@
1554 /* Test a user response to a question.
1555 Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */
1556 # if !@HAVE_RPMATCH@
1557 _GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1)));
1558 # endif
1559 _GL_CXXALIAS_SYS (rpmatch, int, (const char *response));
1560 _GL_CXXALIASWARN (rpmatch);
1561 #elif defined GNULIB_POSIXCHECK
1562 # undef rpmatch
1563 # if HAVE_RAW_DECL_RPMATCH
1564 _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
1565 "use gnulib module rpmatch for portability");
1566 # endif
1567 #endif
1568
1569 #if @GNULIB_SECURE_GETENV@
1570 /* Look up NAME in the environment, returning 0 in insecure situations. */
1571 # if !@HAVE_SECURE_GETENV@
1572 _GL_FUNCDECL_SYS (secure_getenv, char *,
1573 (char const *name) _GL_ARG_NONNULL ((1)));
1574 # endif
1575 _GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name));
1576 _GL_CXXALIASWARN (secure_getenv);
1577 #elif defined GNULIB_POSIXCHECK
1578 # undef secure_getenv
1579 # if HAVE_RAW_DECL_SECURE_GETENV
1580 _GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - "
1581 "use gnulib module secure_getenv for portability");
1582 # endif
1583 #endif
1584
1585 #if @GNULIB_SETENV@
1586 /* Set NAME to VALUE in the environment.
1587 If REPLACE is nonzero, overwrite an existing value. */
1588 # if @REPLACE_SETENV@
1589 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1590 # undef setenv
1591 # define setenv rpl_setenv
1592 # endif
1593 _GL_FUNCDECL_RPL (setenv, int,
1594 (const char *name, const char *value, int replace)
1595 _GL_ARG_NONNULL ((1)));
1596 _GL_CXXALIAS_RPL (setenv, int,
1597 (const char *name, const char *value, int replace));
1598 # else
1599 # if !@HAVE_DECL_SETENV@
1600 _GL_FUNCDECL_SYS (setenv, int,
1601 (const char *name, const char *value, int replace)
1602 _GL_ARG_NONNULL ((1)));
1603 # endif
1604 _GL_CXXALIAS_SYS (setenv, int,
1605 (const char *name, const char *value, int replace));
1606 # endif
1607 # if !(@REPLACE_SETENV@ && !@HAVE_DECL_SETENV@)
1608 _GL_CXXALIASWARN (setenv);
1609 # endif
1610 #elif defined GNULIB_POSIXCHECK
1611 # undef setenv
1612 # if HAVE_RAW_DECL_SETENV
1613 _GL_WARN_ON_USE (setenv, "setenv is unportable - "
1614 "use gnulib module setenv for portability");
1615 # endif
1616 #endif
1617
1618 #if @GNULIB_STRTOD@
1619 /* Parse a double from STRING, updating ENDP if appropriate. */
1620 # if @REPLACE_STRTOD@
1621 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1622 # define strtod rpl_strtod
1623 # endif
1624 # define GNULIB_defined_strtod_function 1
1625 _GL_FUNCDECL_RPL (strtod, double,
1626 (const char *restrict str, char **restrict endp)
1627 _GL_ARG_NONNULL ((1)));
1628 _GL_CXXALIAS_RPL (strtod, double,
1629 (const char *restrict str, char **restrict endp));
1630 # else
1631 # if !@HAVE_STRTOD@
1632 _GL_FUNCDECL_SYS (strtod, double,
1633 (const char *restrict str, char **restrict endp)
1634 _GL_ARG_NONNULL ((1)));
1635 # endif
1636 _GL_CXXALIAS_SYS (strtod, double,
1637 (const char *restrict str, char **restrict endp));
1638 # endif
1639 # if __GLIBC__ >= 2
1640 _GL_CXXALIASWARN (strtod);
1641 # endif
1642 #elif defined GNULIB_POSIXCHECK
1643 # undef strtod
1644 # if HAVE_RAW_DECL_STRTOD
1645 _GL_WARN_ON_USE (strtod, "strtod is unportable - "
1646 "use gnulib module strtod for portability");
1647 # endif
1648 #endif
1649
1650 #if @GNULIB_STRTOF@
1651 /* Parse a float from STRING, updating ENDP if appropriate. */
1652 # if @REPLACE_STRTOF@
1653 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1654 # define strtof rpl_strtof
1655 # endif
1656 # define GNULIB_defined_strtof_function 1
1657 _GL_FUNCDECL_RPL (strtof, float,
1658 (const char *restrict str, char **restrict endp)
1659 _GL_ARG_NONNULL ((1)));
1660 _GL_CXXALIAS_RPL (strtof, float,
1661 (const char *restrict str, char **restrict endp));
1662 # else
1663 # if !@HAVE_STRTOF@
1664 _GL_FUNCDECL_SYS (strtof, float,
1665 (const char *restrict str, char **restrict endp)
1666 _GL_ARG_NONNULL ((1)));
1667 # endif
1668 _GL_CXXALIAS_SYS (strtof, float,
1669 (const char *restrict str, char **restrict endp));
1670 # endif
1671 # if __GLIBC__ >= 2
1672 _GL_CXXALIASWARN (strtof);
1673 # endif
1674 #elif defined GNULIB_POSIXCHECK
1675 # undef strtof
1676 # if HAVE_RAW_DECL_STRTOF
1677 _GL_WARN_ON_USE (strtof, "strtof is unportable - "
1678 "use gnulib module strtof for portability");
1679 # endif
1680 #endif
1681
1682 #if @GNULIB_STRTOLD@
1683 /* Parse a 'long double' from STRING, updating ENDP if appropriate. */
1684 # if @REPLACE_STRTOLD@
1685 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1686 # define strtold rpl_strtold
1687 # endif
1688 # define GNULIB_defined_strtold_function 1
1689 _GL_FUNCDECL_RPL (strtold, long double,
1690 (const char *restrict str, char **restrict endp)
1691 _GL_ARG_NONNULL ((1)));
1692 _GL_CXXALIAS_RPL (strtold, long double,
1693 (const char *restrict str, char **restrict endp));
1694 # else
1695 # if !@HAVE_STRTOLD@
1696 _GL_FUNCDECL_SYS (strtold, long double,
1697 (const char *restrict str, char **restrict endp)
1698 _GL_ARG_NONNULL ((1)));
1699 # endif
1700 _GL_CXXALIAS_SYS (strtold, long double,
1701 (const char *restrict str, char **restrict endp));
1702 # endif
1703 _GL_CXXALIASWARN (strtold);
1704 #elif defined GNULIB_POSIXCHECK
1705 # undef strtold
1706 # if HAVE_RAW_DECL_STRTOLD
1707 _GL_WARN_ON_USE (strtold, "strtold is unportable - "
1708 "use gnulib module strtold for portability");
1709 # endif
1710 #endif
1711
1712 #if @GNULIB_STRTOL@
1713 /* Parse a signed integer whose textual representation starts at STRING.
1714 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
1715 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
1716 "0x").
1717 If ENDPTR is not NULL, the address of the first byte after the integer is
1718 stored in *ENDPTR.
1719 Upon overflow, the return value is LONG_MAX or LONG_MIN, and errno is set
1720 to ERANGE. */
1721 # if @REPLACE_STRTOL@
1722 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1723 # define strtol rpl_strtol
1724 # endif
1725 # define GNULIB_defined_strtol_function 1
1726 _GL_FUNCDECL_RPL (strtol, long,
1727 (const char *restrict string, char **restrict endptr,
1728 int base)
1729 _GL_ARG_NONNULL ((1)));
1730 _GL_CXXALIAS_RPL (strtol, long,
1731 (const char *restrict string, char **restrict endptr,
1732 int base));
1733 # else
1734 # if !@HAVE_STRTOL@
1735 _GL_FUNCDECL_SYS (strtol, long,
1736 (const char *restrict string, char **restrict endptr,
1737 int base)
1738 _GL_ARG_NONNULL ((1)));
1739 # endif
1740 _GL_CXXALIAS_SYS (strtol, long,
1741 (const char *restrict string, char **restrict endptr,
1742 int base));
1743 # endif
1744 # if __GLIBC__ >= 2
1745 _GL_CXXALIASWARN (strtol);
1746 # endif
1747 #elif defined GNULIB_POSIXCHECK
1748 # undef strtol
1749 # if HAVE_RAW_DECL_STRTOL
1750 _GL_WARN_ON_USE (strtol, "strtol is unportable - "
1751 "use gnulib module strtol for portability");
1752 # endif
1753 #endif
1754
1755 #if @GNULIB_STRTOLL@
1756 /* Parse a signed integer whose textual representation starts at STRING.
1757 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
1758 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
1759 "0x").
1760 If ENDPTR is not NULL, the address of the first byte after the integer is
1761 stored in *ENDPTR.
1762 Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
1763 to ERANGE. */
1764 # if @REPLACE_STRTOLL@
1765 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1766 # define strtoll rpl_strtoll
1767 # endif
1768 # define GNULIB_defined_strtoll_function 1
1769 _GL_FUNCDECL_RPL (strtoll, long long,
1770 (const char *restrict string, char **restrict endptr,
1771 int base)
1772 _GL_ARG_NONNULL ((1)));
1773 _GL_CXXALIAS_RPL (strtoll, long long,
1774 (const char *restrict string, char **restrict endptr,
1775 int base));
1776 # else
1777 # if !@HAVE_STRTOLL@
1778 _GL_FUNCDECL_SYS (strtoll, long long,
1779 (const char *restrict string, char **restrict endptr,
1780 int base)
1781 _GL_ARG_NONNULL ((1)));
1782 # endif
1783 _GL_CXXALIAS_SYS (strtoll, long long,
1784 (const char *restrict string, char **restrict endptr,
1785 int base));
1786 # endif
1787 _GL_CXXALIASWARN (strtoll);
1788 #elif defined GNULIB_POSIXCHECK
1789 # undef strtoll
1790 # if HAVE_RAW_DECL_STRTOLL
1791 _GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
1792 "use gnulib module strtoll for portability");
1793 # endif
1794 #endif
1795
1796 #if @GNULIB_STRTOUL@
1797 /* Parse an unsigned integer whose textual representation starts at STRING.
1798 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
1799 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
1800 "0x").
1801 If ENDPTR is not NULL, the address of the first byte after the integer is
1802 stored in *ENDPTR.
1803 Upon overflow, the return value is ULONG_MAX, and errno is set to ERANGE. */
1804 # if @REPLACE_STRTOUL@
1805 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1806 # define strtoul rpl_strtoul
1807 # endif
1808 # define GNULIB_defined_strtoul_function 1
1809 _GL_FUNCDECL_RPL (strtoul, unsigned long,
1810 (const char *restrict string, char **restrict endptr,
1811 int base)
1812 _GL_ARG_NONNULL ((1)));
1813 _GL_CXXALIAS_RPL (strtoul, unsigned long,
1814 (const char *restrict string, char **restrict endptr,
1815 int base));
1816 # else
1817 # if !@HAVE_STRTOUL@
1818 _GL_FUNCDECL_SYS (strtoul, unsigned long,
1819 (const char *restrict string, char **restrict endptr,
1820 int base)
1821 _GL_ARG_NONNULL ((1)));
1822 # endif
1823 _GL_CXXALIAS_SYS (strtoul, unsigned long,
1824 (const char *restrict string, char **restrict endptr,
1825 int base));
1826 # endif
1827 # if __GLIBC__ >= 2
1828 _GL_CXXALIASWARN (strtoul);
1829 # endif
1830 #elif defined GNULIB_POSIXCHECK
1831 # undef strtoul
1832 # if HAVE_RAW_DECL_STRTOUL
1833 _GL_WARN_ON_USE (strtoul, "strtoul is unportable - "
1834 "use gnulib module strtoul for portability");
1835 # endif
1836 #endif
1837
1838 #if @GNULIB_STRTOULL@
1839 /* Parse an unsigned integer whose textual representation starts at STRING.
1840 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
1841 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
1842 "0x").
1843 If ENDPTR is not NULL, the address of the first byte after the integer is
1844 stored in *ENDPTR.
1845 Upon overflow, the return value is ULLONG_MAX, and errno is set to
1846 ERANGE. */
1847 # if @REPLACE_STRTOULL@
1848 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1849 # define strtoull rpl_strtoull
1850 # endif
1851 # define GNULIB_defined_strtoull_function 1
1852 _GL_FUNCDECL_RPL (strtoull, unsigned long long,
1853 (const char *restrict string, char **restrict endptr,
1854 int base)
1855 _GL_ARG_NONNULL ((1)));
1856 _GL_CXXALIAS_RPL (strtoull, unsigned long long,
1857 (const char *restrict string, char **restrict endptr,
1858 int base));
1859 # else
1860 # if !@HAVE_STRTOULL@
1861 _GL_FUNCDECL_SYS (strtoull, unsigned long long,
1862 (const char *restrict string, char **restrict endptr,
1863 int base)
1864 _GL_ARG_NONNULL ((1)));
1865 # endif
1866 _GL_CXXALIAS_SYS (strtoull, unsigned long long,
1867 (const char *restrict string, char **restrict endptr,
1868 int base));
1869 # endif
1870 _GL_CXXALIASWARN (strtoull);
1871 #elif defined GNULIB_POSIXCHECK
1872 # undef strtoull
1873 # if HAVE_RAW_DECL_STRTOULL
1874 _GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
1875 "use gnulib module strtoull for portability");
1876 # endif
1877 #endif
1878
1879 #if @GNULIB_UNLOCKPT@
1880 /* Unlock the slave side of the pseudo-terminal whose master side is specified
1881 by FD, so that it can be opened. */
1882 # if !@HAVE_UNLOCKPT@
1883 _GL_FUNCDECL_SYS (unlockpt, int, (int fd));
1884 # endif
1885 _GL_CXXALIAS_SYS (unlockpt, int, (int fd));
1886 _GL_CXXALIASWARN (unlockpt);
1887 #elif defined GNULIB_POSIXCHECK
1888 # undef unlockpt
1889 # if HAVE_RAW_DECL_UNLOCKPT
1890 _GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
1891 "use gnulib module unlockpt for portability");
1892 # endif
1893 #endif
1894
1895 #if @GNULIB_UNSETENV@
1896 /* Remove the variable NAME from the environment. */
1897 # if @REPLACE_UNSETENV@
1898 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1899 # undef unsetenv
1900 # define unsetenv rpl_unsetenv
1901 # endif
1902 _GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
1903 _GL_CXXALIAS_RPL (unsetenv, int, (const char *name));
1904 # else
1905 # if !@HAVE_DECL_UNSETENV@
1906 _GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
1907 # endif
1908 _GL_CXXALIAS_SYS (unsetenv, int, (const char *name));
1909 # endif
1910 # if !(@REPLACE_UNSETENV@ && !@HAVE_DECL_UNSETENV@)
1911 _GL_CXXALIASWARN (unsetenv);
1912 # endif
1913 #elif defined GNULIB_POSIXCHECK
1914 # undef unsetenv
1915 # if HAVE_RAW_DECL_UNSETENV
1916 _GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
1917 "use gnulib module unsetenv for portability");
1918 # endif
1919 #endif
1920
1921 /* Convert a wide character to a multibyte character. */
1922 #if @GNULIB_WCTOMB@
1923 # if @REPLACE_WCTOMB@
1924 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1925 # undef wctomb
1926 # define wctomb rpl_wctomb
1927 # endif
1928 _GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc));
1929 _GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc));
1930 # else
1931 _GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc));
1932 # endif
1933 # if __GLIBC__ >= 2
1934 _GL_CXXALIASWARN (wctomb);
1935 # endif
1936 #endif
1937
1938
1939 #endif /* _@GUARD_PREFIX@_STDLIB_H */
1940 #endif /* _@GUARD_PREFIX@_STDLIB_H */
1941 #endif