151ddd709SJohn Marino /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ 251ddd709SJohn Marino /* A GNU-like <stdlib.h>. 351ddd709SJohn Marino 4*4ce1b016SDaniel Fojt Copyright (C) 1995, 2001-2004, 2006-2020 Free Software Foundation, Inc. 551ddd709SJohn Marino 651ddd709SJohn Marino This program is free software: you can redistribute it and/or modify 751ddd709SJohn Marino it under the terms of the GNU General Public License as published by 851ddd709SJohn Marino the Free Software Foundation; either version 3 of the License, or 951ddd709SJohn Marino (at your option) any later version. 1051ddd709SJohn Marino 1151ddd709SJohn Marino This program is distributed in the hope that it will be useful, 1251ddd709SJohn Marino but WITHOUT ANY WARRANTY; without even the implied warranty of 1351ddd709SJohn Marino MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1451ddd709SJohn Marino GNU General Public License for more details. 1551ddd709SJohn Marino 1651ddd709SJohn Marino You should have received a copy of the GNU General Public License 17*4ce1b016SDaniel Fojt along with this program. If not, see <https://www.gnu.org/licenses/>. */ 1851ddd709SJohn Marino 1951ddd709SJohn Marino #if __GNUC__ >= 3 2051ddd709SJohn Marino #pragma GCC system_header 2151ddd709SJohn Marino #endif 2251ddd709SJohn Marino 2351ddd709SJohn Marino 2451ddd709SJohn Marino #if defined __need_system_stdlib_h || defined __need_malloc_and_calloc 2551ddd709SJohn Marino /* Special invocation conventions inside some gnulib header files, 2651ddd709SJohn Marino and inside some glibc header files, respectively. */ 2751ddd709SJohn Marino 2851ddd709SJohn Marino #include_next <stdlib.h> 2951ddd709SJohn Marino 3051ddd709SJohn Marino #else 3151ddd709SJohn Marino /* Normal invocation convention. */ 3251ddd709SJohn Marino 3351ddd709SJohn Marino #ifndef _GL_STDLIB_H 3451ddd709SJohn Marino 3551ddd709SJohn Marino /* The include_next requires a split double-inclusion guard. */ 3651ddd709SJohn Marino #include_next <stdlib.h> 3751ddd709SJohn Marino 3851ddd709SJohn Marino #ifndef _GL_STDLIB_H 3951ddd709SJohn Marino #define _GL_STDLIB_H 4051ddd709SJohn Marino 4151ddd709SJohn Marino /* NetBSD 5.0 mis-defines NULL. */ 4251ddd709SJohn Marino #include <stddef.h> 4351ddd709SJohn Marino 4451ddd709SJohn Marino /* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>. */ 4551ddd709SJohn Marino #if 0 && !defined WEXITSTATUS 4651ddd709SJohn Marino # include <sys/wait.h> 4751ddd709SJohn Marino #endif 4851ddd709SJohn Marino 4951ddd709SJohn Marino /* Solaris declares getloadavg() in <sys/loadavg.h>. */ 5051ddd709SJohn Marino #if (0 || defined GNULIB_POSIXCHECK) && 0 51*4ce1b016SDaniel Fojt /* OpenIndiana has a bug: <sys/time.h> must be included before 52*4ce1b016SDaniel Fojt <sys/loadavg.h>. */ 53*4ce1b016SDaniel Fojt # include <sys/time.h> 5451ddd709SJohn Marino # include <sys/loadavg.h> 5551ddd709SJohn Marino #endif 5651ddd709SJohn Marino 5751ddd709SJohn Marino /* Native Windows platforms declare mktemp() in <io.h>. */ 58*4ce1b016SDaniel Fojt #if 0 && (defined _WIN32 && ! defined __CYGWIN__) 5951ddd709SJohn Marino # include <io.h> 6051ddd709SJohn Marino #endif 6151ddd709SJohn Marino 6251ddd709SJohn Marino #if 0 6351ddd709SJohn Marino 6451ddd709SJohn Marino /* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included 6551ddd709SJohn Marino from <stdlib.h> if _REENTRANT is defined. Include it whenever we need 6651ddd709SJohn Marino 'struct random_data'. */ 6751ddd709SJohn Marino # if 1 6851ddd709SJohn Marino # include <random.h> 6951ddd709SJohn Marino # endif 7051ddd709SJohn Marino 7151ddd709SJohn Marino # if !1 || 0 || !1 7251ddd709SJohn Marino # include <stdint.h> 7351ddd709SJohn Marino # endif 7451ddd709SJohn Marino 7551ddd709SJohn Marino # if !1 7651ddd709SJohn Marino /* Define 'struct random_data'. 7751ddd709SJohn Marino But allow multiple gnulib generated <stdlib.h> replacements to coexist. */ 7851ddd709SJohn Marino # if !GNULIB_defined_struct_random_data 7951ddd709SJohn Marino struct random_data 8051ddd709SJohn Marino { 8151ddd709SJohn Marino int32_t *fptr; /* Front pointer. */ 8251ddd709SJohn Marino int32_t *rptr; /* Rear pointer. */ 8351ddd709SJohn Marino int32_t *state; /* Array of state values. */ 8451ddd709SJohn Marino int rand_type; /* Type of random number generator. */ 8551ddd709SJohn Marino int rand_deg; /* Degree of random number generator. */ 8651ddd709SJohn Marino int rand_sep; /* Distance between front and rear. */ 8751ddd709SJohn Marino int32_t *end_ptr; /* Pointer behind state table. */ 8851ddd709SJohn Marino }; 8951ddd709SJohn Marino # define GNULIB_defined_struct_random_data 1 9051ddd709SJohn Marino # endif 9151ddd709SJohn Marino # endif 9251ddd709SJohn Marino #endif 9351ddd709SJohn Marino 94*4ce1b016SDaniel Fojt #if (0 || 0 || 0 || 0 || 0 || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !(defined _WIN32 && ! defined __CYGWIN__) 9551ddd709SJohn Marino /* On Mac OS X 10.3, only <unistd.h> declares mkstemp. */ 9651ddd709SJohn Marino /* On Mac OS X 10.5, only <unistd.h> declares mkstemps. */ 97*4ce1b016SDaniel Fojt /* On Mac OS X 10.13, only <unistd.h> declares mkostemp and mkostemps. */ 9851ddd709SJohn Marino /* On Cygwin 1.7.1, only <unistd.h> declares getsubopt. */ 9951ddd709SJohn Marino /* But avoid namespace pollution on glibc systems and native Windows. */ 10051ddd709SJohn Marino # include <unistd.h> 10151ddd709SJohn Marino #endif 10251ddd709SJohn Marino 10351ddd709SJohn Marino /* The __attribute__ feature is available in gcc versions 2.5 and later. 10451ddd709SJohn Marino The attribute __pure__ was added in gcc 2.96. */ 10551ddd709SJohn Marino #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) 10651ddd709SJohn Marino # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) 10751ddd709SJohn Marino #else 10851ddd709SJohn Marino # define _GL_ATTRIBUTE_PURE /* empty */ 10951ddd709SJohn Marino #endif 11051ddd709SJohn Marino 11151ddd709SJohn Marino /* The definition of _Noreturn is copied here. */ 112*4ce1b016SDaniel Fojt /* A C macro for declaring that a function does not return. 113*4ce1b016SDaniel Fojt Copyright (C) 2011-2020 Free Software Foundation, Inc. 114*4ce1b016SDaniel Fojt 115*4ce1b016SDaniel Fojt This program is free software: you can redistribute it and/or modify it 116*4ce1b016SDaniel Fojt under the terms of the GNU General Public License as published 117*4ce1b016SDaniel Fojt by the Free Software Foundation; either version 3 of the License, or 118*4ce1b016SDaniel Fojt (at your option) any later version. 119*4ce1b016SDaniel Fojt 120*4ce1b016SDaniel Fojt This program is distributed in the hope that it will be useful, 121*4ce1b016SDaniel Fojt but WITHOUT ANY WARRANTY; without even the implied warranty of 122*4ce1b016SDaniel Fojt MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 123*4ce1b016SDaniel Fojt General Public License for more details. 124*4ce1b016SDaniel Fojt 125*4ce1b016SDaniel Fojt You should have received a copy of the GNU General Public License 126*4ce1b016SDaniel Fojt along with this program. If not, see <https://www.gnu.org/licenses/>. */ 127*4ce1b016SDaniel Fojt 128*4ce1b016SDaniel Fojt #ifndef _Noreturn 129*4ce1b016SDaniel Fojt # if (defined __cplusplus \ 130*4ce1b016SDaniel Fojt && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \ 131*4ce1b016SDaniel Fojt || (defined _MSC_VER && 1900 <= _MSC_VER)) \ 132*4ce1b016SDaniel Fojt && 0) 133*4ce1b016SDaniel Fojt /* [[noreturn]] is not practically usable, because with it the syntax 134*4ce1b016SDaniel Fojt extern _Noreturn void func (...); 135*4ce1b016SDaniel Fojt would not be valid; such a declaration would only be valid with 'extern' 136*4ce1b016SDaniel Fojt and '_Noreturn' swapped, or without the 'extern' keyword. However, some 137*4ce1b016SDaniel Fojt AIX system header files and several gnulib header files use precisely 138*4ce1b016SDaniel Fojt this syntax with 'extern'. */ 139*4ce1b016SDaniel Fojt # define _Noreturn [[noreturn]] 140*4ce1b016SDaniel Fojt # elif ((!defined __cplusplus || defined __clang__) \ 141*4ce1b016SDaniel Fojt && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \ 142*4ce1b016SDaniel Fojt || 4 < __GNUC__ + (7 <= __GNUC_MINOR__))) 143*4ce1b016SDaniel Fojt /* _Noreturn works as-is. */ 144*4ce1b016SDaniel Fojt # elif 2 < __GNUC__ + (8 <= __GNUC_MINOR__) || 0x5110 <= __SUNPRO_C 14551ddd709SJohn Marino # define _Noreturn __attribute__ ((__noreturn__)) 146*4ce1b016SDaniel Fojt # elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0) 14751ddd709SJohn Marino # define _Noreturn __declspec (noreturn) 14851ddd709SJohn Marino # else 14951ddd709SJohn Marino # define _Noreturn 15051ddd709SJohn Marino # endif 15151ddd709SJohn Marino #endif 15251ddd709SJohn Marino 15351ddd709SJohn Marino /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 154*4ce1b016SDaniel Fojt /* C++ compatible function declaration macros. 155*4ce1b016SDaniel Fojt Copyright (C) 2010-2020 Free Software Foundation, Inc. 156*4ce1b016SDaniel Fojt 157*4ce1b016SDaniel Fojt This program is free software: you can redistribute it and/or modify it 158*4ce1b016SDaniel Fojt under the terms of the GNU General Public License as published 159*4ce1b016SDaniel Fojt by the Free Software Foundation; either version 3 of the License, or 160*4ce1b016SDaniel Fojt (at your option) any later version. 161*4ce1b016SDaniel Fojt 162*4ce1b016SDaniel Fojt This program is distributed in the hope that it will be useful, 163*4ce1b016SDaniel Fojt but WITHOUT ANY WARRANTY; without even the implied warranty of 164*4ce1b016SDaniel Fojt MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 165*4ce1b016SDaniel Fojt General Public License for more details. 166*4ce1b016SDaniel Fojt 167*4ce1b016SDaniel Fojt You should have received a copy of the GNU General Public License 168*4ce1b016SDaniel Fojt along with this program. If not, see <https://www.gnu.org/licenses/>. */ 169*4ce1b016SDaniel Fojt 17051ddd709SJohn Marino #ifndef _GL_CXXDEFS_H 17151ddd709SJohn Marino #define _GL_CXXDEFS_H 17251ddd709SJohn Marino 173*4ce1b016SDaniel Fojt /* Begin/end the GNULIB_NAMESPACE namespace. */ 174*4ce1b016SDaniel Fojt #if defined __cplusplus && defined GNULIB_NAMESPACE 175*4ce1b016SDaniel Fojt # define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE { 176*4ce1b016SDaniel Fojt # define _GL_END_NAMESPACE } 177*4ce1b016SDaniel Fojt #else 178*4ce1b016SDaniel Fojt # define _GL_BEGIN_NAMESPACE 179*4ce1b016SDaniel Fojt # define _GL_END_NAMESPACE 180*4ce1b016SDaniel Fojt #endif 181*4ce1b016SDaniel Fojt 18251ddd709SJohn Marino /* The three most frequent use cases of these macros are: 18351ddd709SJohn Marino 18451ddd709SJohn Marino * For providing a substitute for a function that is missing on some 18551ddd709SJohn Marino platforms, but is declared and works fine on the platforms on which 18651ddd709SJohn Marino it exists: 18751ddd709SJohn Marino 18851ddd709SJohn Marino #if @GNULIB_FOO@ 18951ddd709SJohn Marino # if !@HAVE_FOO@ 19051ddd709SJohn Marino _GL_FUNCDECL_SYS (foo, ...); 19151ddd709SJohn Marino # endif 19251ddd709SJohn Marino _GL_CXXALIAS_SYS (foo, ...); 19351ddd709SJohn Marino _GL_CXXALIASWARN (foo); 19451ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 19551ddd709SJohn Marino ... 19651ddd709SJohn Marino #endif 19751ddd709SJohn Marino 19851ddd709SJohn Marino * For providing a replacement for a function that exists on all platforms, 19951ddd709SJohn Marino but is broken/insufficient and needs to be replaced on some platforms: 20051ddd709SJohn Marino 20151ddd709SJohn Marino #if @GNULIB_FOO@ 20251ddd709SJohn Marino # if @REPLACE_FOO@ 20351ddd709SJohn Marino # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 20451ddd709SJohn Marino # undef foo 20551ddd709SJohn Marino # define foo rpl_foo 20651ddd709SJohn Marino # endif 20751ddd709SJohn Marino _GL_FUNCDECL_RPL (foo, ...); 20851ddd709SJohn Marino _GL_CXXALIAS_RPL (foo, ...); 20951ddd709SJohn Marino # else 21051ddd709SJohn Marino _GL_CXXALIAS_SYS (foo, ...); 21151ddd709SJohn Marino # endif 21251ddd709SJohn Marino _GL_CXXALIASWARN (foo); 21351ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 21451ddd709SJohn Marino ... 21551ddd709SJohn Marino #endif 21651ddd709SJohn Marino 21751ddd709SJohn Marino * For providing a replacement for a function that exists on some platforms 21851ddd709SJohn Marino but is broken/insufficient and needs to be replaced on some of them and 21951ddd709SJohn Marino is additionally either missing or undeclared on some other platforms: 22051ddd709SJohn Marino 22151ddd709SJohn Marino #if @GNULIB_FOO@ 22251ddd709SJohn Marino # if @REPLACE_FOO@ 22351ddd709SJohn Marino # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 22451ddd709SJohn Marino # undef foo 22551ddd709SJohn Marino # define foo rpl_foo 22651ddd709SJohn Marino # endif 22751ddd709SJohn Marino _GL_FUNCDECL_RPL (foo, ...); 22851ddd709SJohn Marino _GL_CXXALIAS_RPL (foo, ...); 22951ddd709SJohn Marino # else 23051ddd709SJohn Marino # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ 23151ddd709SJohn Marino _GL_FUNCDECL_SYS (foo, ...); 23251ddd709SJohn Marino # endif 23351ddd709SJohn Marino _GL_CXXALIAS_SYS (foo, ...); 23451ddd709SJohn Marino # endif 23551ddd709SJohn Marino _GL_CXXALIASWARN (foo); 23651ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 23751ddd709SJohn Marino ... 23851ddd709SJohn Marino #endif 23951ddd709SJohn Marino */ 24051ddd709SJohn Marino 24151ddd709SJohn Marino /* _GL_EXTERN_C declaration; 24251ddd709SJohn Marino performs the declaration with C linkage. */ 24351ddd709SJohn Marino #if defined __cplusplus 24451ddd709SJohn Marino # define _GL_EXTERN_C extern "C" 24551ddd709SJohn Marino #else 24651ddd709SJohn Marino # define _GL_EXTERN_C extern 24751ddd709SJohn Marino #endif 24851ddd709SJohn Marino 24951ddd709SJohn Marino /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); 25051ddd709SJohn Marino declares a replacement function, named rpl_func, with the given prototype, 25151ddd709SJohn Marino consisting of return type, parameters, and attributes. 25251ddd709SJohn Marino Example: 25351ddd709SJohn Marino _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) 25451ddd709SJohn Marino _GL_ARG_NONNULL ((1))); 25551ddd709SJohn Marino */ 25651ddd709SJohn Marino #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ 25751ddd709SJohn Marino _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) 25851ddd709SJohn Marino #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ 25951ddd709SJohn Marino _GL_EXTERN_C rettype rpl_func parameters_and_attributes 26051ddd709SJohn Marino 26151ddd709SJohn Marino /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); 26251ddd709SJohn Marino declares the system function, named func, with the given prototype, 26351ddd709SJohn Marino consisting of return type, parameters, and attributes. 26451ddd709SJohn Marino Example: 26551ddd709SJohn Marino _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) 26651ddd709SJohn Marino _GL_ARG_NONNULL ((1))); 26751ddd709SJohn Marino */ 26851ddd709SJohn Marino #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ 26951ddd709SJohn Marino _GL_EXTERN_C rettype func parameters_and_attributes 27051ddd709SJohn Marino 27151ddd709SJohn Marino /* _GL_CXXALIAS_RPL (func, rettype, parameters); 27251ddd709SJohn Marino declares a C++ alias called GNULIB_NAMESPACE::func 27351ddd709SJohn Marino that redirects to rpl_func, if GNULIB_NAMESPACE is defined. 27451ddd709SJohn Marino Example: 27551ddd709SJohn Marino _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); 276*4ce1b016SDaniel Fojt 277*4ce1b016SDaniel Fojt Wrapping rpl_func in an object with an inline conversion operator 278*4ce1b016SDaniel Fojt avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is 279*4ce1b016SDaniel Fojt actually used in the program. */ 28051ddd709SJohn Marino #define _GL_CXXALIAS_RPL(func,rettype,parameters) \ 28151ddd709SJohn Marino _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) 28251ddd709SJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE 28351ddd709SJohn Marino # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 28451ddd709SJohn Marino namespace GNULIB_NAMESPACE \ 28551ddd709SJohn Marino { \ 286*4ce1b016SDaniel Fojt static const struct _gl_ ## func ## _wrapper \ 287*4ce1b016SDaniel Fojt { \ 288*4ce1b016SDaniel Fojt typedef rettype (*type) parameters; \ 289*4ce1b016SDaniel Fojt \ 290*4ce1b016SDaniel Fojt inline operator type () const \ 291*4ce1b016SDaniel Fojt { \ 292*4ce1b016SDaniel Fojt return ::rpl_func; \ 293*4ce1b016SDaniel Fojt } \ 294*4ce1b016SDaniel Fojt } func = {}; \ 29551ddd709SJohn Marino } \ 29651ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 29751ddd709SJohn Marino #else 29851ddd709SJohn Marino # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 29951ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 30051ddd709SJohn Marino #endif 30151ddd709SJohn Marino 30251ddd709SJohn Marino /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); 30351ddd709SJohn Marino is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); 30451ddd709SJohn Marino except that the C function rpl_func may have a slightly different 30551ddd709SJohn Marino declaration. A cast is used to silence the "invalid conversion" error 30651ddd709SJohn Marino that would otherwise occur. */ 30751ddd709SJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE 30851ddd709SJohn Marino # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 30951ddd709SJohn Marino namespace GNULIB_NAMESPACE \ 31051ddd709SJohn Marino { \ 311*4ce1b016SDaniel Fojt static const struct _gl_ ## func ## _wrapper \ 312*4ce1b016SDaniel Fojt { \ 313*4ce1b016SDaniel Fojt typedef rettype (*type) parameters; \ 314*4ce1b016SDaniel Fojt \ 315*4ce1b016SDaniel Fojt inline operator type () const \ 316*4ce1b016SDaniel Fojt { \ 317*4ce1b016SDaniel Fojt return reinterpret_cast<type>(::rpl_func); \ 318*4ce1b016SDaniel Fojt } \ 319*4ce1b016SDaniel Fojt } func = {}; \ 32051ddd709SJohn Marino } \ 32151ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 32251ddd709SJohn Marino #else 32351ddd709SJohn Marino # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 32451ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 32551ddd709SJohn Marino #endif 32651ddd709SJohn Marino 32751ddd709SJohn Marino /* _GL_CXXALIAS_SYS (func, rettype, parameters); 32851ddd709SJohn Marino declares a C++ alias called GNULIB_NAMESPACE::func 32951ddd709SJohn Marino that redirects to the system provided function func, if GNULIB_NAMESPACE 33051ddd709SJohn Marino is defined. 33151ddd709SJohn Marino Example: 33251ddd709SJohn Marino _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); 333*4ce1b016SDaniel Fojt 334*4ce1b016SDaniel Fojt Wrapping func in an object with an inline conversion operator 335*4ce1b016SDaniel Fojt avoids a reference to func unless GNULIB_NAMESPACE::func is 336*4ce1b016SDaniel Fojt actually used in the program. */ 33751ddd709SJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE 33851ddd709SJohn Marino # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 33951ddd709SJohn Marino namespace GNULIB_NAMESPACE \ 34051ddd709SJohn Marino { \ 341*4ce1b016SDaniel Fojt static const struct _gl_ ## func ## _wrapper \ 342*4ce1b016SDaniel Fojt { \ 343*4ce1b016SDaniel Fojt typedef rettype (*type) parameters; \ 344*4ce1b016SDaniel Fojt \ 345*4ce1b016SDaniel Fojt inline operator type () const \ 346*4ce1b016SDaniel Fojt { \ 347*4ce1b016SDaniel Fojt return ::func; \ 348*4ce1b016SDaniel Fojt } \ 349*4ce1b016SDaniel Fojt } func = {}; \ 35051ddd709SJohn Marino } \ 35151ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 35251ddd709SJohn Marino #else 35351ddd709SJohn Marino # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 35451ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 35551ddd709SJohn Marino #endif 35651ddd709SJohn Marino 35751ddd709SJohn Marino /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); 35851ddd709SJohn Marino is like _GL_CXXALIAS_SYS (func, rettype, parameters); 35951ddd709SJohn Marino except that the C function func may have a slightly different declaration. 36051ddd709SJohn Marino A cast is used to silence the "invalid conversion" error that would 36151ddd709SJohn Marino otherwise occur. */ 36251ddd709SJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE 36351ddd709SJohn Marino # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 36451ddd709SJohn Marino namespace GNULIB_NAMESPACE \ 36551ddd709SJohn Marino { \ 366*4ce1b016SDaniel Fojt static const struct _gl_ ## func ## _wrapper \ 367*4ce1b016SDaniel Fojt { \ 368*4ce1b016SDaniel Fojt typedef rettype (*type) parameters; \ 369*4ce1b016SDaniel Fojt \ 370*4ce1b016SDaniel Fojt inline operator type () const \ 371*4ce1b016SDaniel Fojt { \ 372*4ce1b016SDaniel Fojt return reinterpret_cast<type>(::func); \ 373*4ce1b016SDaniel Fojt } \ 374*4ce1b016SDaniel Fojt } func = {}; \ 37551ddd709SJohn Marino } \ 37651ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 37751ddd709SJohn Marino #else 37851ddd709SJohn Marino # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 37951ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 38051ddd709SJohn Marino #endif 38151ddd709SJohn Marino 38251ddd709SJohn Marino /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); 38351ddd709SJohn Marino is like _GL_CXXALIAS_SYS (func, rettype, parameters); 38451ddd709SJohn Marino except that the C function is picked among a set of overloaded functions, 38551ddd709SJohn Marino namely the one with rettype2 and parameters2. Two consecutive casts 38651ddd709SJohn Marino are used to silence the "cannot find a match" and "invalid conversion" 38751ddd709SJohn Marino errors that would otherwise occur. */ 38851ddd709SJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE 38951ddd709SJohn Marino /* The outer cast must be a reinterpret_cast. 39051ddd709SJohn Marino The inner cast: When the function is defined as a set of overloaded 39151ddd709SJohn Marino functions, it works as a static_cast<>, choosing the designated variant. 39251ddd709SJohn Marino When the function is defined as a single variant, it works as a 39351ddd709SJohn Marino reinterpret_cast<>. The parenthesized cast syntax works both ways. */ 39451ddd709SJohn Marino # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 39551ddd709SJohn Marino namespace GNULIB_NAMESPACE \ 39651ddd709SJohn Marino { \ 397*4ce1b016SDaniel Fojt static const struct _gl_ ## func ## _wrapper \ 398*4ce1b016SDaniel Fojt { \ 399*4ce1b016SDaniel Fojt typedef rettype (*type) parameters; \ 400*4ce1b016SDaniel Fojt \ 401*4ce1b016SDaniel Fojt inline operator type () const \ 402*4ce1b016SDaniel Fojt { \ 403*4ce1b016SDaniel Fojt return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \ 404*4ce1b016SDaniel Fojt } \ 405*4ce1b016SDaniel Fojt } func = {}; \ 40651ddd709SJohn Marino } \ 40751ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 40851ddd709SJohn Marino #else 40951ddd709SJohn Marino # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 41051ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 41151ddd709SJohn Marino #endif 41251ddd709SJohn Marino 41351ddd709SJohn Marino /* _GL_CXXALIASWARN (func); 41451ddd709SJohn Marino causes a warning to be emitted when ::func is used but not when 41551ddd709SJohn Marino GNULIB_NAMESPACE::func is used. func must be defined without overloaded 41651ddd709SJohn Marino variants. */ 41751ddd709SJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE 41851ddd709SJohn Marino # define _GL_CXXALIASWARN(func) \ 41951ddd709SJohn Marino _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) 42051ddd709SJohn Marino # define _GL_CXXALIASWARN_1(func,namespace) \ 42151ddd709SJohn Marino _GL_CXXALIASWARN_2 (func, namespace) 422*4ce1b016SDaniel Fojt /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 42351ddd709SJohn Marino we enable the warning only when not optimizing. */ 42451ddd709SJohn Marino # if !__OPTIMIZE__ 42551ddd709SJohn Marino # define _GL_CXXALIASWARN_2(func,namespace) \ 42651ddd709SJohn Marino _GL_WARN_ON_USE (func, \ 42751ddd709SJohn Marino "The symbol ::" #func " refers to the system function. " \ 42851ddd709SJohn Marino "Use " #namespace "::" #func " instead.") 42951ddd709SJohn Marino # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 43051ddd709SJohn Marino # define _GL_CXXALIASWARN_2(func,namespace) \ 43151ddd709SJohn Marino extern __typeof__ (func) func 43251ddd709SJohn Marino # else 43351ddd709SJohn Marino # define _GL_CXXALIASWARN_2(func,namespace) \ 43451ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 43551ddd709SJohn Marino # endif 43651ddd709SJohn Marino #else 43751ddd709SJohn Marino # define _GL_CXXALIASWARN(func) \ 43851ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 43951ddd709SJohn Marino #endif 44051ddd709SJohn Marino 44151ddd709SJohn Marino /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); 44251ddd709SJohn Marino causes a warning to be emitted when the given overloaded variant of ::func 44351ddd709SJohn Marino is used but not when GNULIB_NAMESPACE::func is used. */ 44451ddd709SJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE 44551ddd709SJohn Marino # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 44651ddd709SJohn Marino _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ 44751ddd709SJohn Marino GNULIB_NAMESPACE) 44851ddd709SJohn Marino # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ 44951ddd709SJohn Marino _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) 450*4ce1b016SDaniel Fojt /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 45151ddd709SJohn Marino we enable the warning only when not optimizing. */ 45251ddd709SJohn Marino # if !__OPTIMIZE__ 45351ddd709SJohn Marino # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 45451ddd709SJohn Marino _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \ 45551ddd709SJohn Marino "The symbol ::" #func " refers to the system function. " \ 45651ddd709SJohn Marino "Use " #namespace "::" #func " instead.") 45751ddd709SJohn Marino # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 45851ddd709SJohn Marino # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 45951ddd709SJohn Marino extern __typeof__ (func) func 46051ddd709SJohn Marino # else 46151ddd709SJohn Marino # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 46251ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 46351ddd709SJohn Marino # endif 46451ddd709SJohn Marino #else 46551ddd709SJohn Marino # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 46651ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 46751ddd709SJohn Marino #endif 46851ddd709SJohn Marino 46951ddd709SJohn Marino #endif /* _GL_CXXDEFS_H */ 47051ddd709SJohn Marino 47151ddd709SJohn Marino /* The definition of _GL_ARG_NONNULL is copied here. */ 472*4ce1b016SDaniel Fojt /* A C macro for declaring that specific arguments must not be NULL. 473*4ce1b016SDaniel Fojt Copyright (C) 2009-2020 Free Software Foundation, Inc. 474*4ce1b016SDaniel Fojt 475*4ce1b016SDaniel Fojt This program is free software: you can redistribute it and/or modify it 476*4ce1b016SDaniel Fojt under the terms of the GNU General Public License as published 477*4ce1b016SDaniel Fojt by the Free Software Foundation; either version 3 of the License, or 478*4ce1b016SDaniel Fojt (at your option) any later version. 479*4ce1b016SDaniel Fojt 480*4ce1b016SDaniel Fojt This program is distributed in the hope that it will be useful, 481*4ce1b016SDaniel Fojt but WITHOUT ANY WARRANTY; without even the implied warranty of 482*4ce1b016SDaniel Fojt MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 483*4ce1b016SDaniel Fojt General Public License for more details. 484*4ce1b016SDaniel Fojt 485*4ce1b016SDaniel Fojt You should have received a copy of the GNU General Public License 486*4ce1b016SDaniel Fojt along with this program. If not, see <https://www.gnu.org/licenses/>. */ 487*4ce1b016SDaniel Fojt 48851ddd709SJohn Marino /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools 48951ddd709SJohn Marino that the values passed as arguments n, ..., m must be non-NULL pointers. 49051ddd709SJohn Marino n = 1 stands for the first argument, n = 2 for the second argument etc. */ 49151ddd709SJohn Marino #ifndef _GL_ARG_NONNULL 49251ddd709SJohn Marino # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3 49351ddd709SJohn Marino # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) 49451ddd709SJohn Marino # else 49551ddd709SJohn Marino # define _GL_ARG_NONNULL(params) 49651ddd709SJohn Marino # endif 49751ddd709SJohn Marino #endif 49851ddd709SJohn Marino 49951ddd709SJohn Marino /* The definition of _GL_WARN_ON_USE is copied here. */ 500*4ce1b016SDaniel Fojt /* A C macro for emitting warnings if a function is used. 501*4ce1b016SDaniel Fojt Copyright (C) 2010-2020 Free Software Foundation, Inc. 502*4ce1b016SDaniel Fojt 503*4ce1b016SDaniel Fojt This program is free software: you can redistribute it and/or modify it 504*4ce1b016SDaniel Fojt under the terms of the GNU General Public License as published 505*4ce1b016SDaniel Fojt by the Free Software Foundation; either version 3 of the License, or 506*4ce1b016SDaniel Fojt (at your option) any later version. 507*4ce1b016SDaniel Fojt 508*4ce1b016SDaniel Fojt This program is distributed in the hope that it will be useful, 509*4ce1b016SDaniel Fojt but WITHOUT ANY WARRANTY; without even the implied warranty of 510*4ce1b016SDaniel Fojt MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 511*4ce1b016SDaniel Fojt General Public License for more details. 512*4ce1b016SDaniel Fojt 513*4ce1b016SDaniel Fojt You should have received a copy of the GNU General Public License 514*4ce1b016SDaniel Fojt along with this program. If not, see <https://www.gnu.org/licenses/>. */ 515*4ce1b016SDaniel Fojt 516*4ce1b016SDaniel Fojt /* _GL_WARN_ON_USE (function, "literal string") issues a declaration 517*4ce1b016SDaniel Fojt for FUNCTION which will then trigger a compiler warning containing 518*4ce1b016SDaniel Fojt the text of "literal string" anywhere that function is called, if 519*4ce1b016SDaniel Fojt supported by the compiler. If the compiler does not support this 520*4ce1b016SDaniel Fojt feature, the macro expands to an unused extern declaration. 521*4ce1b016SDaniel Fojt 522*4ce1b016SDaniel Fojt _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the 523*4ce1b016SDaniel Fojt attribute used in _GL_WARN_ON_USE. If the compiler does not support 524*4ce1b016SDaniel Fojt this feature, it expands to empty. 525*4ce1b016SDaniel Fojt 526*4ce1b016SDaniel Fojt These macros are useful for marking a function as a potential 527*4ce1b016SDaniel Fojt portability trap, with the intent that "literal string" include 528*4ce1b016SDaniel Fojt instructions on the replacement function that should be used 529*4ce1b016SDaniel Fojt instead. 530*4ce1b016SDaniel Fojt _GL_WARN_ON_USE is for functions with 'extern' linkage. 531*4ce1b016SDaniel Fojt _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline' 532*4ce1b016SDaniel Fojt linkage. 533*4ce1b016SDaniel Fojt 534*4ce1b016SDaniel Fojt However, one of the reasons that a function is a portability trap is 535*4ce1b016SDaniel Fojt if it has the wrong signature. Declaring FUNCTION with a different 536*4ce1b016SDaniel Fojt signature in C is a compilation error, so this macro must use the 537*4ce1b016SDaniel Fojt same type as any existing declaration so that programs that avoid 538*4ce1b016SDaniel Fojt the problematic FUNCTION do not fail to compile merely because they 539*4ce1b016SDaniel Fojt included a header that poisoned the function. But this implies that 540*4ce1b016SDaniel Fojt _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already 541*4ce1b016SDaniel Fojt have a declaration. Use of this macro implies that there must not 542*4ce1b016SDaniel Fojt be any other macro hiding the declaration of FUNCTION; but 543*4ce1b016SDaniel Fojt undefining FUNCTION first is part of the poisoning process anyway 544*4ce1b016SDaniel Fojt (although for symbols that are provided only via a macro, the result 545*4ce1b016SDaniel Fojt is a compilation error rather than a warning containing 546*4ce1b016SDaniel Fojt "literal string"). Also note that in C++, it is only safe to use if 547*4ce1b016SDaniel Fojt FUNCTION has no overloads. 548*4ce1b016SDaniel Fojt 549*4ce1b016SDaniel Fojt For an example, it is possible to poison 'getline' by: 550*4ce1b016SDaniel Fojt - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]], 551*4ce1b016SDaniel Fojt [getline]) in configure.ac, which potentially defines 552*4ce1b016SDaniel Fojt HAVE_RAW_DECL_GETLINE 553*4ce1b016SDaniel Fojt - adding this code to a header that wraps the system <stdio.h>: 554*4ce1b016SDaniel Fojt #undef getline 555*4ce1b016SDaniel Fojt #if HAVE_RAW_DECL_GETLINE 556*4ce1b016SDaniel Fojt _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but" 557*4ce1b016SDaniel Fojt "not universally present; use the gnulib module getline"); 558*4ce1b016SDaniel Fojt #endif 559*4ce1b016SDaniel Fojt 560*4ce1b016SDaniel Fojt It is not possible to directly poison global variables. But it is 561*4ce1b016SDaniel Fojt possible to write a wrapper accessor function, and poison that 562*4ce1b016SDaniel Fojt (less common usage, like &environ, will cause a compilation error 563*4ce1b016SDaniel Fojt rather than issue the nice warning, but the end result of informing 564*4ce1b016SDaniel Fojt the developer about their portability problem is still achieved): 565*4ce1b016SDaniel Fojt #if HAVE_RAW_DECL_ENVIRON 566*4ce1b016SDaniel Fojt static char *** 567*4ce1b016SDaniel Fojt rpl_environ (void) { return &environ; } 568*4ce1b016SDaniel Fojt _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared"); 569*4ce1b016SDaniel Fojt # undef environ 570*4ce1b016SDaniel Fojt # define environ (*rpl_environ ()) 571*4ce1b016SDaniel Fojt #endif 572*4ce1b016SDaniel Fojt or better (avoiding contradictory use of 'static' and 'extern'): 573*4ce1b016SDaniel Fojt #if HAVE_RAW_DECL_ENVIRON 574*4ce1b016SDaniel Fojt static char *** 575*4ce1b016SDaniel Fojt _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared") 576*4ce1b016SDaniel Fojt rpl_environ (void) { return &environ; } 577*4ce1b016SDaniel Fojt # undef environ 578*4ce1b016SDaniel Fojt # define environ (*rpl_environ ()) 579*4ce1b016SDaniel Fojt #endif 580*4ce1b016SDaniel Fojt */ 58151ddd709SJohn Marino #ifndef _GL_WARN_ON_USE 58251ddd709SJohn Marino 58351ddd709SJohn Marino # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 58451ddd709SJohn Marino /* A compiler attribute is available in gcc versions 4.3.0 and later. */ 58551ddd709SJohn Marino # define _GL_WARN_ON_USE(function, message) \ 58651ddd709SJohn Marino extern __typeof__ (function) function __attribute__ ((__warning__ (message))) 587*4ce1b016SDaniel Fojt # define _GL_WARN_ON_USE_ATTRIBUTE(message) \ 588*4ce1b016SDaniel Fojt __attribute__ ((__warning__ (message))) 58951ddd709SJohn Marino # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 59051ddd709SJohn Marino /* Verify the existence of the function. */ 59151ddd709SJohn Marino # define _GL_WARN_ON_USE(function, message) \ 59251ddd709SJohn Marino extern __typeof__ (function) function 593*4ce1b016SDaniel Fojt # define _GL_WARN_ON_USE_ATTRIBUTE(message) 59451ddd709SJohn Marino # else /* Unsupported. */ 59551ddd709SJohn Marino # define _GL_WARN_ON_USE(function, message) \ 59651ddd709SJohn Marino _GL_WARN_EXTERN_C int _gl_warn_on_use 597*4ce1b016SDaniel Fojt # define _GL_WARN_ON_USE_ATTRIBUTE(message) 59851ddd709SJohn Marino # endif 59951ddd709SJohn Marino #endif 60051ddd709SJohn Marino 60151ddd709SJohn Marino /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string") 60251ddd709SJohn Marino is like _GL_WARN_ON_USE (function, "string"), except that the function is 60351ddd709SJohn Marino declared with the given prototype, consisting of return type, parameters, 60451ddd709SJohn Marino and attributes. 60551ddd709SJohn Marino This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does 60651ddd709SJohn Marino not work in this case. */ 60751ddd709SJohn Marino #ifndef _GL_WARN_ON_USE_CXX 60851ddd709SJohn Marino # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 60951ddd709SJohn Marino # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 61051ddd709SJohn Marino extern rettype function parameters_and_attributes \ 61151ddd709SJohn Marino __attribute__ ((__warning__ (msg))) 61251ddd709SJohn Marino # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 61351ddd709SJohn Marino /* Verify the existence of the function. */ 61451ddd709SJohn Marino # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 61551ddd709SJohn Marino extern rettype function parameters_and_attributes 61651ddd709SJohn Marino # else /* Unsupported. */ 61751ddd709SJohn Marino # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 61851ddd709SJohn Marino _GL_WARN_EXTERN_C int _gl_warn_on_use 61951ddd709SJohn Marino # endif 62051ddd709SJohn Marino #endif 62151ddd709SJohn Marino 62251ddd709SJohn Marino /* _GL_WARN_EXTERN_C declaration; 62351ddd709SJohn Marino performs the declaration with C linkage. */ 62451ddd709SJohn Marino #ifndef _GL_WARN_EXTERN_C 62551ddd709SJohn Marino # if defined __cplusplus 62651ddd709SJohn Marino # define _GL_WARN_EXTERN_C extern "C" 62751ddd709SJohn Marino # else 62851ddd709SJohn Marino # define _GL_WARN_EXTERN_C extern 62951ddd709SJohn Marino # endif 63051ddd709SJohn Marino #endif 63151ddd709SJohn Marino 63251ddd709SJohn Marino 63351ddd709SJohn Marino /* Some systems do not define EXIT_*, despite otherwise supporting C89. */ 63451ddd709SJohn Marino #ifndef EXIT_SUCCESS 63551ddd709SJohn Marino # define EXIT_SUCCESS 0 63651ddd709SJohn Marino #endif 63751ddd709SJohn Marino /* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere 63851ddd709SJohn Marino with proper operation of xargs. */ 63951ddd709SJohn Marino #ifndef EXIT_FAILURE 64051ddd709SJohn Marino # define EXIT_FAILURE 1 64151ddd709SJohn Marino #elif EXIT_FAILURE != 1 64251ddd709SJohn Marino # undef EXIT_FAILURE 64351ddd709SJohn Marino # define EXIT_FAILURE 1 64451ddd709SJohn Marino #endif 64551ddd709SJohn Marino 64651ddd709SJohn Marino 64751ddd709SJohn Marino #if 0 64851ddd709SJohn Marino /* Terminate the current process with the given return code, without running 64951ddd709SJohn Marino the 'atexit' handlers. */ 65051ddd709SJohn Marino # if !1 65151ddd709SJohn Marino _GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status)); 65251ddd709SJohn Marino # endif 65351ddd709SJohn Marino _GL_CXXALIAS_SYS (_Exit, void, (int status)); 65451ddd709SJohn Marino _GL_CXXALIASWARN (_Exit); 65551ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 65651ddd709SJohn Marino # undef _Exit 65751ddd709SJohn Marino # if HAVE_RAW_DECL__EXIT 65851ddd709SJohn Marino _GL_WARN_ON_USE (_Exit, "_Exit is unportable - " 65951ddd709SJohn Marino "use gnulib module _Exit for portability"); 66051ddd709SJohn Marino # endif 66151ddd709SJohn Marino #endif 66251ddd709SJohn Marino 66351ddd709SJohn Marino 66451ddd709SJohn Marino #if 0 66551ddd709SJohn Marino /* Parse a signed decimal integer. 66651ddd709SJohn Marino Returns the value of the integer. Errors are not detected. */ 66751ddd709SJohn Marino # if !1 66851ddd709SJohn Marino _GL_FUNCDECL_SYS (atoll, long long, (const char *string) 66951ddd709SJohn Marino _GL_ATTRIBUTE_PURE 67051ddd709SJohn Marino _GL_ARG_NONNULL ((1))); 67151ddd709SJohn Marino # endif 67251ddd709SJohn Marino _GL_CXXALIAS_SYS (atoll, long long, (const char *string)); 67351ddd709SJohn Marino _GL_CXXALIASWARN (atoll); 67451ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 67551ddd709SJohn Marino # undef atoll 67651ddd709SJohn Marino # if HAVE_RAW_DECL_ATOLL 67751ddd709SJohn Marino _GL_WARN_ON_USE (atoll, "atoll is unportable - " 67851ddd709SJohn Marino "use gnulib module atoll for portability"); 67951ddd709SJohn Marino # endif 68051ddd709SJohn Marino #endif 68151ddd709SJohn Marino 68251ddd709SJohn Marino #if 0 68351ddd709SJohn Marino # if 0 68451ddd709SJohn Marino # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 68551ddd709SJohn Marino # undef calloc 68651ddd709SJohn Marino # define calloc rpl_calloc 68751ddd709SJohn Marino # endif 68851ddd709SJohn Marino _GL_FUNCDECL_RPL (calloc, void *, (size_t nmemb, size_t size)); 68951ddd709SJohn Marino _GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size)); 69051ddd709SJohn Marino # else 69151ddd709SJohn Marino _GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size)); 69251ddd709SJohn Marino # endif 693*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2 69451ddd709SJohn Marino _GL_CXXALIASWARN (calloc); 695*4ce1b016SDaniel Fojt # endif 69651ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 69751ddd709SJohn Marino # undef calloc 69851ddd709SJohn Marino /* Assume calloc is always declared. */ 69951ddd709SJohn Marino _GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - " 70051ddd709SJohn Marino "use gnulib module calloc-posix for portability"); 70151ddd709SJohn Marino #endif 70251ddd709SJohn Marino 70351ddd709SJohn Marino #if 0 70451ddd709SJohn Marino # if 0 70551ddd709SJohn Marino # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 70651ddd709SJohn Marino # define canonicalize_file_name rpl_canonicalize_file_name 70751ddd709SJohn Marino # endif 70851ddd709SJohn Marino _GL_FUNCDECL_RPL (canonicalize_file_name, char *, (const char *name) 70951ddd709SJohn Marino _GL_ARG_NONNULL ((1))); 71051ddd709SJohn Marino _GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name)); 71151ddd709SJohn Marino # else 71251ddd709SJohn Marino # if !1 71351ddd709SJohn Marino _GL_FUNCDECL_SYS (canonicalize_file_name, char *, (const char *name) 71451ddd709SJohn Marino _GL_ARG_NONNULL ((1))); 71551ddd709SJohn Marino # endif 71651ddd709SJohn Marino _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name)); 71751ddd709SJohn Marino # endif 71851ddd709SJohn Marino _GL_CXXALIASWARN (canonicalize_file_name); 71951ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 72051ddd709SJohn Marino # undef canonicalize_file_name 72151ddd709SJohn Marino # if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME 72251ddd709SJohn Marino _GL_WARN_ON_USE (canonicalize_file_name, 72351ddd709SJohn Marino "canonicalize_file_name is unportable - " 72451ddd709SJohn Marino "use gnulib module canonicalize-lgpl for portability"); 72551ddd709SJohn Marino # endif 72651ddd709SJohn Marino #endif 72751ddd709SJohn Marino 72851ddd709SJohn Marino #if 0 72951ddd709SJohn Marino /* Store max(NELEM,3) load average numbers in LOADAVG[]. 73051ddd709SJohn Marino The three numbers are the load average of the last 1 minute, the last 5 73151ddd709SJohn Marino minutes, and the last 15 minutes, respectively. 73251ddd709SJohn Marino LOADAVG is an array of NELEM numbers. */ 73351ddd709SJohn Marino # if !1 73451ddd709SJohn Marino _GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem) 73551ddd709SJohn Marino _GL_ARG_NONNULL ((1))); 73651ddd709SJohn Marino # endif 73751ddd709SJohn Marino _GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem)); 73851ddd709SJohn Marino _GL_CXXALIASWARN (getloadavg); 73951ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 74051ddd709SJohn Marino # undef getloadavg 74151ddd709SJohn Marino # if HAVE_RAW_DECL_GETLOADAVG 74251ddd709SJohn Marino _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - " 74351ddd709SJohn Marino "use gnulib module getloadavg for portability"); 74451ddd709SJohn Marino # endif 74551ddd709SJohn Marino #endif 74651ddd709SJohn Marino 74751ddd709SJohn Marino #if 0 74851ddd709SJohn Marino /* Assuming *OPTIONP is a comma separated list of elements of the form 74951ddd709SJohn Marino "token" or "token=value", getsubopt parses the first of these elements. 75051ddd709SJohn Marino If the first element refers to a "token" that is member of the given 75151ddd709SJohn Marino NULL-terminated array of tokens: 75251ddd709SJohn Marino - It replaces the comma with a NUL byte, updates *OPTIONP to point past 75351ddd709SJohn Marino the first option and the comma, sets *VALUEP to the value of the 75451ddd709SJohn Marino element (or NULL if it doesn't contain an "=" sign), 75551ddd709SJohn Marino - It returns the index of the "token" in the given array of tokens. 75651ddd709SJohn Marino Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined. 757*4ce1b016SDaniel Fojt For more details see the POSIX specification. 758*4ce1b016SDaniel Fojt https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsubopt.html */ 75951ddd709SJohn Marino # if !1 76051ddd709SJohn Marino _GL_FUNCDECL_SYS (getsubopt, int, 76151ddd709SJohn Marino (char **optionp, char *const *tokens, char **valuep) 76251ddd709SJohn Marino _GL_ARG_NONNULL ((1, 2, 3))); 76351ddd709SJohn Marino # endif 76451ddd709SJohn Marino _GL_CXXALIAS_SYS (getsubopt, int, 76551ddd709SJohn Marino (char **optionp, char *const *tokens, char **valuep)); 76651ddd709SJohn Marino _GL_CXXALIASWARN (getsubopt); 76751ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 76851ddd709SJohn Marino # undef getsubopt 76951ddd709SJohn Marino # if HAVE_RAW_DECL_GETSUBOPT 77051ddd709SJohn Marino _GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - " 77151ddd709SJohn Marino "use gnulib module getsubopt for portability"); 77251ddd709SJohn Marino # endif 77351ddd709SJohn Marino #endif 77451ddd709SJohn Marino 77551ddd709SJohn Marino #if 0 77651ddd709SJohn Marino /* Change the ownership and access permission of the slave side of the 77751ddd709SJohn Marino pseudo-terminal whose master side is specified by FD. */ 77851ddd709SJohn Marino # if !1 77951ddd709SJohn Marino _GL_FUNCDECL_SYS (grantpt, int, (int fd)); 78051ddd709SJohn Marino # endif 78151ddd709SJohn Marino _GL_CXXALIAS_SYS (grantpt, int, (int fd)); 78251ddd709SJohn Marino _GL_CXXALIASWARN (grantpt); 78351ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 78451ddd709SJohn Marino # undef grantpt 78551ddd709SJohn Marino # if HAVE_RAW_DECL_GRANTPT 78651ddd709SJohn Marino _GL_WARN_ON_USE (grantpt, "grantpt is not portable - " 78751ddd709SJohn Marino "use gnulib module grantpt for portability"); 78851ddd709SJohn Marino # endif 78951ddd709SJohn Marino #endif 79051ddd709SJohn Marino 79151ddd709SJohn Marino /* If _GL_USE_STDLIB_ALLOC is nonzero, the including module does not 79251ddd709SJohn Marino rely on GNU or POSIX semantics for malloc and realloc (for example, 79351ddd709SJohn Marino by never specifying a zero size), so it does not need malloc or 79451ddd709SJohn Marino realloc to be redefined. */ 79551ddd709SJohn Marino #if 1 79651ddd709SJohn Marino # if 0 79751ddd709SJohn Marino # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ 79851ddd709SJohn Marino || _GL_USE_STDLIB_ALLOC) 79951ddd709SJohn Marino # undef malloc 80051ddd709SJohn Marino # define malloc rpl_malloc 80151ddd709SJohn Marino # endif 80251ddd709SJohn Marino _GL_FUNCDECL_RPL (malloc, void *, (size_t size)); 80351ddd709SJohn Marino _GL_CXXALIAS_RPL (malloc, void *, (size_t size)); 80451ddd709SJohn Marino # else 80551ddd709SJohn Marino _GL_CXXALIAS_SYS (malloc, void *, (size_t size)); 80651ddd709SJohn Marino # endif 807*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2 80851ddd709SJohn Marino _GL_CXXALIASWARN (malloc); 809*4ce1b016SDaniel Fojt # endif 81051ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC 81151ddd709SJohn Marino # undef malloc 81251ddd709SJohn Marino /* Assume malloc is always declared. */ 81351ddd709SJohn Marino _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - " 81451ddd709SJohn Marino "use gnulib module malloc-posix for portability"); 81551ddd709SJohn Marino #endif 81651ddd709SJohn Marino 81751ddd709SJohn Marino /* Convert a multibyte character to a wide character. */ 81851ddd709SJohn Marino #if 1 81951ddd709SJohn Marino # if 0 82051ddd709SJohn Marino # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 82151ddd709SJohn Marino # undef mbtowc 82251ddd709SJohn Marino # define mbtowc rpl_mbtowc 82351ddd709SJohn Marino # endif 82451ddd709SJohn Marino _GL_FUNCDECL_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); 82551ddd709SJohn Marino _GL_CXXALIAS_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); 82651ddd709SJohn Marino # else 827*4ce1b016SDaniel Fojt # if !1 828*4ce1b016SDaniel Fojt _GL_FUNCDECL_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); 829*4ce1b016SDaniel Fojt # endif 83051ddd709SJohn Marino _GL_CXXALIAS_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); 83151ddd709SJohn Marino # endif 832*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2 83351ddd709SJohn Marino _GL_CXXALIASWARN (mbtowc); 83451ddd709SJohn Marino # endif 835*4ce1b016SDaniel Fojt #elif defined GNULIB_POSIXCHECK 836*4ce1b016SDaniel Fojt # undef mbtowc 837*4ce1b016SDaniel Fojt # if HAVE_RAW_DECL_MBTOWC 838*4ce1b016SDaniel Fojt _GL_WARN_ON_USE (mbtowc, "mbtowc is not portable - " 839*4ce1b016SDaniel Fojt "use gnulib module mbtowc for portability"); 840*4ce1b016SDaniel Fojt # endif 841*4ce1b016SDaniel Fojt #endif 84251ddd709SJohn Marino 84351ddd709SJohn Marino #if 0 84451ddd709SJohn Marino /* Create a unique temporary directory from TEMPLATE. 84551ddd709SJohn Marino The last six characters of TEMPLATE must be "XXXXXX"; 84651ddd709SJohn Marino they are replaced with a string that makes the directory name unique. 84751ddd709SJohn Marino Returns TEMPLATE, or a null pointer if it cannot get a unique name. 84851ddd709SJohn Marino The directory is created mode 700. */ 84951ddd709SJohn Marino # if !1 85051ddd709SJohn Marino _GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1))); 85151ddd709SJohn Marino # endif 85251ddd709SJohn Marino _GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/)); 85351ddd709SJohn Marino _GL_CXXALIASWARN (mkdtemp); 85451ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 85551ddd709SJohn Marino # undef mkdtemp 85651ddd709SJohn Marino # if HAVE_RAW_DECL_MKDTEMP 85751ddd709SJohn Marino _GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - " 85851ddd709SJohn Marino "use gnulib module mkdtemp for portability"); 85951ddd709SJohn Marino # endif 86051ddd709SJohn Marino #endif 86151ddd709SJohn Marino 86251ddd709SJohn Marino #if 0 86351ddd709SJohn Marino /* Create a unique temporary file from TEMPLATE. 86451ddd709SJohn Marino The last six characters of TEMPLATE must be "XXXXXX"; 86551ddd709SJohn Marino they are replaced with a string that makes the file name unique. 86651ddd709SJohn Marino The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>) 86751ddd709SJohn Marino and O_TEXT, O_BINARY (defined in "binary-io.h"). 86851ddd709SJohn Marino The file is then created, with the specified flags, ensuring it didn't exist 86951ddd709SJohn Marino before. 87051ddd709SJohn Marino The file is created read-write (mask at least 0600 & ~umask), but it may be 87151ddd709SJohn Marino world-readable and world-writable (mask 0666 & ~umask), depending on the 87251ddd709SJohn Marino implementation. 87351ddd709SJohn Marino Returns the open file descriptor if successful, otherwise -1 and errno 87451ddd709SJohn Marino set. */ 87551ddd709SJohn Marino # if !1 87651ddd709SJohn Marino _GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/) 87751ddd709SJohn Marino _GL_ARG_NONNULL ((1))); 87851ddd709SJohn Marino # endif 87951ddd709SJohn Marino _GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)); 88051ddd709SJohn Marino _GL_CXXALIASWARN (mkostemp); 88151ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 88251ddd709SJohn Marino # undef mkostemp 88351ddd709SJohn Marino # if HAVE_RAW_DECL_MKOSTEMP 88451ddd709SJohn Marino _GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - " 88551ddd709SJohn Marino "use gnulib module mkostemp for portability"); 88651ddd709SJohn Marino # endif 88751ddd709SJohn Marino #endif 88851ddd709SJohn Marino 88951ddd709SJohn Marino #if 0 89051ddd709SJohn Marino /* Create a unique temporary file from TEMPLATE. 89151ddd709SJohn Marino The last six characters of TEMPLATE before a suffix of length 89251ddd709SJohn Marino SUFFIXLEN must be "XXXXXX"; 89351ddd709SJohn Marino they are replaced with a string that makes the file name unique. 89451ddd709SJohn Marino The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>) 89551ddd709SJohn Marino and O_TEXT, O_BINARY (defined in "binary-io.h"). 89651ddd709SJohn Marino The file is then created, with the specified flags, ensuring it didn't exist 89751ddd709SJohn Marino before. 89851ddd709SJohn Marino The file is created read-write (mask at least 0600 & ~umask), but it may be 89951ddd709SJohn Marino world-readable and world-writable (mask 0666 & ~umask), depending on the 90051ddd709SJohn Marino implementation. 90151ddd709SJohn Marino Returns the open file descriptor if successful, otherwise -1 and errno 90251ddd709SJohn Marino set. */ 90351ddd709SJohn Marino # if !1 90451ddd709SJohn Marino _GL_FUNCDECL_SYS (mkostemps, int, 90551ddd709SJohn Marino (char * /*template*/, int /*suffixlen*/, int /*flags*/) 90651ddd709SJohn Marino _GL_ARG_NONNULL ((1))); 90751ddd709SJohn Marino # endif 90851ddd709SJohn Marino _GL_CXXALIAS_SYS (mkostemps, int, 90951ddd709SJohn Marino (char * /*template*/, int /*suffixlen*/, int /*flags*/)); 91051ddd709SJohn Marino _GL_CXXALIASWARN (mkostemps); 91151ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 91251ddd709SJohn Marino # undef mkostemps 91351ddd709SJohn Marino # if HAVE_RAW_DECL_MKOSTEMPS 91451ddd709SJohn Marino _GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - " 91551ddd709SJohn Marino "use gnulib module mkostemps for portability"); 91651ddd709SJohn Marino # endif 91751ddd709SJohn Marino #endif 91851ddd709SJohn Marino 91951ddd709SJohn Marino #if 0 92051ddd709SJohn Marino /* Create a unique temporary file from TEMPLATE. 92151ddd709SJohn Marino The last six characters of TEMPLATE must be "XXXXXX"; 92251ddd709SJohn Marino they are replaced with a string that makes the file name unique. 92351ddd709SJohn Marino The file is then created, ensuring it didn't exist before. 92451ddd709SJohn Marino The file is created read-write (mask at least 0600 & ~umask), but it may be 92551ddd709SJohn Marino world-readable and world-writable (mask 0666 & ~umask), depending on the 92651ddd709SJohn Marino implementation. 92751ddd709SJohn Marino Returns the open file descriptor if successful, otherwise -1 and errno 92851ddd709SJohn Marino set. */ 92951ddd709SJohn Marino # if 0 93051ddd709SJohn Marino # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 93151ddd709SJohn Marino # define mkstemp rpl_mkstemp 93251ddd709SJohn Marino # endif 93351ddd709SJohn Marino _GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); 93451ddd709SJohn Marino _GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/)); 93551ddd709SJohn Marino # else 93651ddd709SJohn Marino # if ! 1 93751ddd709SJohn Marino _GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); 93851ddd709SJohn Marino # endif 93951ddd709SJohn Marino _GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/)); 94051ddd709SJohn Marino # endif 94151ddd709SJohn Marino _GL_CXXALIASWARN (mkstemp); 94251ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 94351ddd709SJohn Marino # undef mkstemp 94451ddd709SJohn Marino # if HAVE_RAW_DECL_MKSTEMP 94551ddd709SJohn Marino _GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - " 94651ddd709SJohn Marino "use gnulib module mkstemp for portability"); 94751ddd709SJohn Marino # endif 94851ddd709SJohn Marino #endif 94951ddd709SJohn Marino 95051ddd709SJohn Marino #if 0 95151ddd709SJohn Marino /* Create a unique temporary file from TEMPLATE. 95251ddd709SJohn Marino The last six characters of TEMPLATE prior to a suffix of length 95351ddd709SJohn Marino SUFFIXLEN must be "XXXXXX"; 95451ddd709SJohn Marino they are replaced with a string that makes the file name unique. 95551ddd709SJohn Marino The file is then created, ensuring it didn't exist before. 95651ddd709SJohn Marino The file is created read-write (mask at least 0600 & ~umask), but it may be 95751ddd709SJohn Marino world-readable and world-writable (mask 0666 & ~umask), depending on the 95851ddd709SJohn Marino implementation. 95951ddd709SJohn Marino Returns the open file descriptor if successful, otherwise -1 and errno 96051ddd709SJohn Marino set. */ 96151ddd709SJohn Marino # if !1 96251ddd709SJohn Marino _GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/) 96351ddd709SJohn Marino _GL_ARG_NONNULL ((1))); 96451ddd709SJohn Marino # endif 96551ddd709SJohn Marino _GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)); 96651ddd709SJohn Marino _GL_CXXALIASWARN (mkstemps); 96751ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 96851ddd709SJohn Marino # undef mkstemps 96951ddd709SJohn Marino # if HAVE_RAW_DECL_MKSTEMPS 97051ddd709SJohn Marino _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - " 97151ddd709SJohn Marino "use gnulib module mkstemps for portability"); 97251ddd709SJohn Marino # endif 97351ddd709SJohn Marino #endif 97451ddd709SJohn Marino 97551ddd709SJohn Marino #if 0 97651ddd709SJohn Marino /* Return an FD open to the master side of a pseudo-terminal. Flags should 97751ddd709SJohn Marino include O_RDWR, and may also include O_NOCTTY. */ 97851ddd709SJohn Marino # if !1 97951ddd709SJohn Marino _GL_FUNCDECL_SYS (posix_openpt, int, (int flags)); 98051ddd709SJohn Marino # endif 98151ddd709SJohn Marino _GL_CXXALIAS_SYS (posix_openpt, int, (int flags)); 98251ddd709SJohn Marino _GL_CXXALIASWARN (posix_openpt); 98351ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 98451ddd709SJohn Marino # undef posix_openpt 98551ddd709SJohn Marino # if HAVE_RAW_DECL_POSIX_OPENPT 98651ddd709SJohn Marino _GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - " 98751ddd709SJohn Marino "use gnulib module posix_openpt for portability"); 98851ddd709SJohn Marino # endif 98951ddd709SJohn Marino #endif 99051ddd709SJohn Marino 99151ddd709SJohn Marino #if 0 99251ddd709SJohn Marino /* Return the pathname of the pseudo-terminal slave associated with 99351ddd709SJohn Marino the master FD is open on, or NULL on errors. */ 99451ddd709SJohn Marino # if 0 99551ddd709SJohn Marino # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 99651ddd709SJohn Marino # undef ptsname 99751ddd709SJohn Marino # define ptsname rpl_ptsname 99851ddd709SJohn Marino # endif 99951ddd709SJohn Marino _GL_FUNCDECL_RPL (ptsname, char *, (int fd)); 100051ddd709SJohn Marino _GL_CXXALIAS_RPL (ptsname, char *, (int fd)); 100151ddd709SJohn Marino # else 100251ddd709SJohn Marino # if !1 100351ddd709SJohn Marino _GL_FUNCDECL_SYS (ptsname, char *, (int fd)); 100451ddd709SJohn Marino # endif 100551ddd709SJohn Marino _GL_CXXALIAS_SYS (ptsname, char *, (int fd)); 100651ddd709SJohn Marino # endif 100751ddd709SJohn Marino _GL_CXXALIASWARN (ptsname); 100851ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 100951ddd709SJohn Marino # undef ptsname 101051ddd709SJohn Marino # if HAVE_RAW_DECL_PTSNAME 101151ddd709SJohn Marino _GL_WARN_ON_USE (ptsname, "ptsname is not portable - " 101251ddd709SJohn Marino "use gnulib module ptsname for portability"); 101351ddd709SJohn Marino # endif 101451ddd709SJohn Marino #endif 101551ddd709SJohn Marino 101651ddd709SJohn Marino #if 0 101751ddd709SJohn Marino /* Set the pathname of the pseudo-terminal slave associated with 101851ddd709SJohn Marino the master FD is open on and return 0, or set errno and return 101951ddd709SJohn Marino non-zero on errors. */ 102051ddd709SJohn Marino # if 0 102151ddd709SJohn Marino # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 102251ddd709SJohn Marino # undef ptsname_r 102351ddd709SJohn Marino # define ptsname_r rpl_ptsname_r 102451ddd709SJohn Marino # endif 102551ddd709SJohn Marino _GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len)); 102651ddd709SJohn Marino _GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len)); 102751ddd709SJohn Marino # else 102851ddd709SJohn Marino # if !1 102951ddd709SJohn Marino _GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); 103051ddd709SJohn Marino # endif 103151ddd709SJohn Marino _GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); 103251ddd709SJohn Marino # endif 103351ddd709SJohn Marino _GL_CXXALIASWARN (ptsname_r); 103451ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 103551ddd709SJohn Marino # undef ptsname_r 103651ddd709SJohn Marino # if HAVE_RAW_DECL_PTSNAME_R 103751ddd709SJohn Marino _GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - " 103851ddd709SJohn Marino "use gnulib module ptsname_r for portability"); 103951ddd709SJohn Marino # endif 104051ddd709SJohn Marino #endif 104151ddd709SJohn Marino 104251ddd709SJohn Marino #if IN_GREP_GNULIB_TESTS 104351ddd709SJohn Marino # if 1 104451ddd709SJohn Marino # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 104551ddd709SJohn Marino # undef putenv 104651ddd709SJohn Marino # define putenv rpl_putenv 104751ddd709SJohn Marino # endif 104851ddd709SJohn Marino _GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1))); 104951ddd709SJohn Marino _GL_CXXALIAS_RPL (putenv, int, (char *string)); 105051ddd709SJohn Marino # else 105151ddd709SJohn Marino _GL_CXXALIAS_SYS (putenv, int, (char *string)); 105251ddd709SJohn Marino # endif 105351ddd709SJohn Marino _GL_CXXALIASWARN (putenv); 105451ddd709SJohn Marino #endif 105551ddd709SJohn Marino 1056cf51209aSJohn Marino #if 0 1057*4ce1b016SDaniel Fojt /* Sort an array of NMEMB elements, starting at address BASE, each element 1058*4ce1b016SDaniel Fojt occupying SIZE bytes, in ascending order according to the comparison 1059*4ce1b016SDaniel Fojt function COMPARE. */ 1060cf51209aSJohn Marino # if 0 1061cf51209aSJohn Marino # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1062cf51209aSJohn Marino # undef qsort_r 1063cf51209aSJohn Marino # define qsort_r rpl_qsort_r 1064cf51209aSJohn Marino # endif 1065cf51209aSJohn Marino _GL_FUNCDECL_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size, 1066cf51209aSJohn Marino int (*compare) (void const *, void const *, 1067cf51209aSJohn Marino void *), 1068cf51209aSJohn Marino void *arg) _GL_ARG_NONNULL ((1, 4))); 1069cf51209aSJohn Marino _GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size, 1070cf51209aSJohn Marino int (*compare) (void const *, void const *, 1071cf51209aSJohn Marino void *), 1072cf51209aSJohn Marino void *arg)); 1073cf51209aSJohn Marino # else 1074*4ce1b016SDaniel Fojt # if !1 1075*4ce1b016SDaniel Fojt _GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size, 1076*4ce1b016SDaniel Fojt int (*compare) (void const *, void const *, 1077*4ce1b016SDaniel Fojt void *), 1078*4ce1b016SDaniel Fojt void *arg) _GL_ARG_NONNULL ((1, 4))); 1079*4ce1b016SDaniel Fojt # endif 1080cf51209aSJohn Marino _GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size, 1081cf51209aSJohn Marino int (*compare) (void const *, void const *, 1082cf51209aSJohn Marino void *), 1083cf51209aSJohn Marino void *arg)); 1084cf51209aSJohn Marino # endif 1085cf51209aSJohn Marino _GL_CXXALIASWARN (qsort_r); 1086*4ce1b016SDaniel Fojt #elif defined GNULIB_POSIXCHECK 1087*4ce1b016SDaniel Fojt # undef qsort_r 1088*4ce1b016SDaniel Fojt # if HAVE_RAW_DECL_QSORT_R 1089*4ce1b016SDaniel Fojt _GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - " 1090*4ce1b016SDaniel Fojt "use gnulib module qsort_r for portability"); 1091*4ce1b016SDaniel Fojt # endif 1092cf51209aSJohn Marino #endif 1093cf51209aSJohn Marino 109451ddd709SJohn Marino 109551ddd709SJohn Marino #if 0 109651ddd709SJohn Marino # if !1 109751ddd709SJohn Marino # ifndef RAND_MAX 109851ddd709SJohn Marino # define RAND_MAX 2147483647 109951ddd709SJohn Marino # endif 110051ddd709SJohn Marino # endif 110151ddd709SJohn Marino #endif 110251ddd709SJohn Marino 110351ddd709SJohn Marino 110451ddd709SJohn Marino #if 0 1105*4ce1b016SDaniel Fojt # if 0 1106*4ce1b016SDaniel Fojt # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1107*4ce1b016SDaniel Fojt # undef random 1108*4ce1b016SDaniel Fojt # define random rpl_random 1109*4ce1b016SDaniel Fojt # endif 1110*4ce1b016SDaniel Fojt _GL_FUNCDECL_RPL (random, long, (void)); 1111*4ce1b016SDaniel Fojt _GL_CXXALIAS_RPL (random, long, (void)); 1112*4ce1b016SDaniel Fojt # else 111351ddd709SJohn Marino # if !1 111451ddd709SJohn Marino _GL_FUNCDECL_SYS (random, long, (void)); 111551ddd709SJohn Marino # endif 1116*4ce1b016SDaniel Fojt /* Need to cast, because on Haiku, the return type is 1117*4ce1b016SDaniel Fojt int. */ 1118*4ce1b016SDaniel Fojt _GL_CXXALIAS_SYS_CAST (random, long, (void)); 1119*4ce1b016SDaniel Fojt # endif 112051ddd709SJohn Marino _GL_CXXALIASWARN (random); 112151ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 112251ddd709SJohn Marino # undef random 112351ddd709SJohn Marino # if HAVE_RAW_DECL_RANDOM 112451ddd709SJohn Marino _GL_WARN_ON_USE (random, "random is unportable - " 112551ddd709SJohn Marino "use gnulib module random for portability"); 112651ddd709SJohn Marino # endif 112751ddd709SJohn Marino #endif 112851ddd709SJohn Marino 112951ddd709SJohn Marino #if 0 1130*4ce1b016SDaniel Fojt # if 0 1131*4ce1b016SDaniel Fojt # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1132*4ce1b016SDaniel Fojt # undef srandom 1133*4ce1b016SDaniel Fojt # define srandom rpl_srandom 1134*4ce1b016SDaniel Fojt # endif 1135*4ce1b016SDaniel Fojt _GL_FUNCDECL_RPL (srandom, void, (unsigned int seed)); 1136*4ce1b016SDaniel Fojt _GL_CXXALIAS_RPL (srandom, void, (unsigned int seed)); 1137*4ce1b016SDaniel Fojt # else 113851ddd709SJohn Marino # if !1 113951ddd709SJohn Marino _GL_FUNCDECL_SYS (srandom, void, (unsigned int seed)); 114051ddd709SJohn Marino # endif 1141*4ce1b016SDaniel Fojt /* Need to cast, because on FreeBSD, the first parameter is 1142*4ce1b016SDaniel Fojt unsigned long seed. */ 1143*4ce1b016SDaniel Fojt _GL_CXXALIAS_SYS_CAST (srandom, void, (unsigned int seed)); 1144*4ce1b016SDaniel Fojt # endif 114551ddd709SJohn Marino _GL_CXXALIASWARN (srandom); 114651ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 114751ddd709SJohn Marino # undef srandom 114851ddd709SJohn Marino # if HAVE_RAW_DECL_SRANDOM 114951ddd709SJohn Marino _GL_WARN_ON_USE (srandom, "srandom is unportable - " 115051ddd709SJohn Marino "use gnulib module random for portability"); 115151ddd709SJohn Marino # endif 115251ddd709SJohn Marino #endif 115351ddd709SJohn Marino 115451ddd709SJohn Marino #if 0 1155*4ce1b016SDaniel Fojt # if 0 1156*4ce1b016SDaniel Fojt # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1157*4ce1b016SDaniel Fojt # undef initstate 1158*4ce1b016SDaniel Fojt # define initstate rpl_initstate 1159*4ce1b016SDaniel Fojt # endif 1160*4ce1b016SDaniel Fojt _GL_FUNCDECL_RPL (initstate, char *, 1161*4ce1b016SDaniel Fojt (unsigned int seed, char *buf, size_t buf_size) 1162*4ce1b016SDaniel Fojt _GL_ARG_NONNULL ((2))); 1163*4ce1b016SDaniel Fojt _GL_CXXALIAS_RPL (initstate, char *, 1164*4ce1b016SDaniel Fojt (unsigned int seed, char *buf, size_t buf_size)); 1165*4ce1b016SDaniel Fojt # else 1166*4ce1b016SDaniel Fojt # if !1 || !1 116751ddd709SJohn Marino _GL_FUNCDECL_SYS (initstate, char *, 116851ddd709SJohn Marino (unsigned int seed, char *buf, size_t buf_size) 116951ddd709SJohn Marino _GL_ARG_NONNULL ((2))); 117051ddd709SJohn Marino # endif 1171*4ce1b016SDaniel Fojt /* Need to cast, because on FreeBSD, the first parameter is 1172*4ce1b016SDaniel Fojt unsigned long seed. */ 1173*4ce1b016SDaniel Fojt _GL_CXXALIAS_SYS_CAST (initstate, char *, 117451ddd709SJohn Marino (unsigned int seed, char *buf, size_t buf_size)); 1175*4ce1b016SDaniel Fojt # endif 117651ddd709SJohn Marino _GL_CXXALIASWARN (initstate); 117751ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 117851ddd709SJohn Marino # undef initstate 1179*4ce1b016SDaniel Fojt # if HAVE_RAW_DECL_INITSTATE 118051ddd709SJohn Marino _GL_WARN_ON_USE (initstate, "initstate is unportable - " 118151ddd709SJohn Marino "use gnulib module random for portability"); 118251ddd709SJohn Marino # endif 118351ddd709SJohn Marino #endif 118451ddd709SJohn Marino 118551ddd709SJohn Marino #if 0 1186*4ce1b016SDaniel Fojt # if 0 1187*4ce1b016SDaniel Fojt # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1188*4ce1b016SDaniel Fojt # undef setstate 1189*4ce1b016SDaniel Fojt # define setstate rpl_setstate 1190*4ce1b016SDaniel Fojt # endif 1191*4ce1b016SDaniel Fojt _GL_FUNCDECL_RPL (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); 1192*4ce1b016SDaniel Fojt _GL_CXXALIAS_RPL (setstate, char *, (char *arg_state)); 1193*4ce1b016SDaniel Fojt # else 1194*4ce1b016SDaniel Fojt # if !1 || !1 119551ddd709SJohn Marino _GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); 119651ddd709SJohn Marino # endif 1197*4ce1b016SDaniel Fojt /* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter 1198*4ce1b016SDaniel Fojt is const char *arg_state. */ 1199*4ce1b016SDaniel Fojt _GL_CXXALIAS_SYS_CAST (setstate, char *, (char *arg_state)); 1200*4ce1b016SDaniel Fojt # endif 120151ddd709SJohn Marino _GL_CXXALIASWARN (setstate); 120251ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 120351ddd709SJohn Marino # undef setstate 1204*4ce1b016SDaniel Fojt # if HAVE_RAW_DECL_SETSTATE 120551ddd709SJohn Marino _GL_WARN_ON_USE (setstate, "setstate is unportable - " 120651ddd709SJohn Marino "use gnulib module random for portability"); 120751ddd709SJohn Marino # endif 120851ddd709SJohn Marino #endif 120951ddd709SJohn Marino 121051ddd709SJohn Marino 121151ddd709SJohn Marino #if 0 121251ddd709SJohn Marino # if 0 121351ddd709SJohn Marino # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 121451ddd709SJohn Marino # undef random_r 121551ddd709SJohn Marino # define random_r rpl_random_r 121651ddd709SJohn Marino # endif 121751ddd709SJohn Marino _GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result) 121851ddd709SJohn Marino _GL_ARG_NONNULL ((1, 2))); 121951ddd709SJohn Marino _GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result)); 122051ddd709SJohn Marino # else 122151ddd709SJohn Marino # if !1 122251ddd709SJohn Marino _GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result) 122351ddd709SJohn Marino _GL_ARG_NONNULL ((1, 2))); 122451ddd709SJohn Marino # endif 122551ddd709SJohn Marino _GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result)); 122651ddd709SJohn Marino # endif 122751ddd709SJohn Marino _GL_CXXALIASWARN (random_r); 122851ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 122951ddd709SJohn Marino # undef random_r 123051ddd709SJohn Marino # if HAVE_RAW_DECL_RANDOM_R 123151ddd709SJohn Marino _GL_WARN_ON_USE (random_r, "random_r is unportable - " 123251ddd709SJohn Marino "use gnulib module random_r for portability"); 123351ddd709SJohn Marino # endif 123451ddd709SJohn Marino #endif 123551ddd709SJohn Marino 123651ddd709SJohn Marino #if 0 123751ddd709SJohn Marino # if 0 123851ddd709SJohn Marino # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 123951ddd709SJohn Marino # undef srandom_r 124051ddd709SJohn Marino # define srandom_r rpl_srandom_r 124151ddd709SJohn Marino # endif 124251ddd709SJohn Marino _GL_FUNCDECL_RPL (srandom_r, int, 124351ddd709SJohn Marino (unsigned int seed, struct random_data *rand_state) 124451ddd709SJohn Marino _GL_ARG_NONNULL ((2))); 124551ddd709SJohn Marino _GL_CXXALIAS_RPL (srandom_r, int, 124651ddd709SJohn Marino (unsigned int seed, struct random_data *rand_state)); 124751ddd709SJohn Marino # else 124851ddd709SJohn Marino # if !1 124951ddd709SJohn Marino _GL_FUNCDECL_SYS (srandom_r, int, 125051ddd709SJohn Marino (unsigned int seed, struct random_data *rand_state) 125151ddd709SJohn Marino _GL_ARG_NONNULL ((2))); 125251ddd709SJohn Marino # endif 125351ddd709SJohn Marino _GL_CXXALIAS_SYS (srandom_r, int, 125451ddd709SJohn Marino (unsigned int seed, struct random_data *rand_state)); 125551ddd709SJohn Marino # endif 125651ddd709SJohn Marino _GL_CXXALIASWARN (srandom_r); 125751ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 125851ddd709SJohn Marino # undef srandom_r 125951ddd709SJohn Marino # if HAVE_RAW_DECL_SRANDOM_R 126051ddd709SJohn Marino _GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - " 126151ddd709SJohn Marino "use gnulib module random_r for portability"); 126251ddd709SJohn Marino # endif 126351ddd709SJohn Marino #endif 126451ddd709SJohn Marino 126551ddd709SJohn Marino #if 0 126651ddd709SJohn Marino # if 0 126751ddd709SJohn Marino # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 126851ddd709SJohn Marino # undef initstate_r 126951ddd709SJohn Marino # define initstate_r rpl_initstate_r 127051ddd709SJohn Marino # endif 127151ddd709SJohn Marino _GL_FUNCDECL_RPL (initstate_r, int, 127251ddd709SJohn Marino (unsigned int seed, char *buf, size_t buf_size, 127351ddd709SJohn Marino struct random_data *rand_state) 127451ddd709SJohn Marino _GL_ARG_NONNULL ((2, 4))); 127551ddd709SJohn Marino _GL_CXXALIAS_RPL (initstate_r, int, 127651ddd709SJohn Marino (unsigned int seed, char *buf, size_t buf_size, 127751ddd709SJohn Marino struct random_data *rand_state)); 127851ddd709SJohn Marino # else 127951ddd709SJohn Marino # if !1 128051ddd709SJohn Marino _GL_FUNCDECL_SYS (initstate_r, int, 128151ddd709SJohn Marino (unsigned int seed, char *buf, size_t buf_size, 128251ddd709SJohn Marino struct random_data *rand_state) 128351ddd709SJohn Marino _GL_ARG_NONNULL ((2, 4))); 128451ddd709SJohn Marino # endif 1285*4ce1b016SDaniel Fojt /* Need to cast, because on Haiku, the third parameter is 1286*4ce1b016SDaniel Fojt unsigned long buf_size. */ 1287*4ce1b016SDaniel Fojt _GL_CXXALIAS_SYS_CAST (initstate_r, int, 128851ddd709SJohn Marino (unsigned int seed, char *buf, size_t buf_size, 128951ddd709SJohn Marino struct random_data *rand_state)); 129051ddd709SJohn Marino # endif 129151ddd709SJohn Marino _GL_CXXALIASWARN (initstate_r); 129251ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 129351ddd709SJohn Marino # undef initstate_r 129451ddd709SJohn Marino # if HAVE_RAW_DECL_INITSTATE_R 129551ddd709SJohn Marino _GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - " 129651ddd709SJohn Marino "use gnulib module random_r for portability"); 129751ddd709SJohn Marino # endif 129851ddd709SJohn Marino #endif 129951ddd709SJohn Marino 130051ddd709SJohn Marino #if 0 130151ddd709SJohn Marino # if 0 130251ddd709SJohn Marino # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 130351ddd709SJohn Marino # undef setstate_r 130451ddd709SJohn Marino # define setstate_r rpl_setstate_r 130551ddd709SJohn Marino # endif 130651ddd709SJohn Marino _GL_FUNCDECL_RPL (setstate_r, int, 130751ddd709SJohn Marino (char *arg_state, struct random_data *rand_state) 130851ddd709SJohn Marino _GL_ARG_NONNULL ((1, 2))); 130951ddd709SJohn Marino _GL_CXXALIAS_RPL (setstate_r, int, 131051ddd709SJohn Marino (char *arg_state, struct random_data *rand_state)); 131151ddd709SJohn Marino # else 131251ddd709SJohn Marino # if !1 131351ddd709SJohn Marino _GL_FUNCDECL_SYS (setstate_r, int, 131451ddd709SJohn Marino (char *arg_state, struct random_data *rand_state) 131551ddd709SJohn Marino _GL_ARG_NONNULL ((1, 2))); 131651ddd709SJohn Marino # endif 1317*4ce1b016SDaniel Fojt /* Need to cast, because on Haiku, the first parameter is 1318*4ce1b016SDaniel Fojt void *arg_state. */ 1319*4ce1b016SDaniel Fojt _GL_CXXALIAS_SYS_CAST (setstate_r, int, 132051ddd709SJohn Marino (char *arg_state, struct random_data *rand_state)); 132151ddd709SJohn Marino # endif 132251ddd709SJohn Marino _GL_CXXALIASWARN (setstate_r); 132351ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 132451ddd709SJohn Marino # undef setstate_r 132551ddd709SJohn Marino # if HAVE_RAW_DECL_SETSTATE_R 132651ddd709SJohn Marino _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - " 132751ddd709SJohn Marino "use gnulib module random_r for portability"); 132851ddd709SJohn Marino # endif 132951ddd709SJohn Marino #endif 133051ddd709SJohn Marino 133151ddd709SJohn Marino 133251ddd709SJohn Marino #if 1 133351ddd709SJohn Marino # if 0 133451ddd709SJohn Marino # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ 133551ddd709SJohn Marino || _GL_USE_STDLIB_ALLOC) 133651ddd709SJohn Marino # undef realloc 133751ddd709SJohn Marino # define realloc rpl_realloc 133851ddd709SJohn Marino # endif 133951ddd709SJohn Marino _GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size)); 134051ddd709SJohn Marino _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size)); 134151ddd709SJohn Marino # else 134251ddd709SJohn Marino _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size)); 134351ddd709SJohn Marino # endif 1344*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2 134551ddd709SJohn Marino _GL_CXXALIASWARN (realloc); 1346*4ce1b016SDaniel Fojt # endif 134751ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC 134851ddd709SJohn Marino # undef realloc 134951ddd709SJohn Marino /* Assume realloc is always declared. */ 135051ddd709SJohn Marino _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - " 135151ddd709SJohn Marino "use gnulib module realloc-posix for portability"); 135251ddd709SJohn Marino #endif 135351ddd709SJohn Marino 1354*4ce1b016SDaniel Fojt 1355*4ce1b016SDaniel Fojt #if 0 1356*4ce1b016SDaniel Fojt # if ! 1 1357*4ce1b016SDaniel Fojt _GL_FUNCDECL_SYS (reallocarray, void *, 1358*4ce1b016SDaniel Fojt (void *ptr, size_t nmemb, size_t size)); 1359*4ce1b016SDaniel Fojt # endif 1360*4ce1b016SDaniel Fojt _GL_CXXALIAS_SYS (reallocarray, void *, 1361*4ce1b016SDaniel Fojt (void *ptr, size_t nmemb, size_t size)); 1362*4ce1b016SDaniel Fojt _GL_CXXALIASWARN (reallocarray); 1363*4ce1b016SDaniel Fojt #elif defined GNULIB_POSIXCHECK 1364*4ce1b016SDaniel Fojt # undef reallocarray 1365*4ce1b016SDaniel Fojt # if HAVE_RAW_DECL_REALLOCARRAY 1366*4ce1b016SDaniel Fojt _GL_WARN_ON_USE (reallocarray, "reallocarray is not portable - " 1367*4ce1b016SDaniel Fojt "use gnulib module reallocarray for portability"); 1368*4ce1b016SDaniel Fojt # endif 1369*4ce1b016SDaniel Fojt #endif 1370*4ce1b016SDaniel Fojt 137151ddd709SJohn Marino #if 0 137251ddd709SJohn Marino # if 0 137351ddd709SJohn Marino # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 137451ddd709SJohn Marino # define realpath rpl_realpath 137551ddd709SJohn Marino # endif 137651ddd709SJohn Marino _GL_FUNCDECL_RPL (realpath, char *, (const char *name, char *resolved) 137751ddd709SJohn Marino _GL_ARG_NONNULL ((1))); 137851ddd709SJohn Marino _GL_CXXALIAS_RPL (realpath, char *, (const char *name, char *resolved)); 137951ddd709SJohn Marino # else 138051ddd709SJohn Marino # if !1 138151ddd709SJohn Marino _GL_FUNCDECL_SYS (realpath, char *, (const char *name, char *resolved) 138251ddd709SJohn Marino _GL_ARG_NONNULL ((1))); 138351ddd709SJohn Marino # endif 138451ddd709SJohn Marino _GL_CXXALIAS_SYS (realpath, char *, (const char *name, char *resolved)); 138551ddd709SJohn Marino # endif 138651ddd709SJohn Marino _GL_CXXALIASWARN (realpath); 138751ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 138851ddd709SJohn Marino # undef realpath 138951ddd709SJohn Marino # if HAVE_RAW_DECL_REALPATH 139051ddd709SJohn Marino _GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module " 139151ddd709SJohn Marino "canonicalize or canonicalize-lgpl for portability"); 139251ddd709SJohn Marino # endif 139351ddd709SJohn Marino #endif 139451ddd709SJohn Marino 139551ddd709SJohn Marino #if 0 139651ddd709SJohn Marino /* Test a user response to a question. 139751ddd709SJohn Marino Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */ 139851ddd709SJohn Marino # if !1 139951ddd709SJohn Marino _GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1))); 140051ddd709SJohn Marino # endif 140151ddd709SJohn Marino _GL_CXXALIAS_SYS (rpmatch, int, (const char *response)); 140251ddd709SJohn Marino _GL_CXXALIASWARN (rpmatch); 140351ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 140451ddd709SJohn Marino # undef rpmatch 140551ddd709SJohn Marino # if HAVE_RAW_DECL_RPMATCH 140651ddd709SJohn Marino _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - " 140751ddd709SJohn Marino "use gnulib module rpmatch for portability"); 140851ddd709SJohn Marino # endif 140951ddd709SJohn Marino #endif 141051ddd709SJohn Marino 141151ddd709SJohn Marino #if 0 141251ddd709SJohn Marino /* Look up NAME in the environment, returning 0 in insecure situations. */ 141351ddd709SJohn Marino # if !1 141451ddd709SJohn Marino _GL_FUNCDECL_SYS (secure_getenv, char *, 141551ddd709SJohn Marino (char const *name) _GL_ARG_NONNULL ((1))); 141651ddd709SJohn Marino # endif 141751ddd709SJohn Marino _GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name)); 141851ddd709SJohn Marino _GL_CXXALIASWARN (secure_getenv); 141951ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 142051ddd709SJohn Marino # undef secure_getenv 142151ddd709SJohn Marino # if HAVE_RAW_DECL_SECURE_GETENV 142251ddd709SJohn Marino _GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - " 142351ddd709SJohn Marino "use gnulib module secure_getenv for portability"); 142451ddd709SJohn Marino # endif 142551ddd709SJohn Marino #endif 142651ddd709SJohn Marino 142751ddd709SJohn Marino #if IN_GREP_GNULIB_TESTS 142851ddd709SJohn Marino /* Set NAME to VALUE in the environment. 142951ddd709SJohn Marino If REPLACE is nonzero, overwrite an existing value. */ 143051ddd709SJohn Marino # if 0 143151ddd709SJohn Marino # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 143251ddd709SJohn Marino # undef setenv 143351ddd709SJohn Marino # define setenv rpl_setenv 143451ddd709SJohn Marino # endif 143551ddd709SJohn Marino _GL_FUNCDECL_RPL (setenv, int, 143651ddd709SJohn Marino (const char *name, const char *value, int replace) 143751ddd709SJohn Marino _GL_ARG_NONNULL ((1))); 143851ddd709SJohn Marino _GL_CXXALIAS_RPL (setenv, int, 143951ddd709SJohn Marino (const char *name, const char *value, int replace)); 144051ddd709SJohn Marino # else 144151ddd709SJohn Marino # if !1 144251ddd709SJohn Marino _GL_FUNCDECL_SYS (setenv, int, 144351ddd709SJohn Marino (const char *name, const char *value, int replace) 144451ddd709SJohn Marino _GL_ARG_NONNULL ((1))); 144551ddd709SJohn Marino # endif 144651ddd709SJohn Marino _GL_CXXALIAS_SYS (setenv, int, 144751ddd709SJohn Marino (const char *name, const char *value, int replace)); 144851ddd709SJohn Marino # endif 144951ddd709SJohn Marino # if !(0 && !1) 145051ddd709SJohn Marino _GL_CXXALIASWARN (setenv); 145151ddd709SJohn Marino # endif 145251ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 145351ddd709SJohn Marino # undef setenv 145451ddd709SJohn Marino # if HAVE_RAW_DECL_SETENV 145551ddd709SJohn Marino _GL_WARN_ON_USE (setenv, "setenv is unportable - " 145651ddd709SJohn Marino "use gnulib module setenv for portability"); 145751ddd709SJohn Marino # endif 145851ddd709SJohn Marino #endif 145951ddd709SJohn Marino 146051ddd709SJohn Marino #if 0 146151ddd709SJohn Marino /* Parse a double from STRING, updating ENDP if appropriate. */ 146251ddd709SJohn Marino # if 0 146351ddd709SJohn Marino # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 146451ddd709SJohn Marino # define strtod rpl_strtod 146551ddd709SJohn Marino # endif 1466*4ce1b016SDaniel Fojt # define GNULIB_defined_strtod_function 1 146751ddd709SJohn Marino _GL_FUNCDECL_RPL (strtod, double, (const char *str, char **endp) 146851ddd709SJohn Marino _GL_ARG_NONNULL ((1))); 146951ddd709SJohn Marino _GL_CXXALIAS_RPL (strtod, double, (const char *str, char **endp)); 147051ddd709SJohn Marino # else 147151ddd709SJohn Marino # if !1 147251ddd709SJohn Marino _GL_FUNCDECL_SYS (strtod, double, (const char *str, char **endp) 147351ddd709SJohn Marino _GL_ARG_NONNULL ((1))); 147451ddd709SJohn Marino # endif 147551ddd709SJohn Marino _GL_CXXALIAS_SYS (strtod, double, (const char *str, char **endp)); 147651ddd709SJohn Marino # endif 1477*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2 147851ddd709SJohn Marino _GL_CXXALIASWARN (strtod); 1479*4ce1b016SDaniel Fojt # endif 148051ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 148151ddd709SJohn Marino # undef strtod 148251ddd709SJohn Marino # if HAVE_RAW_DECL_STRTOD 148351ddd709SJohn Marino _GL_WARN_ON_USE (strtod, "strtod is unportable - " 148451ddd709SJohn Marino "use gnulib module strtod for portability"); 148551ddd709SJohn Marino # endif 148651ddd709SJohn Marino #endif 148751ddd709SJohn Marino 1488*4ce1b016SDaniel Fojt #if 0 1489*4ce1b016SDaniel Fojt /* Parse a 'long double' from STRING, updating ENDP if appropriate. */ 1490*4ce1b016SDaniel Fojt # if 0 1491*4ce1b016SDaniel Fojt # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1492*4ce1b016SDaniel Fojt # define strtold rpl_strtold 1493*4ce1b016SDaniel Fojt # endif 1494*4ce1b016SDaniel Fojt # define GNULIB_defined_strtold_function 1 1495*4ce1b016SDaniel Fojt _GL_FUNCDECL_RPL (strtold, long double, (const char *str, char **endp) 1496*4ce1b016SDaniel Fojt _GL_ARG_NONNULL ((1))); 1497*4ce1b016SDaniel Fojt _GL_CXXALIAS_RPL (strtold, long double, (const char *str, char **endp)); 1498*4ce1b016SDaniel Fojt # else 1499*4ce1b016SDaniel Fojt # if !1 1500*4ce1b016SDaniel Fojt _GL_FUNCDECL_SYS (strtold, long double, (const char *str, char **endp) 1501*4ce1b016SDaniel Fojt _GL_ARG_NONNULL ((1))); 1502*4ce1b016SDaniel Fojt # endif 1503*4ce1b016SDaniel Fojt _GL_CXXALIAS_SYS (strtold, long double, (const char *str, char **endp)); 1504*4ce1b016SDaniel Fojt # endif 1505*4ce1b016SDaniel Fojt _GL_CXXALIASWARN (strtold); 1506*4ce1b016SDaniel Fojt #elif defined GNULIB_POSIXCHECK 1507*4ce1b016SDaniel Fojt # undef strtold 1508*4ce1b016SDaniel Fojt # if HAVE_RAW_DECL_STRTOLD 1509*4ce1b016SDaniel Fojt _GL_WARN_ON_USE (strtold, "strtold is unportable - " 1510*4ce1b016SDaniel Fojt "use gnulib module strtold for portability"); 1511*4ce1b016SDaniel Fojt # endif 1512*4ce1b016SDaniel Fojt #endif 1513*4ce1b016SDaniel Fojt 151451ddd709SJohn Marino #if 1 151551ddd709SJohn Marino /* Parse a signed integer whose textual representation starts at STRING. 151651ddd709SJohn Marino The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, 151751ddd709SJohn Marino it may be decimal or octal (with prefix "0") or hexadecimal (with prefix 151851ddd709SJohn Marino "0x"). 151951ddd709SJohn Marino If ENDPTR is not NULL, the address of the first byte after the integer is 152051ddd709SJohn Marino stored in *ENDPTR. 152151ddd709SJohn Marino Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set 152251ddd709SJohn Marino to ERANGE. */ 152351ddd709SJohn Marino # if !1 152451ddd709SJohn Marino _GL_FUNCDECL_SYS (strtoll, long long, 152551ddd709SJohn Marino (const char *string, char **endptr, int base) 152651ddd709SJohn Marino _GL_ARG_NONNULL ((1))); 152751ddd709SJohn Marino # endif 152851ddd709SJohn Marino _GL_CXXALIAS_SYS (strtoll, long long, 152951ddd709SJohn Marino (const char *string, char **endptr, int base)); 153051ddd709SJohn Marino _GL_CXXALIASWARN (strtoll); 153151ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 153251ddd709SJohn Marino # undef strtoll 153351ddd709SJohn Marino # if HAVE_RAW_DECL_STRTOLL 153451ddd709SJohn Marino _GL_WARN_ON_USE (strtoll, "strtoll is unportable - " 153551ddd709SJohn Marino "use gnulib module strtoll for portability"); 153651ddd709SJohn Marino # endif 153751ddd709SJohn Marino #endif 153851ddd709SJohn Marino 153951ddd709SJohn Marino #if 1 154051ddd709SJohn Marino /* Parse an unsigned integer whose textual representation starts at STRING. 154151ddd709SJohn Marino The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, 154251ddd709SJohn Marino it may be decimal or octal (with prefix "0") or hexadecimal (with prefix 154351ddd709SJohn Marino "0x"). 154451ddd709SJohn Marino If ENDPTR is not NULL, the address of the first byte after the integer is 154551ddd709SJohn Marino stored in *ENDPTR. 154651ddd709SJohn Marino Upon overflow, the return value is ULLONG_MAX, and errno is set to 154751ddd709SJohn Marino ERANGE. */ 154851ddd709SJohn Marino # if !1 154951ddd709SJohn Marino _GL_FUNCDECL_SYS (strtoull, unsigned long long, 155051ddd709SJohn Marino (const char *string, char **endptr, int base) 155151ddd709SJohn Marino _GL_ARG_NONNULL ((1))); 155251ddd709SJohn Marino # endif 155351ddd709SJohn Marino _GL_CXXALIAS_SYS (strtoull, unsigned long long, 155451ddd709SJohn Marino (const char *string, char **endptr, int base)); 155551ddd709SJohn Marino _GL_CXXALIASWARN (strtoull); 155651ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 155751ddd709SJohn Marino # undef strtoull 155851ddd709SJohn Marino # if HAVE_RAW_DECL_STRTOULL 155951ddd709SJohn Marino _GL_WARN_ON_USE (strtoull, "strtoull is unportable - " 156051ddd709SJohn Marino "use gnulib module strtoull for portability"); 156151ddd709SJohn Marino # endif 156251ddd709SJohn Marino #endif 156351ddd709SJohn Marino 156451ddd709SJohn Marino #if 0 156551ddd709SJohn Marino /* Unlock the slave side of the pseudo-terminal whose master side is specified 156651ddd709SJohn Marino by FD, so that it can be opened. */ 156751ddd709SJohn Marino # if !1 156851ddd709SJohn Marino _GL_FUNCDECL_SYS (unlockpt, int, (int fd)); 156951ddd709SJohn Marino # endif 157051ddd709SJohn Marino _GL_CXXALIAS_SYS (unlockpt, int, (int fd)); 157151ddd709SJohn Marino _GL_CXXALIASWARN (unlockpt); 157251ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 157351ddd709SJohn Marino # undef unlockpt 157451ddd709SJohn Marino # if HAVE_RAW_DECL_UNLOCKPT 157551ddd709SJohn Marino _GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - " 157651ddd709SJohn Marino "use gnulib module unlockpt for portability"); 157751ddd709SJohn Marino # endif 157851ddd709SJohn Marino #endif 157951ddd709SJohn Marino 158051ddd709SJohn Marino #if IN_GREP_GNULIB_TESTS 158151ddd709SJohn Marino /* Remove the variable NAME from the environment. */ 1582cf51209aSJohn Marino # if 0 158351ddd709SJohn Marino # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 158451ddd709SJohn Marino # undef unsetenv 158551ddd709SJohn Marino # define unsetenv rpl_unsetenv 158651ddd709SJohn Marino # endif 158751ddd709SJohn Marino _GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); 158851ddd709SJohn Marino _GL_CXXALIAS_RPL (unsetenv, int, (const char *name)); 158951ddd709SJohn Marino # else 159051ddd709SJohn Marino # if !1 159151ddd709SJohn Marino _GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); 159251ddd709SJohn Marino # endif 159351ddd709SJohn Marino _GL_CXXALIAS_SYS (unsetenv, int, (const char *name)); 159451ddd709SJohn Marino # endif 1595cf51209aSJohn Marino # if !(0 && !1) 159651ddd709SJohn Marino _GL_CXXALIASWARN (unsetenv); 159751ddd709SJohn Marino # endif 159851ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 159951ddd709SJohn Marino # undef unsetenv 160051ddd709SJohn Marino # if HAVE_RAW_DECL_UNSETENV 160151ddd709SJohn Marino _GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - " 160251ddd709SJohn Marino "use gnulib module unsetenv for portability"); 160351ddd709SJohn Marino # endif 160451ddd709SJohn Marino #endif 160551ddd709SJohn Marino 160651ddd709SJohn Marino /* Convert a wide character to a multibyte character. */ 160751ddd709SJohn Marino #if 1 160851ddd709SJohn Marino # if 0 160951ddd709SJohn Marino # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 161051ddd709SJohn Marino # undef wctomb 161151ddd709SJohn Marino # define wctomb rpl_wctomb 161251ddd709SJohn Marino # endif 161351ddd709SJohn Marino _GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc)); 161451ddd709SJohn Marino _GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc)); 161551ddd709SJohn Marino # else 161651ddd709SJohn Marino _GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc)); 161751ddd709SJohn Marino # endif 1618*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2 161951ddd709SJohn Marino _GL_CXXALIASWARN (wctomb); 162051ddd709SJohn Marino # endif 1621*4ce1b016SDaniel Fojt #endif 162251ddd709SJohn Marino 162351ddd709SJohn Marino 162451ddd709SJohn Marino #endif /* _GL_STDLIB_H */ 162551ddd709SJohn Marino #endif /* _GL_STDLIB_H */ 162651ddd709SJohn Marino #endif 1627