8f803a2ea319db18651835c435eb3d84fedf3d29
[deliverable/binutils-gdb.git] / gnulib / import / stdlib.in.h
1 /* A GNU-like <stdlib.h>.
2
3 Copyright (C) 1995, 2001-2004, 2006-2016 Free Software Foundation, Inc.
4
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.
9
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.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://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 __need_malloc_and_calloc
24 /* Special invocation conventions inside some gnulib header files,
25 and inside some glibc header files, respectively. */
26
27 #@INCLUDE_NEXT@ @NEXT_STDLIB_H@
28
29 #else
30 /* Normal invocation convention. */
31
32 #ifndef _@GUARD_PREFIX@_STDLIB_H
33
34 /* The include_next requires a split double-inclusion guard. */
35 #@INCLUDE_NEXT@ @NEXT_STDLIB_H@
36
37 #ifndef _@GUARD_PREFIX@_STDLIB_H
38 #define _@GUARD_PREFIX@_STDLIB_H
39
40 /* NetBSD 5.0 mis-defines NULL. */
41 #include <stddef.h>
42
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
47
48 /* Solaris declares getloadavg() in <sys/loadavg.h>. */
49 #if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@
50 # include <sys/loadavg.h>
51 #endif
52
53 /* Native Windows platforms declare mktemp() in <io.h>. */
54 #if 0 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
55 # include <io.h>
56 #endif
57
58 #if @GNULIB_RANDOM_R@
59
60 /* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included
61 from <stdlib.h> if _REENTRANT is defined. Include it whenever we need
62 'struct random_data'. */
63 # if @HAVE_RANDOM_H@
64 # include <random.h>
65 # endif
66
67 # if !@HAVE_STRUCT_RANDOM_DATA@ || @REPLACE_RANDOM_R@ || !@HAVE_RANDOM_R@
68 # include <stdint.h>
69 # endif
70
71 # if !@HAVE_STRUCT_RANDOM_DATA@
72 /* Define 'struct random_data'.
73 But allow multiple gnulib generated <stdlib.h> replacements to coexist. */
74 # if !GNULIB_defined_struct_random_data
75 struct random_data
76 {
77 int32_t *fptr; /* Front pointer. */
78 int32_t *rptr; /* Rear pointer. */
79 int32_t *state; /* Array of state values. */
80 int rand_type; /* Type of random number generator. */
81 int rand_deg; /* Degree of random number generator. */
82 int rand_sep; /* Distance between front and rear. */
83 int32_t *end_ptr; /* Pointer behind state table. */
84 };
85 # define GNULIB_defined_struct_random_data 1
86 # endif
87 # endif
88 #endif
89
90 #if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_MKOSTEMP@ || @GNULIB_MKOSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
91 /* On Mac OS X 10.3, only <unistd.h> declares mkstemp. */
92 /* On Mac OS X 10.5, only <unistd.h> declares mkstemps. */
93 /* On Mac OS X 10.13, only <unistd.h> declares mkostemp and mkostemps. */
94 /* On Cygwin 1.7.1, only <unistd.h> declares getsubopt. */
95 /* But avoid namespace pollution on glibc systems and native Windows. */
96 # include <unistd.h>
97 #endif
98
99 /* The __attribute__ feature is available in gcc versions 2.5 and later.
100 The attribute __pure__ was added in gcc 2.96. */
101 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
102 # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
103 #else
104 # define _GL_ATTRIBUTE_PURE /* empty */
105 #endif
106
107 /* The definition of _Noreturn is copied here. */
108
109 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
110
111 /* The definition of _GL_ARG_NONNULL is copied here. */
112
113 /* The definition of _GL_WARN_ON_USE is copied here. */
114
115
116 /* Some systems do not define EXIT_*, despite otherwise supporting C89. */
117 #ifndef EXIT_SUCCESS
118 # define EXIT_SUCCESS 0
119 #endif
120 /* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere
121 with proper operation of xargs. */
122 #ifndef EXIT_FAILURE
123 # define EXIT_FAILURE 1
124 #elif EXIT_FAILURE != 1
125 # undef EXIT_FAILURE
126 # define EXIT_FAILURE 1
127 #endif
128
129
130 #if @GNULIB__EXIT@
131 /* Terminate the current process with the given return code, without running
132 the 'atexit' handlers. */
133 # if !@HAVE__EXIT@
134 _GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status));
135 # endif
136 _GL_CXXALIAS_SYS (_Exit, void, (int status));
137 _GL_CXXALIASWARN (_Exit);
138 #elif defined GNULIB_POSIXCHECK
139 # undef _Exit
140 # if HAVE_RAW_DECL__EXIT
141 _GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
142 "use gnulib module _Exit for portability");
143 # endif
144 #endif
145
146
147 #if @GNULIB_ATOLL@
148 /* Parse a signed decimal integer.
149 Returns the value of the integer. Errors are not detected. */
150 # if !@HAVE_ATOLL@
151 _GL_FUNCDECL_SYS (atoll, long long, (const char *string)
152 _GL_ATTRIBUTE_PURE
153 _GL_ARG_NONNULL ((1)));
154 # endif
155 _GL_CXXALIAS_SYS (atoll, long long, (const char *string));
156 _GL_CXXALIASWARN (atoll);
157 #elif defined GNULIB_POSIXCHECK
158 # undef atoll
159 # if HAVE_RAW_DECL_ATOLL
160 _GL_WARN_ON_USE (atoll, "atoll is unportable - "
161 "use gnulib module atoll for portability");
162 # endif
163 #endif
164
165 #if @GNULIB_CALLOC_POSIX@
166 # if @REPLACE_CALLOC@
167 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
168 # undef calloc
169 # define calloc rpl_calloc
170 # endif
171 _GL_FUNCDECL_RPL (calloc, void *, (size_t nmemb, size_t size));
172 _GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size));
173 # else
174 _GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
175 # endif
176 _GL_CXXALIASWARN (calloc);
177 #elif defined GNULIB_POSIXCHECK
178 # undef calloc
179 /* Assume calloc is always declared. */
180 _GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - "
181 "use gnulib module calloc-posix for portability");
182 #endif
183
184 #if @GNULIB_CANONICALIZE_FILE_NAME@
185 # if @REPLACE_CANONICALIZE_FILE_NAME@
186 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
187 # define canonicalize_file_name rpl_canonicalize_file_name
188 # endif
189 _GL_FUNCDECL_RPL (canonicalize_file_name, char *, (const char *name)
190 _GL_ARG_NONNULL ((1)));
191 _GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name));
192 # else
193 # if !@HAVE_CANONICALIZE_FILE_NAME@
194 _GL_FUNCDECL_SYS (canonicalize_file_name, char *, (const char *name)
195 _GL_ARG_NONNULL ((1)));
196 # endif
197 _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
198 # endif
199 _GL_CXXALIASWARN (canonicalize_file_name);
200 #elif defined GNULIB_POSIXCHECK
201 # undef canonicalize_file_name
202 # if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
203 _GL_WARN_ON_USE (canonicalize_file_name,
204 "canonicalize_file_name is unportable - "
205 "use gnulib module canonicalize-lgpl for portability");
206 # endif
207 #endif
208
209 #if @GNULIB_GETLOADAVG@
210 /* Store max(NELEM,3) load average numbers in LOADAVG[].
211 The three numbers are the load average of the last 1 minute, the last 5
212 minutes, and the last 15 minutes, respectively.
213 LOADAVG is an array of NELEM numbers. */
214 # if !@HAVE_DECL_GETLOADAVG@
215 _GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem)
216 _GL_ARG_NONNULL ((1)));
217 # endif
218 _GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem));
219 _GL_CXXALIASWARN (getloadavg);
220 #elif defined GNULIB_POSIXCHECK
221 # undef getloadavg
222 # if HAVE_RAW_DECL_GETLOADAVG
223 _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
224 "use gnulib module getloadavg for portability");
225 # endif
226 #endif
227
228 #if @GNULIB_GETSUBOPT@
229 /* Assuming *OPTIONP is a comma separated list of elements of the form
230 "token" or "token=value", getsubopt parses the first of these elements.
231 If the first element refers to a "token" that is member of the given
232 NULL-terminated array of tokens:
233 - It replaces the comma with a NUL byte, updates *OPTIONP to point past
234 the first option and the comma, sets *VALUEP to the value of the
235 element (or NULL if it doesn't contain an "=" sign),
236 - It returns the index of the "token" in the given array of tokens.
237 Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
238 For more details see the POSIX:2001 specification.
239 http://www.opengroup.org/susv3xsh/getsubopt.html */
240 # if !@HAVE_GETSUBOPT@
241 _GL_FUNCDECL_SYS (getsubopt, int,
242 (char **optionp, char *const *tokens, char **valuep)
243 _GL_ARG_NONNULL ((1, 2, 3)));
244 # endif
245 _GL_CXXALIAS_SYS (getsubopt, int,
246 (char **optionp, char *const *tokens, char **valuep));
247 _GL_CXXALIASWARN (getsubopt);
248 #elif defined GNULIB_POSIXCHECK
249 # undef getsubopt
250 # if HAVE_RAW_DECL_GETSUBOPT
251 _GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
252 "use gnulib module getsubopt for portability");
253 # endif
254 #endif
255
256 #if @GNULIB_GRANTPT@
257 /* Change the ownership and access permission of the slave side of the
258 pseudo-terminal whose master side is specified by FD. */
259 # if !@HAVE_GRANTPT@
260 _GL_FUNCDECL_SYS (grantpt, int, (int fd));
261 # endif
262 _GL_CXXALIAS_SYS (grantpt, int, (int fd));
263 _GL_CXXALIASWARN (grantpt);
264 #elif defined GNULIB_POSIXCHECK
265 # undef grantpt
266 # if HAVE_RAW_DECL_GRANTPT
267 _GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
268 "use gnulib module grantpt for portability");
269 # endif
270 #endif
271
272 /* If _GL_USE_STDLIB_ALLOC is nonzero, the including module does not
273 rely on GNU or POSIX semantics for malloc and realloc (for example,
274 by never specifying a zero size), so it does not need malloc or
275 realloc to be redefined. */
276 #if @GNULIB_MALLOC_POSIX@
277 # if @REPLACE_MALLOC@
278 # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
279 || _GL_USE_STDLIB_ALLOC)
280 # undef malloc
281 # define malloc rpl_malloc
282 # endif
283 _GL_FUNCDECL_RPL (malloc, void *, (size_t size));
284 _GL_CXXALIAS_RPL (malloc, void *, (size_t size));
285 # else
286 _GL_CXXALIAS_SYS (malloc, void *, (size_t size));
287 # endif
288 _GL_CXXALIASWARN (malloc);
289 #elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
290 # undef malloc
291 /* Assume malloc is always declared. */
292 _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
293 "use gnulib module malloc-posix for portability");
294 #endif
295
296 /* Convert a multibyte character to a wide character. */
297 #if @GNULIB_MBTOWC@
298 # if @REPLACE_MBTOWC@
299 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
300 # undef mbtowc
301 # define mbtowc rpl_mbtowc
302 # endif
303 _GL_FUNCDECL_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
304 _GL_CXXALIAS_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
305 # else
306 _GL_CXXALIAS_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
307 # endif
308 _GL_CXXALIASWARN (mbtowc);
309 #endif
310
311 #if @GNULIB_MKDTEMP@
312 /* Create a unique temporary directory from TEMPLATE.
313 The last six characters of TEMPLATE must be "XXXXXX";
314 they are replaced with a string that makes the directory name unique.
315 Returns TEMPLATE, or a null pointer if it cannot get a unique name.
316 The directory is created mode 700. */
317 # if !@HAVE_MKDTEMP@
318 _GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1)));
319 # endif
320 _GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/));
321 _GL_CXXALIASWARN (mkdtemp);
322 #elif defined GNULIB_POSIXCHECK
323 # undef mkdtemp
324 # if HAVE_RAW_DECL_MKDTEMP
325 _GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
326 "use gnulib module mkdtemp for portability");
327 # endif
328 #endif
329
330 #if @GNULIB_MKOSTEMP@
331 /* Create a unique temporary file from TEMPLATE.
332 The last six characters of TEMPLATE must be "XXXXXX";
333 they are replaced with a string that makes the file name unique.
334 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
335 and O_TEXT, O_BINARY (defined in "binary-io.h").
336 The file is then created, with the specified flags, ensuring it didn't exist
337 before.
338 The file is created read-write (mask at least 0600 & ~umask), but it may be
339 world-readable and world-writable (mask 0666 & ~umask), depending on the
340 implementation.
341 Returns the open file descriptor if successful, otherwise -1 and errno
342 set. */
343 # if !@HAVE_MKOSTEMP@
344 _GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)
345 _GL_ARG_NONNULL ((1)));
346 # endif
347 _GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/));
348 _GL_CXXALIASWARN (mkostemp);
349 #elif defined GNULIB_POSIXCHECK
350 # undef mkostemp
351 # if HAVE_RAW_DECL_MKOSTEMP
352 _GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
353 "use gnulib module mkostemp for portability");
354 # endif
355 #endif
356
357 #if @GNULIB_MKOSTEMPS@
358 /* Create a unique temporary file from TEMPLATE.
359 The last six characters of TEMPLATE before a suffix of length
360 SUFFIXLEN must be "XXXXXX";
361 they are replaced with a string that makes the file name unique.
362 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
363 and O_TEXT, O_BINARY (defined in "binary-io.h").
364 The file is then created, with the specified flags, ensuring it didn't exist
365 before.
366 The file is created read-write (mask at least 0600 & ~umask), but it may be
367 world-readable and world-writable (mask 0666 & ~umask), depending on the
368 implementation.
369 Returns the open file descriptor if successful, otherwise -1 and errno
370 set. */
371 # if !@HAVE_MKOSTEMPS@
372 _GL_FUNCDECL_SYS (mkostemps, int,
373 (char * /*template*/, int /*suffixlen*/, int /*flags*/)
374 _GL_ARG_NONNULL ((1)));
375 # endif
376 _GL_CXXALIAS_SYS (mkostemps, int,
377 (char * /*template*/, int /*suffixlen*/, int /*flags*/));
378 _GL_CXXALIASWARN (mkostemps);
379 #elif defined GNULIB_POSIXCHECK
380 # undef mkostemps
381 # if HAVE_RAW_DECL_MKOSTEMPS
382 _GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
383 "use gnulib module mkostemps for portability");
384 # endif
385 #endif
386
387 #if @GNULIB_MKSTEMP@
388 /* Create a unique temporary file from TEMPLATE.
389 The last six characters of TEMPLATE must be "XXXXXX";
390 they are replaced with a string that makes the file name unique.
391 The file is then created, ensuring it didn't exist before.
392 The file is created read-write (mask at least 0600 & ~umask), but it may be
393 world-readable and world-writable (mask 0666 & ~umask), depending on the
394 implementation.
395 Returns the open file descriptor if successful, otherwise -1 and errno
396 set. */
397 # if @REPLACE_MKSTEMP@
398 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
399 # define mkstemp rpl_mkstemp
400 # endif
401 _GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
402 _GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/));
403 # else
404 # if ! @HAVE_MKSTEMP@
405 _GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
406 # endif
407 _GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/));
408 # endif
409 _GL_CXXALIASWARN (mkstemp);
410 #elif defined GNULIB_POSIXCHECK
411 # undef mkstemp
412 # if HAVE_RAW_DECL_MKSTEMP
413 _GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
414 "use gnulib module mkstemp for portability");
415 # endif
416 #endif
417
418 #if @GNULIB_MKSTEMPS@
419 /* Create a unique temporary file from TEMPLATE.
420 The last six characters of TEMPLATE prior to a suffix of length
421 SUFFIXLEN must be "XXXXXX";
422 they are replaced with a string that makes the file name unique.
423 The file is then created, ensuring it didn't exist before.
424 The file is created read-write (mask at least 0600 & ~umask), but it may be
425 world-readable and world-writable (mask 0666 & ~umask), depending on the
426 implementation.
427 Returns the open file descriptor if successful, otherwise -1 and errno
428 set. */
429 # if !@HAVE_MKSTEMPS@
430 _GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)
431 _GL_ARG_NONNULL ((1)));
432 # endif
433 _GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/));
434 _GL_CXXALIASWARN (mkstemps);
435 #elif defined GNULIB_POSIXCHECK
436 # undef mkstemps
437 # if HAVE_RAW_DECL_MKSTEMPS
438 _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
439 "use gnulib module mkstemps for portability");
440 # endif
441 #endif
442
443 #if @GNULIB_POSIX_OPENPT@
444 /* Return an FD open to the master side of a pseudo-terminal. Flags should
445 include O_RDWR, and may also include O_NOCTTY. */
446 # if !@HAVE_POSIX_OPENPT@
447 _GL_FUNCDECL_SYS (posix_openpt, int, (int flags));
448 # endif
449 _GL_CXXALIAS_SYS (posix_openpt, int, (int flags));
450 _GL_CXXALIASWARN (posix_openpt);
451 #elif defined GNULIB_POSIXCHECK
452 # undef posix_openpt
453 # if HAVE_RAW_DECL_POSIX_OPENPT
454 _GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - "
455 "use gnulib module posix_openpt for portability");
456 # endif
457 #endif
458
459 #if @GNULIB_PTSNAME@
460 /* Return the pathname of the pseudo-terminal slave associated with
461 the master FD is open on, or NULL on errors. */
462 # if @REPLACE_PTSNAME@
463 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
464 # undef ptsname
465 # define ptsname rpl_ptsname
466 # endif
467 _GL_FUNCDECL_RPL (ptsname, char *, (int fd));
468 _GL_CXXALIAS_RPL (ptsname, char *, (int fd));
469 # else
470 # if !@HAVE_PTSNAME@
471 _GL_FUNCDECL_SYS (ptsname, char *, (int fd));
472 # endif
473 _GL_CXXALIAS_SYS (ptsname, char *, (int fd));
474 # endif
475 _GL_CXXALIASWARN (ptsname);
476 #elif defined GNULIB_POSIXCHECK
477 # undef ptsname
478 # if HAVE_RAW_DECL_PTSNAME
479 _GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
480 "use gnulib module ptsname for portability");
481 # endif
482 #endif
483
484 #if @GNULIB_PTSNAME_R@
485 /* Set the pathname of the pseudo-terminal slave associated with
486 the master FD is open on and return 0, or set errno and return
487 non-zero on errors. */
488 # if @REPLACE_PTSNAME_R@
489 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
490 # undef ptsname_r
491 # define ptsname_r rpl_ptsname_r
492 # endif
493 _GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
494 _GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
495 # else
496 # if !@HAVE_PTSNAME_R@
497 _GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
498 # endif
499 _GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
500 # endif
501 _GL_CXXALIASWARN (ptsname_r);
502 #elif defined GNULIB_POSIXCHECK
503 # undef ptsname_r
504 # if HAVE_RAW_DECL_PTSNAME_R
505 _GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - "
506 "use gnulib module ptsname_r for portability");
507 # endif
508 #endif
509
510 #if @GNULIB_PUTENV@
511 # if @REPLACE_PUTENV@
512 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
513 # undef putenv
514 # define putenv rpl_putenv
515 # endif
516 _GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1)));
517 _GL_CXXALIAS_RPL (putenv, int, (char *string));
518 # else
519 _GL_CXXALIAS_SYS (putenv, int, (char *string));
520 # endif
521 _GL_CXXALIASWARN (putenv);
522 #endif
523
524 #if @GNULIB_QSORT_R@
525 /* Sort an array of NMEMB elements, starting at address BASE, each element
526 occupying SIZE bytes, in ascending order according to the comparison
527 function COMPARE. */
528 # if @REPLACE_QSORT_R@
529 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
530 # undef qsort_r
531 # define qsort_r rpl_qsort_r
532 # endif
533 _GL_FUNCDECL_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
534 int (*compare) (void const *, void const *,
535 void *),
536 void *arg) _GL_ARG_NONNULL ((1, 4)));
537 _GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
538 int (*compare) (void const *, void const *,
539 void *),
540 void *arg));
541 # else
542 # if !@HAVE_QSORT_R@
543 _GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
544 int (*compare) (void const *, void const *,
545 void *),
546 void *arg) _GL_ARG_NONNULL ((1, 4)));
547 # endif
548 _GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
549 int (*compare) (void const *, void const *,
550 void *),
551 void *arg));
552 # endif
553 _GL_CXXALIASWARN (qsort_r);
554 #elif defined GNULIB_POSIXCHECK
555 # undef qsort_r
556 # if HAVE_RAW_DECL_QSORT_R
557 _GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - "
558 "use gnulib module qsort_r for portability");
559 # endif
560 #endif
561
562
563 #if @GNULIB_RANDOM_R@
564 # if !@HAVE_RANDOM_R@
565 # ifndef RAND_MAX
566 # define RAND_MAX 2147483647
567 # endif
568 # endif
569 #endif
570
571
572 #if @GNULIB_RANDOM@
573 # if !@HAVE_RANDOM@
574 _GL_FUNCDECL_SYS (random, long, (void));
575 # endif
576 _GL_CXXALIAS_SYS (random, long, (void));
577 _GL_CXXALIASWARN (random);
578 #elif defined GNULIB_POSIXCHECK
579 # undef random
580 # if HAVE_RAW_DECL_RANDOM
581 _GL_WARN_ON_USE (random, "random is unportable - "
582 "use gnulib module random for portability");
583 # endif
584 #endif
585
586 #if @GNULIB_RANDOM@
587 # if !@HAVE_RANDOM@
588 _GL_FUNCDECL_SYS (srandom, void, (unsigned int seed));
589 # endif
590 _GL_CXXALIAS_SYS (srandom, void, (unsigned int seed));
591 _GL_CXXALIASWARN (srandom);
592 #elif defined GNULIB_POSIXCHECK
593 # undef srandom
594 # if HAVE_RAW_DECL_SRANDOM
595 _GL_WARN_ON_USE (srandom, "srandom is unportable - "
596 "use gnulib module random for portability");
597 # endif
598 #endif
599
600 #if @GNULIB_RANDOM@
601 # if !@HAVE_RANDOM@
602 _GL_FUNCDECL_SYS (initstate, char *,
603 (unsigned int seed, char *buf, size_t buf_size)
604 _GL_ARG_NONNULL ((2)));
605 # endif
606 _GL_CXXALIAS_SYS (initstate, char *,
607 (unsigned int seed, char *buf, size_t buf_size));
608 _GL_CXXALIASWARN (initstate);
609 #elif defined GNULIB_POSIXCHECK
610 # undef initstate
611 # if HAVE_RAW_DECL_INITSTATE_R
612 _GL_WARN_ON_USE (initstate, "initstate is unportable - "
613 "use gnulib module random for portability");
614 # endif
615 #endif
616
617 #if @GNULIB_RANDOM@
618 # if !@HAVE_RANDOM@
619 _GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
620 # endif
621 _GL_CXXALIAS_SYS (setstate, char *, (char *arg_state));
622 _GL_CXXALIASWARN (setstate);
623 #elif defined GNULIB_POSIXCHECK
624 # undef setstate
625 # if HAVE_RAW_DECL_SETSTATE_R
626 _GL_WARN_ON_USE (setstate, "setstate is unportable - "
627 "use gnulib module random for portability");
628 # endif
629 #endif
630
631
632 #if @GNULIB_RANDOM_R@
633 # if @REPLACE_RANDOM_R@
634 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
635 # undef random_r
636 # define random_r rpl_random_r
637 # endif
638 _GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result)
639 _GL_ARG_NONNULL ((1, 2)));
640 _GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result));
641 # else
642 # if !@HAVE_RANDOM_R@
643 _GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result)
644 _GL_ARG_NONNULL ((1, 2)));
645 # endif
646 _GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
647 # endif
648 _GL_CXXALIASWARN (random_r);
649 #elif defined GNULIB_POSIXCHECK
650 # undef random_r
651 # if HAVE_RAW_DECL_RANDOM_R
652 _GL_WARN_ON_USE (random_r, "random_r is unportable - "
653 "use gnulib module random_r for portability");
654 # endif
655 #endif
656
657 #if @GNULIB_RANDOM_R@
658 # if @REPLACE_RANDOM_R@
659 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
660 # undef srandom_r
661 # define srandom_r rpl_srandom_r
662 # endif
663 _GL_FUNCDECL_RPL (srandom_r, int,
664 (unsigned int seed, struct random_data *rand_state)
665 _GL_ARG_NONNULL ((2)));
666 _GL_CXXALIAS_RPL (srandom_r, int,
667 (unsigned int seed, struct random_data *rand_state));
668 # else
669 # if !@HAVE_RANDOM_R@
670 _GL_FUNCDECL_SYS (srandom_r, int,
671 (unsigned int seed, struct random_data *rand_state)
672 _GL_ARG_NONNULL ((2)));
673 # endif
674 _GL_CXXALIAS_SYS (srandom_r, int,
675 (unsigned int seed, struct random_data *rand_state));
676 # endif
677 _GL_CXXALIASWARN (srandom_r);
678 #elif defined GNULIB_POSIXCHECK
679 # undef srandom_r
680 # if HAVE_RAW_DECL_SRANDOM_R
681 _GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
682 "use gnulib module random_r for portability");
683 # endif
684 #endif
685
686 #if @GNULIB_RANDOM_R@
687 # if @REPLACE_RANDOM_R@
688 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
689 # undef initstate_r
690 # define initstate_r rpl_initstate_r
691 # endif
692 _GL_FUNCDECL_RPL (initstate_r, int,
693 (unsigned int seed, char *buf, size_t buf_size,
694 struct random_data *rand_state)
695 _GL_ARG_NONNULL ((2, 4)));
696 _GL_CXXALIAS_RPL (initstate_r, int,
697 (unsigned int seed, char *buf, size_t buf_size,
698 struct random_data *rand_state));
699 # else
700 # if !@HAVE_RANDOM_R@
701 _GL_FUNCDECL_SYS (initstate_r, int,
702 (unsigned int seed, char *buf, size_t buf_size,
703 struct random_data *rand_state)
704 _GL_ARG_NONNULL ((2, 4)));
705 # endif
706 _GL_CXXALIAS_SYS (initstate_r, int,
707 (unsigned int seed, char *buf, size_t buf_size,
708 struct random_data *rand_state));
709 # endif
710 _GL_CXXALIASWARN (initstate_r);
711 #elif defined GNULIB_POSIXCHECK
712 # undef initstate_r
713 # if HAVE_RAW_DECL_INITSTATE_R
714 _GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
715 "use gnulib module random_r for portability");
716 # endif
717 #endif
718
719 #if @GNULIB_RANDOM_R@
720 # if @REPLACE_RANDOM_R@
721 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
722 # undef setstate_r
723 # define setstate_r rpl_setstate_r
724 # endif
725 _GL_FUNCDECL_RPL (setstate_r, int,
726 (char *arg_state, struct random_data *rand_state)
727 _GL_ARG_NONNULL ((1, 2)));
728 _GL_CXXALIAS_RPL (setstate_r, int,
729 (char *arg_state, struct random_data *rand_state));
730 # else
731 # if !@HAVE_RANDOM_R@
732 _GL_FUNCDECL_SYS (setstate_r, int,
733 (char *arg_state, struct random_data *rand_state)
734 _GL_ARG_NONNULL ((1, 2)));
735 # endif
736 _GL_CXXALIAS_SYS (setstate_r, int,
737 (char *arg_state, struct random_data *rand_state));
738 # endif
739 _GL_CXXALIASWARN (setstate_r);
740 #elif defined GNULIB_POSIXCHECK
741 # undef setstate_r
742 # if HAVE_RAW_DECL_SETSTATE_R
743 _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
744 "use gnulib module random_r for portability");
745 # endif
746 #endif
747
748
749 #if @GNULIB_REALLOC_POSIX@
750 # if @REPLACE_REALLOC@
751 # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
752 || _GL_USE_STDLIB_ALLOC)
753 # undef realloc
754 # define realloc rpl_realloc
755 # endif
756 _GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size));
757 _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
758 # else
759 _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
760 # endif
761 _GL_CXXALIASWARN (realloc);
762 #elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
763 # undef realloc
764 /* Assume realloc is always declared. */
765 _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
766 "use gnulib module realloc-posix for portability");
767 #endif
768
769 #if @GNULIB_REALPATH@
770 # if @REPLACE_REALPATH@
771 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
772 # define realpath rpl_realpath
773 # endif
774 _GL_FUNCDECL_RPL (realpath, char *, (const char *name, char *resolved)
775 _GL_ARG_NONNULL ((1)));
776 _GL_CXXALIAS_RPL (realpath, char *, (const char *name, char *resolved));
777 # else
778 # if !@HAVE_REALPATH@
779 _GL_FUNCDECL_SYS (realpath, char *, (const char *name, char *resolved)
780 _GL_ARG_NONNULL ((1)));
781 # endif
782 _GL_CXXALIAS_SYS (realpath, char *, (const char *name, char *resolved));
783 # endif
784 _GL_CXXALIASWARN (realpath);
785 #elif defined GNULIB_POSIXCHECK
786 # undef realpath
787 # if HAVE_RAW_DECL_REALPATH
788 _GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module "
789 "canonicalize or canonicalize-lgpl for portability");
790 # endif
791 #endif
792
793 #if @GNULIB_RPMATCH@
794 /* Test a user response to a question.
795 Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */
796 # if !@HAVE_RPMATCH@
797 _GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1)));
798 # endif
799 _GL_CXXALIAS_SYS (rpmatch, int, (const char *response));
800 _GL_CXXALIASWARN (rpmatch);
801 #elif defined GNULIB_POSIXCHECK
802 # undef rpmatch
803 # if HAVE_RAW_DECL_RPMATCH
804 _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
805 "use gnulib module rpmatch for portability");
806 # endif
807 #endif
808
809 #if @GNULIB_SECURE_GETENV@
810 /* Look up NAME in the environment, returning 0 in insecure situations. */
811 # if !@HAVE_SECURE_GETENV@
812 _GL_FUNCDECL_SYS (secure_getenv, char *,
813 (char const *name) _GL_ARG_NONNULL ((1)));
814 # endif
815 _GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name));
816 _GL_CXXALIASWARN (secure_getenv);
817 #elif defined GNULIB_POSIXCHECK
818 # undef secure_getenv
819 # if HAVE_RAW_DECL_SECURE_GETENV
820 _GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - "
821 "use gnulib module secure_getenv for portability");
822 # endif
823 #endif
824
825 #if @GNULIB_SETENV@
826 /* Set NAME to VALUE in the environment.
827 If REPLACE is nonzero, overwrite an existing value. */
828 # if @REPLACE_SETENV@
829 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
830 # undef setenv
831 # define setenv rpl_setenv
832 # endif
833 _GL_FUNCDECL_RPL (setenv, int,
834 (const char *name, const char *value, int replace)
835 _GL_ARG_NONNULL ((1)));
836 _GL_CXXALIAS_RPL (setenv, int,
837 (const char *name, const char *value, int replace));
838 # else
839 # if !@HAVE_DECL_SETENV@
840 _GL_FUNCDECL_SYS (setenv, int,
841 (const char *name, const char *value, int replace)
842 _GL_ARG_NONNULL ((1)));
843 # endif
844 _GL_CXXALIAS_SYS (setenv, int,
845 (const char *name, const char *value, int replace));
846 # endif
847 # if !(@REPLACE_SETENV@ && !@HAVE_DECL_SETENV@)
848 _GL_CXXALIASWARN (setenv);
849 # endif
850 #elif defined GNULIB_POSIXCHECK
851 # undef setenv
852 # if HAVE_RAW_DECL_SETENV
853 _GL_WARN_ON_USE (setenv, "setenv is unportable - "
854 "use gnulib module setenv for portability");
855 # endif
856 #endif
857
858 #if @GNULIB_STRTOD@
859 /* Parse a double from STRING, updating ENDP if appropriate. */
860 # if @REPLACE_STRTOD@
861 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
862 # define strtod rpl_strtod
863 # endif
864 _GL_FUNCDECL_RPL (strtod, double, (const char *str, char **endp)
865 _GL_ARG_NONNULL ((1)));
866 _GL_CXXALIAS_RPL (strtod, double, (const char *str, char **endp));
867 # else
868 # if !@HAVE_STRTOD@
869 _GL_FUNCDECL_SYS (strtod, double, (const char *str, char **endp)
870 _GL_ARG_NONNULL ((1)));
871 # endif
872 _GL_CXXALIAS_SYS (strtod, double, (const char *str, char **endp));
873 # endif
874 _GL_CXXALIASWARN (strtod);
875 #elif defined GNULIB_POSIXCHECK
876 # undef strtod
877 # if HAVE_RAW_DECL_STRTOD
878 _GL_WARN_ON_USE (strtod, "strtod is unportable - "
879 "use gnulib module strtod for portability");
880 # endif
881 #endif
882
883 #if @GNULIB_STRTOLL@
884 /* Parse a signed integer whose textual representation starts at STRING.
885 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
886 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
887 "0x").
888 If ENDPTR is not NULL, the address of the first byte after the integer is
889 stored in *ENDPTR.
890 Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
891 to ERANGE. */
892 # if !@HAVE_STRTOLL@
893 _GL_FUNCDECL_SYS (strtoll, long long,
894 (const char *string, char **endptr, int base)
895 _GL_ARG_NONNULL ((1)));
896 # endif
897 _GL_CXXALIAS_SYS (strtoll, long long,
898 (const char *string, char **endptr, int base));
899 _GL_CXXALIASWARN (strtoll);
900 #elif defined GNULIB_POSIXCHECK
901 # undef strtoll
902 # if HAVE_RAW_DECL_STRTOLL
903 _GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
904 "use gnulib module strtoll for portability");
905 # endif
906 #endif
907
908 #if @GNULIB_STRTOULL@
909 /* Parse an unsigned integer whose textual representation starts at STRING.
910 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
911 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
912 "0x").
913 If ENDPTR is not NULL, the address of the first byte after the integer is
914 stored in *ENDPTR.
915 Upon overflow, the return value is ULLONG_MAX, and errno is set to
916 ERANGE. */
917 # if !@HAVE_STRTOULL@
918 _GL_FUNCDECL_SYS (strtoull, unsigned long long,
919 (const char *string, char **endptr, int base)
920 _GL_ARG_NONNULL ((1)));
921 # endif
922 _GL_CXXALIAS_SYS (strtoull, unsigned long long,
923 (const char *string, char **endptr, int base));
924 _GL_CXXALIASWARN (strtoull);
925 #elif defined GNULIB_POSIXCHECK
926 # undef strtoull
927 # if HAVE_RAW_DECL_STRTOULL
928 _GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
929 "use gnulib module strtoull for portability");
930 # endif
931 #endif
932
933 #if @GNULIB_UNLOCKPT@
934 /* Unlock the slave side of the pseudo-terminal whose master side is specified
935 by FD, so that it can be opened. */
936 # if !@HAVE_UNLOCKPT@
937 _GL_FUNCDECL_SYS (unlockpt, int, (int fd));
938 # endif
939 _GL_CXXALIAS_SYS (unlockpt, int, (int fd));
940 _GL_CXXALIASWARN (unlockpt);
941 #elif defined GNULIB_POSIXCHECK
942 # undef unlockpt
943 # if HAVE_RAW_DECL_UNLOCKPT
944 _GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
945 "use gnulib module unlockpt for portability");
946 # endif
947 #endif
948
949 #if @GNULIB_UNSETENV@
950 /* Remove the variable NAME from the environment. */
951 # if @REPLACE_UNSETENV@
952 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
953 # undef unsetenv
954 # define unsetenv rpl_unsetenv
955 # endif
956 _GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
957 _GL_CXXALIAS_RPL (unsetenv, int, (const char *name));
958 # else
959 # if !@HAVE_DECL_UNSETENV@
960 _GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
961 # endif
962 _GL_CXXALIAS_SYS (unsetenv, int, (const char *name));
963 # endif
964 # if !(@REPLACE_UNSETENV@ && !@HAVE_DECL_UNSETENV@)
965 _GL_CXXALIASWARN (unsetenv);
966 # endif
967 #elif defined GNULIB_POSIXCHECK
968 # undef unsetenv
969 # if HAVE_RAW_DECL_UNSETENV
970 _GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
971 "use gnulib module unsetenv for portability");
972 # endif
973 #endif
974
975 /* Convert a wide character to a multibyte character. */
976 #if @GNULIB_WCTOMB@
977 # if @REPLACE_WCTOMB@
978 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
979 # undef wctomb
980 # define wctomb rpl_wctomb
981 # endif
982 _GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc));
983 _GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc));
984 # else
985 _GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc));
986 # endif
987 _GL_CXXALIASWARN (wctomb);
988 #endif
989
990
991 #endif /* _@GUARD_PREFIX@_STDLIB_H */
992 #endif /* _@GUARD_PREFIX@_STDLIB_H */
993 #endif
This page took 0.048294 seconds and 3 git commands to generate.