diff options
author | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2021-11-17 01:05:54 +0100 |
---|---|---|
committer | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2022-07-24 19:35:11 +0200 |
commit | a405fc138596f552581d2011fd6de02d5c8186c4 (patch) | |
tree | 4c084700b5cb5e9fcedf982a2d921bbc41d9935a /gl/stdlib.in.h | |
parent | 9f2a9ca3d72023ff9b5707d1872c54d65edc9017 (diff) | |
download | monitoring-plugins-a405fc138596f552581d2011fd6de02d5c8186c4.tar.gz |
Sync with the latest Gnulib code (1a268176f)
Diffstat (limited to 'gl/stdlib.in.h')
-rw-r--r-- | gl/stdlib.in.h | 740 |
1 files changed, 666 insertions, 74 deletions
diff --git a/gl/stdlib.in.h b/gl/stdlib.in.h index c9552480..0855112d 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-2021 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,69 @@ _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 | _GL_FUNCDECL_RPL (free, void, (void *ptr)); | ||
188 | _GL_CXXALIAS_RPL (free, void, (void *ptr)); | ||
189 | # else | ||
190 | _GL_CXXALIAS_SYS (free, void, (void *ptr)); | ||
191 | # endif | ||
192 | # if __GLIBC__ >= 2 | ||
193 | _GL_CXXALIASWARN (free); | ||
194 | # endif | ||
195 | #elif defined GNULIB_POSIXCHECK | ||
196 | # undef free | ||
197 | /* Assume free is always declared. */ | ||
198 | _GL_WARN_ON_USE (free, "free is not future POSIX compliant everywhere - " | ||
199 | "use gnulib module free for portability"); | ||
200 | #endif | ||
201 | |||
202 | |||
203 | /* Allocate memory with indefinite extent and specified alignment. */ | ||
204 | #if @GNULIB_ALIGNED_ALLOC@ | ||
205 | # if @REPLACE_ALIGNED_ALLOC@ | ||
206 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
207 | # undef aligned_alloc | ||
208 | # define aligned_alloc rpl_aligned_alloc | ||
209 | # endif | ||
210 | _GL_FUNCDECL_RPL (aligned_alloc, void *, | ||
211 | (size_t alignment, size_t size) | ||
212 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
213 | _GL_CXXALIAS_RPL (aligned_alloc, void *, (size_t alignment, size_t size)); | ||
214 | # else | ||
215 | # if @HAVE_ALIGNED_ALLOC@ | ||
216 | # if __GNUC__ >= 11 | ||
217 | /* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */ | ||
218 | _GL_FUNCDECL_SYS (aligned_alloc, void *, | ||
219 | (size_t alignment, size_t size) | ||
220 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
221 | # endif | ||
222 | _GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size)); | ||
223 | # endif | ||
224 | # endif | ||
225 | # if @HAVE_ALIGNED_ALLOC@ | ||
226 | _GL_CXXALIASWARN (aligned_alloc); | ||
227 | # endif | ||
228 | #else | ||
229 | # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined aligned_alloc | ||
230 | /* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */ | ||
231 | _GL_FUNCDECL_SYS (aligned_alloc, void *, | ||
232 | (size_t alignment, size_t size) | ||
233 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
234 | # endif | ||
235 | # if defined GNULIB_POSIXCHECK | ||
236 | # undef aligned_alloc | ||
237 | # if HAVE_RAW_DECL_ALIGNED_ALLOC | ||
238 | _GL_WARN_ON_USE (aligned_alloc, "aligned_alloc is not portable - " | ||
239 | "use gnulib module aligned_alloc for portability"); | ||
240 | # endif | ||
241 | # endif | ||
242 | #endif | ||
243 | |||
146 | #if @GNULIB_ATOLL@ | 244 | #if @GNULIB_ATOLL@ |
147 | /* Parse a signed decimal integer. | 245 | /* Parse a signed decimal integer. |
148 | Returns the value of the integer. Errors are not detected. */ | 246 | Returns the value of the integer. Errors are not detected. */ |
@@ -167,17 +265,35 @@ _GL_WARN_ON_USE (atoll, "atoll is unportable - " | |||
167 | # undef calloc | 265 | # undef calloc |
168 | # define calloc rpl_calloc | 266 | # define calloc rpl_calloc |
169 | # endif | 267 | # endif |
170 | _GL_FUNCDECL_RPL (calloc, void *, (size_t nmemb, size_t size)); | 268 | _GL_FUNCDECL_RPL (calloc, void *, |
269 | (size_t nmemb, size_t size) | ||
270 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
171 | _GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size)); | 271 | _GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size)); |
172 | # else | 272 | # else |
273 | # if __GNUC__ >= 11 | ||
274 | /* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */ | ||
275 | _GL_FUNCDECL_SYS (calloc, void *, | ||
276 | (size_t nmemb, size_t size) | ||
277 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
278 | # endif | ||
173 | _GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size)); | 279 | _GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size)); |
174 | # endif | 280 | # endif |
281 | # if __GLIBC__ >= 2 | ||
175 | _GL_CXXALIASWARN (calloc); | 282 | _GL_CXXALIASWARN (calloc); |
176 | #elif defined GNULIB_POSIXCHECK | 283 | # endif |
177 | # undef calloc | 284 | #else |
285 | # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined calloc | ||
286 | /* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */ | ||
287 | _GL_FUNCDECL_SYS (calloc, void *, | ||
288 | (size_t nmemb, size_t size) | ||
289 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
290 | # endif | ||
291 | # if defined GNULIB_POSIXCHECK | ||
292 | # undef calloc | ||
178 | /* Assume calloc is always declared. */ | 293 | /* Assume calloc is always declared. */ |
179 | _GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - " | 294 | _GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - " |
180 | "use gnulib module calloc-posix for portability"); | 295 | "use gnulib module calloc-posix for portability"); |
296 | # endif | ||
181 | #endif | 297 | #endif |
182 | 298 | ||
183 | #if @GNULIB_CANONICALIZE_FILE_NAME@ | 299 | #if @GNULIB_CANONICALIZE_FILE_NAME@ |
@@ -185,23 +301,108 @@ _GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - " | |||
185 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 301 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
186 | # define canonicalize_file_name rpl_canonicalize_file_name | 302 | # define canonicalize_file_name rpl_canonicalize_file_name |
187 | # endif | 303 | # endif |
188 | _GL_FUNCDECL_RPL (canonicalize_file_name, char *, (const char *name) | 304 | _GL_FUNCDECL_RPL (canonicalize_file_name, char *, |
189 | _GL_ARG_NONNULL ((1))); | 305 | (const char *name) |
306 | _GL_ARG_NONNULL ((1)) | ||
307 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
190 | _GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name)); | 308 | _GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name)); |
191 | # else | 309 | # else |
192 | # if !@HAVE_CANONICALIZE_FILE_NAME@ | 310 | # if !@HAVE_CANONICALIZE_FILE_NAME@ || __GNUC__ >= 11 |
193 | _GL_FUNCDECL_SYS (canonicalize_file_name, char *, (const char *name) | 311 | _GL_FUNCDECL_SYS (canonicalize_file_name, char *, |
194 | _GL_ARG_NONNULL ((1))); | 312 | (const char *name) |
313 | _GL_ARG_NONNULL ((1)) | ||
314 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
195 | # endif | 315 | # endif |
196 | _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name)); | 316 | _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name)); |
197 | # endif | 317 | # endif |
318 | # ifndef GNULIB_defined_canonicalize_file_name | ||
319 | # define GNULIB_defined_canonicalize_file_name \ | ||
320 | (!@HAVE_CANONICALIZE_FILE_NAME@ || @REPLACE_CANONICALIZE_FILE_NAME@) | ||
321 | # endif | ||
198 | _GL_CXXALIASWARN (canonicalize_file_name); | 322 | _GL_CXXALIASWARN (canonicalize_file_name); |
199 | #elif defined GNULIB_POSIXCHECK | 323 | #else |
200 | # undef canonicalize_file_name | 324 | # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined canonicalize_file_name |
201 | # if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME | 325 | /* For -Wmismatched-dealloc: Associate canonicalize_file_name with free or |
326 | rpl_free. */ | ||
327 | _GL_FUNCDECL_SYS (canonicalize_file_name, char *, | ||
328 | (const char *name) | ||
329 | _GL_ARG_NONNULL ((1)) | ||
330 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
331 | # endif | ||
332 | # if defined GNULIB_POSIXCHECK | ||
333 | # undef canonicalize_file_name | ||
334 | # if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME | ||
202 | _GL_WARN_ON_USE (canonicalize_file_name, | 335 | _GL_WARN_ON_USE (canonicalize_file_name, |
203 | "canonicalize_file_name is unportable - " | 336 | "canonicalize_file_name is unportable - " |
204 | "use gnulib module canonicalize-lgpl for portability"); | 337 | "use gnulib module canonicalize-lgpl for portability"); |
338 | # endif | ||
339 | # endif | ||
340 | #endif | ||
341 | |||
342 | #if @GNULIB_MDA_ECVT@ | ||
343 | /* On native Windows, map 'ecvt' to '_ecvt', so that -loldnames is not | ||
344 | required. In C++ with GNULIB_NAMESPACE, avoid differences between | ||
345 | platforms by defining GNULIB_NAMESPACE::ecvt on all platforms that have | ||
346 | it. */ | ||
347 | # if defined _WIN32 && !defined __CYGWIN__ | ||
348 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
349 | # undef ecvt | ||
350 | # define ecvt _ecvt | ||
351 | # endif | ||
352 | _GL_CXXALIAS_MDA (ecvt, char *, | ||
353 | (double number, int ndigits, int *decptp, int *signp)); | ||
354 | # else | ||
355 | # if @HAVE_DECL_ECVT@ | ||
356 | _GL_CXXALIAS_SYS (ecvt, char *, | ||
357 | (double number, int ndigits, int *decptp, int *signp)); | ||
358 | # endif | ||
359 | # endif | ||
360 | # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_ECVT@ | ||
361 | _GL_CXXALIASWARN (ecvt); | ||
362 | # endif | ||
363 | #endif | ||
364 | |||
365 | #if @GNULIB_MDA_FCVT@ | ||
366 | /* On native Windows, map 'fcvt' to '_fcvt', so that -loldnames is not | ||
367 | required. In C++ with GNULIB_NAMESPACE, avoid differences between | ||
368 | platforms by defining GNULIB_NAMESPACE::fcvt on all platforms that have | ||
369 | it. */ | ||
370 | # if defined _WIN32 && !defined __CYGWIN__ | ||
371 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
372 | # undef fcvt | ||
373 | # define fcvt _fcvt | ||
374 | # endif | ||
375 | _GL_CXXALIAS_MDA (fcvt, char *, | ||
376 | (double number, int ndigits, int *decptp, int *signp)); | ||
377 | # else | ||
378 | # if @HAVE_DECL_FCVT@ | ||
379 | _GL_CXXALIAS_SYS (fcvt, char *, | ||
380 | (double number, int ndigits, int *decptp, int *signp)); | ||
381 | # endif | ||
382 | # endif | ||
383 | # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_FCVT@ | ||
384 | _GL_CXXALIASWARN (fcvt); | ||
385 | # endif | ||
386 | #endif | ||
387 | |||
388 | #if @GNULIB_MDA_GCVT@ | ||
389 | /* On native Windows, map 'gcvt' to '_gcvt', so that -loldnames is not | ||
390 | required. In C++ with GNULIB_NAMESPACE, avoid differences between | ||
391 | platforms by defining GNULIB_NAMESPACE::gcvt on all platforms that have | ||
392 | it. */ | ||
393 | # if defined _WIN32 && !defined __CYGWIN__ | ||
394 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
395 | # undef gcvt | ||
396 | # define gcvt _gcvt | ||
397 | # endif | ||
398 | _GL_CXXALIAS_MDA (gcvt, char *, (double number, int ndigits, char *buf)); | ||
399 | # else | ||
400 | # if @HAVE_DECL_GCVT@ | ||
401 | _GL_CXXALIAS_SYS (gcvt, char *, (double number, int ndigits, char *buf)); | ||
402 | # endif | ||
403 | # endif | ||
404 | # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_GCVT@ | ||
405 | _GL_CXXALIASWARN (gcvt); | ||
205 | # endif | 406 | # endif |
206 | #endif | 407 | #endif |
207 | 408 | ||
@@ -234,8 +435,8 @@ _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - " | |||
234 | element (or NULL if it doesn't contain an "=" sign), | 435 | element (or NULL if it doesn't contain an "=" sign), |
235 | - It returns the index of the "token" in the given array of tokens. | 436 | - It returns the index of the "token" in the given array of tokens. |
236 | Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined. | 437 | Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined. |
237 | For more details see the POSIX:2001 specification. | 438 | For more details see the POSIX specification. |
238 | http://www.opengroup.org/susv3xsh/getsubopt.html */ | 439 | https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsubopt.html */ |
239 | # if !@HAVE_GETSUBOPT@ | 440 | # if !@HAVE_GETSUBOPT@ |
240 | _GL_FUNCDECL_SYS (getsubopt, int, | 441 | _GL_FUNCDECL_SYS (getsubopt, int, |
241 | (char **optionp, char *const *tokens, char **valuep) | 442 | (char **optionp, char *const *tokens, char **valuep) |
@@ -279,17 +480,35 @@ _GL_WARN_ON_USE (grantpt, "grantpt is not portable - " | |||
279 | # undef malloc | 480 | # undef malloc |
280 | # define malloc rpl_malloc | 481 | # define malloc rpl_malloc |
281 | # endif | 482 | # endif |
282 | _GL_FUNCDECL_RPL (malloc, void *, (size_t size)); | 483 | _GL_FUNCDECL_RPL (malloc, void *, |
484 | (size_t size) | ||
485 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
283 | _GL_CXXALIAS_RPL (malloc, void *, (size_t size)); | 486 | _GL_CXXALIAS_RPL (malloc, void *, (size_t size)); |
284 | # else | 487 | # else |
488 | # if __GNUC__ >= 11 | ||
489 | /* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */ | ||
490 | _GL_FUNCDECL_SYS (malloc, void *, | ||
491 | (size_t size) | ||
492 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
493 | # endif | ||
285 | _GL_CXXALIAS_SYS (malloc, void *, (size_t size)); | 494 | _GL_CXXALIAS_SYS (malloc, void *, (size_t size)); |
286 | # endif | 495 | # endif |
496 | # if __GLIBC__ >= 2 | ||
287 | _GL_CXXALIASWARN (malloc); | 497 | _GL_CXXALIASWARN (malloc); |
288 | #elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC | 498 | # endif |
289 | # undef malloc | 499 | #else |
500 | # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined malloc | ||
501 | /* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */ | ||
502 | _GL_FUNCDECL_SYS (malloc, void *, | ||
503 | (size_t size) | ||
504 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
505 | # endif | ||
506 | # if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC | ||
507 | # undef malloc | ||
290 | /* Assume malloc is always declared. */ | 508 | /* Assume malloc is always declared. */ |
291 | _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - " | 509 | _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - " |
292 | "use gnulib module malloc-posix for portability"); | 510 | "use gnulib module malloc-posix for portability"); |
511 | # endif | ||
293 | #endif | 512 | #endif |
294 | 513 | ||
295 | /* Convert a multibyte character to a wide character. */ | 514 | /* Convert a multibyte character to a wide character. */ |
@@ -299,12 +518,27 @@ _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - " | |||
299 | # undef mbtowc | 518 | # undef mbtowc |
300 | # define mbtowc rpl_mbtowc | 519 | # define mbtowc rpl_mbtowc |
301 | # endif | 520 | # endif |
302 | _GL_FUNCDECL_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); | 521 | _GL_FUNCDECL_RPL (mbtowc, int, |
303 | _GL_CXXALIAS_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); | 522 | (wchar_t *restrict pwc, const char *restrict s, size_t n)); |
523 | _GL_CXXALIAS_RPL (mbtowc, int, | ||
524 | (wchar_t *restrict pwc, const char *restrict s, size_t n)); | ||
304 | # else | 525 | # else |
305 | _GL_CXXALIAS_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); | 526 | # if !@HAVE_MBTOWC@ |
527 | _GL_FUNCDECL_SYS (mbtowc, int, | ||
528 | (wchar_t *restrict pwc, const char *restrict s, size_t n)); | ||
529 | # endif | ||
530 | _GL_CXXALIAS_SYS (mbtowc, int, | ||
531 | (wchar_t *restrict pwc, const char *restrict s, size_t n)); | ||
306 | # endif | 532 | # endif |
533 | # if __GLIBC__ >= 2 | ||
307 | _GL_CXXALIASWARN (mbtowc); | 534 | _GL_CXXALIASWARN (mbtowc); |
535 | # endif | ||
536 | #elif defined GNULIB_POSIXCHECK | ||
537 | # undef mbtowc | ||
538 | # if HAVE_RAW_DECL_MBTOWC | ||
539 | _GL_WARN_ON_USE (mbtowc, "mbtowc is not portable - " | ||
540 | "use gnulib module mbtowc for portability"); | ||
541 | # endif | ||
308 | #endif | 542 | #endif |
309 | 543 | ||
310 | #if @GNULIB_MKDTEMP@ | 544 | #if @GNULIB_MKDTEMP@ |
@@ -439,6 +673,51 @@ _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - " | |||
439 | # endif | 673 | # endif |
440 | #endif | 674 | #endif |
441 | 675 | ||
676 | #if @GNULIB_MDA_MKTEMP@ | ||
677 | /* On native Windows, map 'mktemp' to '_mktemp', so that -loldnames is not | ||
678 | required. In C++ with GNULIB_NAMESPACE, avoid differences between | ||
679 | platforms by defining GNULIB_NAMESPACE::mktemp always. */ | ||
680 | # if defined _WIN32 && !defined __CYGWIN__ | ||
681 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
682 | # undef mktemp | ||
683 | # define mktemp _mktemp | ||
684 | # endif | ||
685 | _GL_CXXALIAS_MDA (mktemp, char *, (char * /*template*/)); | ||
686 | # else | ||
687 | _GL_CXXALIAS_SYS (mktemp, char *, (char * /*template*/)); | ||
688 | # endif | ||
689 | _GL_CXXALIASWARN (mktemp); | ||
690 | #endif | ||
691 | |||
692 | /* Allocate memory with indefinite extent and specified alignment. */ | ||
693 | #if @GNULIB_POSIX_MEMALIGN@ | ||
694 | # if @REPLACE_POSIX_MEMALIGN@ | ||
695 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
696 | # undef posix_memalign | ||
697 | # define posix_memalign rpl_posix_memalign | ||
698 | # endif | ||
699 | _GL_FUNCDECL_RPL (posix_memalign, int, | ||
700 | (void **memptr, size_t alignment, size_t size) | ||
701 | _GL_ARG_NONNULL ((1))); | ||
702 | _GL_CXXALIAS_RPL (posix_memalign, int, | ||
703 | (void **memptr, size_t alignment, size_t size)); | ||
704 | # else | ||
705 | # if @HAVE_POSIX_MEMALIGN@ | ||
706 | _GL_CXXALIAS_SYS (posix_memalign, int, | ||
707 | (void **memptr, size_t alignment, size_t size)); | ||
708 | # endif | ||
709 | # endif | ||
710 | # if @HAVE_POSIX_MEMALIGN@ | ||
711 | _GL_CXXALIASWARN (posix_memalign); | ||
712 | # endif | ||
713 | #elif defined GNULIB_POSIXCHECK | ||
714 | # undef posix_memalign | ||
715 | # if HAVE_RAW_DECL_POSIX_MEMALIGN | ||
716 | _GL_WARN_ON_USE (posix_memalign, "posix_memalign is not portable - " | ||
717 | "use gnulib module posix_memalign for portability"); | ||
718 | # endif | ||
719 | #endif | ||
720 | |||
442 | #if @GNULIB_POSIX_OPENPT@ | 721 | #if @GNULIB_POSIX_OPENPT@ |
443 | /* Return an FD open to the master side of a pseudo-terminal. Flags should | 722 | /* Return an FD open to the master side of a pseudo-terminal. Flags should |
444 | include O_RDWR, and may also include O_NOCTTY. */ | 723 | include O_RDWR, and may also include O_NOCTTY. */ |
@@ -497,6 +776,9 @@ _GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); | |||
497 | # endif | 776 | # endif |
498 | _GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); | 777 | _GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); |
499 | # endif | 778 | # endif |
779 | # ifndef GNULIB_defined_ptsname_r | ||
780 | # define GNULIB_defined_ptsname_r (!@HAVE_PTSNAME_R@ || @REPLACE_PTSNAME_R@) | ||
781 | # endif | ||
500 | _GL_CXXALIASWARN (ptsname_r); | 782 | _GL_CXXALIASWARN (ptsname_r); |
501 | #elif defined GNULIB_POSIXCHECK | 783 | #elif defined GNULIB_POSIXCHECK |
502 | # undef ptsname_r | 784 | # undef ptsname_r |
@@ -514,12 +796,72 @@ _GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - " | |||
514 | # endif | 796 | # endif |
515 | _GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1))); | 797 | _GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1))); |
516 | _GL_CXXALIAS_RPL (putenv, int, (char *string)); | 798 | _GL_CXXALIAS_RPL (putenv, int, (char *string)); |
799 | # elif defined _WIN32 && !defined __CYGWIN__ | ||
800 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
801 | # undef putenv | ||
802 | # define putenv _putenv | ||
803 | # endif | ||
804 | _GL_CXXALIAS_MDA (putenv, int, (char *string)); | ||
805 | # else | ||
806 | _GL_CXXALIAS_SYS (putenv, int, (char *string)); | ||
807 | # endif | ||
808 | _GL_CXXALIASWARN (putenv); | ||
809 | #elif @GNULIB_MDA_PUTENV@ | ||
810 | /* On native Windows, map 'putenv' to '_putenv', so that -loldnames is not | ||
811 | required. In C++ with GNULIB_NAMESPACE, avoid differences between | ||
812 | platforms by defining GNULIB_NAMESPACE::putenv always. */ | ||
813 | # if defined _WIN32 && !defined __CYGWIN__ | ||
814 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
815 | # undef putenv | ||
816 | # define putenv _putenv | ||
817 | # endif | ||
818 | /* Need to cast, because on mingw, the parameter is either | ||
819 | 'const char *string' or 'char *string'. */ | ||
820 | _GL_CXXALIAS_MDA_CAST (putenv, int, (char *string)); | ||
517 | # else | 821 | # else |
518 | _GL_CXXALIAS_SYS (putenv, int, (char *string)); | 822 | _GL_CXXALIAS_SYS (putenv, int, (char *string)); |
519 | # endif | 823 | # endif |
520 | _GL_CXXALIASWARN (putenv); | 824 | _GL_CXXALIASWARN (putenv); |
521 | #endif | 825 | #endif |
522 | 826 | ||
827 | #if @GNULIB_QSORT_R@ | ||
828 | /* Sort an array of NMEMB elements, starting at address BASE, each element | ||
829 | occupying SIZE bytes, in ascending order according to the comparison | ||
830 | function COMPARE. */ | ||
831 | # if @REPLACE_QSORT_R@ | ||
832 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
833 | # undef qsort_r | ||
834 | # define qsort_r rpl_qsort_r | ||
835 | # endif | ||
836 | _GL_FUNCDECL_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size, | ||
837 | int (*compare) (void const *, void const *, | ||
838 | void *), | ||
839 | void *arg) _GL_ARG_NONNULL ((1, 4))); | ||
840 | _GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size, | ||
841 | int (*compare) (void const *, void const *, | ||
842 | void *), | ||
843 | void *arg)); | ||
844 | # else | ||
845 | # if !@HAVE_QSORT_R@ | ||
846 | _GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size, | ||
847 | int (*compare) (void const *, void const *, | ||
848 | void *), | ||
849 | void *arg) _GL_ARG_NONNULL ((1, 4))); | ||
850 | # endif | ||
851 | _GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size, | ||
852 | int (*compare) (void const *, void const *, | ||
853 | void *), | ||
854 | void *arg)); | ||
855 | # endif | ||
856 | _GL_CXXALIASWARN (qsort_r); | ||
857 | #elif defined GNULIB_POSIXCHECK | ||
858 | # undef qsort_r | ||
859 | # if HAVE_RAW_DECL_QSORT_R | ||
860 | _GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - " | ||
861 | "use gnulib module qsort_r for portability"); | ||
862 | # endif | ||
863 | #endif | ||
864 | |||
523 | 865 | ||
524 | #if @GNULIB_RANDOM_R@ | 866 | #if @GNULIB_RANDOM_R@ |
525 | # if !@HAVE_RANDOM_R@ | 867 | # if !@HAVE_RANDOM_R@ |
@@ -531,10 +873,21 @@ _GL_CXXALIASWARN (putenv); | |||
531 | 873 | ||
532 | 874 | ||
533 | #if @GNULIB_RANDOM@ | 875 | #if @GNULIB_RANDOM@ |
534 | # if !@HAVE_RANDOM@ | 876 | # if @REPLACE_RANDOM@ |
877 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
878 | # undef random | ||
879 | # define random rpl_random | ||
880 | # endif | ||
881 | _GL_FUNCDECL_RPL (random, long, (void)); | ||
882 | _GL_CXXALIAS_RPL (random, long, (void)); | ||
883 | # else | ||
884 | # if !@HAVE_RANDOM@ | ||
535 | _GL_FUNCDECL_SYS (random, long, (void)); | 885 | _GL_FUNCDECL_SYS (random, long, (void)); |
886 | # endif | ||
887 | /* Need to cast, because on Haiku, the return type is | ||
888 | int. */ | ||
889 | _GL_CXXALIAS_SYS_CAST (random, long, (void)); | ||
536 | # endif | 890 | # endif |
537 | _GL_CXXALIAS_SYS (random, long, (void)); | ||
538 | _GL_CXXALIASWARN (random); | 891 | _GL_CXXALIASWARN (random); |
539 | #elif defined GNULIB_POSIXCHECK | 892 | #elif defined GNULIB_POSIXCHECK |
540 | # undef random | 893 | # undef random |
@@ -545,10 +898,21 @@ _GL_WARN_ON_USE (random, "random is unportable - " | |||
545 | #endif | 898 | #endif |
546 | 899 | ||
547 | #if @GNULIB_RANDOM@ | 900 | #if @GNULIB_RANDOM@ |
548 | # if !@HAVE_RANDOM@ | 901 | # if @REPLACE_RANDOM@ |
902 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
903 | # undef srandom | ||
904 | # define srandom rpl_srandom | ||
905 | # endif | ||
906 | _GL_FUNCDECL_RPL (srandom, void, (unsigned int seed)); | ||
907 | _GL_CXXALIAS_RPL (srandom, void, (unsigned int seed)); | ||
908 | # else | ||
909 | # if !@HAVE_RANDOM@ | ||
549 | _GL_FUNCDECL_SYS (srandom, void, (unsigned int seed)); | 910 | _GL_FUNCDECL_SYS (srandom, void, (unsigned int seed)); |
911 | # endif | ||
912 | /* Need to cast, because on FreeBSD, the first parameter is | ||
913 | unsigned long seed. */ | ||
914 | _GL_CXXALIAS_SYS_CAST (srandom, void, (unsigned int seed)); | ||
550 | # endif | 915 | # endif |
551 | _GL_CXXALIAS_SYS (srandom, void, (unsigned int seed)); | ||
552 | _GL_CXXALIASWARN (srandom); | 916 | _GL_CXXALIASWARN (srandom); |
553 | #elif defined GNULIB_POSIXCHECK | 917 | #elif defined GNULIB_POSIXCHECK |
554 | # undef srandom | 918 | # undef srandom |
@@ -559,31 +923,56 @@ _GL_WARN_ON_USE (srandom, "srandom is unportable - " | |||
559 | #endif | 923 | #endif |
560 | 924 | ||
561 | #if @GNULIB_RANDOM@ | 925 | #if @GNULIB_RANDOM@ |
562 | # if !@HAVE_RANDOM@ | 926 | # if @REPLACE_INITSTATE@ |
927 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
928 | # undef initstate | ||
929 | # define initstate rpl_initstate | ||
930 | # endif | ||
931 | _GL_FUNCDECL_RPL (initstate, char *, | ||
932 | (unsigned int seed, char *buf, size_t buf_size) | ||
933 | _GL_ARG_NONNULL ((2))); | ||
934 | _GL_CXXALIAS_RPL (initstate, char *, | ||
935 | (unsigned int seed, char *buf, size_t buf_size)); | ||
936 | # else | ||
937 | # if !@HAVE_INITSTATE@ || !@HAVE_DECL_INITSTATE@ | ||
563 | _GL_FUNCDECL_SYS (initstate, char *, | 938 | _GL_FUNCDECL_SYS (initstate, char *, |
564 | (unsigned int seed, char *buf, size_t buf_size) | 939 | (unsigned int seed, char *buf, size_t buf_size) |
565 | _GL_ARG_NONNULL ((2))); | 940 | _GL_ARG_NONNULL ((2))); |
941 | # endif | ||
942 | /* Need to cast, because on FreeBSD, the first parameter is | ||
943 | unsigned long seed. */ | ||
944 | _GL_CXXALIAS_SYS_CAST (initstate, char *, | ||
945 | (unsigned int seed, char *buf, size_t buf_size)); | ||
566 | # endif | 946 | # endif |
567 | _GL_CXXALIAS_SYS (initstate, char *, | ||
568 | (unsigned int seed, char *buf, size_t buf_size)); | ||
569 | _GL_CXXALIASWARN (initstate); | 947 | _GL_CXXALIASWARN (initstate); |
570 | #elif defined GNULIB_POSIXCHECK | 948 | #elif defined GNULIB_POSIXCHECK |
571 | # undef initstate | 949 | # undef initstate |
572 | # if HAVE_RAW_DECL_INITSTATE_R | 950 | # if HAVE_RAW_DECL_INITSTATE |
573 | _GL_WARN_ON_USE (initstate, "initstate is unportable - " | 951 | _GL_WARN_ON_USE (initstate, "initstate is unportable - " |
574 | "use gnulib module random for portability"); | 952 | "use gnulib module random for portability"); |
575 | # endif | 953 | # endif |
576 | #endif | 954 | #endif |
577 | 955 | ||
578 | #if @GNULIB_RANDOM@ | 956 | #if @GNULIB_RANDOM@ |
579 | # if !@HAVE_RANDOM@ | 957 | # if @REPLACE_SETSTATE@ |
958 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
959 | # undef setstate | ||
960 | # define setstate rpl_setstate | ||
961 | # endif | ||
962 | _GL_FUNCDECL_RPL (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); | ||
963 | _GL_CXXALIAS_RPL (setstate, char *, (char *arg_state)); | ||
964 | # else | ||
965 | # if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@ | ||
580 | _GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); | 966 | _GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); |
967 | # endif | ||
968 | /* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter | ||
969 | is const char *arg_state. */ | ||
970 | _GL_CXXALIAS_SYS_CAST (setstate, char *, (char *arg_state)); | ||
581 | # endif | 971 | # endif |
582 | _GL_CXXALIAS_SYS (setstate, char *, (char *arg_state)); | ||
583 | _GL_CXXALIASWARN (setstate); | 972 | _GL_CXXALIASWARN (setstate); |
584 | #elif defined GNULIB_POSIXCHECK | 973 | #elif defined GNULIB_POSIXCHECK |
585 | # undef setstate | 974 | # undef setstate |
586 | # if HAVE_RAW_DECL_SETSTATE_R | 975 | # if HAVE_RAW_DECL_SETSTATE |
587 | _GL_WARN_ON_USE (setstate, "setstate is unportable - " | 976 | _GL_WARN_ON_USE (setstate, "setstate is unportable - " |
588 | "use gnulib module random for portability"); | 977 | "use gnulib module random for portability"); |
589 | # endif | 978 | # endif |
@@ -664,9 +1053,11 @@ _GL_FUNCDECL_SYS (initstate_r, int, | |||
664 | struct random_data *rand_state) | 1053 | struct random_data *rand_state) |
665 | _GL_ARG_NONNULL ((2, 4))); | 1054 | _GL_ARG_NONNULL ((2, 4))); |
666 | # endif | 1055 | # endif |
667 | _GL_CXXALIAS_SYS (initstate_r, int, | 1056 | /* Need to cast, because on Haiku, the third parameter is |
668 | (unsigned int seed, char *buf, size_t buf_size, | 1057 | unsigned long buf_size. */ |
669 | struct random_data *rand_state)); | 1058 | _GL_CXXALIAS_SYS_CAST (initstate_r, int, |
1059 | (unsigned int seed, char *buf, size_t buf_size, | ||
1060 | struct random_data *rand_state)); | ||
670 | # endif | 1061 | # endif |
671 | _GL_CXXALIASWARN (initstate_r); | 1062 | _GL_CXXALIASWARN (initstate_r); |
672 | #elif defined GNULIB_POSIXCHECK | 1063 | #elif defined GNULIB_POSIXCHECK |
@@ -694,8 +1085,10 @@ _GL_FUNCDECL_SYS (setstate_r, int, | |||
694 | (char *arg_state, struct random_data *rand_state) | 1085 | (char *arg_state, struct random_data *rand_state) |
695 | _GL_ARG_NONNULL ((1, 2))); | 1086 | _GL_ARG_NONNULL ((1, 2))); |
696 | # endif | 1087 | # endif |
697 | _GL_CXXALIAS_SYS (setstate_r, int, | 1088 | /* Need to cast, because on Haiku, the first parameter is |
698 | (char *arg_state, struct random_data *rand_state)); | 1089 | void *arg_state. */ |
1090 | _GL_CXXALIAS_SYS_CAST (setstate_r, int, | ||
1091 | (char *arg_state, struct random_data *rand_state)); | ||
699 | # endif | 1092 | # endif |
700 | _GL_CXXALIASWARN (setstate_r); | 1093 | _GL_CXXALIASWARN (setstate_r); |
701 | #elif defined GNULIB_POSIXCHECK | 1094 | #elif defined GNULIB_POSIXCHECK |
@@ -714,17 +1107,60 @@ _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - " | |||
714 | # undef realloc | 1107 | # undef realloc |
715 | # define realloc rpl_realloc | 1108 | # define realloc rpl_realloc |
716 | # endif | 1109 | # endif |
717 | _GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size)); | 1110 | _GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size) |
1111 | _GL_ATTRIBUTE_DEALLOC_FREE); | ||
718 | _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size)); | 1112 | _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size)); |
719 | # else | 1113 | # else |
1114 | # if __GNUC__ >= 11 | ||
1115 | /* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */ | ||
1116 | _GL_FUNCDECL_SYS (realloc, void *, (void *ptr, size_t size) | ||
1117 | _GL_ATTRIBUTE_DEALLOC_FREE); | ||
1118 | # endif | ||
720 | _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size)); | 1119 | _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size)); |
721 | # endif | 1120 | # endif |
1121 | # if __GLIBC__ >= 2 | ||
722 | _GL_CXXALIASWARN (realloc); | 1122 | _GL_CXXALIASWARN (realloc); |
723 | #elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC | 1123 | # endif |
724 | # undef realloc | 1124 | #else |
1125 | # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined realloc | ||
1126 | /* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */ | ||
1127 | _GL_FUNCDECL_SYS (realloc, void *, (void *ptr, size_t size) | ||
1128 | _GL_ATTRIBUTE_DEALLOC_FREE); | ||
1129 | # endif | ||
1130 | # if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC | ||
1131 | # undef realloc | ||
725 | /* Assume realloc is always declared. */ | 1132 | /* Assume realloc is always declared. */ |
726 | _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - " | 1133 | _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - " |
727 | "use gnulib module realloc-posix for portability"); | 1134 | "use gnulib module realloc-posix for portability"); |
1135 | # endif | ||
1136 | #endif | ||
1137 | |||
1138 | |||
1139 | #if @GNULIB_REALLOCARRAY@ | ||
1140 | # if @REPLACE_REALLOCARRAY@ | ||
1141 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
1142 | # undef reallocarray | ||
1143 | # define reallocarray rpl_reallocarray | ||
1144 | # endif | ||
1145 | _GL_FUNCDECL_RPL (reallocarray, void *, | ||
1146 | (void *ptr, size_t nmemb, size_t size)); | ||
1147 | _GL_CXXALIAS_RPL (reallocarray, void *, | ||
1148 | (void *ptr, size_t nmemb, size_t size)); | ||
1149 | # else | ||
1150 | # if ! @HAVE_REALLOCARRAY@ | ||
1151 | _GL_FUNCDECL_SYS (reallocarray, void *, | ||
1152 | (void *ptr, size_t nmemb, size_t size)); | ||
1153 | # endif | ||
1154 | _GL_CXXALIAS_SYS (reallocarray, void *, | ||
1155 | (void *ptr, size_t nmemb, size_t size)); | ||
1156 | # endif | ||
1157 | _GL_CXXALIASWARN (reallocarray); | ||
1158 | #elif defined GNULIB_POSIXCHECK | ||
1159 | # undef reallocarray | ||
1160 | # if HAVE_RAW_DECL_REALLOCARRAY | ||
1161 | _GL_WARN_ON_USE (reallocarray, "reallocarray is not portable - " | ||
1162 | "use gnulib module reallocarray for portability"); | ||
1163 | # endif | ||
728 | #endif | 1164 | #endif |
729 | 1165 | ||
730 | #if @GNULIB_REALPATH@ | 1166 | #if @GNULIB_REALPATH@ |
@@ -732,15 +1168,19 @@ _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - " | |||
732 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1168 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
733 | # define realpath rpl_realpath | 1169 | # define realpath rpl_realpath |
734 | # endif | 1170 | # endif |
735 | _GL_FUNCDECL_RPL (realpath, char *, (const char *name, char *resolved) | 1171 | _GL_FUNCDECL_RPL (realpath, char *, |
736 | _GL_ARG_NONNULL ((1))); | 1172 | (const char *restrict name, char *restrict resolved) |
737 | _GL_CXXALIAS_RPL (realpath, char *, (const char *name, char *resolved)); | 1173 | _GL_ARG_NONNULL ((1))); |
1174 | _GL_CXXALIAS_RPL (realpath, char *, | ||
1175 | (const char *restrict name, char *restrict resolved)); | ||
738 | # else | 1176 | # else |
739 | # if !@HAVE_REALPATH@ | 1177 | # if !@HAVE_REALPATH@ |
740 | _GL_FUNCDECL_SYS (realpath, char *, (const char *name, char *resolved) | 1178 | _GL_FUNCDECL_SYS (realpath, char *, |
741 | _GL_ARG_NONNULL ((1))); | 1179 | (const char *restrict name, char *restrict resolved) |
1180 | _GL_ARG_NONNULL ((1))); | ||
742 | # endif | 1181 | # endif |
743 | _GL_CXXALIAS_SYS (realpath, char *, (const char *name, char *resolved)); | 1182 | _GL_CXXALIAS_SYS (realpath, char *, |
1183 | (const char *restrict name, char *restrict resolved)); | ||
744 | # endif | 1184 | # endif |
745 | _GL_CXXALIASWARN (realpath); | 1185 | _GL_CXXALIASWARN (realpath); |
746 | #elif defined GNULIB_POSIXCHECK | 1186 | #elif defined GNULIB_POSIXCHECK |
@@ -822,17 +1262,24 @@ _GL_WARN_ON_USE (setenv, "setenv is unportable - " | |||
822 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1262 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
823 | # define strtod rpl_strtod | 1263 | # define strtod rpl_strtod |
824 | # endif | 1264 | # endif |
825 | _GL_FUNCDECL_RPL (strtod, double, (const char *str, char **endp) | 1265 | # define GNULIB_defined_strtod_function 1 |
826 | _GL_ARG_NONNULL ((1))); | 1266 | _GL_FUNCDECL_RPL (strtod, double, |
827 | _GL_CXXALIAS_RPL (strtod, double, (const char *str, char **endp)); | 1267 | (const char *restrict str, char **restrict endp) |
1268 | _GL_ARG_NONNULL ((1))); | ||
1269 | _GL_CXXALIAS_RPL (strtod, double, | ||
1270 | (const char *restrict str, char **restrict endp)); | ||
828 | # else | 1271 | # else |
829 | # if !@HAVE_STRTOD@ | 1272 | # if !@HAVE_STRTOD@ |
830 | _GL_FUNCDECL_SYS (strtod, double, (const char *str, char **endp) | 1273 | _GL_FUNCDECL_SYS (strtod, double, |
831 | _GL_ARG_NONNULL ((1))); | 1274 | (const char *restrict str, char **restrict endp) |
1275 | _GL_ARG_NONNULL ((1))); | ||
832 | # endif | 1276 | # endif |
833 | _GL_CXXALIAS_SYS (strtod, double, (const char *str, char **endp)); | 1277 | _GL_CXXALIAS_SYS (strtod, double, |
1278 | (const char *restrict str, char **restrict endp)); | ||
834 | # endif | 1279 | # endif |
1280 | # if __GLIBC__ >= 2 | ||
835 | _GL_CXXALIASWARN (strtod); | 1281 | _GL_CXXALIASWARN (strtod); |
1282 | # endif | ||
836 | #elif defined GNULIB_POSIXCHECK | 1283 | #elif defined GNULIB_POSIXCHECK |
837 | # undef strtod | 1284 | # undef strtod |
838 | # if HAVE_RAW_DECL_STRTOD | 1285 | # if HAVE_RAW_DECL_STRTOD |
@@ -841,6 +1288,77 @@ _GL_WARN_ON_USE (strtod, "strtod is unportable - " | |||
841 | # endif | 1288 | # endif |
842 | #endif | 1289 | #endif |
843 | 1290 | ||
1291 | #if @GNULIB_STRTOLD@ | ||
1292 | /* Parse a 'long double' from STRING, updating ENDP if appropriate. */ | ||
1293 | # if @REPLACE_STRTOLD@ | ||
1294 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
1295 | # define strtold rpl_strtold | ||
1296 | # endif | ||
1297 | # define GNULIB_defined_strtold_function 1 | ||
1298 | _GL_FUNCDECL_RPL (strtold, long double, | ||
1299 | (const char *restrict str, char **restrict endp) | ||
1300 | _GL_ARG_NONNULL ((1))); | ||
1301 | _GL_CXXALIAS_RPL (strtold, long double, | ||
1302 | (const char *restrict str, char **restrict endp)); | ||
1303 | # else | ||
1304 | # if !@HAVE_STRTOLD@ | ||
1305 | _GL_FUNCDECL_SYS (strtold, long double, | ||
1306 | (const char *restrict str, char **restrict endp) | ||
1307 | _GL_ARG_NONNULL ((1))); | ||
1308 | # endif | ||
1309 | _GL_CXXALIAS_SYS (strtold, long double, | ||
1310 | (const char *restrict str, char **restrict endp)); | ||
1311 | # endif | ||
1312 | _GL_CXXALIASWARN (strtold); | ||
1313 | #elif defined GNULIB_POSIXCHECK | ||
1314 | # undef strtold | ||
1315 | # if HAVE_RAW_DECL_STRTOLD | ||
1316 | _GL_WARN_ON_USE (strtold, "strtold is unportable - " | ||
1317 | "use gnulib module strtold for portability"); | ||
1318 | # endif | ||
1319 | #endif | ||
1320 | |||
1321 | #if @GNULIB_STRTOL@ | ||
1322 | /* Parse a signed integer whose textual representation starts at STRING. | ||
1323 | The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, | ||
1324 | it may be decimal or octal (with prefix "0") or hexadecimal (with prefix | ||
1325 | "0x"). | ||
1326 | If ENDPTR is not NULL, the address of the first byte after the integer is | ||
1327 | stored in *ENDPTR. | ||
1328 | Upon overflow, the return value is LONG_MAX or LONG_MIN, and errno is set | ||
1329 | to ERANGE. */ | ||
1330 | # if @REPLACE_STRTOL@ | ||
1331 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
1332 | # define strtol rpl_strtol | ||
1333 | # endif | ||
1334 | # define GNULIB_defined_strtol_function 1 | ||
1335 | _GL_FUNCDECL_RPL (strtol, long, | ||
1336 | (const char *restrict string, char **restrict endptr, | ||
1337 | int base) | ||
1338 | _GL_ARG_NONNULL ((1))); | ||
1339 | _GL_CXXALIAS_RPL (strtol, long, | ||
1340 | (const char *restrict string, char **restrict endptr, | ||
1341 | int base)); | ||
1342 | # else | ||
1343 | # if !@HAVE_STRTOL@ | ||
1344 | _GL_FUNCDECL_SYS (strtol, long, | ||
1345 | (const char *restrict string, char **restrict endptr, | ||
1346 | int base) | ||
1347 | _GL_ARG_NONNULL ((1))); | ||
1348 | # endif | ||
1349 | _GL_CXXALIAS_SYS (strtol, long, | ||
1350 | (const char *restrict string, char **restrict endptr, | ||
1351 | int base)); | ||
1352 | # endif | ||
1353 | _GL_CXXALIASWARN (strtol); | ||
1354 | #elif defined GNULIB_POSIXCHECK | ||
1355 | # undef strtol | ||
1356 | # if HAVE_RAW_DECL_STRTOL | ||
1357 | _GL_WARN_ON_USE (strtol, "strtol is unportable - " | ||
1358 | "use gnulib module strtol for portability"); | ||
1359 | # endif | ||
1360 | #endif | ||
1361 | |||
844 | #if @GNULIB_STRTOLL@ | 1362 | #if @GNULIB_STRTOLL@ |
845 | /* Parse a signed integer whose textual representation starts at STRING. | 1363 | /* 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, | 1364 | The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, |
@@ -850,13 +1368,29 @@ _GL_WARN_ON_USE (strtod, "strtod is unportable - " | |||
850 | stored in *ENDPTR. | 1368 | stored in *ENDPTR. |
851 | Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set | 1369 | Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set |
852 | to ERANGE. */ | 1370 | to ERANGE. */ |
853 | # if !@HAVE_STRTOLL@ | 1371 | # if @REPLACE_STRTOLL@ |
1372 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
1373 | # define strtoll rpl_strtoll | ||
1374 | # endif | ||
1375 | # define GNULIB_defined_strtoll_function 1 | ||
1376 | _GL_FUNCDECL_RPL (strtoll, long long, | ||
1377 | (const char *restrict string, char **restrict endptr, | ||
1378 | int base) | ||
1379 | _GL_ARG_NONNULL ((1))); | ||
1380 | _GL_CXXALIAS_RPL (strtoll, long long, | ||
1381 | (const char *restrict string, char **restrict endptr, | ||
1382 | int base)); | ||
1383 | # else | ||
1384 | # if !@HAVE_STRTOLL@ | ||
854 | _GL_FUNCDECL_SYS (strtoll, long long, | 1385 | _GL_FUNCDECL_SYS (strtoll, long long, |
855 | (const char *string, char **endptr, int base) | 1386 | (const char *restrict string, char **restrict endptr, |
1387 | int base) | ||
856 | _GL_ARG_NONNULL ((1))); | 1388 | _GL_ARG_NONNULL ((1))); |
857 | # endif | 1389 | # endif |
858 | _GL_CXXALIAS_SYS (strtoll, long long, | 1390 | _GL_CXXALIAS_SYS (strtoll, long long, |
859 | (const char *string, char **endptr, int base)); | 1391 | (const char *restrict string, char **restrict endptr, |
1392 | int base)); | ||
1393 | # endif | ||
860 | _GL_CXXALIASWARN (strtoll); | 1394 | _GL_CXXALIASWARN (strtoll); |
861 | #elif defined GNULIB_POSIXCHECK | 1395 | #elif defined GNULIB_POSIXCHECK |
862 | # undef strtoll | 1396 | # undef strtoll |
@@ -866,6 +1400,46 @@ _GL_WARN_ON_USE (strtoll, "strtoll is unportable - " | |||
866 | # endif | 1400 | # endif |
867 | #endif | 1401 | #endif |
868 | 1402 | ||
1403 | #if @GNULIB_STRTOUL@ | ||
1404 | /* Parse an unsigned integer whose textual representation starts at STRING. | ||
1405 | The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, | ||
1406 | it may be decimal or octal (with prefix "0") or hexadecimal (with prefix | ||
1407 | "0x"). | ||
1408 | If ENDPTR is not NULL, the address of the first byte after the integer is | ||
1409 | stored in *ENDPTR. | ||
1410 | Upon overflow, the return value is ULONG_MAX, and errno is set to ERANGE. */ | ||
1411 | # if @REPLACE_STRTOUL@ | ||
1412 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
1413 | # define strtoul rpl_strtoul | ||
1414 | # endif | ||
1415 | # define GNULIB_defined_strtoul_function 1 | ||
1416 | _GL_FUNCDECL_RPL (strtoul, unsigned long, | ||
1417 | (const char *restrict string, char **restrict endptr, | ||
1418 | int base) | ||
1419 | _GL_ARG_NONNULL ((1))); | ||
1420 | _GL_CXXALIAS_RPL (strtoul, unsigned long, | ||
1421 | (const char *restrict string, char **restrict endptr, | ||
1422 | int base)); | ||
1423 | # else | ||
1424 | # if !@HAVE_STRTOUL@ | ||
1425 | _GL_FUNCDECL_SYS (strtoul, unsigned long, | ||
1426 | (const char *restrict string, char **restrict endptr, | ||
1427 | int base) | ||
1428 | _GL_ARG_NONNULL ((1))); | ||
1429 | # endif | ||
1430 | _GL_CXXALIAS_SYS (strtoul, unsigned long, | ||
1431 | (const char *restrict string, char **restrict endptr, | ||
1432 | int base)); | ||
1433 | # endif | ||
1434 | _GL_CXXALIASWARN (strtoul); | ||
1435 | #elif defined GNULIB_POSIXCHECK | ||
1436 | # undef strtoul | ||
1437 | # if HAVE_RAW_DECL_STRTOUL | ||
1438 | _GL_WARN_ON_USE (strtoul, "strtoul is unportable - " | ||
1439 | "use gnulib module strtoul for portability"); | ||
1440 | # endif | ||
1441 | #endif | ||
1442 | |||
869 | #if @GNULIB_STRTOULL@ | 1443 | #if @GNULIB_STRTOULL@ |
870 | /* Parse an unsigned integer whose textual representation starts at STRING. | 1444 | /* 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, | 1445 | The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, |
@@ -875,13 +1449,29 @@ _GL_WARN_ON_USE (strtoll, "strtoll is unportable - " | |||
875 | stored in *ENDPTR. | 1449 | stored in *ENDPTR. |
876 | Upon overflow, the return value is ULLONG_MAX, and errno is set to | 1450 | Upon overflow, the return value is ULLONG_MAX, and errno is set to |
877 | ERANGE. */ | 1451 | ERANGE. */ |
878 | # if !@HAVE_STRTOULL@ | 1452 | # if @REPLACE_STRTOULL@ |
1453 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
1454 | # define strtoull rpl_strtoull | ||
1455 | # endif | ||
1456 | # define GNULIB_defined_strtoull_function 1 | ||
1457 | _GL_FUNCDECL_RPL (strtoull, unsigned long long, | ||
1458 | (const char *restrict string, char **restrict endptr, | ||
1459 | int base) | ||
1460 | _GL_ARG_NONNULL ((1))); | ||
1461 | _GL_CXXALIAS_RPL (strtoull, unsigned long long, | ||
1462 | (const char *restrict string, char **restrict endptr, | ||
1463 | int base)); | ||
1464 | # else | ||
1465 | # if !@HAVE_STRTOULL@ | ||
879 | _GL_FUNCDECL_SYS (strtoull, unsigned long long, | 1466 | _GL_FUNCDECL_SYS (strtoull, unsigned long long, |
880 | (const char *string, char **endptr, int base) | 1467 | (const char *restrict string, char **restrict endptr, |
1468 | int base) | ||
881 | _GL_ARG_NONNULL ((1))); | 1469 | _GL_ARG_NONNULL ((1))); |
882 | # endif | 1470 | # endif |
883 | _GL_CXXALIAS_SYS (strtoull, unsigned long long, | 1471 | _GL_CXXALIAS_SYS (strtoull, unsigned long long, |
884 | (const char *string, char **endptr, int base)); | 1472 | (const char *restrict string, char **restrict endptr, |
1473 | int base)); | ||
1474 | # endif | ||
885 | _GL_CXXALIASWARN (strtoull); | 1475 | _GL_CXXALIASWARN (strtoull); |
886 | #elif defined GNULIB_POSIXCHECK | 1476 | #elif defined GNULIB_POSIXCHECK |
887 | # undef strtoull | 1477 | # undef strtoull |
@@ -945,7 +1535,9 @@ _GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc)); | |||
945 | # else | 1535 | # else |
946 | _GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc)); | 1536 | _GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc)); |
947 | # endif | 1537 | # endif |
1538 | # if __GLIBC__ >= 2 | ||
948 | _GL_CXXALIASWARN (wctomb); | 1539 | _GL_CXXALIASWARN (wctomb); |
1540 | # endif | ||
949 | #endif | 1541 | #endif |
950 | 1542 | ||
951 | 1543 | ||