summaryrefslogtreecommitdiffstats
path: root/gl/stdlib.in.h
diff options
context:
space:
mode:
authorLorenz <12514511+RincewindsHat@users.noreply.github.com>2023-03-27 10:34:19 (GMT)
committerGitHub <noreply@github.com>2023-03-27 10:34:19 (GMT)
commitbbc97d57f7f9e0a49fea78c02861c444fe95d46a (patch)
treec8956bbbe9b73e37d261735699a82cccaacea0db /gl/stdlib.in.h
parent917dba07fded8ef04967183a4c0443b5cce2db82 (diff)
parent482aa6c7fe86d7a899e4888d14149f1ccd5401fd (diff)
downloadmonitoring-plugins-bbc97d5.tar.gz
Merge branch 'master' into dev/check_ssh-patches
Diffstat (limited to 'gl/stdlib.in.h')
-rw-r--r--gl/stdlib.in.h763
1 files changed, 686 insertions, 77 deletions
diff --git a/gl/stdlib.in.h b/gl/stdlib.in.h
index c955248..b79e5f7 100644
--- a/gl/stdlib.in.h
+++ b/gl/stdlib.in.h
@@ -1,19 +1,19 @@
1/* A GNU-like <stdlib.h>. 1/* A GNU-like <stdlib.h>.
2 2
3 Copyright (C) 1995, 2001-2004, 2006-2013 Free Software Foundation, Inc. 3 Copyright (C) 1995, 2001-2004, 2006-2023 Free Software Foundation, Inc.
4 4
5 This program is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU Lesser General Public License as
7 the Free Software Foundation; either version 3 of the License, or 7 published by the Free Software Foundation; either version 2.1 of the
8 (at your option) any later version. 8 License, or (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU Lesser General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17 17
18#if __GNUC__ >= 3 18#if __GNUC__ >= 3
19@PRAGMA_SYSTEM_HEADER@ 19@PRAGMA_SYSTEM_HEADER@
@@ -47,11 +47,14 @@
47 47
48/* Solaris declares getloadavg() in <sys/loadavg.h>. */ 48/* Solaris declares getloadavg() in <sys/loadavg.h>. */
49#if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@ 49#if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@
50/* OpenIndiana has a bug: <sys/time.h> must be included before
51 <sys/loadavg.h>. */
52# include <sys/time.h>
50# include <sys/loadavg.h> 53# include <sys/loadavg.h>
51#endif 54#endif
52 55
53/* Native Windows platforms declare mktemp() in <io.h>. */ 56/* Native Windows platforms declare _mktemp() in <io.h>. */
54#if 0 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) 57#if defined _WIN32 && !defined __CYGWIN__
55# include <io.h> 58# include <io.h>
56#endif 59#endif
57 60
@@ -87,20 +90,52 @@ struct random_data
87# endif 90# endif
88#endif 91#endif
89 92
90#if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) 93#if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_MKOSTEMP@ || @GNULIB_MKOSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !(defined _WIN32 && ! defined __CYGWIN__)
91/* On Mac OS X 10.3, only <unistd.h> declares mkstemp. */ 94/* On Mac OS X 10.3, only <unistd.h> declares mkstemp. */
92/* On Mac OS X 10.5, only <unistd.h> declares mkstemps. */ 95/* On Mac OS X 10.5, only <unistd.h> declares mkstemps. */
96/* On Mac OS X 10.13, only <unistd.h> declares mkostemp and mkostemps. */
93/* On Cygwin 1.7.1, only <unistd.h> declares getsubopt. */ 97/* On Cygwin 1.7.1, only <unistd.h> declares getsubopt. */
94/* But avoid namespace pollution on glibc systems and native Windows. */ 98/* But avoid namespace pollution on glibc systems and native Windows. */
95# include <unistd.h> 99# include <unistd.h>
96#endif 100#endif
97 101
102/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
103 that can be freed by passing them as the Ith argument to the
104 function F. */
105#ifndef _GL_ATTRIBUTE_DEALLOC
106# if __GNUC__ >= 11
107# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
108# else
109# define _GL_ATTRIBUTE_DEALLOC(f, i)
110# endif
111#endif
112
113/* _GL_ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that
114 can be freed via 'free'; it can be used only after declaring 'free'. */
115/* Applies to: functions. Cannot be used on inline functions. */
116#ifndef _GL_ATTRIBUTE_DEALLOC_FREE
117# define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (free, 1)
118#endif
119
120/* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly
121 allocated memory. */
122/* Applies to: functions. */
123#ifndef _GL_ATTRIBUTE_MALLOC
124# if __GNUC__ >= 3 || defined __clang__
125# define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
126# else
127# define _GL_ATTRIBUTE_MALLOC
128# endif
129#endif
130
98/* The __attribute__ feature is available in gcc versions 2.5 and later. 131/* The __attribute__ feature is available in gcc versions 2.5 and later.
99 The attribute __pure__ was added in gcc 2.96. */ 132 The attribute __pure__ was added in gcc 2.96. */
100#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) 133#ifndef _GL_ATTRIBUTE_PURE
101# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) 134# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
102#else 135# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
103# define _GL_ATTRIBUTE_PURE /* empty */ 136# else
137# define _GL_ATTRIBUTE_PURE /* empty */
138# endif
104#endif 139#endif
105 140
106/* The definition of _Noreturn is copied here. */ 141/* The definition of _Noreturn is copied here. */
@@ -143,6 +178,73 @@ _GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
143#endif 178#endif
144 179
145 180
181#if @GNULIB_FREE_POSIX@
182# if @REPLACE_FREE@
183# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
184# undef free
185# define free rpl_free
186# endif
187# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
188_GL_FUNCDECL_RPL (free, void, (void *ptr) throw ());
189# else
190_GL_FUNCDECL_RPL (free, void, (void *ptr));
191# endif
192_GL_CXXALIAS_RPL (free, void, (void *ptr));
193# else
194_GL_CXXALIAS_SYS (free, void, (void *ptr));
195# endif
196# if __GLIBC__ >= 2
197_GL_CXXALIASWARN (free);
198# endif
199#elif defined GNULIB_POSIXCHECK
200# undef free
201/* Assume free is always declared. */
202_GL_WARN_ON_USE (free, "free is not future POSIX compliant everywhere - "
203 "use gnulib module free for portability");
204#endif
205
206
207/* Allocate memory with indefinite extent and specified alignment. */
208#if @GNULIB_ALIGNED_ALLOC@
209# if @REPLACE_ALIGNED_ALLOC@
210# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
211# undef aligned_alloc
212# define aligned_alloc rpl_aligned_alloc
213# endif
214_GL_FUNCDECL_RPL (aligned_alloc, void *,
215 (size_t alignment, size_t size)
216 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
217_GL_CXXALIAS_RPL (aligned_alloc, void *, (size_t alignment, size_t size));
218# else
219# if @HAVE_ALIGNED_ALLOC@
220# if __GNUC__ >= 11
221/* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */
222_GL_FUNCDECL_SYS (aligned_alloc, void *,
223 (size_t alignment, size_t size)
224 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
225# endif
226_GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size));
227# endif
228# endif
229# if (__GLIBC__ >= 2) && @HAVE_ALIGNED_ALLOC@
230_GL_CXXALIASWARN (aligned_alloc);
231# endif
232#else
233# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined aligned_alloc
234/* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */
235_GL_FUNCDECL_SYS (aligned_alloc, void *,
236 (size_t alignment, size_t size)
237 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
238# endif
239# if defined GNULIB_POSIXCHECK
240# undef aligned_alloc
241# if HAVE_RAW_DECL_ALIGNED_ALLOC
242_GL_WARN_ON_USE (aligned_alloc, "aligned_alloc is not portable - "
243 "use gnulib module aligned_alloc for portability");
244# endif
245# endif
246#endif
247
146#if @GNULIB_ATOLL@ 248#if @GNULIB_ATOLL@
147/* Parse a signed decimal integer. 249/* Parse a signed decimal integer.
148 Returns the value of the integer. Errors are not detected. */ 250 Returns the value of the integer. Errors are not detected. */
@@ -162,22 +264,41 @@ _GL_WARN_ON_USE (atoll, "atoll is unportable - "
162#endif 264#endif
163 265
164#if @GNULIB_CALLOC_POSIX@ 266#if @GNULIB_CALLOC_POSIX@
165# if @REPLACE_CALLOC@ 267# if (@GNULIB_CALLOC_POSIX@ && @REPLACE_CALLOC_FOR_CALLOC_POSIX@) \
268 || (@GNULIB_CALLOC_GNU@ && @REPLACE_CALLOC_FOR_CALLOC_GNU@)
166# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 269# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
167# undef calloc 270# undef calloc
168# define calloc rpl_calloc 271# define calloc rpl_calloc
169# endif 272# endif
170_GL_FUNCDECL_RPL (calloc, void *, (size_t nmemb, size_t size)); 273_GL_FUNCDECL_RPL (calloc, void *,
274 (size_t nmemb, size_t size)
275 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
171_GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size)); 276_GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size));
172# else 277# else
278# if __GNUC__ >= 11
279/* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */
280_GL_FUNCDECL_SYS (calloc, void *,
281 (size_t nmemb, size_t size)
282 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
283# endif
173_GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size)); 284_GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
174# endif 285# endif
286# if __GLIBC__ >= 2
175_GL_CXXALIASWARN (calloc); 287_GL_CXXALIASWARN (calloc);
176#elif defined GNULIB_POSIXCHECK 288# endif
177# undef calloc 289#else
290# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined calloc
291/* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */
292_GL_FUNCDECL_SYS (calloc, void *,
293 (size_t nmemb, size_t size)
294 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
295# endif
296# if defined GNULIB_POSIXCHECK
297# undef calloc
178/* Assume calloc is always declared. */ 298/* Assume calloc is always declared. */
179_GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - " 299_GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - "
180 "use gnulib module calloc-posix for portability"); 300 "use gnulib module calloc-posix for portability");
301# endif
181#endif 302#endif
182 303
183#if @GNULIB_CANONICALIZE_FILE_NAME@ 304#if @GNULIB_CANONICALIZE_FILE_NAME@
@@ -185,23 +306,108 @@ _GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - "
185# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 306# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
186# define canonicalize_file_name rpl_canonicalize_file_name 307# define canonicalize_file_name rpl_canonicalize_file_name
187# endif 308# endif
188_GL_FUNCDECL_RPL (canonicalize_file_name, char *, (const char *name) 309_GL_FUNCDECL_RPL (canonicalize_file_name, char *,
189 _GL_ARG_NONNULL ((1))); 310 (const char *name)
311 _GL_ARG_NONNULL ((1))
312 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
190_GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name)); 313_GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name));
191# else 314# else
192# if !@HAVE_CANONICALIZE_FILE_NAME@ 315# if !@HAVE_CANONICALIZE_FILE_NAME@ || __GNUC__ >= 11
193_GL_FUNCDECL_SYS (canonicalize_file_name, char *, (const char *name) 316_GL_FUNCDECL_SYS (canonicalize_file_name, char *,
194 _GL_ARG_NONNULL ((1))); 317 (const char *name)
318 _GL_ARG_NONNULL ((1))
319 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
195# endif 320# endif
196_GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name)); 321_GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
197# endif 322# endif
323# ifndef GNULIB_defined_canonicalize_file_name
324# define GNULIB_defined_canonicalize_file_name \
325 (!@HAVE_CANONICALIZE_FILE_NAME@ || @REPLACE_CANONICALIZE_FILE_NAME@)
326# endif
198_GL_CXXALIASWARN (canonicalize_file_name); 327_GL_CXXALIASWARN (canonicalize_file_name);
199#elif defined GNULIB_POSIXCHECK 328#else
200# undef canonicalize_file_name 329# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined canonicalize_file_name
201# if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME 330/* For -Wmismatched-dealloc: Associate canonicalize_file_name with free or
331 rpl_free. */
332_GL_FUNCDECL_SYS (canonicalize_file_name, char *,
333 (const char *name)
334 _GL_ARG_NONNULL ((1))
335 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
336# endif
337# if defined GNULIB_POSIXCHECK
338# undef canonicalize_file_name
339# if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
202_GL_WARN_ON_USE (canonicalize_file_name, 340_GL_WARN_ON_USE (canonicalize_file_name,
203 "canonicalize_file_name is unportable - " 341 "canonicalize_file_name is unportable - "
204 "use gnulib module canonicalize-lgpl for portability"); 342 "use gnulib module canonicalize-lgpl for portability");
343# endif
344# endif
345#endif
346
347#if @GNULIB_MDA_ECVT@
348/* On native Windows, map 'ecvt' to '_ecvt', so that -loldnames is not
349 required. In C++ with GNULIB_NAMESPACE, avoid differences between
350 platforms by defining GNULIB_NAMESPACE::ecvt on all platforms that have
351 it. */
352# if defined _WIN32 && !defined __CYGWIN__
353# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
354# undef ecvt
355# define ecvt _ecvt
356# endif
357_GL_CXXALIAS_MDA (ecvt, char *,
358 (double number, int ndigits, int *decptp, int *signp));
359# else
360# if @HAVE_DECL_ECVT@
361_GL_CXXALIAS_SYS (ecvt, char *,
362 (double number, int ndigits, int *decptp, int *signp));
363# endif
364# endif
365# if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_ECVT@
366_GL_CXXALIASWARN (ecvt);
367# endif
368#endif
369
370#if @GNULIB_MDA_FCVT@
371/* On native Windows, map 'fcvt' to '_fcvt', so that -loldnames is not
372 required. In C++ with GNULIB_NAMESPACE, avoid differences between
373 platforms by defining GNULIB_NAMESPACE::fcvt on all platforms that have
374 it. */
375# if defined _WIN32 && !defined __CYGWIN__
376# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
377# undef fcvt
378# define fcvt _fcvt
379# endif
380_GL_CXXALIAS_MDA (fcvt, char *,
381 (double number, int ndigits, int *decptp, int *signp));
382# else
383# if @HAVE_DECL_FCVT@
384_GL_CXXALIAS_SYS (fcvt, char *,
385 (double number, int ndigits, int *decptp, int *signp));
386# endif
387# endif
388# if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_FCVT@
389_GL_CXXALIASWARN (fcvt);
390# endif
391#endif
392
393#if @GNULIB_MDA_GCVT@
394/* On native Windows, map 'gcvt' to '_gcvt', so that -loldnames is not
395 required. In C++ with GNULIB_NAMESPACE, avoid differences between
396 platforms by defining GNULIB_NAMESPACE::gcvt on all platforms that have
397 it. */
398# if defined _WIN32 && !defined __CYGWIN__
399# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
400# undef gcvt
401# define gcvt _gcvt
402# endif
403_GL_CXXALIAS_MDA (gcvt, char *, (double number, int ndigits, char *buf));
404# else
405# if @HAVE_DECL_GCVT@
406_GL_CXXALIAS_SYS (gcvt, char *, (double number, int ndigits, char *buf));
407# endif
408# endif
409# if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_GCVT@
410_GL_CXXALIASWARN (gcvt);
205# endif 411# endif
206#endif 412#endif
207 413
@@ -234,8 +440,8 @@ _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
234 element (or NULL if it doesn't contain an "=" sign), 440 element (or NULL if it doesn't contain an "=" sign),
235 - It returns the index of the "token" in the given array of tokens. 441 - It returns the index of the "token" in the given array of tokens.
236 Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined. 442 Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
237 For more details see the POSIX:2001 specification. 443 For more details see the POSIX specification.
238 http://www.opengroup.org/susv3xsh/getsubopt.html */ 444 https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsubopt.html */
239# if !@HAVE_GETSUBOPT@ 445# if !@HAVE_GETSUBOPT@
240_GL_FUNCDECL_SYS (getsubopt, int, 446_GL_FUNCDECL_SYS (getsubopt, int,
241 (char **optionp, char *const *tokens, char **valuep) 447 (char **optionp, char *const *tokens, char **valuep)
@@ -273,23 +479,42 @@ _GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
273 by never specifying a zero size), so it does not need malloc or 479 by never specifying a zero size), so it does not need malloc or
274 realloc to be redefined. */ 480 realloc to be redefined. */
275#if @GNULIB_MALLOC_POSIX@ 481#if @GNULIB_MALLOC_POSIX@
276# if @REPLACE_MALLOC@ 482# if (@GNULIB_MALLOC_POSIX@ && @REPLACE_MALLOC_FOR_MALLOC_POSIX@) \
483 || (@GNULIB_MALLOC_GNU@ && @REPLACE_MALLOC_FOR_MALLOC_GNU@)
277# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ 484# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
278 || _GL_USE_STDLIB_ALLOC) 485 || _GL_USE_STDLIB_ALLOC)
279# undef malloc 486# undef malloc
280# define malloc rpl_malloc 487# define malloc rpl_malloc
281# endif 488# endif
282_GL_FUNCDECL_RPL (malloc, void *, (size_t size)); 489_GL_FUNCDECL_RPL (malloc, void *,
490 (size_t size)
491 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
283_GL_CXXALIAS_RPL (malloc, void *, (size_t size)); 492_GL_CXXALIAS_RPL (malloc, void *, (size_t size));
284# else 493# else
494# if __GNUC__ >= 11
495/* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */
496_GL_FUNCDECL_SYS (malloc, void *,
497 (size_t size)
498 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
499# endif
285_GL_CXXALIAS_SYS (malloc, void *, (size_t size)); 500_GL_CXXALIAS_SYS (malloc, void *, (size_t size));
286# endif 501# endif
502# if __GLIBC__ >= 2
287_GL_CXXALIASWARN (malloc); 503_GL_CXXALIASWARN (malloc);
288#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC 504# endif
289# undef malloc 505#else
506# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined malloc
507/* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */
508_GL_FUNCDECL_SYS (malloc, void *,
509 (size_t size)
510 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
511# endif
512# if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
513# undef malloc
290/* Assume malloc is always declared. */ 514/* Assume malloc is always declared. */
291_GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - " 515_GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
292 "use gnulib module malloc-posix for portability"); 516 "use gnulib module malloc-posix for portability");
517# endif
293#endif 518#endif
294 519
295/* Convert a multibyte character to a wide character. */ 520/* Convert a multibyte character to a wide character. */
@@ -299,12 +524,27 @@ _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
299# undef mbtowc 524# undef mbtowc
300# define mbtowc rpl_mbtowc 525# define mbtowc rpl_mbtowc
301# endif 526# endif
302_GL_FUNCDECL_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); 527_GL_FUNCDECL_RPL (mbtowc, int,
303_GL_CXXALIAS_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); 528 (wchar_t *restrict pwc, const char *restrict s, size_t n));
529_GL_CXXALIAS_RPL (mbtowc, int,
530 (wchar_t *restrict pwc, const char *restrict s, size_t n));
304# else 531# else
305_GL_CXXALIAS_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); 532# if !@HAVE_MBTOWC@
533_GL_FUNCDECL_SYS (mbtowc, int,
534 (wchar_t *restrict pwc, const char *restrict s, size_t n));
535# endif
536_GL_CXXALIAS_SYS (mbtowc, int,
537 (wchar_t *restrict pwc, const char *restrict s, size_t n));
306# endif 538# endif
539# if __GLIBC__ >= 2
307_GL_CXXALIASWARN (mbtowc); 540_GL_CXXALIASWARN (mbtowc);
541# endif
542#elif defined GNULIB_POSIXCHECK
543# undef mbtowc
544# if HAVE_RAW_DECL_MBTOWC
545_GL_WARN_ON_USE (mbtowc, "mbtowc is not portable - "
546 "use gnulib module mbtowc for portability");
547# endif
308#endif 548#endif
309 549
310#if @GNULIB_MKDTEMP@ 550#if @GNULIB_MKDTEMP@
@@ -439,6 +679,51 @@ _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
439# endif 679# endif
440#endif 680#endif
441 681
682#if @GNULIB_MDA_MKTEMP@
683/* On native Windows, map 'mktemp' to '_mktemp', so that -loldnames is not
684 required. In C++ with GNULIB_NAMESPACE, avoid differences between
685 platforms by defining GNULIB_NAMESPACE::mktemp always. */
686# if defined _WIN32 && !defined __CYGWIN__
687# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
688# undef mktemp
689# define mktemp _mktemp
690# endif
691_GL_CXXALIAS_MDA (mktemp, char *, (char * /*template*/));
692# else
693_GL_CXXALIAS_SYS (mktemp, char *, (char * /*template*/));
694# endif
695_GL_CXXALIASWARN (mktemp);
696#endif
697
698/* Allocate memory with indefinite extent and specified alignment. */
699#if @GNULIB_POSIX_MEMALIGN@
700# if @REPLACE_POSIX_MEMALIGN@
701# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
702# undef posix_memalign
703# define posix_memalign rpl_posix_memalign
704# endif
705_GL_FUNCDECL_RPL (posix_memalign, int,
706 (void **memptr, size_t alignment, size_t size)
707 _GL_ARG_NONNULL ((1)));
708_GL_CXXALIAS_RPL (posix_memalign, int,
709 (void **memptr, size_t alignment, size_t size));
710# else
711# if @HAVE_POSIX_MEMALIGN@
712_GL_CXXALIAS_SYS (posix_memalign, int,
713 (void **memptr, size_t alignment, size_t size));
714# endif
715# endif
716# if @HAVE_POSIX_MEMALIGN@
717_GL_CXXALIASWARN (posix_memalign);
718# endif
719#elif defined GNULIB_POSIXCHECK
720# undef posix_memalign
721# if HAVE_RAW_DECL_POSIX_MEMALIGN
722_GL_WARN_ON_USE (posix_memalign, "posix_memalign is not portable - "
723 "use gnulib module posix_memalign for portability");
724# endif
725#endif
726
442#if @GNULIB_POSIX_OPENPT@ 727#if @GNULIB_POSIX_OPENPT@
443/* Return an FD open to the master side of a pseudo-terminal. Flags should 728/* Return an FD open to the master side of a pseudo-terminal. Flags should
444 include O_RDWR, and may also include O_NOCTTY. */ 729 include O_RDWR, and may also include O_NOCTTY. */
@@ -497,6 +782,9 @@ _GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
497# endif 782# endif
498_GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); 783_GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
499# endif 784# endif
785# ifndef GNULIB_defined_ptsname_r
786# define GNULIB_defined_ptsname_r (!@HAVE_PTSNAME_R@ || @REPLACE_PTSNAME_R@)
787# endif
500_GL_CXXALIASWARN (ptsname_r); 788_GL_CXXALIASWARN (ptsname_r);
501#elif defined GNULIB_POSIXCHECK 789#elif defined GNULIB_POSIXCHECK
502# undef ptsname_r 790# undef ptsname_r
@@ -514,12 +802,78 @@ _GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - "
514# endif 802# endif
515_GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1))); 803_GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1)));
516_GL_CXXALIAS_RPL (putenv, int, (char *string)); 804_GL_CXXALIAS_RPL (putenv, int, (char *string));
805# elif defined _WIN32 && !defined __CYGWIN__
806# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
807# undef putenv
808# define putenv _putenv
809# endif
810_GL_CXXALIAS_MDA (putenv, int, (char *string));
811# else
812_GL_CXXALIAS_SYS (putenv, int, (char *string));
813# endif
814_GL_CXXALIASWARN (putenv);
815#elif @GNULIB_MDA_PUTENV@
816/* On native Windows, map 'putenv' to '_putenv', so that -loldnames is not
817 required. In C++ with GNULIB_NAMESPACE, avoid differences between
818 platforms by defining GNULIB_NAMESPACE::putenv always. */
819# if defined _WIN32 && !defined __CYGWIN__
820# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
821# undef putenv
822# define putenv _putenv
823# endif
824/* Need to cast, because on mingw, the parameter is either
825 'const char *string' or 'char *string'. */
826_GL_CXXALIAS_MDA_CAST (putenv, int, (char *string));
517# else 827# else
518_GL_CXXALIAS_SYS (putenv, int, (char *string)); 828_GL_CXXALIAS_SYS (putenv, int, (char *string));
519# endif 829# endif
520_GL_CXXALIASWARN (putenv); 830_GL_CXXALIASWARN (putenv);
521#endif 831#endif
522 832
833#if @GNULIB_QSORT_R@
834/* Sort an array of NMEMB elements, starting at address BASE, each element
835 occupying SIZE bytes, in ascending order according to the comparison
836 function COMPARE. */
837# ifdef __cplusplus
838extern "C" {
839# endif
840# if !GNULIB_defined_qsort_r_fn_types
841typedef int (*_gl_qsort_r_compar_fn) (void const *, void const *, void *);
842# define GNULIB_defined_qsort_r_fn_types 1
843# endif
844# ifdef __cplusplus
845}
846# endif
847# if @REPLACE_QSORT_R@
848# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
849# undef qsort_r
850# define qsort_r rpl_qsort_r
851# endif
852_GL_FUNCDECL_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
853 _gl_qsort_r_compar_fn compare,
854 void *arg) _GL_ARG_NONNULL ((1, 4)));
855_GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
856 _gl_qsort_r_compar_fn compare,
857 void *arg));
858# else
859# if !@HAVE_QSORT_R@
860_GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
861 _gl_qsort_r_compar_fn compare,
862 void *arg) _GL_ARG_NONNULL ((1, 4)));
863# endif
864_GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
865 _gl_qsort_r_compar_fn compare,
866 void *arg));
867# endif
868_GL_CXXALIASWARN (qsort_r);
869#elif defined GNULIB_POSIXCHECK
870# undef qsort_r
871# if HAVE_RAW_DECL_QSORT_R
872_GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - "
873 "use gnulib module qsort_r for portability");
874# endif
875#endif
876
523 877
524#if @GNULIB_RANDOM_R@ 878#if @GNULIB_RANDOM_R@
525# if !@HAVE_RANDOM_R@ 879# if !@HAVE_RANDOM_R@
@@ -531,10 +885,21 @@ _GL_CXXALIASWARN (putenv);
531 885
532 886
533#if @GNULIB_RANDOM@ 887#if @GNULIB_RANDOM@
534# if !@HAVE_RANDOM@ 888# if @REPLACE_RANDOM@
889# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
890# undef random
891# define random rpl_random
892# endif
893_GL_FUNCDECL_RPL (random, long, (void));
894_GL_CXXALIAS_RPL (random, long, (void));
895# else
896# if !@HAVE_RANDOM@
535_GL_FUNCDECL_SYS (random, long, (void)); 897_GL_FUNCDECL_SYS (random, long, (void));
898# endif
899/* Need to cast, because on Haiku, the return type is
900 int. */
901_GL_CXXALIAS_SYS_CAST (random, long, (void));
536# endif 902# endif
537_GL_CXXALIAS_SYS (random, long, (void));
538_GL_CXXALIASWARN (random); 903_GL_CXXALIASWARN (random);
539#elif defined GNULIB_POSIXCHECK 904#elif defined GNULIB_POSIXCHECK
540# undef random 905# undef random
@@ -545,10 +910,21 @@ _GL_WARN_ON_USE (random, "random is unportable - "
545#endif 910#endif
546 911
547#if @GNULIB_RANDOM@ 912#if @GNULIB_RANDOM@
548# if !@HAVE_RANDOM@ 913# if @REPLACE_RANDOM@
914# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
915# undef srandom
916# define srandom rpl_srandom
917# endif
918_GL_FUNCDECL_RPL (srandom, void, (unsigned int seed));
919_GL_CXXALIAS_RPL (srandom, void, (unsigned int seed));
920# else
921# if !@HAVE_RANDOM@
549_GL_FUNCDECL_SYS (srandom, void, (unsigned int seed)); 922_GL_FUNCDECL_SYS (srandom, void, (unsigned int seed));
923# endif
924/* Need to cast, because on FreeBSD, the first parameter is
925 unsigned long seed. */
926_GL_CXXALIAS_SYS_CAST (srandom, void, (unsigned int seed));
550# endif 927# endif
551_GL_CXXALIAS_SYS (srandom, void, (unsigned int seed));
552_GL_CXXALIASWARN (srandom); 928_GL_CXXALIASWARN (srandom);
553#elif defined GNULIB_POSIXCHECK 929#elif defined GNULIB_POSIXCHECK
554# undef srandom 930# undef srandom
@@ -559,31 +935,56 @@ _GL_WARN_ON_USE (srandom, "srandom is unportable - "
559#endif 935#endif
560 936
561#if @GNULIB_RANDOM@ 937#if @GNULIB_RANDOM@
562# if !@HAVE_RANDOM@ 938# if @REPLACE_INITSTATE@
939# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
940# undef initstate
941# define initstate rpl_initstate
942# endif
943_GL_FUNCDECL_RPL (initstate, char *,
944 (unsigned int seed, char *buf, size_t buf_size)
945 _GL_ARG_NONNULL ((2)));
946_GL_CXXALIAS_RPL (initstate, char *,
947 (unsigned int seed, char *buf, size_t buf_size));
948# else
949# if !@HAVE_INITSTATE@ || !@HAVE_DECL_INITSTATE@
563_GL_FUNCDECL_SYS (initstate, char *, 950_GL_FUNCDECL_SYS (initstate, char *,
564 (unsigned int seed, char *buf, size_t buf_size) 951 (unsigned int seed, char *buf, size_t buf_size)
565 _GL_ARG_NONNULL ((2))); 952 _GL_ARG_NONNULL ((2)));
953# endif
954/* Need to cast, because on FreeBSD, the first parameter is
955 unsigned long seed. */
956_GL_CXXALIAS_SYS_CAST (initstate, char *,
957 (unsigned int seed, char *buf, size_t buf_size));
566# endif 958# endif
567_GL_CXXALIAS_SYS (initstate, char *,
568 (unsigned int seed, char *buf, size_t buf_size));
569_GL_CXXALIASWARN (initstate); 959_GL_CXXALIASWARN (initstate);
570#elif defined GNULIB_POSIXCHECK 960#elif defined GNULIB_POSIXCHECK
571# undef initstate 961# undef initstate
572# if HAVE_RAW_DECL_INITSTATE_R 962# if HAVE_RAW_DECL_INITSTATE
573_GL_WARN_ON_USE (initstate, "initstate is unportable - " 963_GL_WARN_ON_USE (initstate, "initstate is unportable - "
574 "use gnulib module random for portability"); 964 "use gnulib module random for portability");
575# endif 965# endif
576#endif 966#endif
577 967
578#if @GNULIB_RANDOM@ 968#if @GNULIB_RANDOM@
579# if !@HAVE_RANDOM@ 969# if @REPLACE_SETSTATE@
970# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
971# undef setstate
972# define setstate rpl_setstate
973# endif
974_GL_FUNCDECL_RPL (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
975_GL_CXXALIAS_RPL (setstate, char *, (char *arg_state));
976# else
977# if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@
580_GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); 978_GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
979# endif
980/* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter
981 is const char *arg_state. */
982_GL_CXXALIAS_SYS_CAST (setstate, char *, (char *arg_state));
581# endif 983# endif
582_GL_CXXALIAS_SYS (setstate, char *, (char *arg_state));
583_GL_CXXALIASWARN (setstate); 984_GL_CXXALIASWARN (setstate);
584#elif defined GNULIB_POSIXCHECK 985#elif defined GNULIB_POSIXCHECK
585# undef setstate 986# undef setstate
586# if HAVE_RAW_DECL_SETSTATE_R 987# if HAVE_RAW_DECL_SETSTATE
587_GL_WARN_ON_USE (setstate, "setstate is unportable - " 988_GL_WARN_ON_USE (setstate, "setstate is unportable - "
588 "use gnulib module random for portability"); 989 "use gnulib module random for portability");
589# endif 990# endif
@@ -664,9 +1065,11 @@ _GL_FUNCDECL_SYS (initstate_r, int,
664 struct random_data *rand_state) 1065 struct random_data *rand_state)
665 _GL_ARG_NONNULL ((2, 4))); 1066 _GL_ARG_NONNULL ((2, 4)));
666# endif 1067# endif
667_GL_CXXALIAS_SYS (initstate_r, int, 1068/* Need to cast, because on Haiku, the third parameter is
668 (unsigned int seed, char *buf, size_t buf_size, 1069 unsigned long buf_size. */
669 struct random_data *rand_state)); 1070_GL_CXXALIAS_SYS_CAST (initstate_r, int,
1071 (unsigned int seed, char *buf, size_t buf_size,
1072 struct random_data *rand_state));
670# endif 1073# endif
671_GL_CXXALIASWARN (initstate_r); 1074_GL_CXXALIASWARN (initstate_r);
672#elif defined GNULIB_POSIXCHECK 1075#elif defined GNULIB_POSIXCHECK
@@ -694,8 +1097,10 @@ _GL_FUNCDECL_SYS (setstate_r, int,
694 (char *arg_state, struct random_data *rand_state) 1097 (char *arg_state, struct random_data *rand_state)
695 _GL_ARG_NONNULL ((1, 2))); 1098 _GL_ARG_NONNULL ((1, 2)));
696# endif 1099# endif
697_GL_CXXALIAS_SYS (setstate_r, int, 1100/* Need to cast, because on Haiku, the first parameter is
698 (char *arg_state, struct random_data *rand_state)); 1101 void *arg_state. */
1102_GL_CXXALIAS_SYS_CAST (setstate_r, int,
1103 (char *arg_state, struct random_data *rand_state));
699# endif 1104# endif
700_GL_CXXALIASWARN (setstate_r); 1105_GL_CXXALIASWARN (setstate_r);
701#elif defined GNULIB_POSIXCHECK 1106#elif defined GNULIB_POSIXCHECK
@@ -708,23 +1113,67 @@ _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
708 1113
709 1114
710#if @GNULIB_REALLOC_POSIX@ 1115#if @GNULIB_REALLOC_POSIX@
711# if @REPLACE_REALLOC@ 1116# if (@GNULIB_REALLOC_POSIX@ && @REPLACE_REALLOC_FOR_REALLOC_POSIX@) \
1117 || (@GNULIB_REALLOC_GNU@ && @REPLACE_REALLOC_FOR_REALLOC_GNU@)
712# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ 1118# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
713 || _GL_USE_STDLIB_ALLOC) 1119 || _GL_USE_STDLIB_ALLOC)
714# undef realloc 1120# undef realloc
715# define realloc rpl_realloc 1121# define realloc rpl_realloc
716# endif 1122# endif
717_GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size)); 1123_GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size)
1124 _GL_ATTRIBUTE_DEALLOC_FREE);
718_GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size)); 1125_GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
719# else 1126# else
1127# if __GNUC__ >= 11
1128/* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */
1129_GL_FUNCDECL_SYS (realloc, void *, (void *ptr, size_t size)
1130 _GL_ATTRIBUTE_DEALLOC_FREE);
1131# endif
720_GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size)); 1132_GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
721# endif 1133# endif
1134# if __GLIBC__ >= 2
722_GL_CXXALIASWARN (realloc); 1135_GL_CXXALIASWARN (realloc);
723#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC 1136# endif
724# undef realloc 1137#else
1138# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined realloc
1139/* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */
1140_GL_FUNCDECL_SYS (realloc, void *, (void *ptr, size_t size)
1141 _GL_ATTRIBUTE_DEALLOC_FREE);
1142# endif
1143# if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
1144# undef realloc
725/* Assume realloc is always declared. */ 1145/* Assume realloc is always declared. */
726_GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - " 1146_GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
727 "use gnulib module realloc-posix for portability"); 1147 "use gnulib module realloc-posix for portability");
1148# endif
1149#endif
1150
1151
1152#if @GNULIB_REALLOCARRAY@
1153# if @REPLACE_REALLOCARRAY@
1154# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1155# undef reallocarray
1156# define reallocarray rpl_reallocarray
1157# endif
1158_GL_FUNCDECL_RPL (reallocarray, void *,
1159 (void *ptr, size_t nmemb, size_t size));
1160_GL_CXXALIAS_RPL (reallocarray, void *,
1161 (void *ptr, size_t nmemb, size_t size));
1162# else
1163# if ! @HAVE_REALLOCARRAY@
1164_GL_FUNCDECL_SYS (reallocarray, void *,
1165 (void *ptr, size_t nmemb, size_t size));
1166# endif
1167_GL_CXXALIAS_SYS (reallocarray, void *,
1168 (void *ptr, size_t nmemb, size_t size));
1169# endif
1170_GL_CXXALIASWARN (reallocarray);
1171#elif defined GNULIB_POSIXCHECK
1172# undef reallocarray
1173# if HAVE_RAW_DECL_REALLOCARRAY
1174_GL_WARN_ON_USE (reallocarray, "reallocarray is not portable - "
1175 "use gnulib module reallocarray for portability");
1176# endif
728#endif 1177#endif
729 1178
730#if @GNULIB_REALPATH@ 1179#if @GNULIB_REALPATH@
@@ -732,15 +1181,19 @@ _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
732# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1181# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
733# define realpath rpl_realpath 1182# define realpath rpl_realpath
734# endif 1183# endif
735_GL_FUNCDECL_RPL (realpath, char *, (const char *name, char *resolved) 1184_GL_FUNCDECL_RPL (realpath, char *,
736 _GL_ARG_NONNULL ((1))); 1185 (const char *restrict name, char *restrict resolved)
737_GL_CXXALIAS_RPL (realpath, char *, (const char *name, char *resolved)); 1186 _GL_ARG_NONNULL ((1)));
1187_GL_CXXALIAS_RPL (realpath, char *,
1188 (const char *restrict name, char *restrict resolved));
738# else 1189# else
739# if !@HAVE_REALPATH@ 1190# if !@HAVE_REALPATH@
740_GL_FUNCDECL_SYS (realpath, char *, (const char *name, char *resolved) 1191_GL_FUNCDECL_SYS (realpath, char *,
741 _GL_ARG_NONNULL ((1))); 1192 (const char *restrict name, char *restrict resolved)
1193 _GL_ARG_NONNULL ((1)));
742# endif 1194# endif
743_GL_CXXALIAS_SYS (realpath, char *, (const char *name, char *resolved)); 1195_GL_CXXALIAS_SYS (realpath, char *,
1196 (const char *restrict name, char *restrict resolved));
744# endif 1197# endif
745_GL_CXXALIASWARN (realpath); 1198_GL_CXXALIASWARN (realpath);
746#elif defined GNULIB_POSIXCHECK 1199#elif defined GNULIB_POSIXCHECK
@@ -822,17 +1275,24 @@ _GL_WARN_ON_USE (setenv, "setenv is unportable - "
822# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1275# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
823# define strtod rpl_strtod 1276# define strtod rpl_strtod
824# endif 1277# endif
825_GL_FUNCDECL_RPL (strtod, double, (const char *str, char **endp) 1278# define GNULIB_defined_strtod_function 1
826 _GL_ARG_NONNULL ((1))); 1279_GL_FUNCDECL_RPL (strtod, double,
827_GL_CXXALIAS_RPL (strtod, double, (const char *str, char **endp)); 1280 (const char *restrict str, char **restrict endp)
1281 _GL_ARG_NONNULL ((1)));
1282_GL_CXXALIAS_RPL (strtod, double,
1283 (const char *restrict str, char **restrict endp));
828# else 1284# else
829# if !@HAVE_STRTOD@ 1285# if !@HAVE_STRTOD@
830_GL_FUNCDECL_SYS (strtod, double, (const char *str, char **endp) 1286_GL_FUNCDECL_SYS (strtod, double,
831 _GL_ARG_NONNULL ((1))); 1287 (const char *restrict str, char **restrict endp)
1288 _GL_ARG_NONNULL ((1)));
832# endif 1289# endif
833_GL_CXXALIAS_SYS (strtod, double, (const char *str, char **endp)); 1290_GL_CXXALIAS_SYS (strtod, double,
1291 (const char *restrict str, char **restrict endp));
834# endif 1292# endif
1293# if __GLIBC__ >= 2
835_GL_CXXALIASWARN (strtod); 1294_GL_CXXALIASWARN (strtod);
1295# endif
836#elif defined GNULIB_POSIXCHECK 1296#elif defined GNULIB_POSIXCHECK
837# undef strtod 1297# undef strtod
838# if HAVE_RAW_DECL_STRTOD 1298# if HAVE_RAW_DECL_STRTOD
@@ -841,6 +1301,79 @@ _GL_WARN_ON_USE (strtod, "strtod is unportable - "
841# endif 1301# endif
842#endif 1302#endif
843 1303
1304#if @GNULIB_STRTOLD@
1305 /* Parse a 'long double' from STRING, updating ENDP if appropriate. */
1306# if @REPLACE_STRTOLD@
1307# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1308# define strtold rpl_strtold
1309# endif
1310# define GNULIB_defined_strtold_function 1
1311_GL_FUNCDECL_RPL (strtold, long double,
1312 (const char *restrict str, char **restrict endp)
1313 _GL_ARG_NONNULL ((1)));
1314_GL_CXXALIAS_RPL (strtold, long double,
1315 (const char *restrict str, char **restrict endp));
1316# else
1317# if !@HAVE_STRTOLD@
1318_GL_FUNCDECL_SYS (strtold, long double,
1319 (const char *restrict str, char **restrict endp)
1320 _GL_ARG_NONNULL ((1)));
1321# endif
1322_GL_CXXALIAS_SYS (strtold, long double,
1323 (const char *restrict str, char **restrict endp));
1324# endif
1325_GL_CXXALIASWARN (strtold);
1326#elif defined GNULIB_POSIXCHECK
1327# undef strtold
1328# if HAVE_RAW_DECL_STRTOLD
1329_GL_WARN_ON_USE (strtold, "strtold is unportable - "
1330 "use gnulib module strtold for portability");
1331# endif
1332#endif
1333
1334#if @GNULIB_STRTOL@
1335/* Parse a signed integer whose textual representation starts at STRING.
1336 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
1337 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
1338 "0x").
1339 If ENDPTR is not NULL, the address of the first byte after the integer is
1340 stored in *ENDPTR.
1341 Upon overflow, the return value is LONG_MAX or LONG_MIN, and errno is set
1342 to ERANGE. */
1343# if @REPLACE_STRTOL@
1344# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1345# define strtol rpl_strtol
1346# endif
1347# define GNULIB_defined_strtol_function 1
1348_GL_FUNCDECL_RPL (strtol, long,
1349 (const char *restrict string, char **restrict endptr,
1350 int base)
1351 _GL_ARG_NONNULL ((1)));
1352_GL_CXXALIAS_RPL (strtol, long,
1353 (const char *restrict string, char **restrict endptr,
1354 int base));
1355# else
1356# if !@HAVE_STRTOL@
1357_GL_FUNCDECL_SYS (strtol, long,
1358 (const char *restrict string, char **restrict endptr,
1359 int base)
1360 _GL_ARG_NONNULL ((1)));
1361# endif
1362_GL_CXXALIAS_SYS (strtol, long,
1363 (const char *restrict string, char **restrict endptr,
1364 int base));
1365# endif
1366# if __GLIBC__ >= 2
1367_GL_CXXALIASWARN (strtol);
1368# endif
1369#elif defined GNULIB_POSIXCHECK
1370# undef strtol
1371# if HAVE_RAW_DECL_STRTOL
1372_GL_WARN_ON_USE (strtol, "strtol is unportable - "
1373 "use gnulib module strtol for portability");
1374# endif
1375#endif
1376
844#if @GNULIB_STRTOLL@ 1377#if @GNULIB_STRTOLL@
845/* Parse a signed integer whose textual representation starts at STRING. 1378/* Parse a signed integer whose textual representation starts at STRING.
846 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, 1379 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
@@ -850,13 +1383,29 @@ _GL_WARN_ON_USE (strtod, "strtod is unportable - "
850 stored in *ENDPTR. 1383 stored in *ENDPTR.
851 Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set 1384 Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
852 to ERANGE. */ 1385 to ERANGE. */
853# if !@HAVE_STRTOLL@ 1386# if @REPLACE_STRTOLL@
1387# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1388# define strtoll rpl_strtoll
1389# endif
1390# define GNULIB_defined_strtoll_function 1
1391_GL_FUNCDECL_RPL (strtoll, long long,
1392 (const char *restrict string, char **restrict endptr,
1393 int base)
1394 _GL_ARG_NONNULL ((1)));
1395_GL_CXXALIAS_RPL (strtoll, long long,
1396 (const char *restrict string, char **restrict endptr,
1397 int base));
1398# else
1399# if !@HAVE_STRTOLL@
854_GL_FUNCDECL_SYS (strtoll, long long, 1400_GL_FUNCDECL_SYS (strtoll, long long,
855 (const char *string, char **endptr, int base) 1401 (const char *restrict string, char **restrict endptr,
1402 int base)
856 _GL_ARG_NONNULL ((1))); 1403 _GL_ARG_NONNULL ((1)));
857# endif 1404# endif
858_GL_CXXALIAS_SYS (strtoll, long long, 1405_GL_CXXALIAS_SYS (strtoll, long long,
859 (const char *string, char **endptr, int base)); 1406 (const char *restrict string, char **restrict endptr,
1407 int base));
1408# endif
860_GL_CXXALIASWARN (strtoll); 1409_GL_CXXALIASWARN (strtoll);
861#elif defined GNULIB_POSIXCHECK 1410#elif defined GNULIB_POSIXCHECK
862# undef strtoll 1411# undef strtoll
@@ -866,6 +1415,48 @@ _GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
866# endif 1415# endif
867#endif 1416#endif
868 1417
1418#if @GNULIB_STRTOUL@
1419/* Parse an unsigned integer whose textual representation starts at STRING.
1420 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
1421 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
1422 "0x").
1423 If ENDPTR is not NULL, the address of the first byte after the integer is
1424 stored in *ENDPTR.
1425 Upon overflow, the return value is ULONG_MAX, and errno is set to ERANGE. */
1426# if @REPLACE_STRTOUL@
1427# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1428# define strtoul rpl_strtoul
1429# endif
1430# define GNULIB_defined_strtoul_function 1
1431_GL_FUNCDECL_RPL (strtoul, unsigned long,
1432 (const char *restrict string, char **restrict endptr,
1433 int base)
1434 _GL_ARG_NONNULL ((1)));
1435_GL_CXXALIAS_RPL (strtoul, unsigned long,
1436 (const char *restrict string, char **restrict endptr,
1437 int base));
1438# else
1439# if !@HAVE_STRTOUL@
1440_GL_FUNCDECL_SYS (strtoul, unsigned long,
1441 (const char *restrict string, char **restrict endptr,
1442 int base)
1443 _GL_ARG_NONNULL ((1)));
1444# endif
1445_GL_CXXALIAS_SYS (strtoul, unsigned long,
1446 (const char *restrict string, char **restrict endptr,
1447 int base));
1448# endif
1449# if __GLIBC__ >= 2
1450_GL_CXXALIASWARN (strtoul);
1451# endif
1452#elif defined GNULIB_POSIXCHECK
1453# undef strtoul
1454# if HAVE_RAW_DECL_STRTOUL
1455_GL_WARN_ON_USE (strtoul, "strtoul is unportable - "
1456 "use gnulib module strtoul for portability");
1457# endif
1458#endif
1459
869#if @GNULIB_STRTOULL@ 1460#if @GNULIB_STRTOULL@
870/* Parse an unsigned integer whose textual representation starts at STRING. 1461/* Parse an unsigned integer whose textual representation starts at STRING.
871 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, 1462 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
@@ -875,13 +1466,29 @@ _GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
875 stored in *ENDPTR. 1466 stored in *ENDPTR.
876 Upon overflow, the return value is ULLONG_MAX, and errno is set to 1467 Upon overflow, the return value is ULLONG_MAX, and errno is set to
877 ERANGE. */ 1468 ERANGE. */
878# if !@HAVE_STRTOULL@ 1469# if @REPLACE_STRTOULL@
1470# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1471# define strtoull rpl_strtoull
1472# endif
1473# define GNULIB_defined_strtoull_function 1
1474_GL_FUNCDECL_RPL (strtoull, unsigned long long,
1475 (const char *restrict string, char **restrict endptr,
1476 int base)
1477 _GL_ARG_NONNULL ((1)));
1478_GL_CXXALIAS_RPL (strtoull, unsigned long long,
1479 (const char *restrict string, char **restrict endptr,
1480 int base));
1481# else
1482# if !@HAVE_STRTOULL@
879_GL_FUNCDECL_SYS (strtoull, unsigned long long, 1483_GL_FUNCDECL_SYS (strtoull, unsigned long long,
880 (const char *string, char **endptr, int base) 1484 (const char *restrict string, char **restrict endptr,
1485 int base)
881 _GL_ARG_NONNULL ((1))); 1486 _GL_ARG_NONNULL ((1)));
882# endif 1487# endif
883_GL_CXXALIAS_SYS (strtoull, unsigned long long, 1488_GL_CXXALIAS_SYS (strtoull, unsigned long long,
884 (const char *string, char **endptr, int base)); 1489 (const char *restrict string, char **restrict endptr,
1490 int base));
1491# endif
885_GL_CXXALIASWARN (strtoull); 1492_GL_CXXALIASWARN (strtoull);
886#elif defined GNULIB_POSIXCHECK 1493#elif defined GNULIB_POSIXCHECK
887# undef strtoull 1494# undef strtoull
@@ -945,7 +1552,9 @@ _GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc));
945# else 1552# else
946_GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc)); 1553_GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc));
947# endif 1554# endif
1555# if __GLIBC__ >= 2
948_GL_CXXALIASWARN (wctomb); 1556_GL_CXXALIASWARN (wctomb);
1557# endif
949#endif 1558#endif
950 1559
951 1560