diff options
Diffstat (limited to 'gl/string.in.h')
-rw-r--r-- | gl/string.in.h | 200 |
1 files changed, 169 insertions, 31 deletions
diff --git a/gl/string.in.h b/gl/string.in.h index e993b2f..44ec2e7 100644 --- a/gl/string.in.h +++ b/gl/string.in.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* A GNU-like <string.h>. | 1 | /* A GNU-like <string.h>. |
2 | 2 | ||
3 | Copyright (C) 1995-1996, 2001-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 1995-1996, 2001-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file 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 Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -44,6 +44,13 @@ | |||
44 | #ifndef _@GUARD_PREFIX@_STRING_H | 44 | #ifndef _@GUARD_PREFIX@_STRING_H |
45 | #define _@GUARD_PREFIX@_STRING_H | 45 | #define _@GUARD_PREFIX@_STRING_H |
46 | 46 | ||
47 | /* This file uses _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_MALLOC, | ||
48 | _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PURE, GNULIB_POSIXCHECK, | ||
49 | HAVE_RAW_DECL_*. */ | ||
50 | #if !_GL_CONFIG_H_INCLUDED | ||
51 | #error "Please include config.h first." | ||
52 | #endif | ||
53 | |||
47 | /* NetBSD 5.0 mis-defines NULL. */ | 54 | /* NetBSD 5.0 mis-defines NULL. */ |
48 | #include <stddef.h> | 55 | #include <stddef.h> |
49 | 56 | ||
@@ -59,10 +66,11 @@ | |||
59 | # include <unistd.h> | 66 | # include <unistd.h> |
60 | #endif | 67 | #endif |
61 | 68 | ||
62 | /* AIX 7.2 declares ffsl and ffsll in <strings.h>, not in <string.h>. */ | 69 | /* AIX 7.2 and Android 13 declare ffsl and ffsll in <strings.h>, not in |
70 | <string.h>. */ | ||
63 | /* But in any case avoid namespace pollution on glibc systems. */ | 71 | /* But in any case avoid namespace pollution on glibc systems. */ |
64 | #if ((@GNULIB_FFSL@ || @GNULIB_FFSLL@ || defined GNULIB_POSIXCHECK) \ | 72 | #if ((@GNULIB_FFSL@ || @GNULIB_FFSLL@ || defined GNULIB_POSIXCHECK) \ |
65 | && defined _AIX) \ | 73 | && (defined _AIX || defined __ANDROID__)) \ |
66 | && ! defined __GLIBC__ | 74 | && ! defined __GLIBC__ |
67 | # include <strings.h> | 75 | # include <strings.h> |
68 | #endif | 76 | #endif |
@@ -103,6 +111,28 @@ | |||
103 | # endif | 111 | # endif |
104 | #endif | 112 | #endif |
105 | 113 | ||
114 | /* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions. | ||
115 | */ | ||
116 | #ifndef _GL_ATTRIBUTE_NOTHROW | ||
117 | # if defined __cplusplus | ||
118 | # if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4 | ||
119 | # if __cplusplus >= 201103L | ||
120 | # define _GL_ATTRIBUTE_NOTHROW noexcept (true) | ||
121 | # else | ||
122 | # define _GL_ATTRIBUTE_NOTHROW throw () | ||
123 | # endif | ||
124 | # else | ||
125 | # define _GL_ATTRIBUTE_NOTHROW | ||
126 | # endif | ||
127 | # else | ||
128 | # if (__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__ | ||
129 | # define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__)) | ||
130 | # else | ||
131 | # define _GL_ATTRIBUTE_NOTHROW | ||
132 | # endif | ||
133 | # endif | ||
134 | #endif | ||
135 | |||
106 | /* The __attribute__ feature is available in gcc versions 2.5 and later. | 136 | /* The __attribute__ feature is available in gcc versions 2.5 and later. |
107 | The attribute __pure__ was added in gcc 2.96. */ | 137 | The attribute __pure__ was added in gcc 2.96. */ |
108 | #ifndef _GL_ATTRIBUTE_PURE | 138 | #ifndef _GL_ATTRIBUTE_PURE |
@@ -125,7 +155,11 @@ | |||
125 | # if (@REPLACE_FREE@ && !defined free \ | 155 | # if (@REPLACE_FREE@ && !defined free \ |
126 | && !(defined __cplusplus && defined GNULIB_NAMESPACE)) | 156 | && !(defined __cplusplus && defined GNULIB_NAMESPACE)) |
127 | /* We can't do '#define free rpl_free' here. */ | 157 | /* We can't do '#define free rpl_free' here. */ |
158 | # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) | ||
159 | _GL_EXTERN_C void rpl_free (void *) _GL_ATTRIBUTE_NOTHROW; | ||
160 | # else | ||
128 | _GL_EXTERN_C void rpl_free (void *); | 161 | _GL_EXTERN_C void rpl_free (void *); |
162 | # endif | ||
129 | # undef _GL_ATTRIBUTE_DEALLOC_FREE | 163 | # undef _GL_ATTRIBUTE_DEALLOC_FREE |
130 | # define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1) | 164 | # define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1) |
131 | # else | 165 | # else |
@@ -137,7 +171,7 @@ _GL_EXTERN_C | |||
137 | void __cdecl free (void *); | 171 | void __cdecl free (void *); |
138 | # else | 172 | # else |
139 | # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) | 173 | # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) |
140 | _GL_EXTERN_C void free (void *) throw (); | 174 | _GL_EXTERN_C void free (void *) _GL_ATTRIBUTE_NOTHROW; |
141 | # else | 175 | # else |
142 | _GL_EXTERN_C void free (void *); | 176 | _GL_EXTERN_C void free (void *); |
143 | # endif | 177 | # endif |
@@ -152,7 +186,7 @@ _GL_EXTERN_C | |||
152 | void __cdecl free (void *); | 186 | void __cdecl free (void *); |
153 | # else | 187 | # else |
154 | # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) | 188 | # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) |
155 | _GL_EXTERN_C void free (void *) throw (); | 189 | _GL_EXTERN_C void free (void *) _GL_ATTRIBUTE_NOTHROW; |
156 | # else | 190 | # else |
157 | _GL_EXTERN_C void free (void *); | 191 | _GL_EXTERN_C void free (void *); |
158 | # endif | 192 | # endif |
@@ -255,9 +289,12 @@ _GL_CXXALIAS_SYS_CAST2 (memchr, | |||
255 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ | 289 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ |
256 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \ | 290 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \ |
257 | || defined __clang__) | 291 | || defined __clang__) |
258 | _GL_CXXALIASWARN1 (memchr, void *, (void *__s, int __c, size_t __n) throw ()); | 292 | _GL_CXXALIASWARN1 (memchr, void *, |
293 | (void *__s, int __c, size_t __n) | ||
294 | _GL_ATTRIBUTE_NOTHROW); | ||
259 | _GL_CXXALIASWARN1 (memchr, void const *, | 295 | _GL_CXXALIASWARN1 (memchr, void const *, |
260 | (void const *__s, int __c, size_t __n) throw ()); | 296 | (void const *__s, int __c, size_t __n) |
297 | _GL_ATTRIBUTE_NOTHROW); | ||
261 | # elif __GLIBC__ >= 2 | 298 | # elif __GLIBC__ >= 2 |
262 | _GL_CXXALIASWARN (memchr); | 299 | _GL_CXXALIASWARN (memchr); |
263 | # endif | 300 | # endif |
@@ -307,16 +344,32 @@ _GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - " | |||
307 | /* Copy N bytes of SRC to DEST, return pointer to bytes after the | 344 | /* Copy N bytes of SRC to DEST, return pointer to bytes after the |
308 | last written byte. */ | 345 | last written byte. */ |
309 | #if @GNULIB_MEMPCPY@ | 346 | #if @GNULIB_MEMPCPY@ |
310 | # if ! @HAVE_MEMPCPY@ | 347 | # if @REPLACE_MEMPCPY@ |
348 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
349 | # undef mempcpy | ||
350 | # define mempcpy rpl_mempcpy | ||
351 | # endif | ||
352 | _GL_FUNCDECL_RPL (mempcpy, void *, | ||
353 | (void *restrict __dest, void const *restrict __src, | ||
354 | size_t __n) | ||
355 | _GL_ARG_NONNULL ((1, 2))); | ||
356 | _GL_CXXALIAS_RPL (mempcpy, void *, | ||
357 | (void *restrict __dest, void const *restrict __src, | ||
358 | size_t __n)); | ||
359 | # else | ||
360 | # if !@HAVE_MEMPCPY@ | ||
311 | _GL_FUNCDECL_SYS (mempcpy, void *, | 361 | _GL_FUNCDECL_SYS (mempcpy, void *, |
312 | (void *restrict __dest, void const *restrict __src, | 362 | (void *restrict __dest, void const *restrict __src, |
313 | size_t __n) | 363 | size_t __n) |
314 | _GL_ARG_NONNULL ((1, 2))); | 364 | _GL_ARG_NONNULL ((1, 2))); |
315 | # endif | 365 | # endif |
316 | _GL_CXXALIAS_SYS (mempcpy, void *, | 366 | _GL_CXXALIAS_SYS (mempcpy, void *, |
317 | (void *restrict __dest, void const *restrict __src, | 367 | (void *restrict __dest, void const *restrict __src, |
318 | size_t __n)); | 368 | size_t __n)); |
369 | # endif | ||
370 | # if __GLIBC__ >= 2 | ||
319 | _GL_CXXALIASWARN (mempcpy); | 371 | _GL_CXXALIASWARN (mempcpy); |
372 | # endif | ||
320 | #elif defined GNULIB_POSIXCHECK | 373 | #elif defined GNULIB_POSIXCHECK |
321 | # undef mempcpy | 374 | # undef mempcpy |
322 | # if HAVE_RAW_DECL_MEMPCPY | 375 | # if HAVE_RAW_DECL_MEMPCPY |
@@ -341,9 +394,13 @@ _GL_CXXALIAS_SYS_CAST2 (memrchr, | |||
341 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ | 394 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ |
342 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \ | 395 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \ |
343 | || defined __clang__) | 396 | || defined __clang__) |
344 | _GL_CXXALIASWARN1 (memrchr, void *, (void *, int, size_t) throw ()); | 397 | _GL_CXXALIASWARN1 (memrchr, void *, |
345 | _GL_CXXALIASWARN1 (memrchr, void const *, (void const *, int, size_t) throw ()); | 398 | (void *, int, size_t) |
346 | # else | 399 | _GL_ATTRIBUTE_NOTHROW); |
400 | _GL_CXXALIASWARN1 (memrchr, void const *, | ||
401 | (void const *, int, size_t) | ||
402 | _GL_ATTRIBUTE_NOTHROW); | ||
403 | # elif __GLIBC__ >= 2 | ||
347 | _GL_CXXALIASWARN (memrchr); | 404 | _GL_CXXALIASWARN (memrchr); |
348 | # endif | 405 | # endif |
349 | #elif defined GNULIB_POSIXCHECK | 406 | #elif defined GNULIB_POSIXCHECK |
@@ -357,11 +414,21 @@ _GL_WARN_ON_USE (memrchr, "memrchr is unportable - " | |||
357 | /* Overwrite a block of memory. The compiler will not optimize | 414 | /* Overwrite a block of memory. The compiler will not optimize |
358 | effects away, even if the block is dead after the call. */ | 415 | effects away, even if the block is dead after the call. */ |
359 | #if @GNULIB_MEMSET_EXPLICIT@ | 416 | #if @GNULIB_MEMSET_EXPLICIT@ |
360 | # if ! @HAVE_MEMSET_EXPLICIT@ | 417 | # if @REPLACE_MEMSET_EXPLICIT@ |
418 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
419 | # undef memset_explicit | ||
420 | # define memset_explicit rpl_memset_explicit | ||
421 | # endif | ||
422 | _GL_FUNCDECL_RPL (memset_explicit, void *, | ||
423 | (void *__dest, int __c, size_t __n) _GL_ARG_NONNULL ((1))); | ||
424 | _GL_CXXALIAS_RPL (memset_explicit, void *, (void *__dest, int __c, size_t __n)); | ||
425 | # else | ||
426 | # if !@HAVE_MEMSET_EXPLICIT@ | ||
361 | _GL_FUNCDECL_SYS (memset_explicit, void *, | 427 | _GL_FUNCDECL_SYS (memset_explicit, void *, |
362 | (void *__dest, int __c, size_t __n) _GL_ARG_NONNULL ((1))); | 428 | (void *__dest, int __c, size_t __n) _GL_ARG_NONNULL ((1))); |
363 | # endif | 429 | # endif |
364 | _GL_CXXALIAS_SYS (memset_explicit, void *, (void *__dest, int __c, size_t __n)); | 430 | _GL_CXXALIAS_SYS (memset_explicit, void *, (void *__dest, int __c, size_t __n)); |
431 | # endif | ||
365 | _GL_CXXALIASWARN (memset_explicit); | 432 | _GL_CXXALIASWARN (memset_explicit); |
366 | #elif defined GNULIB_POSIXCHECK | 433 | #elif defined GNULIB_POSIXCHECK |
367 | # undef memset_explicit | 434 | # undef memset_explicit |
@@ -389,9 +456,12 @@ _GL_CXXALIAS_SYS_CAST2 (rawmemchr, | |||
389 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ | 456 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ |
390 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \ | 457 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \ |
391 | || defined __clang__) | 458 | || defined __clang__) |
392 | _GL_CXXALIASWARN1 (rawmemchr, void *, (void *__s, int __c_in) throw ()); | 459 | _GL_CXXALIASWARN1 (rawmemchr, void *, |
460 | (void *__s, int __c_in) | ||
461 | _GL_ATTRIBUTE_NOTHROW); | ||
393 | _GL_CXXALIASWARN1 (rawmemchr, void const *, | 462 | _GL_CXXALIASWARN1 (rawmemchr, void const *, |
394 | (void const *__s, int __c_in) throw ()); | 463 | (void const *__s, int __c_in) |
464 | _GL_ATTRIBUTE_NOTHROW); | ||
395 | # else | 465 | # else |
396 | _GL_CXXALIASWARN (rawmemchr); | 466 | _GL_CXXALIASWARN (rawmemchr); |
397 | # endif | 467 | # endif |
@@ -405,14 +475,28 @@ _GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - " | |||
405 | 475 | ||
406 | /* Copy SRC to DST, returning the address of the terminating '\0' in DST. */ | 476 | /* Copy SRC to DST, returning the address of the terminating '\0' in DST. */ |
407 | #if @GNULIB_STPCPY@ | 477 | #if @GNULIB_STPCPY@ |
408 | # if ! @HAVE_STPCPY@ | 478 | # if @REPLACE_STPCPY@ |
479 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
480 | # undef stpcpy | ||
481 | # define stpcpy rpl_stpcpy | ||
482 | # endif | ||
483 | _GL_FUNCDECL_RPL (stpcpy, char *, | ||
484 | (char *restrict __dst, char const *restrict __src) | ||
485 | _GL_ARG_NONNULL ((1, 2))); | ||
486 | _GL_CXXALIAS_RPL (stpcpy, char *, | ||
487 | (char *restrict __dst, char const *restrict __src)); | ||
488 | # else | ||
489 | # if !@HAVE_STPCPY@ | ||
409 | _GL_FUNCDECL_SYS (stpcpy, char *, | 490 | _GL_FUNCDECL_SYS (stpcpy, char *, |
410 | (char *restrict __dst, char const *restrict __src) | 491 | (char *restrict __dst, char const *restrict __src) |
411 | _GL_ARG_NONNULL ((1, 2))); | 492 | _GL_ARG_NONNULL ((1, 2))); |
412 | # endif | 493 | # endif |
413 | _GL_CXXALIAS_SYS (stpcpy, char *, | 494 | _GL_CXXALIAS_SYS (stpcpy, char *, |
414 | (char *restrict __dst, char const *restrict __src)); | 495 | (char *restrict __dst, char const *restrict __src)); |
496 | # endif | ||
497 | # if __GLIBC__ >= 2 | ||
415 | _GL_CXXALIASWARN (stpcpy); | 498 | _GL_CXXALIASWARN (stpcpy); |
499 | # endif | ||
416 | #elif defined GNULIB_POSIXCHECK | 500 | #elif defined GNULIB_POSIXCHECK |
417 | # undef stpcpy | 501 | # undef stpcpy |
418 | # if HAVE_RAW_DECL_STPCPY | 502 | # if HAVE_RAW_DECL_STPCPY |
@@ -447,7 +531,9 @@ _GL_CXXALIAS_SYS (stpncpy, char *, | |||
447 | (char *restrict __dst, char const *restrict __src, | 531 | (char *restrict __dst, char const *restrict __src, |
448 | size_t __n)); | 532 | size_t __n)); |
449 | # endif | 533 | # endif |
534 | # if __GLIBC__ >= 2 | ||
450 | _GL_CXXALIASWARN (stpncpy); | 535 | _GL_CXXALIASWARN (stpncpy); |
536 | # endif | ||
451 | #elif defined GNULIB_POSIXCHECK | 537 | #elif defined GNULIB_POSIXCHECK |
452 | # undef stpncpy | 538 | # undef stpncpy |
453 | # if HAVE_RAW_DECL_STPNCPY | 539 | # if HAVE_RAW_DECL_STPNCPY |
@@ -495,10 +581,13 @@ _GL_CXXALIAS_SYS_CAST2 (strchrnul, | |||
495 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ | 581 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ |
496 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \ | 582 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \ |
497 | || defined __clang__) | 583 | || defined __clang__) |
498 | _GL_CXXALIASWARN1 (strchrnul, char *, (char *__s, int __c_in) throw ()); | 584 | _GL_CXXALIASWARN1 (strchrnul, char *, |
585 | (char *__s, int __c_in) | ||
586 | _GL_ATTRIBUTE_NOTHROW); | ||
499 | _GL_CXXALIASWARN1 (strchrnul, char const *, | 587 | _GL_CXXALIASWARN1 (strchrnul, char const *, |
500 | (char const *__s, int __c_in) throw ()); | 588 | (char const *__s, int __c_in) |
501 | # else | 589 | _GL_ATTRIBUTE_NOTHROW); |
590 | # elif __GLIBC__ >= 2 | ||
502 | _GL_CXXALIASWARN (strchrnul); | 591 | _GL_CXXALIASWARN (strchrnul); |
503 | # endif | 592 | # endif |
504 | #elif defined GNULIB_POSIXCHECK | 593 | #elif defined GNULIB_POSIXCHECK |
@@ -533,10 +622,18 @@ _GL_CXXALIAS_MDA (strdup, char *, (char const *__s)); | |||
533 | # undef strdup | 622 | # undef strdup |
534 | # endif | 623 | # endif |
535 | # if (!@HAVE_DECL_STRDUP@ || __GNUC__ >= 11) && !defined strdup | 624 | # if (!@HAVE_DECL_STRDUP@ || __GNUC__ >= 11) && !defined strdup |
625 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 | ||
626 | _GL_FUNCDECL_SYS (strdup, char *, | ||
627 | (char const *__s) | ||
628 | _GL_ATTRIBUTE_NOTHROW | ||
629 | _GL_ARG_NONNULL ((1)) | ||
630 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
631 | # else | ||
536 | _GL_FUNCDECL_SYS (strdup, char *, | 632 | _GL_FUNCDECL_SYS (strdup, char *, |
537 | (char const *__s) | 633 | (char const *__s) |
538 | _GL_ARG_NONNULL ((1)) | 634 | _GL_ARG_NONNULL ((1)) |
539 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 635 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); |
636 | # endif | ||
540 | # endif | 637 | # endif |
541 | _GL_CXXALIAS_SYS (strdup, char *, (char const *__s)); | 638 | _GL_CXXALIAS_SYS (strdup, char *, (char const *__s)); |
542 | # endif | 639 | # endif |
@@ -544,10 +641,18 @@ _GL_CXXALIASWARN (strdup); | |||
544 | #else | 641 | #else |
545 | # if __GNUC__ >= 11 && !defined strdup | 642 | # if __GNUC__ >= 11 && !defined strdup |
546 | /* For -Wmismatched-dealloc: Associate strdup with free or rpl_free. */ | 643 | /* For -Wmismatched-dealloc: Associate strdup with free or rpl_free. */ |
644 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 | ||
547 | _GL_FUNCDECL_SYS (strdup, char *, | 645 | _GL_FUNCDECL_SYS (strdup, char *, |
548 | (char const *__s) | 646 | (char const *__s) |
647 | _GL_ATTRIBUTE_NOTHROW | ||
549 | _GL_ARG_NONNULL ((1)) | 648 | _GL_ARG_NONNULL ((1)) |
550 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 649 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); |
650 | # else | ||
651 | _GL_FUNCDECL_SYS (strdup, char *, | ||
652 | (char const *__s) | ||
653 | _GL_ARG_NONNULL ((1)) | ||
654 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
655 | # endif | ||
551 | # endif | 656 | # endif |
552 | # if defined GNULIB_POSIXCHECK | 657 | # if defined GNULIB_POSIXCHECK |
553 | # undef strdup | 658 | # undef strdup |
@@ -616,10 +721,18 @@ _GL_FUNCDECL_RPL (strndup, char *, | |||
616 | _GL_CXXALIAS_RPL (strndup, char *, (char const *__s, size_t __n)); | 721 | _GL_CXXALIAS_RPL (strndup, char *, (char const *__s, size_t __n)); |
617 | # else | 722 | # else |
618 | # if !@HAVE_DECL_STRNDUP@ || (__GNUC__ >= 11 && !defined strndup) | 723 | # if !@HAVE_DECL_STRNDUP@ || (__GNUC__ >= 11 && !defined strndup) |
724 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 | ||
619 | _GL_FUNCDECL_SYS (strndup, char *, | 725 | _GL_FUNCDECL_SYS (strndup, char *, |
620 | (char const *__s, size_t __n) | 726 | (char const *__s, size_t __n) |
727 | _GL_ATTRIBUTE_NOTHROW | ||
621 | _GL_ARG_NONNULL ((1)) | 728 | _GL_ARG_NONNULL ((1)) |
622 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 729 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); |
730 | # else | ||
731 | _GL_FUNCDECL_SYS (strndup, char *, | ||
732 | (char const *__s, size_t __n) | ||
733 | _GL_ARG_NONNULL ((1)) | ||
734 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
735 | # endif | ||
623 | # endif | 736 | # endif |
624 | _GL_CXXALIAS_SYS (strndup, char *, (char const *__s, size_t __n)); | 737 | _GL_CXXALIAS_SYS (strndup, char *, (char const *__s, size_t __n)); |
625 | # endif | 738 | # endif |
@@ -627,10 +740,18 @@ _GL_CXXALIASWARN (strndup); | |||
627 | #else | 740 | #else |
628 | # if __GNUC__ >= 11 && !defined strndup | 741 | # if __GNUC__ >= 11 && !defined strndup |
629 | /* For -Wmismatched-dealloc: Associate strndup with free or rpl_free. */ | 742 | /* For -Wmismatched-dealloc: Associate strndup with free or rpl_free. */ |
743 | # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 | ||
630 | _GL_FUNCDECL_SYS (strndup, char *, | 744 | _GL_FUNCDECL_SYS (strndup, char *, |
631 | (char const *__s, size_t __n) | 745 | (char const *__s, size_t __n) |
746 | _GL_ATTRIBUTE_NOTHROW | ||
632 | _GL_ARG_NONNULL ((1)) | 747 | _GL_ARG_NONNULL ((1)) |
633 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | 748 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); |
749 | # else | ||
750 | _GL_FUNCDECL_SYS (strndup, char *, | ||
751 | (char const *__s, size_t __n) | ||
752 | _GL_ARG_NONNULL ((1)) | ||
753 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
754 | # endif | ||
634 | # endif | 755 | # endif |
635 | # if defined GNULIB_POSIXCHECK | 756 | # if defined GNULIB_POSIXCHECK |
636 | # undef strndup | 757 | # undef strndup |
@@ -699,9 +820,12 @@ _GL_CXXALIAS_SYS_CAST2 (strpbrk, | |||
699 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ | 820 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ |
700 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \ | 821 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \ |
701 | || defined __clang__) | 822 | || defined __clang__) |
702 | _GL_CXXALIASWARN1 (strpbrk, char *, (char *__s, char const *__accept) throw ()); | 823 | _GL_CXXALIASWARN1 (strpbrk, char *, |
824 | (char *__s, char const *__accept) | ||
825 | _GL_ATTRIBUTE_NOTHROW); | ||
703 | _GL_CXXALIASWARN1 (strpbrk, char const *, | 826 | _GL_CXXALIASWARN1 (strpbrk, char const *, |
704 | (char const *__s, char const *__accept) throw ()); | 827 | (char const *__s, char const *__accept) |
828 | _GL_ATTRIBUTE_NOTHROW); | ||
705 | # elif __GLIBC__ >= 2 | 829 | # elif __GLIBC__ >= 2 |
706 | _GL_CXXALIASWARN (strpbrk); | 830 | _GL_CXXALIASWARN (strpbrk); |
707 | # endif | 831 | # endif |
@@ -809,9 +933,11 @@ _GL_CXXALIAS_SYS_CAST2 (strstr, | |||
809 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \ | 933 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \ |
810 | || defined __clang__) | 934 | || defined __clang__) |
811 | _GL_CXXALIASWARN1 (strstr, char *, | 935 | _GL_CXXALIASWARN1 (strstr, char *, |
812 | (char *haystack, const char *needle) throw ()); | 936 | (char *haystack, const char *needle) |
937 | _GL_ATTRIBUTE_NOTHROW); | ||
813 | _GL_CXXALIASWARN1 (strstr, const char *, | 938 | _GL_CXXALIASWARN1 (strstr, const char *, |
814 | (const char *haystack, const char *needle) throw ()); | 939 | (const char *haystack, const char *needle) |
940 | _GL_ATTRIBUTE_NOTHROW); | ||
815 | # elif __GLIBC__ >= 2 | 941 | # elif __GLIBC__ >= 2 |
816 | _GL_CXXALIASWARN (strstr); | 942 | _GL_CXXALIASWARN (strstr); |
817 | # endif | 943 | # endif |
@@ -860,10 +986,12 @@ _GL_CXXALIAS_SYS_CAST2 (strcasestr, | |||
860 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \ | 986 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \ |
861 | || defined __clang__) | 987 | || defined __clang__) |
862 | _GL_CXXALIASWARN1 (strcasestr, char *, | 988 | _GL_CXXALIASWARN1 (strcasestr, char *, |
863 | (char *haystack, const char *needle) throw ()); | 989 | (char *haystack, const char *needle) |
990 | _GL_ATTRIBUTE_NOTHROW); | ||
864 | _GL_CXXALIASWARN1 (strcasestr, const char *, | 991 | _GL_CXXALIASWARN1 (strcasestr, const char *, |
865 | (const char *haystack, const char *needle) throw ()); | 992 | (const char *haystack, const char *needle) |
866 | # else | 993 | _GL_ATTRIBUTE_NOTHROW); |
994 | # elif __GLIBC__ >= 2 | ||
867 | _GL_CXXALIASWARN (strcasestr); | 995 | _GL_CXXALIASWARN (strcasestr); |
868 | # endif | 996 | # endif |
869 | #elif defined GNULIB_POSIXCHECK | 997 | #elif defined GNULIB_POSIXCHECK |
@@ -1211,7 +1339,7 @@ _GL_FUNCDECL_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen) | |||
1211 | # endif | 1339 | # endif |
1212 | _GL_CXXALIAS_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen)); | 1340 | _GL_CXXALIAS_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen)); |
1213 | # endif | 1341 | # endif |
1214 | # if @HAVE_DECL_STRERROR_R@ | 1342 | # if __GLIBC__ >= 2 && @HAVE_DECL_STRERROR_R@ |
1215 | _GL_CXXALIASWARN (strerror_r); | 1343 | _GL_CXXALIASWARN (strerror_r); |
1216 | # endif | 1344 | # endif |
1217 | #elif defined GNULIB_POSIXCHECK | 1345 | #elif defined GNULIB_POSIXCHECK |
@@ -1301,12 +1429,22 @@ _GL_WARN_ON_USE (strsignal, "strsignal is unportable - " | |||
1301 | #endif | 1429 | #endif |
1302 | 1430 | ||
1303 | #if @GNULIB_STRVERSCMP@ | 1431 | #if @GNULIB_STRVERSCMP@ |
1304 | # if !@HAVE_STRVERSCMP@ | 1432 | # if @REPLACE_STRVERSCMP@ |
1433 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
1434 | # define strverscmp rpl_strverscmp | ||
1435 | # endif | ||
1436 | _GL_FUNCDECL_RPL (strverscmp, int, (const char *, const char *) | ||
1437 | _GL_ATTRIBUTE_PURE | ||
1438 | _GL_ARG_NONNULL ((1, 2))); | ||
1439 | _GL_CXXALIAS_RPL (strverscmp, int, (const char *, const char *)); | ||
1440 | # else | ||
1441 | # if !@HAVE_STRVERSCMP@ | ||
1305 | _GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *) | 1442 | _GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *) |
1306 | _GL_ATTRIBUTE_PURE | 1443 | _GL_ATTRIBUTE_PURE |
1307 | _GL_ARG_NONNULL ((1, 2))); | 1444 | _GL_ARG_NONNULL ((1, 2))); |
1308 | # endif | 1445 | # endif |
1309 | _GL_CXXALIAS_SYS (strverscmp, int, (const char *, const char *)); | 1446 | _GL_CXXALIAS_SYS (strverscmp, int, (const char *, const char *)); |
1447 | # endif | ||
1310 | _GL_CXXALIASWARN (strverscmp); | 1448 | _GL_CXXALIASWARN (strverscmp); |
1311 | #elif defined GNULIB_POSIXCHECK | 1449 | #elif defined GNULIB_POSIXCHECK |
1312 | # undef strverscmp | 1450 | # undef strverscmp |