19 @PRAGMA_SYSTEM_HEADER@
23 #if defined _GL_ALREADY_INCLUDING_STRING_H
30 #@INCLUDE_NEXT@ @NEXT_STRING_H@
35 #ifndef _@GUARD_PREFIX@_STRING_H
37 #define _GL_ALREADY_INCLUDING_STRING_H
40 #@INCLUDE_NEXT@ @NEXT_STRING_H@
42 #undef _GL_ALREADY_INCLUDING_STRING_H
44 #ifndef _@GUARD_PREFIX@_STRING_H
45 #define _@GUARD_PREFIX@_STRING_H
49 #if !_GL_CONFIG_H_INCLUDED
50 #error "Please include config.h first."
57 #if @GNULIB_MBSLEN@ && defined __MirBSD__
63 #if (@GNULIB_STRSIGNAL@ || defined GNULIB_POSIXCHECK) && defined __NetBSD__ \
64 && ! defined __GLIBC__
71 #if ((@GNULIB_FFSL@ || @GNULIB_FFSLL@ || defined GNULIB_POSIXCHECK) \
72 && (defined _AIX || defined __ANDROID__)) \
73 && ! defined __GLIBC__
80 #ifndef _GL_ATTRIBUTE_DEALLOC
82 # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
84 # define _GL_ATTRIBUTE_DEALLOC(f, i)
91 #ifndef _GL_ATTRIBUTE_DEALLOC_FREE
92 # if defined __cplusplus && defined __GNUC__ && !defined __clang__
94 # define _GL_ATTRIBUTE_DEALLOC_FREE \
95 _GL_ATTRIBUTE_DEALLOC ((void (*) (void *)) free, 1)
97 # define _GL_ATTRIBUTE_DEALLOC_FREE \
98 _GL_ATTRIBUTE_DEALLOC (free, 1)
105 #ifndef _GL_ATTRIBUTE_MALLOC
106 # if __GNUC__ >= 3 || defined __clang__
107 # define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
109 # define _GL_ATTRIBUTE_MALLOC
115 #ifndef _GL_ATTRIBUTE_PURE
116 # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
117 # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
119 # define _GL_ATTRIBUTE_PURE
131 #if @GNULIB_FREE_POSIX@
132 # if (@REPLACE_FREE@ && !defined free \
133 && !(defined __cplusplus && defined GNULIB_NAMESPACE))
135 # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
136 _GL_EXTERN_C
void rpl_free (
void *)
throw ();
138 _GL_EXTERN_C
void rpl_free (
void *);
140 # undef _GL_ATTRIBUTE_DEALLOC_FREE
141 # define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1)
143 # if defined _MSC_VER && !defined free
146 __declspec (dllimport)
148 void __cdecl free (
void *);
150 # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
151 _GL_EXTERN_C
void free (
void *)
throw ();
153 _GL_EXTERN_C
void free (
void *);
158 # if defined _MSC_VER && !defined free
161 __declspec (dllimport)
163 void __cdecl free (
void *);
165 # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
166 _GL_EXTERN_C
void free (
void *)
throw ();
168 _GL_EXTERN_C
void free (
void *);
175 #if @GNULIB_EXPLICIT_BZERO@
176 # if ! @HAVE_EXPLICIT_BZERO@
177 _GL_FUNCDECL_SYS (explicit_bzero,
void,
178 (
void *__dest,
size_t __n) _GL_ARG_NONNULL ((1)));
180 _GL_CXXALIAS_SYS (explicit_bzero,
void, (
void *__dest,
size_t __n));
181 _GL_CXXALIASWARN (explicit_bzero);
182 #elif defined GNULIB_POSIXCHECK
183 # undef explicit_bzero
184 # if HAVE_RAW_DECL_EXPLICIT_BZERO
185 _GL_WARN_ON_USE (explicit_bzero,
"explicit_bzero is unportable - "
186 "use gnulib module explicit_bzero for portability");
193 _GL_FUNCDECL_SYS (ffsl,
int, (
long int i));
195 _GL_CXXALIAS_SYS (ffsl,
int, (
long int i));
196 _GL_CXXALIASWARN (ffsl);
197 #elif defined GNULIB_POSIXCHECK
199 # if HAVE_RAW_DECL_FFSL
200 _GL_WARN_ON_USE (ffsl,
"ffsl is not portable - use the ffsl module");
208 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
209 # define ffsll rpl_ffsll
211 _GL_FUNCDECL_RPL (ffsll,
int, (
long long int i));
212 _GL_CXXALIAS_RPL (ffsll,
int, (
long long int i));
215 _GL_FUNCDECL_SYS (ffsll,
int, (
long long int i));
217 _GL_CXXALIAS_SYS (ffsll,
int, (
long long int i));
219 _GL_CXXALIASWARN (ffsll);
220 #elif defined GNULIB_POSIXCHECK
222 # if HAVE_RAW_DECL_FFSLL
223 _GL_WARN_ON_USE (ffsll,
"ffsll is not portable - use the ffsll module");
228 #if @GNULIB_MDA_MEMCCPY@
232 # if defined _WIN32 && !defined __CYGWIN__
233 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
235 # define memccpy _memccpy
237 _GL_CXXALIAS_MDA (memccpy,
void *,
238 (
void *dest,
const void *src,
int c,
size_t n));
240 _GL_CXXALIAS_SYS (memccpy,
void *,
241 (
void *dest,
const void *src,
int c,
size_t n));
243 _GL_CXXALIASWARN (memccpy);
249 # if @REPLACE_MEMCHR@
250 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
252 # define memchr rpl_memchr
254 _GL_FUNCDECL_RPL (memchr,
void *, (
void const *__s,
int __c,
size_t __n)
256 _GL_ARG_NONNULL ((1)));
257 _GL_CXXALIAS_RPL (memchr,
void *, (
void const *__s,
int __c,
size_t __n));
262 _GL_CXXALIAS_SYS_CAST2 (memchr,
263 void *, (
void const *__s,
int __c,
size_t __n),
264 void const *, (
void const *__s,
int __c,
size_t __n));
266 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
267 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \
268 || defined __clang__)
269 _GL_CXXALIASWARN1 (memchr,
void *, (
void *__s,
int __c,
size_t __n)
throw ());
270 _GL_CXXALIASWARN1 (memchr,
void const *,
271 (
void const *__s,
int __c,
size_t __n)
throw ());
272 # elif __GLIBC__ >= 2
273 _GL_CXXALIASWARN (memchr);
275 #elif defined GNULIB_POSIXCHECK
278 _GL_WARN_ON_USE (memchr,
"memchr has platform-specific bugs - "
279 "use gnulib module memchr for portability" );
284 # if @REPLACE_MEMMEM@
285 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
286 # define memmem rpl_memmem
288 _GL_FUNCDECL_RPL (memmem,
void *,
289 (
void const *__haystack,
size_t __haystack_len,
290 void const *__needle,
size_t __needle_len)
292 _GL_ARG_NONNULL ((1, 3)));
293 _GL_CXXALIAS_RPL (memmem,
void *,
294 (
void const *__haystack,
size_t __haystack_len,
295 void const *__needle,
size_t __needle_len));
297 # if ! @HAVE_DECL_MEMMEM@
298 _GL_FUNCDECL_SYS (memmem,
void *,
299 (
void const *__haystack,
size_t __haystack_len,
300 void const *__needle,
size_t __needle_len)
302 _GL_ARG_NONNULL ((1, 3)));
304 _GL_CXXALIAS_SYS (memmem,
void *,
305 (
void const *__haystack,
size_t __haystack_len,
306 void const *__needle,
size_t __needle_len));
308 _GL_CXXALIASWARN (memmem);
309 #elif defined GNULIB_POSIXCHECK
311 # if HAVE_RAW_DECL_MEMMEM
312 _GL_WARN_ON_USE (memmem,
"memmem is unportable and often quadratic - "
313 "use gnulib module memmem-simple for portability, "
314 "and module memmem for speed" );
321 # if @REPLACE_MEMPCPY@
322 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
324 # define mempcpy rpl_mempcpy
326 _GL_FUNCDECL_RPL (mempcpy,
void *,
327 (
void *restrict __dest,
void const *restrict __src,
329 _GL_ARG_NONNULL ((1, 2)));
330 _GL_CXXALIAS_RPL (mempcpy,
void *,
331 (
void *restrict __dest,
void const *restrict __src,
335 _GL_FUNCDECL_SYS (mempcpy,
void *,
336 (
void *restrict __dest,
void const *restrict __src,
338 _GL_ARG_NONNULL ((1, 2)));
340 _GL_CXXALIAS_SYS (mempcpy,
void *,
341 (
void *restrict __dest,
void const *restrict __src,
345 _GL_CXXALIASWARN (mempcpy);
347 #elif defined GNULIB_POSIXCHECK
349 # if HAVE_RAW_DECL_MEMPCPY
350 _GL_WARN_ON_USE (mempcpy,
"mempcpy is unportable - "
351 "use gnulib module mempcpy for portability");
357 # if ! @HAVE_DECL_MEMRCHR@
358 _GL_FUNCDECL_SYS (memrchr,
void *, (
void const *,
int,
size_t)
360 _GL_ARG_NONNULL ((1)));
365 _GL_CXXALIAS_SYS_CAST2 (memrchr,
366 void *, (
void const *,
int,
size_t),
367 void const *, (
void const *,
int,
size_t));
368 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
369 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \
370 || defined __clang__)
371 _GL_CXXALIASWARN1 (memrchr,
void *, (
void *,
int,
size_t)
throw ());
372 _GL_CXXALIASWARN1 (memrchr,
void const *, (
void const *,
int,
size_t)
throw ());
373 # elif __GLIBC__ >= 2
374 _GL_CXXALIASWARN (memrchr);
376 #elif defined GNULIB_POSIXCHECK
378 # if HAVE_RAW_DECL_MEMRCHR
379 _GL_WARN_ON_USE (memrchr,
"memrchr is unportable - "
380 "use gnulib module memrchr for portability");
386 #if @GNULIB_MEMSET_EXPLICIT@
387 # if ! @HAVE_MEMSET_EXPLICIT@
388 _GL_FUNCDECL_SYS (memset_explicit,
void *,
389 (
void *__dest,
int __c,
size_t __n) _GL_ARG_NONNULL ((1)));
391 _GL_CXXALIAS_SYS (memset_explicit,
void *, (
void *__dest,
int __c,
size_t __n));
392 _GL_CXXALIASWARN (memset_explicit);
393 #elif defined GNULIB_POSIXCHECK
394 # undef memset_explicit
395 # if HAVE_RAW_DECL_MEMSET_EXPLICIT
396 _GL_WARN_ON_USE (memset_explicit,
"memset_explicit is unportable - "
397 "use gnulib module memset_explicit for portability");
404 #if @GNULIB_RAWMEMCHR@
405 # if ! @HAVE_RAWMEMCHR@
406 _GL_FUNCDECL_SYS (rawmemchr,
void *, (
void const *__s,
int __c_in)
408 _GL_ARG_NONNULL ((1)));
413 _GL_CXXALIAS_SYS_CAST2 (rawmemchr,
414 void *, (
void const *__s,
int __c_in),
415 void const *, (
void const *__s,
int __c_in));
416 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
417 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \
418 || defined __clang__)
419 _GL_CXXALIASWARN1 (rawmemchr,
void *, (
void *__s,
int __c_in)
throw ());
420 _GL_CXXALIASWARN1 (rawmemchr,
void const *,
421 (
void const *__s,
int __c_in)
throw ());
423 _GL_CXXALIASWARN (rawmemchr);
425 #elif defined GNULIB_POSIXCHECK
427 # if HAVE_RAW_DECL_RAWMEMCHR
428 _GL_WARN_ON_USE (rawmemchr,
"rawmemchr is unportable - "
429 "use gnulib module rawmemchr for portability");
435 # if @REPLACE_STPCPY@
436 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
438 # define stpcpy rpl_stpcpy
440 _GL_FUNCDECL_RPL (stpcpy,
char *,
441 (
char *restrict __dst,
char const *restrict __src)
442 _GL_ARG_NONNULL ((1, 2)));
443 _GL_CXXALIAS_RPL (stpcpy,
char *,
444 (
char *restrict __dst,
char const *restrict __src));
447 _GL_FUNCDECL_SYS (stpcpy,
char *,
448 (
char *restrict __dst,
char const *restrict __src)
449 _GL_ARG_NONNULL ((1, 2)));
451 _GL_CXXALIAS_SYS (stpcpy,
char *,
452 (
char *restrict __dst,
char const *restrict __src));
455 _GL_CXXALIASWARN (stpcpy);
457 #elif defined GNULIB_POSIXCHECK
459 # if HAVE_RAW_DECL_STPCPY
460 _GL_WARN_ON_USE (stpcpy,
"stpcpy is unportable - "
461 "use gnulib module stpcpy for portability");
468 # if @REPLACE_STPNCPY@
469 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
471 # define stpncpy rpl_stpncpy
473 _GL_FUNCDECL_RPL (stpncpy,
char *,
474 (
char *restrict __dst,
char const *restrict __src,
476 _GL_ARG_NONNULL ((1, 2)));
477 _GL_CXXALIAS_RPL (stpncpy,
char *,
478 (
char *restrict __dst,
char const *restrict __src,
481 # if ! @HAVE_STPNCPY@
482 _GL_FUNCDECL_SYS (stpncpy,
char *,
483 (
char *restrict __dst,
char const *restrict __src,
485 _GL_ARG_NONNULL ((1, 2)));
487 _GL_CXXALIAS_SYS (stpncpy,
char *,
488 (
char *restrict __dst,
char const *restrict __src,
492 _GL_CXXALIASWARN (stpncpy);
494 #elif defined GNULIB_POSIXCHECK
496 # if HAVE_RAW_DECL_STPNCPY
497 _GL_WARN_ON_USE (stpncpy,
"stpncpy is unportable - "
498 "use gnulib module stpncpy for portability");
502 #if defined GNULIB_POSIXCHECK
507 _GL_WARN_ON_USE_CXX (strchr,
508 const char *,
char *, (
const char *,
int),
509 "strchr cannot work correctly on character strings "
510 "in some multibyte locales - "
511 "use mbschr if you care about internationalization");
515 #if @GNULIB_STRCHRNUL@
516 # if @REPLACE_STRCHRNUL@
517 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
518 # define strchrnul rpl_strchrnul
520 _GL_FUNCDECL_RPL (strchrnul,
char *, (
const char *__s,
int __c_in)
522 _GL_ARG_NONNULL ((1)));
523 _GL_CXXALIAS_RPL (strchrnul,
char *,
524 (
const char *str,
int ch));
526 # if ! @HAVE_STRCHRNUL@
527 _GL_FUNCDECL_SYS (strchrnul,
char *, (
char const *__s,
int __c_in)
529 _GL_ARG_NONNULL ((1)));
534 _GL_CXXALIAS_SYS_CAST2 (strchrnul,
535 char *, (
char const *__s,
int __c_in),
536 char const *, (
char const *__s,
int __c_in));
538 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
539 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \
540 || defined __clang__)
541 _GL_CXXALIASWARN1 (strchrnul,
char *, (
char *__s,
int __c_in)
throw ());
542 _GL_CXXALIASWARN1 (strchrnul,
char const *,
543 (
char const *__s,
int __c_in)
throw ());
544 # elif __GLIBC__ >= 2
545 _GL_CXXALIASWARN (strchrnul);
547 #elif defined GNULIB_POSIXCHECK
549 # if HAVE_RAW_DECL_STRCHRNUL
550 _GL_WARN_ON_USE (strchrnul,
"strchrnul is unportable - "
551 "use gnulib module strchrnul for portability");
557 # if @REPLACE_STRDUP@
558 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
560 # define strdup rpl_strdup
562 _GL_FUNCDECL_RPL (strdup,
char *,
564 _GL_ARG_NONNULL ((1))
565 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
566 _GL_CXXALIAS_RPL (strdup,
char *, (
char const *__s));
567 # elif defined _WIN32 && !defined __CYGWIN__
568 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
570 # define strdup _strdup
572 _GL_CXXALIAS_MDA (strdup,
char *, (
char const *__s));
574 # if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup
578 # if (!@HAVE_DECL_STRDUP@ || __GNUC__ >= 11) && !defined strdup
579 _GL_FUNCDECL_SYS (strdup,
char *,
581 _GL_ARG_NONNULL ((1))
582 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
584 _GL_CXXALIAS_SYS (strdup,
char *, (
char const *__s));
586 _GL_CXXALIASWARN (strdup);
588 # if __GNUC__ >= 11 && !defined strdup
590 _GL_FUNCDECL_SYS (strdup,
char *,
592 _GL_ARG_NONNULL ((1))
593 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
595 # if defined GNULIB_POSIXCHECK
597 # if HAVE_RAW_DECL_STRDUP
598 _GL_WARN_ON_USE (strdup,
"strdup is unportable - "
599 "use gnulib module strdup for portability");
601 # elif @GNULIB_MDA_STRDUP@
605 # if defined _WIN32 && !defined __CYGWIN__
606 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
608 # define strdup _strdup
610 _GL_CXXALIAS_MDA (strdup,
char *, (
char const *__s));
612 # if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup
615 _GL_CXXALIAS_SYS (strdup,
char *, (
char const *__s));
617 _GL_CXXALIASWARN (strdup);
623 # if @REPLACE_STRNCAT@
624 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
626 # define strncat rpl_strncat
628 _GL_FUNCDECL_RPL (strncat,
char *,
629 (
char *restrict dest,
const char *restrict src,
size_t n)
630 _GL_ARG_NONNULL ((1, 2)));
631 _GL_CXXALIAS_RPL (strncat,
char *,
632 (
char *restrict dest,
const char *restrict src,
size_t n));
634 _GL_CXXALIAS_SYS (strncat,
char *,
635 (
char *restrict dest,
const char *restrict src,
size_t n));
638 _GL_CXXALIASWARN (strncat);
640 #elif defined GNULIB_POSIXCHECK
642 # if HAVE_RAW_DECL_STRNCAT
643 _GL_WARN_ON_USE (strncat,
"strncat is unportable - "
644 "use gnulib module strncat for portability");
650 # if @REPLACE_STRNDUP@
651 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
653 # define strndup rpl_strndup
655 _GL_FUNCDECL_RPL (strndup,
char *,
656 (
char const *__s,
size_t __n)
657 _GL_ARG_NONNULL ((1))
658 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
659 _GL_CXXALIAS_RPL (strndup,
char *, (
char const *__s,
size_t __n));
661 # if !@HAVE_DECL_STRNDUP@ || (__GNUC__ >= 11 && !defined strndup)
662 _GL_FUNCDECL_SYS (strndup,
char *,
663 (
char const *__s,
size_t __n)
664 _GL_ARG_NONNULL ((1))
665 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
667 _GL_CXXALIAS_SYS (strndup,
char *, (
char const *__s,
size_t __n));
669 _GL_CXXALIASWARN (strndup);
671 # if __GNUC__ >= 11 && !defined strndup
673 _GL_FUNCDECL_SYS (strndup,
char *,
674 (
char const *__s,
size_t __n)
675 _GL_ARG_NONNULL ((1))
676 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
678 # if defined GNULIB_POSIXCHECK
680 # if HAVE_RAW_DECL_STRNDUP
681 _GL_WARN_ON_USE (strndup,
"strndup is unportable - "
682 "use gnulib module strndup for portability");
691 # if @REPLACE_STRNLEN@
692 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
694 # define strnlen rpl_strnlen
696 _GL_FUNCDECL_RPL (strnlen,
size_t, (
char const *__s,
size_t __maxlen)
698 _GL_ARG_NONNULL ((1)));
699 _GL_CXXALIAS_RPL (strnlen,
size_t, (
char const *__s,
size_t __maxlen));
701 # if ! @HAVE_DECL_STRNLEN@
702 _GL_FUNCDECL_SYS (strnlen,
size_t, (
char const *__s,
size_t __maxlen)
704 _GL_ARG_NONNULL ((1)));
706 _GL_CXXALIAS_SYS (strnlen,
size_t, (
char const *__s,
size_t __maxlen));
708 _GL_CXXALIASWARN (strnlen);
709 #elif defined GNULIB_POSIXCHECK
711 # if HAVE_RAW_DECL_STRNLEN
712 _GL_WARN_ON_USE (strnlen,
"strnlen is unportable - "
713 "use gnulib module strnlen for portability");
717 #if defined GNULIB_POSIXCHECK
724 _GL_WARN_ON_USE (strcspn,
"strcspn cannot work correctly on character strings "
725 "in multibyte locales - "
726 "use mbscspn if you care about internationalization");
731 # if ! @HAVE_STRPBRK@
732 _GL_FUNCDECL_SYS (strpbrk,
char *, (
char const *__s,
char const *__accept)
734 _GL_ARG_NONNULL ((1, 2)));
739 _GL_CXXALIAS_SYS_CAST2 (strpbrk,
740 char *, (
char const *__s,
char const *__accept),
741 const char *, (
char const *__s,
char const *__accept));
742 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
743 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \
744 || defined __clang__)
745 _GL_CXXALIASWARN1 (strpbrk,
char *, (
char *__s,
char const *__accept)
throw ());
746 _GL_CXXALIASWARN1 (strpbrk,
char const *,
747 (
char const *__s,
char const *__accept)
throw ());
748 # elif __GLIBC__ >= 2
749 _GL_CXXALIASWARN (strpbrk);
751 # if defined GNULIB_POSIXCHECK
757 _GL_WARN_ON_USE_CXX (strpbrk,
758 const char *,
char *, (
const char *,
const char *),
759 "strpbrk cannot work correctly on character strings "
760 "in multibyte locales - "
761 "use mbspbrk if you care about internationalization");
763 #elif defined GNULIB_POSIXCHECK
765 # if HAVE_RAW_DECL_STRPBRK
766 _GL_WARN_ON_USE_CXX (strpbrk,
767 const char *,
char *, (
const char *,
const char *),
768 "strpbrk is unportable - "
769 "use gnulib module strpbrk for portability");
773 #if defined GNULIB_POSIXCHECK
778 _GL_WARN_ON_USE (strspn,
"strspn cannot work correctly on character strings "
779 "in multibyte locales - "
780 "use mbsspn if you care about internationalization");
783 #if defined GNULIB_POSIXCHECK
788 _GL_WARN_ON_USE_CXX (strrchr,
789 const char *,
char *, (
const char *,
int),
790 "strrchr cannot work correctly on character strings "
791 "in some multibyte locales - "
792 "use mbsrchr if you care about internationalization");
813 _GL_FUNCDECL_SYS (strsep,
char *,
814 (
char **restrict __stringp,
char const *restrict __delim)
815 _GL_ARG_NONNULL ((1, 2)));
817 _GL_CXXALIAS_SYS (strsep,
char *,
818 (
char **restrict __stringp,
char const *restrict __delim));
819 _GL_CXXALIASWARN (strsep);
820 # if defined GNULIB_POSIXCHECK
822 _GL_WARN_ON_USE (strsep,
"strsep cannot work correctly on character strings "
823 "in multibyte locales - "
824 "use mbssep if you care about internationalization");
826 #elif defined GNULIB_POSIXCHECK
828 # if HAVE_RAW_DECL_STRSEP
829 _GL_WARN_ON_USE (strsep,
"strsep is unportable - "
830 "use gnulib module strsep for portability");
835 # if @REPLACE_STRSTR@
836 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
837 # define strstr rpl_strstr
839 _GL_FUNCDECL_RPL (strstr,
char *, (
const char *haystack,
const char *needle)
841 _GL_ARG_NONNULL ((1, 2)));
842 _GL_CXXALIAS_RPL (strstr,
char *, (
const char *haystack,
const char *needle));
847 _GL_CXXALIAS_SYS_CAST2 (strstr,
848 char *, (
const char *haystack,
const char *needle),
849 const char *, (
const char *haystack,
const char *needle));
851 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
852 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \
853 || defined __clang__)
854 _GL_CXXALIASWARN1 (strstr,
char *,
855 (
char *haystack,
const char *needle)
throw ());
856 _GL_CXXALIASWARN1 (strstr,
const char *,
857 (
const char *haystack,
const char *needle)
throw ());
858 # elif __GLIBC__ >= 2
859 _GL_CXXALIASWARN (strstr);
861 #elif defined GNULIB_POSIXCHECK
868 _GL_WARN_ON_USE (strstr,
"strstr is quadratic on many systems, and cannot "
869 "work correctly on character strings in most "
870 "multibyte locales - "
871 "use mbsstr if you care about internationalization, "
872 "or use strstr if you care about speed");
877 #if @GNULIB_STRCASESTR@
878 # if @REPLACE_STRCASESTR@
879 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
880 # define strcasestr rpl_strcasestr
882 _GL_FUNCDECL_RPL (strcasestr,
char *,
883 (
const char *haystack,
const char *needle)
885 _GL_ARG_NONNULL ((1, 2)));
886 _GL_CXXALIAS_RPL (strcasestr,
char *,
887 (
const char *haystack,
const char *needle));
889 # if ! @HAVE_STRCASESTR@
890 _GL_FUNCDECL_SYS (strcasestr,
char *,
891 (
const char *haystack,
const char *needle)
893 _GL_ARG_NONNULL ((1, 2)));
898 _GL_CXXALIAS_SYS_CAST2 (strcasestr,
899 char *, (
const char *haystack,
const char *needle),
900 const char *, (
const char *haystack,
const char *needle));
902 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
903 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \
904 || defined __clang__)
905 _GL_CXXALIASWARN1 (strcasestr,
char *,
906 (
char *haystack,
const char *needle)
throw ());
907 _GL_CXXALIASWARN1 (strcasestr,
const char *,
908 (
const char *haystack,
const char *needle)
throw ());
909 # elif __GLIBC__ >= 2
910 _GL_CXXALIASWARN (strcasestr);
912 #elif defined GNULIB_POSIXCHECK
917 # if HAVE_RAW_DECL_STRCASESTR
918 _GL_WARN_ON_USE (strcasestr,
"strcasestr does work correctly on character "
919 "strings in multibyte locales - "
920 "use mbscasestr if you care about "
921 "internationalization, or use c-strcasestr if you want "
922 "a locale independent function");
948 #if @GNULIB_STRTOK_R@
949 # if @REPLACE_STRTOK_R@
950 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
952 # define strtok_r rpl_strtok_r
954 _GL_FUNCDECL_RPL (strtok_r,
char *,
955 (
char *restrict s,
char const *restrict delim,
956 char **restrict save_ptr)
957 _GL_ARG_NONNULL ((2, 3)));
958 _GL_CXXALIAS_RPL (strtok_r,
char *,
959 (
char *restrict s,
char const *restrict delim,
960 char **restrict save_ptr));
962 # if @UNDEFINE_STRTOK_R@ || defined GNULIB_POSIXCHECK
965 # if ! @HAVE_DECL_STRTOK_R@
966 _GL_FUNCDECL_SYS (strtok_r,
char *,
967 (
char *restrict s,
char const *restrict delim,
968 char **restrict save_ptr)
969 _GL_ARG_NONNULL ((2, 3)));
971 _GL_CXXALIAS_SYS (strtok_r,
char *,
972 (
char *restrict s,
char const *restrict delim,
973 char **restrict save_ptr));
975 _GL_CXXALIASWARN (strtok_r);
976 # if defined GNULIB_POSIXCHECK
977 _GL_WARN_ON_USE (strtok_r,
"strtok_r cannot work correctly on character "
978 "strings in multibyte locales - "
979 "use mbstok_r if you care about internationalization");
981 #elif defined GNULIB_POSIXCHECK
983 # if HAVE_RAW_DECL_STRTOK_R
984 _GL_WARN_ON_USE (strtok_r,
"strtok_r is unportable - "
985 "use gnulib module strtok_r for portability");
1000 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1001 # define mbslen rpl_mbslen
1003 _GL_FUNCDECL_RPL (mbslen,
size_t, (
const char *
string)
1005 _GL_ARG_NONNULL ((1)));
1006 _GL_CXXALIAS_RPL (mbslen,
size_t, (
const char *
string));
1008 _GL_FUNCDECL_SYS (mbslen,
size_t, (
const char *
string)
1010 _GL_ARG_NONNULL ((1)));
1011 _GL_CXXALIAS_SYS (mbslen,
size_t, (
const char *
string));
1014 _GL_CXXALIASWARN (mbslen);
1018 #if @GNULIB_MBSNLEN@
1021 _GL_EXTERN_C
size_t mbsnlen (
const char *
string,
size_t len)
1023 _GL_ARG_NONNULL ((1));
1032 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1033 # define mbschr rpl_mbschr
1035 _GL_FUNCDECL_RPL (mbschr,
char *, (
const char *
string,
int c)
1037 _GL_ARG_NONNULL ((1)));
1038 _GL_CXXALIAS_RPL (mbschr,
char *, (
const char *
string,
int c));
1040 _GL_FUNCDECL_SYS (mbschr,
char *, (
const char *
string,
int c)
1042 _GL_ARG_NONNULL ((1)));
1043 _GL_CXXALIAS_SYS (mbschr,
char *, (
const char *
string,
int c));
1045 _GL_CXXALIASWARN (mbschr);
1048 #if @GNULIB_MBSRCHR@
1053 # if defined __hpux || defined __INTERIX
1054 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1055 # define mbsrchr rpl_mbsrchr
1057 _GL_FUNCDECL_RPL (mbsrchr,
char *, (
const char *
string,
int c)
1059 _GL_ARG_NONNULL ((1)));
1060 _GL_CXXALIAS_RPL (mbsrchr,
char *, (
const char *
string,
int c));
1062 _GL_FUNCDECL_SYS (mbsrchr,
char *, (
const char *
string,
int c)
1064 _GL_ARG_NONNULL ((1)));
1065 _GL_CXXALIAS_SYS (mbsrchr,
char *, (
const char *
string,
int c));
1067 _GL_CXXALIASWARN (mbsrchr);
1075 _GL_EXTERN_C
char * mbsstr (
const char *haystack,
const char *needle)
1077 _GL_ARG_NONNULL ((1, 2));
1080 #if @GNULIB_MBSCASECMP@
1087 _GL_EXTERN_C
int mbscasecmp (
const char *s1,
const char *s2)
1089 _GL_ARG_NONNULL ((1, 2));
1092 #if @GNULIB_MBSNCASECMP@
1102 _GL_EXTERN_C
int mbsncasecmp (
const char *s1,
const char *s2,
size_t n)
1104 _GL_ARG_NONNULL ((1, 2));
1107 #if @GNULIB_MBSPCASECMP@
1116 _GL_EXTERN_C
char * mbspcasecmp (
const char *
string,
const char *prefix)
1118 _GL_ARG_NONNULL ((1, 2));
1121 #if @GNULIB_MBSCASESTR@
1127 _GL_EXTERN_C
char * mbscasestr (
const char *haystack,
const char *needle)
1129 _GL_ARG_NONNULL ((1, 2));
1132 #if @GNULIB_MBSCSPN@
1138 _GL_EXTERN_C
size_t mbscspn (
const char *
string,
const char *accept)
1140 _GL_ARG_NONNULL ((1, 2));
1143 #if @GNULIB_MBSPBRK@
1149 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1150 # define mbspbrk rpl_mbspbrk
1152 _GL_FUNCDECL_RPL (mbspbrk,
char *, (
const char *
string,
const char *accept)
1154 _GL_ARG_NONNULL ((1, 2)));
1155 _GL_CXXALIAS_RPL (mbspbrk,
char *, (
const char *
string,
const char *accept));
1157 _GL_FUNCDECL_SYS (mbspbrk,
char *, (
const char *
string,
const char *accept)
1159 _GL_ARG_NONNULL ((1, 2)));
1160 _GL_CXXALIAS_SYS (mbspbrk,
char *, (
const char *
string,
const char *accept));
1162 _GL_CXXALIASWARN (mbspbrk);
1171 _GL_EXTERN_C
size_t mbsspn (
const char *
string,
const char *reject)
1173 _GL_ARG_NONNULL ((1, 2));
1191 _GL_EXTERN_C
char * mbssep (
char **stringp,
const char *delim)
1192 _GL_ARG_NONNULL ((1, 2));
1195 #if @GNULIB_MBSTOK_R@
1212 _GL_EXTERN_C
char * mbstok_r (
char *restrict
string,
const char *delim,
1214 _GL_ARG_NONNULL ((2, 3));
1218 #if @GNULIB_STRERROR@
1219 # if @REPLACE_STRERROR@
1220 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1222 # define strerror rpl_strerror
1224 _GL_FUNCDECL_RPL (strerror,
char *, (
int));
1225 _GL_CXXALIAS_RPL (strerror,
char *, (
int));
1227 _GL_CXXALIAS_SYS (strerror,
char *, (
int));
1230 _GL_CXXALIASWARN (strerror);
1232 #elif defined GNULIB_POSIXCHECK
1235 _GL_WARN_ON_USE (strerror,
"strerror is unportable - "
1236 "use gnulib module strerror to guarantee non-NULL result");
1241 #if @GNULIB_STRERROR_R@
1242 # if @REPLACE_STRERROR_R@
1243 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1245 # define strerror_r rpl_strerror_r
1247 _GL_FUNCDECL_RPL (strerror_r,
int, (
int errnum,
char *buf,
size_t buflen)
1248 _GL_ARG_NONNULL ((2)));
1249 _GL_CXXALIAS_RPL (strerror_r,
int, (
int errnum,
char *buf,
size_t buflen));
1251 # if !@HAVE_DECL_STRERROR_R@
1252 _GL_FUNCDECL_SYS (strerror_r,
int, (
int errnum,
char *buf,
size_t buflen)
1253 _GL_ARG_NONNULL ((2)));
1255 _GL_CXXALIAS_SYS (strerror_r,
int, (
int errnum,
char *buf,
size_t buflen));
1257 # if __GLIBC__ >= 2 && @HAVE_DECL_STRERROR_R@
1258 _GL_CXXALIASWARN (strerror_r);
1260 #elif defined GNULIB_POSIXCHECK
1262 # if HAVE_RAW_DECL_STRERROR_R
1263 _GL_WARN_ON_USE (strerror_r,
"strerror_r is unportable - "
1264 "use gnulib module strerror_r-posix for portability");
1269 #if @GNULIB_STRERRORNAME_NP@
1270 # if @REPLACE_STRERRORNAME_NP@
1271 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1272 # undef strerrorname_np
1273 # define strerrorname_np rpl_strerrorname_np
1275 _GL_FUNCDECL_RPL (strerrorname_np,
const char *, (
int errnum));
1276 _GL_CXXALIAS_RPL (strerrorname_np,
const char *, (
int errnum));
1278 # if !@HAVE_STRERRORNAME_NP@
1279 _GL_FUNCDECL_SYS (strerrorname_np,
const char *, (
int errnum));
1281 _GL_CXXALIAS_SYS (strerrorname_np,
const char *, (
int errnum));
1283 _GL_CXXALIASWARN (strerrorname_np);
1284 #elif defined GNULIB_POSIXCHECK
1285 # undef strerrorname_np
1286 # if HAVE_RAW_DECL_STRERRORNAME_NP
1287 _GL_WARN_ON_USE (strerrorname_np,
"strerrorname_np is unportable - "
1288 "use gnulib module strerrorname_np for portability");
1293 #if @GNULIB_SIGABBREV_NP@
1294 # if ! @HAVE_SIGABBREV_NP@
1295 _GL_FUNCDECL_SYS (sigabbrev_np,
const char *, (
int sig));
1297 _GL_CXXALIAS_SYS (sigabbrev_np,
const char *, (
int sig));
1298 _GL_CXXALIASWARN (sigabbrev_np);
1299 #elif defined GNULIB_POSIXCHECK
1300 # undef sigabbrev_np
1301 # if HAVE_RAW_DECL_SIGABBREV_NP
1302 _GL_WARN_ON_USE (sigabbrev_np,
"sigabbrev_np is unportable - "
1303 "use gnulib module sigabbrev_np for portability");
1308 #if @GNULIB_SIGDESCR_NP@
1309 # if ! @HAVE_SIGDESCR_NP@
1310 _GL_FUNCDECL_SYS (sigdescr_np,
const char *, (
int sig));
1312 _GL_CXXALIAS_SYS (sigdescr_np,
const char *, (
int sig));
1313 _GL_CXXALIASWARN (sigdescr_np);
1314 #elif defined GNULIB_POSIXCHECK
1316 # if HAVE_RAW_DECL_SIGDESCR_NP
1317 _GL_WARN_ON_USE (sigdescr_np,
"sigdescr_np is unportable - "
1318 "use gnulib module sigdescr_np for portability");
1322 #if @GNULIB_STRSIGNAL@
1323 # if @REPLACE_STRSIGNAL@
1324 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1325 # define strsignal rpl_strsignal
1327 _GL_FUNCDECL_RPL (strsignal,
char *, (
int __sig));
1328 _GL_CXXALIAS_RPL (strsignal,
char *, (
int __sig));
1330 # if ! @HAVE_DECL_STRSIGNAL@
1331 _GL_FUNCDECL_SYS (strsignal,
char *, (
int __sig));
1335 _GL_CXXALIAS_SYS_CAST (strsignal,
char *, (
int __sig));
1337 _GL_CXXALIASWARN (strsignal);
1338 #elif defined GNULIB_POSIXCHECK
1340 # if HAVE_RAW_DECL_STRSIGNAL
1341 _GL_WARN_ON_USE (strsignal,
"strsignal is unportable - "
1342 "use gnulib module strsignal for portability");
1346 #if @GNULIB_STRVERSCMP@
1347 # if !@HAVE_STRVERSCMP@
1348 _GL_FUNCDECL_SYS (strverscmp,
int, (
const char *,
const char *)
1350 _GL_ARG_NONNULL ((1, 2)));
1352 _GL_CXXALIAS_SYS (strverscmp,
int, (
const char *,
const char *));
1353 _GL_CXXALIASWARN (strverscmp);
1354 #elif defined GNULIB_POSIXCHECK
1356 # if HAVE_RAW_DECL_STRVERSCMP
1357 _GL_WARN_ON_USE (strverscmp,
"strverscmp is unportable - "
1358 "use gnulib module strverscmp for portability");