20 #pragma GCC system_header 24 #if defined __need_system_stdlib_h || defined __need_malloc_and_calloc 28 #include_next <stdlib.h> 36 #include_next <stdlib.h> 45 #if 0 && !defined WEXITSTATUS 46 # include <sys/wait.h> 50 #if (0 || defined GNULIB_POSIXCHECK) && 0 51 # include <sys/loadavg.h> 55 #if 0 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) 75 # if !GNULIB_defined_struct_random_data 86 # define GNULIB_defined_struct_random_data 1 91 #if (0 || 0 || 0 || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) 101 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) 102 # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) 104 # define _GL_ATTRIBUTE_PURE 108 #if !defined _Noreturn && __STDC_VERSION__ < 201112 109 # if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \ 110 || 0x5110 <= __SUNPRO_C) 111 # define _Noreturn __attribute__ ((__noreturn__)) 112 # elif 1200 <= _MSC_VER 113 # define _Noreturn __declspec (noreturn) 120 #ifndef _GL_CXXDEFS_H 121 #define _GL_CXXDEFS_H 124 #if defined __cplusplus && defined GNULIB_NAMESPACE 125 # define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE { 126 # define _GL_END_NAMESPACE } 128 # define _GL_BEGIN_NAMESPACE 129 # define _GL_END_NAMESPACE 193 #if defined __cplusplus 194 # define _GL_EXTERN_C extern "C" 196 # define _GL_EXTERN_C extern 206 #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ 207 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) 208 #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ 209 _GL_EXTERN_C rettype rpl_func parameters_and_attributes 218 #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ 219 _GL_EXTERN_C rettype func parameters_and_attributes 230 #define _GL_CXXALIAS_RPL(func,rettype,parameters) \ 231 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) 232 #if defined __cplusplus && defined GNULIB_NAMESPACE 233 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 234 namespace GNULIB_NAMESPACE \ 236 static const struct _gl_ ## func ## _wrapper \ 238 typedef rettype (*type) parameters; \ 239 inline type rpl () const { return ::rpl_func; } \ 240 inline operator type () const { return rpl (); } \ 243 _GL_EXTERN_C int _gl_cxxalias_dummy 245 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 246 _GL_EXTERN_C int _gl_cxxalias_dummy 254 #if defined __cplusplus && defined GNULIB_NAMESPACE 255 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 256 namespace GNULIB_NAMESPACE \ 258 static const struct _gl_ ## func ## _wrapper \ 260 typedef rettype (*type) parameters; \ 261 inline type rpl () const \ 262 { return reinterpret_cast<type>(::rpl_func); } \ 263 inline operator type () const { return rpl (); } \ 266 _GL_EXTERN_C int _gl_cxxalias_dummy 268 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 269 _GL_EXTERN_C int _gl_cxxalias_dummy 282 #if defined __cplusplus && defined GNULIB_NAMESPACE 283 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 284 namespace GNULIB_NAMESPACE \ 286 static const struct _gl_ ## func ## _wrapper \ 288 typedef rettype (*type) parameters; \ 289 inline type rpl () const { return ::func; } \ 290 inline operator type () const { return rpl (); } \ 293 _GL_EXTERN_C int _gl_cxxalias_dummy 295 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 296 _GL_EXTERN_C int _gl_cxxalias_dummy 304 #if defined __cplusplus && defined GNULIB_NAMESPACE 305 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 306 namespace GNULIB_NAMESPACE \ 308 static const struct _gl_ ## func ## _wrapper \ 310 typedef rettype (*type) parameters; \ 311 inline type rpl () const \ 312 { return reinterpret_cast<type>(::func); } \ 313 inline operator type () const { return rpl (); }\ 316 _GL_EXTERN_C int _gl_cxxalias_dummy 318 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 319 _GL_EXTERN_C int _gl_cxxalias_dummy 328 #if defined __cplusplus && defined GNULIB_NAMESPACE 334 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 335 namespace GNULIB_NAMESPACE \ 337 static const struct _gl_ ## func ## _wrapper \ 339 typedef rettype (*type) parameters; \ 341 inline type rpl () const \ 342 { return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); }\ 344 inline operator type () const { return rpl (); } \ 347 _GL_EXTERN_C int _gl_cxxalias_dummy 349 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 350 _GL_EXTERN_C int _gl_cxxalias_dummy 357 #if defined __cplusplus && defined GNULIB_NAMESPACE 358 # define _GL_CXXALIASWARN(func) \ 359 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) 360 # define _GL_CXXALIASWARN_1(func,namespace) \ 361 _GL_CXXALIASWARN_2 (func, namespace) 365 # define _GL_CXXALIASWARN_2(func,namespace) \ 366 _GL_WARN_ON_USE (func, \ 367 "The symbol ::" #func " refers to the system function. " \ 368 "Use " #namespace "::" #func " instead.") 369 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 370 # define _GL_CXXALIASWARN_2(func,namespace) \ 371 extern __typeof__ (func) func 373 # define _GL_CXXALIASWARN_2(func,namespace) \ 374 _GL_EXTERN_C int _gl_cxxalias_dummy 377 # define _GL_CXXALIASWARN(func) \ 378 _GL_EXTERN_C int _gl_cxxalias_dummy 384 #if defined __cplusplus && defined GNULIB_NAMESPACE 385 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 386 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ 388 # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ 389 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) 393 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 394 _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \ 395 "The symbol ::" #func " refers to the system function. " \ 396 "Use " #namespace "::" #func " instead.") 397 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 398 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 399 extern __typeof__ (func) func 401 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 402 _GL_EXTERN_C int _gl_cxxalias_dummy 405 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 406 _GL_EXTERN_C int _gl_cxxalias_dummy 415 #ifndef _GL_ARG_NONNULL 416 # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3 417 # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) 419 # define _GL_ARG_NONNULL(params) 424 #ifndef _GL_WARN_ON_USE 426 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 428 # define _GL_WARN_ON_USE(function, message) \ 429 extern __typeof__ (function) function __attribute__ ((__warning__ (message))) 430 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 432 # define _GL_WARN_ON_USE(function, message) \ 433 extern __typeof__ (function) function 435 # define _GL_WARN_ON_USE(function, message) \ 436 _GL_WARN_EXTERN_C int _gl_warn_on_use 446 #ifndef _GL_WARN_ON_USE_CXX 447 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 448 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 449 extern rettype function parameters_and_attributes \ 450 __attribute__ ((__warning__ (msg))) 451 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 453 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 454 extern rettype function parameters_and_attributes 456 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 457 _GL_WARN_EXTERN_C int _gl_warn_on_use 463 #ifndef _GL_WARN_EXTERN_C 464 # if defined __cplusplus 465 # define _GL_WARN_EXTERN_C extern "C" 467 # define _GL_WARN_EXTERN_C extern 474 # define EXIT_SUCCESS 0 479 # define EXIT_FAILURE 1 480 #elif EXIT_FAILURE != 1 482 # define EXIT_FAILURE 1 494 #elif defined GNULIB_POSIXCHECK 496 # if HAVE_RAW_DECL__EXIT 498 "use gnulib module _Exit for portability");
513 #elif defined GNULIB_POSIXCHECK 515 # if HAVE_RAW_DECL_ATOLL 517 "use gnulib module atoll for portability");
523 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 525 # define calloc rpl_calloc 533 #elif defined GNULIB_POSIXCHECK 537 "use gnulib module calloc-posix for portability");
542 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 543 # define canonicalize_file_name rpl_canonicalize_file_name 556 #elif defined GNULIB_POSIXCHECK 557 # undef canonicalize_file_name 558 # if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME 560 "canonicalize_file_name is unportable - " 561 "use gnulib module canonicalize-lgpl for portability");
576 #elif defined GNULIB_POSIXCHECK 578 # if HAVE_RAW_DECL_GETLOADAVG 580 "use gnulib module getloadavg for portability");
598 (
char **optionp,
char *
const *tokens,
char **valuep)
602 (
char **optionp,
char *
const *tokens,
char **valuep));
604 #elif defined GNULIB_POSIXCHECK 606 # if HAVE_RAW_DECL_GETSUBOPT 608 "use gnulib module getsubopt for portability");
620 #elif defined GNULIB_POSIXCHECK 622 # if HAVE_RAW_DECL_GRANTPT 624 "use gnulib module grantpt for portability");
634 # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ 635 || _GL_USE_STDLIB_ALLOC) 637 # define malloc rpl_malloc 645 #elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC 649 "use gnulib module malloc-posix for portability");
655 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 657 # define mbtowc rpl_mbtowc 678 #elif defined GNULIB_POSIXCHECK 680 # if HAVE_RAW_DECL_MKDTEMP 682 "use gnulib module mkdtemp for portability");
705 #elif defined GNULIB_POSIXCHECK 707 # if HAVE_RAW_DECL_MKOSTEMP 709 "use gnulib module mkostemp for portability");
729 (
char * ,
int ,
int )
733 (
char * ,
int ,
int ));
735 #elif defined GNULIB_POSIXCHECK 737 # if HAVE_RAW_DECL_MKOSTEMPS 739 "use gnulib module mkostemps for portability");
754 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 755 # define mkstemp rpl_mkstemp 766 #elif defined GNULIB_POSIXCHECK 768 # if HAVE_RAW_DECL_MKSTEMP 770 "use gnulib module mkstemp for portability");
791 #elif defined GNULIB_POSIXCHECK 793 # if HAVE_RAW_DECL_MKSTEMPS 795 "use gnulib module mkstemps for portability");
807 #elif defined GNULIB_POSIXCHECK 809 # if HAVE_RAW_DECL_POSIX_OPENPT 811 "use gnulib module posix_openpt for portability");
819 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 821 # define ptsname rpl_ptsname 832 #elif defined GNULIB_POSIXCHECK 834 # if HAVE_RAW_DECL_PTSNAME 836 "use gnulib module ptsname for portability");
845 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 847 # define ptsname_r rpl_ptsname_r 858 #elif defined GNULIB_POSIXCHECK 860 # if HAVE_RAW_DECL_PTSNAME_R 862 "use gnulib module ptsname_r for portability");
868 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 870 # define putenv rpl_putenv 885 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 887 # define qsort_r rpl_qsort_r 890 int (*compare) (
void const *,
void const *,
894 int (*compare) (
void const *,
void const *,
900 int (*compare) (
void const *,
void const *,
905 int (*compare) (
void const *,
void const *,
910 #elif defined GNULIB_POSIXCHECK 912 # if HAVE_RAW_DECL_QSORT_R 914 "use gnulib module qsort_r for portability");
922 # define RAND_MAX 2147483647 934 #elif defined GNULIB_POSIXCHECK 936 # if HAVE_RAW_DECL_RANDOM 938 "use gnulib module random for portability");
948 #elif defined GNULIB_POSIXCHECK 950 # if HAVE_RAW_DECL_SRANDOM 952 "use gnulib module random for portability");
959 (
unsigned int seed,
char *buf,
size_t buf_size)
963 (
unsigned int seed,
char *buf,
size_t buf_size));
965 #elif defined GNULIB_POSIXCHECK 967 # if HAVE_RAW_DECL_INITSTATE_R 969 "use gnulib module random for portability");
979 #elif defined GNULIB_POSIXCHECK 981 # if HAVE_RAW_DECL_SETSTATE_R 983 "use gnulib module random for portability");
990 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 992 # define random_r rpl_random_r 996 _GL_CXXALIAS_RPL (random_r,
int, (
struct random_data *buf, int32_t *result));
1002 _GL_CXXALIAS_SYS (random_r,
int, (
struct random_data *buf, int32_t *result));
1005 #elif defined GNULIB_POSIXCHECK 1007 # if HAVE_RAW_DECL_RANDOM_R 1009 "use gnulib module random_r for portability");
1015 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1017 # define srandom_r rpl_srandom_r 1020 (
unsigned int seed,
struct random_data *rand_state)
1023 (
unsigned int seed,
struct random_data *rand_state));
1027 (
unsigned int seed,
struct random_data *rand_state)
1031 (
unsigned int seed,
struct random_data *rand_state));
1034 #elif defined GNULIB_POSIXCHECK 1036 # if HAVE_RAW_DECL_SRANDOM_R 1038 "use gnulib module random_r for portability");
1044 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1046 # define initstate_r rpl_initstate_r 1049 (
unsigned int seed,
char *buf,
size_t buf_size,
1050 struct random_data *rand_state)
1053 (
unsigned int seed,
char *buf,
size_t buf_size,
1054 struct random_data *rand_state));
1058 (
unsigned int seed,
char *buf,
size_t buf_size,
1059 struct random_data *rand_state)
1063 (
unsigned int seed,
char *buf,
size_t buf_size,
1064 struct random_data *rand_state));
1067 #elif defined GNULIB_POSIXCHECK 1069 # if HAVE_RAW_DECL_INITSTATE_R 1071 "use gnulib module random_r for portability");
1077 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1079 # define setstate_r rpl_setstate_r 1082 (
char *arg_state,
struct random_data *rand_state)
1085 (
char *arg_state,
struct random_data *rand_state));
1089 (
char *arg_state,
struct random_data *rand_state)
1093 (
char *arg_state,
struct random_data *rand_state));
1096 #elif defined GNULIB_POSIXCHECK 1098 # if HAVE_RAW_DECL_SETSTATE_R 1100 "use gnulib module random_r for portability");
1107 # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ 1108 || _GL_USE_STDLIB_ALLOC) 1110 # define realloc rpl_realloc 1118 #elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC 1121 _GL_WARN_ON_USE (realloc,
"realloc is not POSIX compliant everywhere - " 1122 "use gnulib module realloc-posix for portability");
1127 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1128 # define realpath rpl_realpath 1141 #elif defined GNULIB_POSIXCHECK 1143 # if HAVE_RAW_DECL_REALPATH 1144 _GL_WARN_ON_USE (realpath,
"realpath is unportable - use gnulib module " 1145 "canonicalize or canonicalize-lgpl for portability");
1157 #elif defined GNULIB_POSIXCHECK 1159 # if HAVE_RAW_DECL_RPMATCH 1161 "use gnulib module rpmatch for portability");
1173 #elif defined GNULIB_POSIXCHECK 1174 # undef secure_getenv 1175 # if HAVE_RAW_DECL_SECURE_GETENV 1177 "use gnulib module secure_getenv for portability");
1185 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1187 # define setenv rpl_setenv 1190 (
const char *
name,
const char *value,
int replace)
1193 (
const char *
name,
const char *value,
int replace));
1197 (
const char *
name,
const char *value,
int replace)
1201 (
const char *
name,
const char *value,
int replace));
1206 #elif defined GNULIB_POSIXCHECK 1208 # if HAVE_RAW_DECL_SETENV 1210 "use gnulib module setenv for portability");
1217 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1218 # define strtod rpl_strtod 1231 #elif defined GNULIB_POSIXCHECK 1233 # if HAVE_RAW_DECL_STRTOD 1235 "use gnulib module strtod for portability");
1250 (
const char *
string,
char **endptr,
int base)
1254 (
const char *
string,
char **endptr,
int base));
1256 #elif defined GNULIB_POSIXCHECK 1258 # if HAVE_RAW_DECL_STRTOLL 1260 "use gnulib module strtoll for portability");
1275 (
const char *
string,
char **endptr,
int base)
1279 (
const char *
string,
char **endptr,
int base));
1281 #elif defined GNULIB_POSIXCHECK 1283 # if HAVE_RAW_DECL_STRTOULL 1285 "use gnulib module strtoull for portability");
1297 #elif defined GNULIB_POSIXCHECK 1299 # if HAVE_RAW_DECL_UNLOCKPT 1301 "use gnulib module unlockpt for portability");
1308 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1310 # define unsetenv rpl_unsetenv 1323 #elif defined GNULIB_POSIXCHECK 1325 # if HAVE_RAW_DECL_UNSETENV 1327 "use gnulib module unsetenv for portability");
1334 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1336 # define wctomb rpl_wctomb #define _GL_ARG_NONNULL(params)
#define _GL_FUNCDECL_RPL(func, rettype, parameters_and_attributes)
#define _GL_CXXALIASWARN(func)
#define _GL_FUNCDECL_SYS(func, rettype, parameters_and_attributes)
#define _GL_WARN_ON_USE(function, message)
#define _GL_ATTRIBUTE_PURE
#define _GL_CXXALIAS_RPL(func, rettype, parameters)
#define _GL_CXXALIAS_SYS(func, rettype, parameters)