20 #pragma GCC system_header 24 #if defined _GL_ALREADY_INCLUDING_STRING_H 31 #include_next <string.h> 38 #define _GL_ALREADY_INCLUDING_STRING_H 41 #include_next <string.h> 43 #undef _GL_ALREADY_INCLUDING_STRING_H 52 #if 0 && defined __MirBSD__ 58 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) 59 # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) 61 # define _GL_ATTRIBUTE_PURE 66 #if (0 || defined GNULIB_POSIXCHECK) && defined __NetBSD__ \ 67 && ! defined __GLIBC__ 92 #if defined __cplusplus && defined GNULIB_NAMESPACE 93 # define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE { 94 # define _GL_END_NAMESPACE } 96 # define _GL_BEGIN_NAMESPACE 97 # define _GL_END_NAMESPACE 161 #if defined __cplusplus 162 # define _GL_EXTERN_C extern "C" 164 # define _GL_EXTERN_C extern 174 #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ 175 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) 176 #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ 177 _GL_EXTERN_C rettype rpl_func parameters_and_attributes 186 #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ 187 _GL_EXTERN_C rettype func parameters_and_attributes 198 #define _GL_CXXALIAS_RPL(func,rettype,parameters) \ 199 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) 200 #if defined __cplusplus && defined GNULIB_NAMESPACE 201 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 202 namespace GNULIB_NAMESPACE \ 204 static const struct _gl_ ## func ## _wrapper \ 206 typedef rettype (*type) parameters; \ 208 inline operator type () const \ 214 _GL_EXTERN_C int _gl_cxxalias_dummy 216 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 217 _GL_EXTERN_C int _gl_cxxalias_dummy 225 #if defined __cplusplus && defined GNULIB_NAMESPACE 226 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 227 namespace GNULIB_NAMESPACE \ 229 static const struct _gl_ ## func ## _wrapper \ 231 typedef rettype (*type) parameters; \ 233 inline operator type () const \ 235 return reinterpret_cast<type>(::rpl_func); \ 239 _GL_EXTERN_C int _gl_cxxalias_dummy 241 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 242 _GL_EXTERN_C int _gl_cxxalias_dummy 255 #if defined __cplusplus && defined GNULIB_NAMESPACE 256 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 257 namespace GNULIB_NAMESPACE \ 259 static const struct _gl_ ## func ## _wrapper \ 261 typedef rettype (*type) parameters; \ 263 inline operator type () const \ 269 _GL_EXTERN_C int _gl_cxxalias_dummy 271 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 272 _GL_EXTERN_C int _gl_cxxalias_dummy 280 #if defined __cplusplus && defined GNULIB_NAMESPACE 281 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 282 namespace GNULIB_NAMESPACE \ 284 static const struct _gl_ ## func ## _wrapper \ 286 typedef rettype (*type) parameters; \ 288 inline operator type () const \ 290 return reinterpret_cast<type>(::func); \ 294 _GL_EXTERN_C int _gl_cxxalias_dummy 296 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 297 _GL_EXTERN_C int _gl_cxxalias_dummy 306 #if defined __cplusplus && defined GNULIB_NAMESPACE 312 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 313 namespace GNULIB_NAMESPACE \ 315 static const struct _gl_ ## func ## _wrapper \ 317 typedef rettype (*type) parameters; \ 319 inline operator type () const \ 321 return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \ 325 _GL_EXTERN_C int _gl_cxxalias_dummy 327 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 328 _GL_EXTERN_C int _gl_cxxalias_dummy 335 #if defined __cplusplus && defined GNULIB_NAMESPACE 336 # define _GL_CXXALIASWARN(func) \ 337 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) 338 # define _GL_CXXALIASWARN_1(func,namespace) \ 339 _GL_CXXALIASWARN_2 (func, namespace) 343 # define _GL_CXXALIASWARN_2(func,namespace) \ 344 _GL_WARN_ON_USE (func, \ 345 "The symbol ::" #func " refers to the system function. " \ 346 "Use " #namespace "::" #func " instead.") 347 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 348 # define _GL_CXXALIASWARN_2(func,namespace) \ 349 extern __typeof__ (func) func 351 # define _GL_CXXALIASWARN_2(func,namespace) \ 352 _GL_EXTERN_C int _gl_cxxalias_dummy 355 # define _GL_CXXALIASWARN(func) \ 356 _GL_EXTERN_C int _gl_cxxalias_dummy 362 #if defined __cplusplus && defined GNULIB_NAMESPACE 363 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 364 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ 366 # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ 367 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) 371 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 372 _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \ 373 "The symbol ::" #func " refers to the system function. " \ 374 "Use " #namespace "::" #func " instead.") 375 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 376 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 377 extern __typeof__ (func) func 379 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 380 _GL_EXTERN_C int _gl_cxxalias_dummy 383 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 384 _GL_EXTERN_C int _gl_cxxalias_dummy 409 #ifndef _GL_ARG_NONNULL 410 # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3 411 # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) 413 # define _GL_ARG_NONNULL(params) 481 #ifndef _GL_WARN_ON_USE 483 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 485 # define _GL_WARN_ON_USE(function, message) \ 486 extern __typeof__ (function) function __attribute__ ((__warning__ (message))) 487 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 489 # define _GL_WARN_ON_USE(function, message) \ 490 extern __typeof__ (function) function 492 # define _GL_WARN_ON_USE(function, message) \ 493 _GL_WARN_EXTERN_C int _gl_warn_on_use 503 #ifndef _GL_WARN_ON_USE_CXX 504 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 505 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 506 extern rettype function parameters_and_attributes \ 507 __attribute__ ((__warning__ (msg))) 508 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 510 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 511 extern rettype function parameters_and_attributes 513 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 514 _GL_WARN_EXTERN_C int _gl_warn_on_use 520 #ifndef _GL_WARN_EXTERN_C 521 # if defined __cplusplus 522 # define _GL_WARN_EXTERN_C extern "C" 524 # define _GL_WARN_EXTERN_C extern 538 #elif defined GNULIB_POSIXCHECK 539 # undef explicit_bzero 540 # if HAVE_RAW_DECL_EXPLICIT_BZERO 542 "use gnulib module explicit_bzero for portability");
553 #elif defined GNULIB_POSIXCHECK 555 # if HAVE_RAW_DECL_FFSL 568 #elif defined GNULIB_POSIXCHECK 570 # if HAVE_RAW_DECL_FFSLL 571 _GL_WARN_ON_USE (ffsll,
"ffsll is not portable - use the ffsll module");
579 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 580 # define memchr rpl_memchr 596 void *, (
void const *__s,
int __c,
size_t __n),
597 void const *, (
void const *__s,
int __c,
size_t __n));
599 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 600 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 603 (
void const *__s,
int __c,
size_t __n));
607 #elif defined GNULIB_POSIXCHECK 611 "use gnulib module memchr for portability" );
617 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 618 # define memmem rpl_memmem 621 (
void const *__haystack,
size_t __haystack_len,
622 void const *__needle,
size_t __needle_len)
626 (
void const *__haystack,
size_t __haystack_len,
627 void const *__needle,
size_t __needle_len));
631 (
void const *__haystack,
size_t __haystack_len,
632 void const *__needle,
size_t __needle_len)
637 (
void const *__haystack,
size_t __haystack_len,
638 void const *__needle,
size_t __needle_len));
641 #elif defined GNULIB_POSIXCHECK 643 # if HAVE_RAW_DECL_MEMMEM 645 "use gnulib module memmem-simple for portability, " 646 "and module memmem for speed" );
663 #elif defined GNULIB_POSIXCHECK 665 # if HAVE_RAW_DECL_MEMPCPY 667 "use gnulib module mempcpy for portability");
682 void *, (
void const *,
int,
size_t),
683 void const *, (
void const *,
int,
size_t));
684 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 685 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 691 #elif defined GNULIB_POSIXCHECK 693 # if HAVE_RAW_DECL_MEMRCHR 695 "use gnulib module memrchr for portability");
712 void *, (
void const *__s,
int __c_in),
713 void const *, (
void const *__s,
int __c_in));
714 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 715 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 721 #elif defined GNULIB_POSIXCHECK 723 # if HAVE_RAW_DECL_RAWMEMCHR 725 "use gnulib module rawmemchr for portability");
739 #elif defined GNULIB_POSIXCHECK 741 # if HAVE_RAW_DECL_STPCPY 743 "use gnulib module stpcpy for portability");
751 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 753 # define stpncpy rpl_stpncpy 774 #elif defined GNULIB_POSIXCHECK 776 # if HAVE_RAW_DECL_STPNCPY 778 "use gnulib module stpncpy for portability");
782 #if defined GNULIB_POSIXCHECK 787 _GL_WARN_ON_USE (strchr,
"strchr cannot work correctly on character strings " 788 "in some multibyte locales - " 789 "use mbschr if you care about internationalization");
795 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 796 # define strchrnul rpl_strchrnul 802 (
const char *str,
int ch));
813 char *, (
char const *__s,
int __c_in),
814 char const *, (
char const *__s,
int __c_in));
816 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 817 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 823 #elif defined GNULIB_POSIXCHECK 825 # if HAVE_RAW_DECL_STRCHRNUL 827 "use gnulib module strchrnul for portability");
834 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 836 # define strdup rpl_strdup 841 # if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup 845 # if !(1 || defined strdup) 851 #elif defined GNULIB_POSIXCHECK 853 # if HAVE_RAW_DECL_STRDUP 855 "use gnulib module strdup for portability");
862 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 864 # define strncat rpl_strncat 868 _GL_CXXALIAS_RPL (strncat,
char *, (
char *dest,
const char *src,
size_t n));
870 _GL_CXXALIAS_SYS (strncat,
char *, (
char *dest,
const char *src,
size_t n));
873 #elif defined GNULIB_POSIXCHECK 875 # if HAVE_RAW_DECL_STRNCAT 877 "use gnulib module strncat for portability");
884 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 886 # define strndup rpl_strndup 899 #elif defined GNULIB_POSIXCHECK 901 # if HAVE_RAW_DECL_STRNDUP 903 "use gnulib module strndup for portability");
912 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 914 # define strnlen rpl_strnlen 929 #elif defined GNULIB_POSIXCHECK 931 # if HAVE_RAW_DECL_STRNLEN 933 "use gnulib module strnlen for portability");
937 #if defined GNULIB_POSIXCHECK 944 _GL_WARN_ON_USE (strcspn,
"strcspn cannot work correctly on character strings " 945 "in multibyte locales - " 946 "use mbscspn if you care about internationalization");
960 char *, (
char const *__s,
char const *__accept),
961 const char *, (
char const *__s,
char const *__accept));
962 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 963 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 966 (
char const *__s,
char const *__accept));
970 # if defined GNULIB_POSIXCHECK 976 _GL_WARN_ON_USE (strpbrk,
"strpbrk cannot work correctly on character strings " 977 "in multibyte locales - " 978 "use mbspbrk if you care about internationalization");
980 #elif defined GNULIB_POSIXCHECK 982 # if HAVE_RAW_DECL_STRPBRK 984 "use gnulib module strpbrk for portability");
988 #if defined GNULIB_POSIXCHECK 993 _GL_WARN_ON_USE (strspn,
"strspn cannot work correctly on character strings " 994 "in multibyte locales - " 995 "use mbsspn if you care about internationalization");
998 #if defined GNULIB_POSIXCHECK 1003 _GL_WARN_ON_USE (strrchr,
"strrchr cannot work correctly on character strings " 1004 "in some multibyte locales - " 1005 "use mbsrchr if you care about internationalization");
1033 # if defined GNULIB_POSIXCHECK 1035 _GL_WARN_ON_USE (strsep,
"strsep cannot work correctly on character strings " 1036 "in multibyte locales - " 1037 "use mbssep if you care about internationalization");
1039 #elif defined GNULIB_POSIXCHECK 1041 # if HAVE_RAW_DECL_STRSEP 1043 "use gnulib module strsep for portability");
1049 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1050 # define strstr rpl_strstr 1061 char *, (
const char *haystack,
const char *needle),
1062 const char *, (
const char *haystack,
const char *needle));
1064 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 1065 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 1068 (
const char *haystack,
const char *needle));
1072 #elif defined GNULIB_POSIXCHECK 1080 "work correctly on character strings in most " 1081 "multibyte locales - " 1082 "use mbsstr if you care about internationalization, " 1083 "or use strstr if you care about speed");
1090 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1091 # define strcasestr rpl_strcasestr 1094 (
const char *haystack,
const char *needle)
1098 (
const char *haystack,
const char *needle));
1102 (
const char *haystack,
const char *needle)
1110 char *, (
const char *haystack,
const char *needle),
1111 const char *, (
const char *haystack,
const char *needle));
1113 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 1114 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 1117 (
const char *haystack,
const char *needle));
1121 #elif defined GNULIB_POSIXCHECK 1126 # if HAVE_RAW_DECL_STRCASESTR 1127 _GL_WARN_ON_USE (strcasestr,
"strcasestr does work correctly on character " 1128 "strings in multibyte locales - " 1129 "use mbscasestr if you care about " 1130 "internationalization, or use c-strcasestr if you want " 1131 "a locale independent function");
1159 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1161 # define strtok_r rpl_strtok_r 1171 # if 0 || defined GNULIB_POSIXCHECK 1185 # if defined GNULIB_POSIXCHECK 1186 _GL_WARN_ON_USE (strtok_r,
"strtok_r cannot work correctly on character " 1187 "strings in multibyte locales - " 1188 "use mbstok_r if you care about internationalization");
1190 #elif defined GNULIB_POSIXCHECK 1192 # if HAVE_RAW_DECL_STRTOK_R 1194 "use gnulib module strtok_r for portability");
1209 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1210 # define mbslen rpl_mbslen 1228 _GL_EXTERN_C size_t mbsnlen (
const char *
string,
size_t len)
1239 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1240 # define mbschr rpl_mbschr 1260 # if defined __hpux || defined __INTERIX 1261 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1262 # define mbsrchr rpl_mbsrchr 1282 _GL_EXTERN_C char * mbsstr (
const char *haystack,
const char *needle)
1294 _GL_EXTERN_C int mbscasecmp (
const char *s1,
const char *s2)
1309 _GL_EXTERN_C int mbsncasecmp (
const char *s1,
const char *s2,
size_t n)
1323 _GL_EXTERN_C char * mbspcasecmp (
const char *
string,
const char *prefix)
1334 _GL_EXTERN_C char * mbscasestr (
const char *haystack,
const char *needle)
1345 _GL_EXTERN_C size_t mbscspn (
const char *
string,
const char *accept)
1356 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1357 # define mbspbrk rpl_mbspbrk 1359 _GL_FUNCDECL_RPL (mbspbrk,
char *, (
const char *
string,
const char *accept)
1362 _GL_CXXALIAS_RPL (mbspbrk,
char *, (
const char *
string,
const char *accept));
1364 _GL_FUNCDECL_SYS (mbspbrk,
char *, (
const char *
string,
const char *accept)
1367 _GL_CXXALIAS_SYS (mbspbrk,
char *, (
const char *
string,
const char *accept));
1378 _GL_EXTERN_C size_t mbsspn (
const char *
string,
const char *reject)
1398 _GL_EXTERN_C char * mbssep (
char **stringp,
const char *delim)
1419 _GL_EXTERN_C char * mbstok_r (
char *
string,
const char *delim,
char **save_ptr)
1426 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1428 # define strerror rpl_strerror 1436 #elif defined GNULIB_POSIXCHECK 1440 "use gnulib module strerror to guarantee non-NULL result");
1447 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1449 # define strerror_r rpl_strerror_r 1464 #elif defined GNULIB_POSIXCHECK 1466 # if HAVE_RAW_DECL_STRERROR_R 1468 "use gnulib module strerror_r-posix for portability");
1474 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1475 # define strsignal rpl_strsignal 1488 #elif defined GNULIB_POSIXCHECK 1490 # if HAVE_RAW_DECL_STRSIGNAL 1492 "use gnulib module strsignal for portability");
1504 #elif defined GNULIB_POSIXCHECK 1506 # if HAVE_RAW_DECL_STRVERSCMP 1508 "use gnulib module strverscmp for portability");
#define _GL_CXXALIAS_SYS_CAST2(func, rettype, parameters, rettype2, parameters2)
Definition: string.h:327
#define _GL_ATTRIBUTE_PURE
Definition: string.h:61
this configure time declaration test was not run int strerror_r(int errnum, char *buf, size_t buflen)
#define _GL_CXXALIASWARN(func)
Definition: string.h:355
#define _GL_CXXALIAS_SYS(func, rettype, parameters)
Definition: string.h:271
#define _GL_CXXALIAS_SYS_CAST(func, rettype, parameters)
Definition: string.h:296
#define _GL_CXXALIAS_RPL(func, rettype, parameters)
Definition: string.h:198
char * strstr(const char *haystack_start, const char *needle_start)
Definition: strstr.c:39
#define _GL_ARG_NONNULL(params)
Definition: string.h:413
#define _GL_CXXALIASWARN1(func, rettype, parameters_and_attributes)
Definition: string.h:383
#define _GL_EXTERN_C
Definition: string.h:164
char * strerror(int n)
Definition: strerror.c:36
#define _GL_FUNCDECL_RPL(func, rettype, parameters_and_attributes)
Definition: string.h:174
#define _GL_WARN_ON_USE(function, message)
Definition: string.h:492
#define restrict
Definition: config.h:1858
#define _GL_FUNCDECL_SYS(func, rettype, parameters_and_attributes)
Definition: string.h:186