summaryrefslogtreecommitdiffstats
path: root/gl/string.in.h
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2024-10-31 15:27:12 (GMT)
committerLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2024-10-31 15:27:12 (GMT)
commit5be04ec2ceb1df77afbca4fcbf9e92a712612d6f (patch)
tree2b2e1c71dffae827c8e45cd4cccc375093d03486 /gl/string.in.h
parent6d1d1dac32841d5ca6ee51bb09b30a6c604b17e2 (diff)
downloadmonitoring-plugins-5be04ec2ceb1df77afbca4fcbf9e92a712612d6f.tar.gz
Sync with the latest Gnulib code (d4ec02b3cc)refs/pull/2037/head
Diffstat (limited to 'gl/string.in.h')
-rw-r--r--gl/string.in.h200
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