diff options
author | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2022-08-23 17:13:04 +0200 |
---|---|---|
committer | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2022-08-23 17:13:04 +0200 |
commit | bbdcf5a704517d35a76ba8b666075da9ffe39ac4 (patch) | |
tree | a36bec4f7c2802dfe5efc5cb2dfc902fec2a23b8 /gl/string.in.h | |
parent | fa1ac7ecb247faf58fe65740c0d40e0585f684c9 (diff) | |
download | monitoring-plugins-bbdcf5a.tar.gz |
Sync with the latest Gnulib code (fa1ac7ec)
Diffstat (limited to 'gl/string.in.h')
-rw-r--r-- | gl/string.in.h | 120 |
1 files changed, 87 insertions, 33 deletions
diff --git a/gl/string.in.h b/gl/string.in.h index afe73508..3996da9f 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-2021 Free Software Foundation, Inc. | 3 | Copyright (C) 1995-1996, 2001-2022 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 |
@@ -112,13 +112,43 @@ | |||
112 | 112 | ||
113 | /* The definition of _GL_WARN_ON_USE is copied here. */ | 113 | /* The definition of _GL_WARN_ON_USE is copied here. */ |
114 | 114 | ||
115 | /* Declare 'free' if needed for _GL_ATTRIBUTE_DEALLOC_FREE. */ | 115 | /* Make _GL_ATTRIBUTE_DEALLOC_FREE work, even though <stdlib.h> may not have |
116 | _GL_EXTERN_C void free (void *); | 116 | been included yet. */ |
117 | #if @GNULIB_FREE_POSIX@ | 117 | #if @GNULIB_FREE_POSIX@ |
118 | # if (@REPLACE_FREE@ && !defined free \ | 118 | # if (@REPLACE_FREE@ && !defined free \ |
119 | && !(defined __cplusplus && defined GNULIB_NAMESPACE)) | 119 | && !(defined __cplusplus && defined GNULIB_NAMESPACE)) |
120 | # define free rpl_free | 120 | /* We can't do '#define free rpl_free' here. */ |
121 | _GL_EXTERN_C void rpl_free (void *); | ||
122 | # undef _GL_ATTRIBUTE_DEALLOC_FREE | ||
123 | # define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1) | ||
124 | # else | ||
125 | # if defined _MSC_VER && !defined free | ||
126 | _GL_EXTERN_C | ||
127 | # if defined _DLL | ||
128 | __declspec (dllimport) | ||
129 | # endif | ||
130 | void __cdecl free (void *); | ||
131 | # else | ||
132 | # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) | ||
133 | _GL_EXTERN_C void free (void *) throw (); | ||
134 | # else | ||
121 | _GL_EXTERN_C void free (void *); | 135 | _GL_EXTERN_C void free (void *); |
136 | # endif | ||
137 | # endif | ||
138 | # endif | ||
139 | #else | ||
140 | # if defined _MSC_VER && !defined free | ||
141 | _GL_EXTERN_C | ||
142 | # if defined _DLL | ||
143 | __declspec (dllimport) | ||
144 | # endif | ||
145 | void __cdecl free (void *); | ||
146 | # else | ||
147 | # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) | ||
148 | _GL_EXTERN_C void free (void *) throw (); | ||
149 | # else | ||
150 | _GL_EXTERN_C void free (void *); | ||
151 | # endif | ||
122 | # endif | 152 | # endif |
123 | #endif | 153 | #endif |
124 | 154 | ||
@@ -216,10 +246,11 @@ _GL_CXXALIAS_SYS_CAST2 (memchr, | |||
216 | void const *, (void const *__s, int __c, size_t __n)); | 246 | void const *, (void const *__s, int __c, size_t __n)); |
217 | # endif | 247 | # endif |
218 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ | 248 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ |
219 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) | 249 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \ |
220 | _GL_CXXALIASWARN1 (memchr, void *, (void *__s, int __c, size_t __n)); | 250 | || defined __clang__) |
251 | _GL_CXXALIASWARN1 (memchr, void *, (void *__s, int __c, size_t __n) throw ()); | ||
221 | _GL_CXXALIASWARN1 (memchr, void const *, | 252 | _GL_CXXALIASWARN1 (memchr, void const *, |
222 | (void const *__s, int __c, size_t __n)); | 253 | (void const *__s, int __c, size_t __n) throw ()); |
223 | # elif __GLIBC__ >= 2 | 254 | # elif __GLIBC__ >= 2 |
224 | _GL_CXXALIASWARN (memchr); | 255 | _GL_CXXALIASWARN (memchr); |
225 | # endif | 256 | # endif |
@@ -301,9 +332,10 @@ _GL_CXXALIAS_SYS_CAST2 (memrchr, | |||
301 | void *, (void const *, int, size_t), | 332 | void *, (void const *, int, size_t), |
302 | void const *, (void const *, int, size_t)); | 333 | void const *, (void const *, int, size_t)); |
303 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ | 334 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ |
304 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) | 335 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \ |
305 | _GL_CXXALIASWARN1 (memrchr, void *, (void *, int, size_t)); | 336 | || defined __clang__) |
306 | _GL_CXXALIASWARN1 (memrchr, void const *, (void const *, int, size_t)); | 337 | _GL_CXXALIASWARN1 (memrchr, void *, (void *, int, size_t) throw ()); |
338 | _GL_CXXALIASWARN1 (memrchr, void const *, (void const *, int, size_t) throw ()); | ||
307 | # else | 339 | # else |
308 | _GL_CXXALIASWARN (memrchr); | 340 | _GL_CXXALIASWARN (memrchr); |
309 | # endif | 341 | # endif |
@@ -331,9 +363,11 @@ _GL_CXXALIAS_SYS_CAST2 (rawmemchr, | |||
331 | void *, (void const *__s, int __c_in), | 363 | void *, (void const *__s, int __c_in), |
332 | void const *, (void const *__s, int __c_in)); | 364 | void const *, (void const *__s, int __c_in)); |
333 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ | 365 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ |
334 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) | 366 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \ |
335 | _GL_CXXALIASWARN1 (rawmemchr, void *, (void *__s, int __c_in)); | 367 | || defined __clang__) |
336 | _GL_CXXALIASWARN1 (rawmemchr, void const *, (void const *__s, int __c_in)); | 368 | _GL_CXXALIASWARN1 (rawmemchr, void *, (void *__s, int __c_in) throw ()); |
369 | _GL_CXXALIASWARN1 (rawmemchr, void const *, | ||
370 | (void const *__s, int __c_in) throw ()); | ||
337 | # else | 371 | # else |
338 | _GL_CXXALIASWARN (rawmemchr); | 372 | _GL_CXXALIASWARN (rawmemchr); |
339 | # endif | 373 | # endif |
@@ -435,9 +469,11 @@ _GL_CXXALIAS_SYS_CAST2 (strchrnul, | |||
435 | char const *, (char const *__s, int __c_in)); | 469 | char const *, (char const *__s, int __c_in)); |
436 | # endif | 470 | # endif |
437 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ | 471 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ |
438 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) | 472 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \ |
439 | _GL_CXXALIASWARN1 (strchrnul, char *, (char *__s, int __c_in)); | 473 | || defined __clang__) |
440 | _GL_CXXALIASWARN1 (strchrnul, char const *, (char const *__s, int __c_in)); | 474 | _GL_CXXALIASWARN1 (strchrnul, char *, (char *__s, int __c_in) throw ()); |
475 | _GL_CXXALIASWARN1 (strchrnul, char const *, | ||
476 | (char const *__s, int __c_in) throw ()); | ||
441 | # else | 477 | # else |
442 | _GL_CXXALIASWARN (strchrnul); | 478 | _GL_CXXALIASWARN (strchrnul); |
443 | # endif | 479 | # endif |
@@ -549,22 +585,35 @@ _GL_WARN_ON_USE (strncat, "strncat is unportable - " | |||
549 | # undef strndup | 585 | # undef strndup |
550 | # define strndup rpl_strndup | 586 | # define strndup rpl_strndup |
551 | # endif | 587 | # endif |
552 | _GL_FUNCDECL_RPL (strndup, char *, (char const *__s, size_t __n) | 588 | _GL_FUNCDECL_RPL (strndup, char *, |
553 | _GL_ARG_NONNULL ((1))); | 589 | (char const *__s, size_t __n) |
590 | _GL_ARG_NONNULL ((1)) | ||
591 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
554 | _GL_CXXALIAS_RPL (strndup, char *, (char const *__s, size_t __n)); | 592 | _GL_CXXALIAS_RPL (strndup, char *, (char const *__s, size_t __n)); |
555 | # else | 593 | # else |
556 | # if ! @HAVE_DECL_STRNDUP@ | 594 | # if !@HAVE_DECL_STRNDUP@ || (__GNUC__ >= 11 && !defined strndup) |
557 | _GL_FUNCDECL_SYS (strndup, char *, (char const *__s, size_t __n) | 595 | _GL_FUNCDECL_SYS (strndup, char *, |
558 | _GL_ARG_NONNULL ((1))); | 596 | (char const *__s, size_t __n) |
597 | _GL_ARG_NONNULL ((1)) | ||
598 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
559 | # endif | 599 | # endif |
560 | _GL_CXXALIAS_SYS (strndup, char *, (char const *__s, size_t __n)); | 600 | _GL_CXXALIAS_SYS (strndup, char *, (char const *__s, size_t __n)); |
561 | # endif | 601 | # endif |
562 | _GL_CXXALIASWARN (strndup); | 602 | _GL_CXXALIASWARN (strndup); |
563 | #elif defined GNULIB_POSIXCHECK | 603 | #else |
564 | # undef strndup | 604 | # if __GNUC__ >= 11 && !defined strndup |
565 | # if HAVE_RAW_DECL_STRNDUP | 605 | /* For -Wmismatched-dealloc: Associate strndup with free or rpl_free. */ |
606 | _GL_FUNCDECL_SYS (strndup, char *, | ||
607 | (char const *__s, size_t __n) | ||
608 | _GL_ARG_NONNULL ((1)) | ||
609 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
610 | # endif | ||
611 | # if defined GNULIB_POSIXCHECK | ||
612 | # undef strndup | ||
613 | # if HAVE_RAW_DECL_STRNDUP | ||
566 | _GL_WARN_ON_USE (strndup, "strndup is unportable - " | 614 | _GL_WARN_ON_USE (strndup, "strndup is unportable - " |
567 | "use gnulib module strndup for portability"); | 615 | "use gnulib module strndup for portability"); |
616 | # endif | ||
568 | # endif | 617 | # endif |
569 | #endif | 618 | #endif |
570 | 619 | ||
@@ -624,10 +673,11 @@ _GL_CXXALIAS_SYS_CAST2 (strpbrk, | |||
624 | char *, (char const *__s, char const *__accept), | 673 | char *, (char const *__s, char const *__accept), |
625 | const char *, (char const *__s, char const *__accept)); | 674 | const char *, (char const *__s, char const *__accept)); |
626 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ | 675 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ |
627 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) | 676 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \ |
628 | _GL_CXXALIASWARN1 (strpbrk, char *, (char *__s, char const *__accept)); | 677 | || defined __clang__) |
678 | _GL_CXXALIASWARN1 (strpbrk, char *, (char *__s, char const *__accept) throw ()); | ||
629 | _GL_CXXALIASWARN1 (strpbrk, char const *, | 679 | _GL_CXXALIASWARN1 (strpbrk, char const *, |
630 | (char const *__s, char const *__accept)); | 680 | (char const *__s, char const *__accept) throw ()); |
631 | # elif __GLIBC__ >= 2 | 681 | # elif __GLIBC__ >= 2 |
632 | _GL_CXXALIASWARN (strpbrk); | 682 | _GL_CXXALIASWARN (strpbrk); |
633 | # endif | 683 | # endif |
@@ -732,10 +782,12 @@ _GL_CXXALIAS_SYS_CAST2 (strstr, | |||
732 | const char *, (const char *haystack, const char *needle)); | 782 | const char *, (const char *haystack, const char *needle)); |
733 | # endif | 783 | # endif |
734 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ | 784 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ |
735 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) | 785 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \ |
736 | _GL_CXXALIASWARN1 (strstr, char *, (char *haystack, const char *needle)); | 786 | || defined __clang__) |
787 | _GL_CXXALIASWARN1 (strstr, char *, | ||
788 | (char *haystack, const char *needle) throw ()); | ||
737 | _GL_CXXALIASWARN1 (strstr, const char *, | 789 | _GL_CXXALIASWARN1 (strstr, const char *, |
738 | (const char *haystack, const char *needle)); | 790 | (const char *haystack, const char *needle) throw ()); |
739 | # elif __GLIBC__ >= 2 | 791 | # elif __GLIBC__ >= 2 |
740 | _GL_CXXALIASWARN (strstr); | 792 | _GL_CXXALIASWARN (strstr); |
741 | # endif | 793 | # endif |
@@ -781,10 +833,12 @@ _GL_CXXALIAS_SYS_CAST2 (strcasestr, | |||
781 | const char *, (const char *haystack, const char *needle)); | 833 | const char *, (const char *haystack, const char *needle)); |
782 | # endif | 834 | # endif |
783 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ | 835 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ |
784 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) | 836 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \ |
785 | _GL_CXXALIASWARN1 (strcasestr, char *, (char *haystack, const char *needle)); | 837 | || defined __clang__) |
838 | _GL_CXXALIASWARN1 (strcasestr, char *, | ||
839 | (char *haystack, const char *needle) throw ()); | ||
786 | _GL_CXXALIASWARN1 (strcasestr, const char *, | 840 | _GL_CXXALIASWARN1 (strcasestr, const char *, |
787 | (const char *haystack, const char *needle)); | 841 | (const char *haystack, const char *needle) throw ()); |
788 | # else | 842 | # else |
789 | _GL_CXXALIASWARN (strcasestr); | 843 | _GL_CXXALIASWARN (strcasestr); |
790 | # endif | 844 | # endif |