1*88e42b0fSchristos /* This file is automatically generated. DO NOT EDIT! */ 2*88e42b0fSchristos /* Generated from: NetBSD: mknative-gdb,v 1.15 2020/12/05 21:27:31 christos Exp */ 3*88e42b0fSchristos /* Generated from: NetBSD: mknative.common,v 1.16 2018/04/15 15:13:37 christos Exp */ 4*88e42b0fSchristos 5*88e42b0fSchristos /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ 6*88e42b0fSchristos /* A GNU-like <stdio.h>. 7*88e42b0fSchristos 8*88e42b0fSchristos Copyright (C) 2004, 2007-2020 Free Software Foundation, Inc. 9*88e42b0fSchristos 10*88e42b0fSchristos This program is free software; you can redistribute it and/or modify 11*88e42b0fSchristos it under the terms of the GNU General Public License as published by 12*88e42b0fSchristos the Free Software Foundation; either version 3, or (at your option) 13*88e42b0fSchristos any later version. 14*88e42b0fSchristos 15*88e42b0fSchristos This program is distributed in the hope that it will be useful, 16*88e42b0fSchristos but WITHOUT ANY WARRANTY; without even the implied warranty of 17*88e42b0fSchristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*88e42b0fSchristos GNU General Public License for more details. 19*88e42b0fSchristos 20*88e42b0fSchristos You should have received a copy of the GNU General Public License 21*88e42b0fSchristos along with this program; if not, see <https://www.gnu.org/licenses/>. */ 22*88e42b0fSchristos 23*88e42b0fSchristos #if __GNUC__ >= 3 24*88e42b0fSchristos #pragma GCC system_header 25*88e42b0fSchristos #endif 26*88e42b0fSchristos 27*88e42b0fSchristos 28*88e42b0fSchristos #if defined __need_FILE || defined __need___FILE || defined _GL_ALREADY_INCLUDING_STDIO_H 29*88e42b0fSchristos /* Special invocation convention: 30*88e42b0fSchristos - Inside glibc header files. 31*88e42b0fSchristos - On OSF/1 5.1 we have a sequence of nested includes 32*88e42b0fSchristos <stdio.h> -> <getopt.h> -> <ctype.h> -> <sys/localedef.h> -> 33*88e42b0fSchristos <sys/lc_core.h> -> <nl_types.h> -> <mesg.h> -> <stdio.h>. 34*88e42b0fSchristos In this situation, the functions are not yet declared, therefore we cannot 35*88e42b0fSchristos provide the C++ aliases. */ 36*88e42b0fSchristos 37*88e42b0fSchristos #include_next <stdio.h> 38*88e42b0fSchristos 39*88e42b0fSchristos #else 40*88e42b0fSchristos /* Normal invocation convention. */ 41*88e42b0fSchristos 42*88e42b0fSchristos #ifndef _GL_STDIO_H 43*88e42b0fSchristos 44*88e42b0fSchristos #define _GL_ALREADY_INCLUDING_STDIO_H 45*88e42b0fSchristos 46*88e42b0fSchristos /* The include_next requires a split double-inclusion guard. */ 47*88e42b0fSchristos #include_next <stdio.h> 48*88e42b0fSchristos 49*88e42b0fSchristos #undef _GL_ALREADY_INCLUDING_STDIO_H 50*88e42b0fSchristos 51*88e42b0fSchristos #ifndef _GL_STDIO_H 52*88e42b0fSchristos #define _GL_STDIO_H 53*88e42b0fSchristos 54*88e42b0fSchristos /* Get va_list. Needed on many systems, including glibc 2.8. */ 55*88e42b0fSchristos #include <stdarg.h> 56*88e42b0fSchristos 57*88e42b0fSchristos #include <stddef.h> 58*88e42b0fSchristos 59*88e42b0fSchristos /* Get off_t and ssize_t. Needed on many systems, including glibc 2.8 60*88e42b0fSchristos and eglibc 2.11.2. 61*88e42b0fSchristos May also define off_t to a 64-bit type on native Windows. */ 62*88e42b0fSchristos #include <sys/types.h> 63*88e42b0fSchristos 64*88e42b0fSchristos /* The __attribute__ feature is available in gcc versions 2.5 and later. 65*88e42b0fSchristos The __-protected variants of the attributes 'format' and 'printf' are 66*88e42b0fSchristos accepted by gcc versions 2.6.4 (effectively 2.7) and later. 67*88e42b0fSchristos We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because 68*88e42b0fSchristos gnulib and libintl do '#define printf __printf__' when they override 69*88e42b0fSchristos the 'printf' function. */ 70*88e42b0fSchristos #ifndef _GL_ATTRIBUTE_FORMAT 71*88e42b0fSchristos # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) 72*88e42b0fSchristos # define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) 73*88e42b0fSchristos # else 74*88e42b0fSchristos # define _GL_ATTRIBUTE_FORMAT(spec) /* empty */ 75*88e42b0fSchristos # endif 76*88e42b0fSchristos #endif 77*88e42b0fSchristos 78*88e42b0fSchristos /* _GL_ATTRIBUTE_FORMAT_PRINTF 79*88e42b0fSchristos indicates to GCC that the function takes a format string and arguments, 80*88e42b0fSchristos where the format string directives are the ones standardized by ISO C99 81*88e42b0fSchristos and POSIX. */ 82*88e42b0fSchristos #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) 83*88e42b0fSchristos # define _GL_ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \ 84*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT ((__gnu_printf__, formatstring_parameter, first_argument)) 85*88e42b0fSchristos #else 86*88e42b0fSchristos # define _GL_ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \ 87*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument)) 88*88e42b0fSchristos #endif 89*88e42b0fSchristos 90*88e42b0fSchristos /* _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_PRINTF, 91*88e42b0fSchristos except that it indicates to GCC that the supported format string directives 92*88e42b0fSchristos are the ones of the system printf(), rather than the ones standardized by 93*88e42b0fSchristos ISO C99 and POSIX. */ 94*88e42b0fSchristos #if GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU 95*88e42b0fSchristos # define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \ 96*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT_PRINTF (formatstring_parameter, first_argument) 97*88e42b0fSchristos #else 98*88e42b0fSchristos # define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \ 99*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument)) 100*88e42b0fSchristos #endif 101*88e42b0fSchristos 102*88e42b0fSchristos /* _GL_ATTRIBUTE_FORMAT_SCANF 103*88e42b0fSchristos indicates to GCC that the function takes a format string and arguments, 104*88e42b0fSchristos where the format string directives are the ones standardized by ISO C99 105*88e42b0fSchristos and POSIX. */ 106*88e42b0fSchristos #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) 107*88e42b0fSchristos # define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \ 108*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT ((__gnu_scanf__, formatstring_parameter, first_argument)) 109*88e42b0fSchristos #else 110*88e42b0fSchristos # define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \ 111*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument)) 112*88e42b0fSchristos #endif 113*88e42b0fSchristos 114*88e42b0fSchristos /* _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_SCANF, 115*88e42b0fSchristos except that it indicates to GCC that the supported format string directives 116*88e42b0fSchristos are the ones of the system scanf(), rather than the ones standardized by 117*88e42b0fSchristos ISO C99 and POSIX. */ 118*88e42b0fSchristos #define _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM(formatstring_parameter, first_argument) \ 119*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument)) 120*88e42b0fSchristos 121*88e42b0fSchristos /* Solaris 10 and NetBSD 7.0 declare renameat in <unistd.h>, not in <stdio.h>. */ 122*88e42b0fSchristos /* But in any case avoid namespace pollution on glibc systems. */ 123*88e42b0fSchristos #if (0 || defined GNULIB_POSIXCHECK) && (defined __sun || defined __NetBSD__) \ 124*88e42b0fSchristos && ! defined __GLIBC__ 125*88e42b0fSchristos # include <unistd.h> 126*88e42b0fSchristos #endif 127*88e42b0fSchristos 128*88e42b0fSchristos /* Android 4.3 declares renameat in <sys/stat.h>, not in <stdio.h>. */ 129*88e42b0fSchristos /* But in any case avoid namespace pollution on glibc systems. */ 130*88e42b0fSchristos #if (0 || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \ 131*88e42b0fSchristos && ! defined __GLIBC__ 132*88e42b0fSchristos # include <sys/stat.h> 133*88e42b0fSchristos #endif 134*88e42b0fSchristos 135*88e42b0fSchristos /* MSVC declares 'perror' in <stdlib.h>, not in <stdio.h>. We must include 136*88e42b0fSchristos it before we #define perror rpl_perror. */ 137*88e42b0fSchristos /* But in any case avoid namespace pollution on glibc systems. */ 138*88e42b0fSchristos #if (0 || defined GNULIB_POSIXCHECK) \ 139*88e42b0fSchristos && (defined _WIN32 && ! defined __CYGWIN__) \ 140*88e42b0fSchristos && ! defined __GLIBC__ 141*88e42b0fSchristos # include <stdlib.h> 142*88e42b0fSchristos #endif 143*88e42b0fSchristos 144*88e42b0fSchristos /* MSVC declares 'remove' in <io.h>, not in <stdio.h>. We must include 145*88e42b0fSchristos it before we #define remove rpl_remove. */ 146*88e42b0fSchristos /* MSVC declares 'rename' in <io.h>, not in <stdio.h>. We must include 147*88e42b0fSchristos it before we #define rename rpl_rename. */ 148*88e42b0fSchristos /* But in any case avoid namespace pollution on glibc systems. */ 149*88e42b0fSchristos #if (0 || 1 || defined GNULIB_POSIXCHECK) \ 150*88e42b0fSchristos && (defined _WIN32 && ! defined __CYGWIN__) \ 151*88e42b0fSchristos && ! defined __GLIBC__ 152*88e42b0fSchristos # include <io.h> 153*88e42b0fSchristos #endif 154*88e42b0fSchristos 155*88e42b0fSchristos 156*88e42b0fSchristos /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 157*88e42b0fSchristos /* C++ compatible function declaration macros. 158*88e42b0fSchristos Copyright (C) 2010-2020 Free Software Foundation, Inc. 159*88e42b0fSchristos 160*88e42b0fSchristos This program is free software: you can redistribute it and/or modify it 161*88e42b0fSchristos under the terms of the GNU General Public License as published 162*88e42b0fSchristos by the Free Software Foundation; either version 3 of the License, or 163*88e42b0fSchristos (at your option) any later version. 164*88e42b0fSchristos 165*88e42b0fSchristos This program is distributed in the hope that it will be useful, 166*88e42b0fSchristos but WITHOUT ANY WARRANTY; without even the implied warranty of 167*88e42b0fSchristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 168*88e42b0fSchristos General Public License for more details. 169*88e42b0fSchristos 170*88e42b0fSchristos You should have received a copy of the GNU General Public License 171*88e42b0fSchristos along with this program. If not, see <https://www.gnu.org/licenses/>. */ 172*88e42b0fSchristos 173*88e42b0fSchristos #ifndef _GL_CXXDEFS_H 174*88e42b0fSchristos #define _GL_CXXDEFS_H 175*88e42b0fSchristos 176*88e42b0fSchristos /* Begin/end the GNULIB_NAMESPACE namespace. */ 177*88e42b0fSchristos #if defined __cplusplus && defined GNULIB_NAMESPACE 178*88e42b0fSchristos # define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE { 179*88e42b0fSchristos # define _GL_END_NAMESPACE } 180*88e42b0fSchristos #else 181*88e42b0fSchristos # define _GL_BEGIN_NAMESPACE 182*88e42b0fSchristos # define _GL_END_NAMESPACE 183*88e42b0fSchristos #endif 184*88e42b0fSchristos 185*88e42b0fSchristos /* The three most frequent use cases of these macros are: 186*88e42b0fSchristos 187*88e42b0fSchristos * For providing a substitute for a function that is missing on some 188*88e42b0fSchristos platforms, but is declared and works fine on the platforms on which 189*88e42b0fSchristos it exists: 190*88e42b0fSchristos 191*88e42b0fSchristos #if @GNULIB_FOO@ 192*88e42b0fSchristos # if !@HAVE_FOO@ 193*88e42b0fSchristos _GL_FUNCDECL_SYS (foo, ...); 194*88e42b0fSchristos # endif 195*88e42b0fSchristos _GL_CXXALIAS_SYS (foo, ...); 196*88e42b0fSchristos _GL_CXXALIASWARN (foo); 197*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 198*88e42b0fSchristos ... 199*88e42b0fSchristos #endif 200*88e42b0fSchristos 201*88e42b0fSchristos * For providing a replacement for a function that exists on all platforms, 202*88e42b0fSchristos but is broken/insufficient and needs to be replaced on some platforms: 203*88e42b0fSchristos 204*88e42b0fSchristos #if @GNULIB_FOO@ 205*88e42b0fSchristos # if @REPLACE_FOO@ 206*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 207*88e42b0fSchristos # undef foo 208*88e42b0fSchristos # define foo rpl_foo 209*88e42b0fSchristos # endif 210*88e42b0fSchristos _GL_FUNCDECL_RPL (foo, ...); 211*88e42b0fSchristos _GL_CXXALIAS_RPL (foo, ...); 212*88e42b0fSchristos # else 213*88e42b0fSchristos _GL_CXXALIAS_SYS (foo, ...); 214*88e42b0fSchristos # endif 215*88e42b0fSchristos _GL_CXXALIASWARN (foo); 216*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 217*88e42b0fSchristos ... 218*88e42b0fSchristos #endif 219*88e42b0fSchristos 220*88e42b0fSchristos * For providing a replacement for a function that exists on some platforms 221*88e42b0fSchristos but is broken/insufficient and needs to be replaced on some of them and 222*88e42b0fSchristos is additionally either missing or undeclared on some other platforms: 223*88e42b0fSchristos 224*88e42b0fSchristos #if @GNULIB_FOO@ 225*88e42b0fSchristos # if @REPLACE_FOO@ 226*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 227*88e42b0fSchristos # undef foo 228*88e42b0fSchristos # define foo rpl_foo 229*88e42b0fSchristos # endif 230*88e42b0fSchristos _GL_FUNCDECL_RPL (foo, ...); 231*88e42b0fSchristos _GL_CXXALIAS_RPL (foo, ...); 232*88e42b0fSchristos # else 233*88e42b0fSchristos # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ 234*88e42b0fSchristos _GL_FUNCDECL_SYS (foo, ...); 235*88e42b0fSchristos # endif 236*88e42b0fSchristos _GL_CXXALIAS_SYS (foo, ...); 237*88e42b0fSchristos # endif 238*88e42b0fSchristos _GL_CXXALIASWARN (foo); 239*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 240*88e42b0fSchristos ... 241*88e42b0fSchristos #endif 242*88e42b0fSchristos */ 243*88e42b0fSchristos 244*88e42b0fSchristos /* _GL_EXTERN_C declaration; 245*88e42b0fSchristos performs the declaration with C linkage. */ 246*88e42b0fSchristos #if defined __cplusplus 247*88e42b0fSchristos # define _GL_EXTERN_C extern "C" 248*88e42b0fSchristos #else 249*88e42b0fSchristos # define _GL_EXTERN_C extern 250*88e42b0fSchristos #endif 251*88e42b0fSchristos 252*88e42b0fSchristos /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); 253*88e42b0fSchristos declares a replacement function, named rpl_func, with the given prototype, 254*88e42b0fSchristos consisting of return type, parameters, and attributes. 255*88e42b0fSchristos Example: 256*88e42b0fSchristos _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) 257*88e42b0fSchristos _GL_ARG_NONNULL ((1))); 258*88e42b0fSchristos */ 259*88e42b0fSchristos #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ 260*88e42b0fSchristos _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) 261*88e42b0fSchristos #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ 262*88e42b0fSchristos _GL_EXTERN_C rettype rpl_func parameters_and_attributes 263*88e42b0fSchristos 264*88e42b0fSchristos /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); 265*88e42b0fSchristos declares the system function, named func, with the given prototype, 266*88e42b0fSchristos consisting of return type, parameters, and attributes. 267*88e42b0fSchristos Example: 268*88e42b0fSchristos _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) 269*88e42b0fSchristos _GL_ARG_NONNULL ((1))); 270*88e42b0fSchristos */ 271*88e42b0fSchristos #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ 272*88e42b0fSchristos _GL_EXTERN_C rettype func parameters_and_attributes 273*88e42b0fSchristos 274*88e42b0fSchristos /* _GL_CXXALIAS_RPL (func, rettype, parameters); 275*88e42b0fSchristos declares a C++ alias called GNULIB_NAMESPACE::func 276*88e42b0fSchristos that redirects to rpl_func, if GNULIB_NAMESPACE is defined. 277*88e42b0fSchristos Example: 278*88e42b0fSchristos _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); 279*88e42b0fSchristos 280*88e42b0fSchristos Wrapping rpl_func in an object with an inline conversion operator 281*88e42b0fSchristos avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is 282*88e42b0fSchristos actually used in the program. */ 283*88e42b0fSchristos #define _GL_CXXALIAS_RPL(func,rettype,parameters) \ 284*88e42b0fSchristos _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) 285*88e42b0fSchristos #if defined __cplusplus && defined GNULIB_NAMESPACE 286*88e42b0fSchristos # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 287*88e42b0fSchristos namespace GNULIB_NAMESPACE \ 288*88e42b0fSchristos { \ 289*88e42b0fSchristos static const struct _gl_ ## func ## _wrapper \ 290*88e42b0fSchristos { \ 291*88e42b0fSchristos typedef rettype (*type) parameters; \ 292*88e42b0fSchristos \ 293*88e42b0fSchristos inline operator type () const \ 294*88e42b0fSchristos { \ 295*88e42b0fSchristos return ::rpl_func; \ 296*88e42b0fSchristos } \ 297*88e42b0fSchristos } func = {}; \ 298*88e42b0fSchristos } \ 299*88e42b0fSchristos _GL_EXTERN_C int _gl_cxxalias_dummy 300*88e42b0fSchristos #else 301*88e42b0fSchristos # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 302*88e42b0fSchristos _GL_EXTERN_C int _gl_cxxalias_dummy 303*88e42b0fSchristos #endif 304*88e42b0fSchristos 305*88e42b0fSchristos /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); 306*88e42b0fSchristos is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); 307*88e42b0fSchristos except that the C function rpl_func may have a slightly different 308*88e42b0fSchristos declaration. A cast is used to silence the "invalid conversion" error 309*88e42b0fSchristos that would otherwise occur. */ 310*88e42b0fSchristos #if defined __cplusplus && defined GNULIB_NAMESPACE 311*88e42b0fSchristos # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 312*88e42b0fSchristos namespace GNULIB_NAMESPACE \ 313*88e42b0fSchristos { \ 314*88e42b0fSchristos static const struct _gl_ ## func ## _wrapper \ 315*88e42b0fSchristos { \ 316*88e42b0fSchristos typedef rettype (*type) parameters; \ 317*88e42b0fSchristos \ 318*88e42b0fSchristos inline operator type () const \ 319*88e42b0fSchristos { \ 320*88e42b0fSchristos return reinterpret_cast<type>(::rpl_func); \ 321*88e42b0fSchristos } \ 322*88e42b0fSchristos } func = {}; \ 323*88e42b0fSchristos } \ 324*88e42b0fSchristos _GL_EXTERN_C int _gl_cxxalias_dummy 325*88e42b0fSchristos #else 326*88e42b0fSchristos # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 327*88e42b0fSchristos _GL_EXTERN_C int _gl_cxxalias_dummy 328*88e42b0fSchristos #endif 329*88e42b0fSchristos 330*88e42b0fSchristos /* _GL_CXXALIAS_SYS (func, rettype, parameters); 331*88e42b0fSchristos declares a C++ alias called GNULIB_NAMESPACE::func 332*88e42b0fSchristos that redirects to the system provided function func, if GNULIB_NAMESPACE 333*88e42b0fSchristos is defined. 334*88e42b0fSchristos Example: 335*88e42b0fSchristos _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); 336*88e42b0fSchristos 337*88e42b0fSchristos Wrapping func in an object with an inline conversion operator 338*88e42b0fSchristos avoids a reference to func unless GNULIB_NAMESPACE::func is 339*88e42b0fSchristos actually used in the program. */ 340*88e42b0fSchristos #if defined __cplusplus && defined GNULIB_NAMESPACE 341*88e42b0fSchristos # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 342*88e42b0fSchristos namespace GNULIB_NAMESPACE \ 343*88e42b0fSchristos { \ 344*88e42b0fSchristos static const struct _gl_ ## func ## _wrapper \ 345*88e42b0fSchristos { \ 346*88e42b0fSchristos typedef rettype (*type) parameters; \ 347*88e42b0fSchristos \ 348*88e42b0fSchristos inline operator type () const \ 349*88e42b0fSchristos { \ 350*88e42b0fSchristos return ::func; \ 351*88e42b0fSchristos } \ 352*88e42b0fSchristos } func = {}; \ 353*88e42b0fSchristos } \ 354*88e42b0fSchristos _GL_EXTERN_C int _gl_cxxalias_dummy 355*88e42b0fSchristos #else 356*88e42b0fSchristos # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 357*88e42b0fSchristos _GL_EXTERN_C int _gl_cxxalias_dummy 358*88e42b0fSchristos #endif 359*88e42b0fSchristos 360*88e42b0fSchristos /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); 361*88e42b0fSchristos is like _GL_CXXALIAS_SYS (func, rettype, parameters); 362*88e42b0fSchristos except that the C function func may have a slightly different declaration. 363*88e42b0fSchristos A cast is used to silence the "invalid conversion" error that would 364*88e42b0fSchristos otherwise occur. */ 365*88e42b0fSchristos #if defined __cplusplus && defined GNULIB_NAMESPACE 366*88e42b0fSchristos # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 367*88e42b0fSchristos namespace GNULIB_NAMESPACE \ 368*88e42b0fSchristos { \ 369*88e42b0fSchristos static const struct _gl_ ## func ## _wrapper \ 370*88e42b0fSchristos { \ 371*88e42b0fSchristos typedef rettype (*type) parameters; \ 372*88e42b0fSchristos \ 373*88e42b0fSchristos inline operator type () const \ 374*88e42b0fSchristos { \ 375*88e42b0fSchristos return reinterpret_cast<type>(::func); \ 376*88e42b0fSchristos } \ 377*88e42b0fSchristos } func = {}; \ 378*88e42b0fSchristos } \ 379*88e42b0fSchristos _GL_EXTERN_C int _gl_cxxalias_dummy 380*88e42b0fSchristos #else 381*88e42b0fSchristos # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 382*88e42b0fSchristos _GL_EXTERN_C int _gl_cxxalias_dummy 383*88e42b0fSchristos #endif 384*88e42b0fSchristos 385*88e42b0fSchristos /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); 386*88e42b0fSchristos is like _GL_CXXALIAS_SYS (func, rettype, parameters); 387*88e42b0fSchristos except that the C function is picked among a set of overloaded functions, 388*88e42b0fSchristos namely the one with rettype2 and parameters2. Two consecutive casts 389*88e42b0fSchristos are used to silence the "cannot find a match" and "invalid conversion" 390*88e42b0fSchristos errors that would otherwise occur. */ 391*88e42b0fSchristos #if defined __cplusplus && defined GNULIB_NAMESPACE 392*88e42b0fSchristos /* The outer cast must be a reinterpret_cast. 393*88e42b0fSchristos The inner cast: When the function is defined as a set of overloaded 394*88e42b0fSchristos functions, it works as a static_cast<>, choosing the designated variant. 395*88e42b0fSchristos When the function is defined as a single variant, it works as a 396*88e42b0fSchristos reinterpret_cast<>. The parenthesized cast syntax works both ways. */ 397*88e42b0fSchristos # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 398*88e42b0fSchristos namespace GNULIB_NAMESPACE \ 399*88e42b0fSchristos { \ 400*88e42b0fSchristos static const struct _gl_ ## func ## _wrapper \ 401*88e42b0fSchristos { \ 402*88e42b0fSchristos typedef rettype (*type) parameters; \ 403*88e42b0fSchristos \ 404*88e42b0fSchristos inline operator type () const \ 405*88e42b0fSchristos { \ 406*88e42b0fSchristos return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \ 407*88e42b0fSchristos } \ 408*88e42b0fSchristos } func = {}; \ 409*88e42b0fSchristos } \ 410*88e42b0fSchristos _GL_EXTERN_C int _gl_cxxalias_dummy 411*88e42b0fSchristos #else 412*88e42b0fSchristos # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 413*88e42b0fSchristos _GL_EXTERN_C int _gl_cxxalias_dummy 414*88e42b0fSchristos #endif 415*88e42b0fSchristos 416*88e42b0fSchristos /* _GL_CXXALIASWARN (func); 417*88e42b0fSchristos causes a warning to be emitted when ::func is used but not when 418*88e42b0fSchristos GNULIB_NAMESPACE::func is used. func must be defined without overloaded 419*88e42b0fSchristos variants. */ 420*88e42b0fSchristos #if defined __cplusplus && defined GNULIB_NAMESPACE 421*88e42b0fSchristos # define _GL_CXXALIASWARN(func) \ 422*88e42b0fSchristos _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) 423*88e42b0fSchristos # define _GL_CXXALIASWARN_1(func,namespace) \ 424*88e42b0fSchristos _GL_CXXALIASWARN_2 (func, namespace) 425*88e42b0fSchristos /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 426*88e42b0fSchristos we enable the warning only when not optimizing. */ 427*88e42b0fSchristos # if !__OPTIMIZE__ 428*88e42b0fSchristos # define _GL_CXXALIASWARN_2(func,namespace) \ 429*88e42b0fSchristos _GL_WARN_ON_USE (func, \ 430*88e42b0fSchristos "The symbol ::" #func " refers to the system function. " \ 431*88e42b0fSchristos "Use " #namespace "::" #func " instead.") 432*88e42b0fSchristos # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 433*88e42b0fSchristos # define _GL_CXXALIASWARN_2(func,namespace) \ 434*88e42b0fSchristos extern __typeof__ (func) func 435*88e42b0fSchristos # else 436*88e42b0fSchristos # define _GL_CXXALIASWARN_2(func,namespace) \ 437*88e42b0fSchristos _GL_EXTERN_C int _gl_cxxalias_dummy 438*88e42b0fSchristos # endif 439*88e42b0fSchristos #else 440*88e42b0fSchristos # define _GL_CXXALIASWARN(func) \ 441*88e42b0fSchristos _GL_EXTERN_C int _gl_cxxalias_dummy 442*88e42b0fSchristos #endif 443*88e42b0fSchristos 444*88e42b0fSchristos /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); 445*88e42b0fSchristos causes a warning to be emitted when the given overloaded variant of ::func 446*88e42b0fSchristos is used but not when GNULIB_NAMESPACE::func is used. */ 447*88e42b0fSchristos #if defined __cplusplus && defined GNULIB_NAMESPACE 448*88e42b0fSchristos # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 449*88e42b0fSchristos _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ 450*88e42b0fSchristos GNULIB_NAMESPACE) 451*88e42b0fSchristos # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ 452*88e42b0fSchristos _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) 453*88e42b0fSchristos /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 454*88e42b0fSchristos we enable the warning only when not optimizing. */ 455*88e42b0fSchristos # if !__OPTIMIZE__ 456*88e42b0fSchristos # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 457*88e42b0fSchristos _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \ 458*88e42b0fSchristos "The symbol ::" #func " refers to the system function. " \ 459*88e42b0fSchristos "Use " #namespace "::" #func " instead.") 460*88e42b0fSchristos # else 461*88e42b0fSchristos # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 462*88e42b0fSchristos _GL_EXTERN_C int _gl_cxxalias_dummy 463*88e42b0fSchristos # endif 464*88e42b0fSchristos #else 465*88e42b0fSchristos # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 466*88e42b0fSchristos _GL_EXTERN_C int _gl_cxxalias_dummy 467*88e42b0fSchristos #endif 468*88e42b0fSchristos 469*88e42b0fSchristos #endif /* _GL_CXXDEFS_H */ 470*88e42b0fSchristos 471*88e42b0fSchristos /* The definition of _GL_ARG_NONNULL is copied here. */ 472*88e42b0fSchristos /* A C macro for declaring that specific arguments must not be NULL. 473*88e42b0fSchristos Copyright (C) 2009-2020 Free Software Foundation, Inc. 474*88e42b0fSchristos 475*88e42b0fSchristos This program is free software: you can redistribute it and/or modify it 476*88e42b0fSchristos under the terms of the GNU General Public License as published 477*88e42b0fSchristos by the Free Software Foundation; either version 3 of the License, or 478*88e42b0fSchristos (at your option) any later version. 479*88e42b0fSchristos 480*88e42b0fSchristos This program is distributed in the hope that it will be useful, 481*88e42b0fSchristos but WITHOUT ANY WARRANTY; without even the implied warranty of 482*88e42b0fSchristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 483*88e42b0fSchristos General Public License for more details. 484*88e42b0fSchristos 485*88e42b0fSchristos You should have received a copy of the GNU General Public License 486*88e42b0fSchristos along with this program. If not, see <https://www.gnu.org/licenses/>. */ 487*88e42b0fSchristos 488*88e42b0fSchristos /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools 489*88e42b0fSchristos that the values passed as arguments n, ..., m must be non-NULL pointers. 490*88e42b0fSchristos n = 1 stands for the first argument, n = 2 for the second argument etc. */ 491*88e42b0fSchristos #ifndef _GL_ARG_NONNULL 492*88e42b0fSchristos # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3 493*88e42b0fSchristos # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) 494*88e42b0fSchristos # else 495*88e42b0fSchristos # define _GL_ARG_NONNULL(params) 496*88e42b0fSchristos # endif 497*88e42b0fSchristos #endif 498*88e42b0fSchristos 499*88e42b0fSchristos /* The definition of _GL_WARN_ON_USE is copied here. */ 500*88e42b0fSchristos /* A C macro for emitting warnings if a function is used. 501*88e42b0fSchristos Copyright (C) 2010-2020 Free Software Foundation, Inc. 502*88e42b0fSchristos 503*88e42b0fSchristos This program is free software: you can redistribute it and/or modify it 504*88e42b0fSchristos under the terms of the GNU General Public License as published 505*88e42b0fSchristos by the Free Software Foundation; either version 3 of the License, or 506*88e42b0fSchristos (at your option) any later version. 507*88e42b0fSchristos 508*88e42b0fSchristos This program is distributed in the hope that it will be useful, 509*88e42b0fSchristos but WITHOUT ANY WARRANTY; without even the implied warranty of 510*88e42b0fSchristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 511*88e42b0fSchristos General Public License for more details. 512*88e42b0fSchristos 513*88e42b0fSchristos You should have received a copy of the GNU General Public License 514*88e42b0fSchristos along with this program. If not, see <https://www.gnu.org/licenses/>. */ 515*88e42b0fSchristos 516*88e42b0fSchristos /* _GL_WARN_ON_USE (function, "literal string") issues a declaration 517*88e42b0fSchristos for FUNCTION which will then trigger a compiler warning containing 518*88e42b0fSchristos the text of "literal string" anywhere that function is called, if 519*88e42b0fSchristos supported by the compiler. If the compiler does not support this 520*88e42b0fSchristos feature, the macro expands to an unused extern declaration. 521*88e42b0fSchristos 522*88e42b0fSchristos _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the 523*88e42b0fSchristos attribute used in _GL_WARN_ON_USE. If the compiler does not support 524*88e42b0fSchristos this feature, it expands to empty. 525*88e42b0fSchristos 526*88e42b0fSchristos These macros are useful for marking a function as a potential 527*88e42b0fSchristos portability trap, with the intent that "literal string" include 528*88e42b0fSchristos instructions on the replacement function that should be used 529*88e42b0fSchristos instead. 530*88e42b0fSchristos _GL_WARN_ON_USE is for functions with 'extern' linkage. 531*88e42b0fSchristos _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline' 532*88e42b0fSchristos linkage. 533*88e42b0fSchristos 534*88e42b0fSchristos However, one of the reasons that a function is a portability trap is 535*88e42b0fSchristos if it has the wrong signature. Declaring FUNCTION with a different 536*88e42b0fSchristos signature in C is a compilation error, so this macro must use the 537*88e42b0fSchristos same type as any existing declaration so that programs that avoid 538*88e42b0fSchristos the problematic FUNCTION do not fail to compile merely because they 539*88e42b0fSchristos included a header that poisoned the function. But this implies that 540*88e42b0fSchristos _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already 541*88e42b0fSchristos have a declaration. Use of this macro implies that there must not 542*88e42b0fSchristos be any other macro hiding the declaration of FUNCTION; but 543*88e42b0fSchristos undefining FUNCTION first is part of the poisoning process anyway 544*88e42b0fSchristos (although for symbols that are provided only via a macro, the result 545*88e42b0fSchristos is a compilation error rather than a warning containing 546*88e42b0fSchristos "literal string"). Also note that in C++, it is only safe to use if 547*88e42b0fSchristos FUNCTION has no overloads. 548*88e42b0fSchristos 549*88e42b0fSchristos For an example, it is possible to poison 'getline' by: 550*88e42b0fSchristos - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]], 551*88e42b0fSchristos [getline]) in configure.ac, which potentially defines 552*88e42b0fSchristos HAVE_RAW_DECL_GETLINE 553*88e42b0fSchristos - adding this code to a header that wraps the system <stdio.h>: 554*88e42b0fSchristos #undef getline 555*88e42b0fSchristos #if HAVE_RAW_DECL_GETLINE 556*88e42b0fSchristos _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but" 557*88e42b0fSchristos "not universally present; use the gnulib module getline"); 558*88e42b0fSchristos #endif 559*88e42b0fSchristos 560*88e42b0fSchristos It is not possible to directly poison global variables. But it is 561*88e42b0fSchristos possible to write a wrapper accessor function, and poison that 562*88e42b0fSchristos (less common usage, like &environ, will cause a compilation error 563*88e42b0fSchristos rather than issue the nice warning, but the end result of informing 564*88e42b0fSchristos the developer about their portability problem is still achieved): 565*88e42b0fSchristos #if HAVE_RAW_DECL_ENVIRON 566*88e42b0fSchristos static char *** 567*88e42b0fSchristos rpl_environ (void) { return &environ; } 568*88e42b0fSchristos _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared"); 569*88e42b0fSchristos # undef environ 570*88e42b0fSchristos # define environ (*rpl_environ ()) 571*88e42b0fSchristos #endif 572*88e42b0fSchristos or better (avoiding contradictory use of 'static' and 'extern'): 573*88e42b0fSchristos #if HAVE_RAW_DECL_ENVIRON 574*88e42b0fSchristos static char *** 575*88e42b0fSchristos _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared") 576*88e42b0fSchristos rpl_environ (void) { return &environ; } 577*88e42b0fSchristos # undef environ 578*88e42b0fSchristos # define environ (*rpl_environ ()) 579*88e42b0fSchristos #endif 580*88e42b0fSchristos */ 581*88e42b0fSchristos #ifndef _GL_WARN_ON_USE 582*88e42b0fSchristos 583*88e42b0fSchristos # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 584*88e42b0fSchristos /* A compiler attribute is available in gcc versions 4.3.0 and later. */ 585*88e42b0fSchristos # define _GL_WARN_ON_USE(function, message) \ 586*88e42b0fSchristos extern __typeof__ (function) function __attribute__ ((__warning__ (message))) 587*88e42b0fSchristos # define _GL_WARN_ON_USE_ATTRIBUTE(message) \ 588*88e42b0fSchristos __attribute__ ((__warning__ (message))) 589*88e42b0fSchristos # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 590*88e42b0fSchristos /* Verify the existence of the function. */ 591*88e42b0fSchristos # define _GL_WARN_ON_USE(function, message) \ 592*88e42b0fSchristos extern __typeof__ (function) function 593*88e42b0fSchristos # define _GL_WARN_ON_USE_ATTRIBUTE(message) 594*88e42b0fSchristos # else /* Unsupported. */ 595*88e42b0fSchristos # define _GL_WARN_ON_USE(function, message) \ 596*88e42b0fSchristos _GL_WARN_EXTERN_C int _gl_warn_on_use 597*88e42b0fSchristos # define _GL_WARN_ON_USE_ATTRIBUTE(message) 598*88e42b0fSchristos # endif 599*88e42b0fSchristos #endif 600*88e42b0fSchristos 601*88e42b0fSchristos /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string") 602*88e42b0fSchristos is like _GL_WARN_ON_USE (function, "string"), except that in C++ mode the 603*88e42b0fSchristos function is declared with the given prototype, consisting of return type, 604*88e42b0fSchristos parameters, and attributes. 605*88e42b0fSchristos This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does 606*88e42b0fSchristos not work in this case. */ 607*88e42b0fSchristos #ifndef _GL_WARN_ON_USE_CXX 608*88e42b0fSchristos # if !defined __cplusplus 609*88e42b0fSchristos # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 610*88e42b0fSchristos _GL_WARN_ON_USE (function, msg) 611*88e42b0fSchristos # else 612*88e42b0fSchristos # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 613*88e42b0fSchristos # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 614*88e42b0fSchristos extern rettype function parameters_and_attributes \ 615*88e42b0fSchristos __attribute__ ((__warning__ (msg))) 616*88e42b0fSchristos # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 617*88e42b0fSchristos /* Verify the existence of the function. */ 618*88e42b0fSchristos # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 619*88e42b0fSchristos extern rettype function parameters_and_attributes 620*88e42b0fSchristos # else /* Unsupported. */ 621*88e42b0fSchristos # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 622*88e42b0fSchristos _GL_WARN_EXTERN_C int _gl_warn_on_use 623*88e42b0fSchristos # endif 624*88e42b0fSchristos # endif 625*88e42b0fSchristos #endif 626*88e42b0fSchristos 627*88e42b0fSchristos /* _GL_WARN_EXTERN_C declaration; 628*88e42b0fSchristos performs the declaration with C linkage. */ 629*88e42b0fSchristos #ifndef _GL_WARN_EXTERN_C 630*88e42b0fSchristos # if defined __cplusplus 631*88e42b0fSchristos # define _GL_WARN_EXTERN_C extern "C" 632*88e42b0fSchristos # else 633*88e42b0fSchristos # define _GL_WARN_EXTERN_C extern 634*88e42b0fSchristos # endif 635*88e42b0fSchristos #endif 636*88e42b0fSchristos 637*88e42b0fSchristos /* Macros for stringification. */ 638*88e42b0fSchristos #define _GL_STDIO_STRINGIZE(token) #token 639*88e42b0fSchristos #define _GL_STDIO_MACROEXPAND_AND_STRINGIZE(token) _GL_STDIO_STRINGIZE(token) 640*88e42b0fSchristos 641*88e42b0fSchristos /* When also using extern inline, suppress the use of static inline in 642*88e42b0fSchristos standard headers of problematic Apple configurations, as Libc at 643*88e42b0fSchristos least through Libc-825.26 (2013-04-09) mishandles it; see, e.g., 644*88e42b0fSchristos <https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html>. 645*88e42b0fSchristos Perhaps Apple will fix this some day. */ 646*88e42b0fSchristos #if (defined _GL_EXTERN_INLINE_IN_USE && defined __APPLE__ \ 647*88e42b0fSchristos && defined __GNUC__ && defined __STDC__) 648*88e42b0fSchristos # undef putc_unlocked 649*88e42b0fSchristos #endif 650*88e42b0fSchristos 651*88e42b0fSchristos #if 0 652*88e42b0fSchristos # if 0 653*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 654*88e42b0fSchristos # define dprintf rpl_dprintf 655*88e42b0fSchristos # endif 656*88e42b0fSchristos _GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *restrict format, ...) 657*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) 658*88e42b0fSchristos _GL_ARG_NONNULL ((2))); 659*88e42b0fSchristos _GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *restrict format, ...)); 660*88e42b0fSchristos # else 661*88e42b0fSchristos # if !1 662*88e42b0fSchristos _GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *restrict format, ...) 663*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) 664*88e42b0fSchristos _GL_ARG_NONNULL ((2))); 665*88e42b0fSchristos # endif 666*88e42b0fSchristos _GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *restrict format, ...)); 667*88e42b0fSchristos # endif 668*88e42b0fSchristos _GL_CXXALIASWARN (dprintf); 669*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 670*88e42b0fSchristos # undef dprintf 671*88e42b0fSchristos # if HAVE_RAW_DECL_DPRINTF 672*88e42b0fSchristos _GL_WARN_ON_USE (dprintf, "dprintf is unportable - " 673*88e42b0fSchristos "use gnulib module dprintf for portability"); 674*88e42b0fSchristos # endif 675*88e42b0fSchristos #endif 676*88e42b0fSchristos 677*88e42b0fSchristos #if 0 678*88e42b0fSchristos /* Close STREAM and its underlying file descriptor. */ 679*88e42b0fSchristos # if 0 680*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 681*88e42b0fSchristos # define fclose rpl_fclose 682*88e42b0fSchristos # endif 683*88e42b0fSchristos _GL_FUNCDECL_RPL (fclose, int, (FILE *stream) _GL_ARG_NONNULL ((1))); 684*88e42b0fSchristos _GL_CXXALIAS_RPL (fclose, int, (FILE *stream)); 685*88e42b0fSchristos # else 686*88e42b0fSchristos _GL_CXXALIAS_SYS (fclose, int, (FILE *stream)); 687*88e42b0fSchristos # endif 688*88e42b0fSchristos # if __GLIBC__ >= 2 689*88e42b0fSchristos _GL_CXXALIASWARN (fclose); 690*88e42b0fSchristos # endif 691*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 692*88e42b0fSchristos # undef fclose 693*88e42b0fSchristos /* Assume fclose is always declared. */ 694*88e42b0fSchristos _GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - " 695*88e42b0fSchristos "use gnulib module fclose for portable POSIX compliance"); 696*88e42b0fSchristos #endif 697*88e42b0fSchristos 698*88e42b0fSchristos #if 0 699*88e42b0fSchristos # if 0 700*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 701*88e42b0fSchristos # undef fdopen 702*88e42b0fSchristos # define fdopen rpl_fdopen 703*88e42b0fSchristos # endif 704*88e42b0fSchristos _GL_FUNCDECL_RPL (fdopen, FILE *, (int fd, const char *mode) 705*88e42b0fSchristos _GL_ARG_NONNULL ((2))); 706*88e42b0fSchristos _GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode)); 707*88e42b0fSchristos # else 708*88e42b0fSchristos _GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode)); 709*88e42b0fSchristos # endif 710*88e42b0fSchristos _GL_CXXALIASWARN (fdopen); 711*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 712*88e42b0fSchristos # undef fdopen 713*88e42b0fSchristos /* Assume fdopen is always declared. */ 714*88e42b0fSchristos _GL_WARN_ON_USE (fdopen, "fdopen on native Windows platforms is not POSIX compliant - " 715*88e42b0fSchristos "use gnulib module fdopen for portability"); 716*88e42b0fSchristos #endif 717*88e42b0fSchristos 718*88e42b0fSchristos #if 0 719*88e42b0fSchristos /* Flush all pending data on STREAM according to POSIX rules. Both 720*88e42b0fSchristos output and seekable input streams are supported. 721*88e42b0fSchristos Note! LOSS OF DATA can occur if fflush is applied on an input stream 722*88e42b0fSchristos that is _not_seekable_ or on an update stream that is _not_seekable_ 723*88e42b0fSchristos and in which the most recent operation was input. Seekability can 724*88e42b0fSchristos be tested with lseek(fileno(fp),0,SEEK_CUR). */ 725*88e42b0fSchristos # if 0 726*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 727*88e42b0fSchristos # define fflush rpl_fflush 728*88e42b0fSchristos # endif 729*88e42b0fSchristos _GL_FUNCDECL_RPL (fflush, int, (FILE *gl_stream)); 730*88e42b0fSchristos _GL_CXXALIAS_RPL (fflush, int, (FILE *gl_stream)); 731*88e42b0fSchristos # else 732*88e42b0fSchristos _GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream)); 733*88e42b0fSchristos # endif 734*88e42b0fSchristos # if __GLIBC__ >= 2 735*88e42b0fSchristos _GL_CXXALIASWARN (fflush); 736*88e42b0fSchristos # endif 737*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 738*88e42b0fSchristos # undef fflush 739*88e42b0fSchristos /* Assume fflush is always declared. */ 740*88e42b0fSchristos _GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - " 741*88e42b0fSchristos "use gnulib module fflush for portable POSIX compliance"); 742*88e42b0fSchristos #endif 743*88e42b0fSchristos 744*88e42b0fSchristos #if 1 745*88e42b0fSchristos # if 0 && 0 746*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 747*88e42b0fSchristos # undef fgetc 748*88e42b0fSchristos # define fgetc rpl_fgetc 749*88e42b0fSchristos # endif 750*88e42b0fSchristos _GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1))); 751*88e42b0fSchristos _GL_CXXALIAS_RPL (fgetc, int, (FILE *stream)); 752*88e42b0fSchristos # else 753*88e42b0fSchristos _GL_CXXALIAS_SYS (fgetc, int, (FILE *stream)); 754*88e42b0fSchristos # endif 755*88e42b0fSchristos # if __GLIBC__ >= 2 756*88e42b0fSchristos _GL_CXXALIASWARN (fgetc); 757*88e42b0fSchristos # endif 758*88e42b0fSchristos #endif 759*88e42b0fSchristos 760*88e42b0fSchristos #if 1 761*88e42b0fSchristos # if 0 && 0 762*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 763*88e42b0fSchristos # undef fgets 764*88e42b0fSchristos # define fgets rpl_fgets 765*88e42b0fSchristos # endif 766*88e42b0fSchristos _GL_FUNCDECL_RPL (fgets, char *, 767*88e42b0fSchristos (char *restrict s, int n, FILE *restrict stream) 768*88e42b0fSchristos _GL_ARG_NONNULL ((1, 3))); 769*88e42b0fSchristos _GL_CXXALIAS_RPL (fgets, char *, 770*88e42b0fSchristos (char *restrict s, int n, FILE *restrict stream)); 771*88e42b0fSchristos # else 772*88e42b0fSchristos _GL_CXXALIAS_SYS (fgets, char *, 773*88e42b0fSchristos (char *restrict s, int n, FILE *restrict stream)); 774*88e42b0fSchristos # endif 775*88e42b0fSchristos # if __GLIBC__ >= 2 776*88e42b0fSchristos _GL_CXXALIASWARN (fgets); 777*88e42b0fSchristos # endif 778*88e42b0fSchristos #endif 779*88e42b0fSchristos 780*88e42b0fSchristos #if 0 781*88e42b0fSchristos # if 0 782*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 783*88e42b0fSchristos # undef fopen 784*88e42b0fSchristos # define fopen rpl_fopen 785*88e42b0fSchristos # endif 786*88e42b0fSchristos _GL_FUNCDECL_RPL (fopen, FILE *, 787*88e42b0fSchristos (const char *restrict filename, const char *restrict mode) 788*88e42b0fSchristos _GL_ARG_NONNULL ((1, 2))); 789*88e42b0fSchristos _GL_CXXALIAS_RPL (fopen, FILE *, 790*88e42b0fSchristos (const char *restrict filename, const char *restrict mode)); 791*88e42b0fSchristos # else 792*88e42b0fSchristos _GL_CXXALIAS_SYS (fopen, FILE *, 793*88e42b0fSchristos (const char *restrict filename, const char *restrict mode)); 794*88e42b0fSchristos # endif 795*88e42b0fSchristos # if __GLIBC__ >= 2 796*88e42b0fSchristos _GL_CXXALIASWARN (fopen); 797*88e42b0fSchristos # endif 798*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 799*88e42b0fSchristos # undef fopen 800*88e42b0fSchristos /* Assume fopen is always declared. */ 801*88e42b0fSchristos _GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX compliant - " 802*88e42b0fSchristos "use gnulib module fopen for portability"); 803*88e42b0fSchristos #endif 804*88e42b0fSchristos 805*88e42b0fSchristos #if 0 || 1 806*88e42b0fSchristos # if (0 && 0) \ 807*88e42b0fSchristos || (1 && 0 && (0 || 0)) 808*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 809*88e42b0fSchristos # define fprintf rpl_fprintf 810*88e42b0fSchristos # endif 811*88e42b0fSchristos # define GNULIB_overrides_fprintf 1 812*88e42b0fSchristos # if 0 || 0 813*88e42b0fSchristos _GL_FUNCDECL_RPL (fprintf, int, 814*88e42b0fSchristos (FILE *restrict fp, const char *restrict format, ...) 815*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) 816*88e42b0fSchristos _GL_ARG_NONNULL ((1, 2))); 817*88e42b0fSchristos # else 818*88e42b0fSchristos _GL_FUNCDECL_RPL (fprintf, int, 819*88e42b0fSchristos (FILE *restrict fp, const char *restrict format, ...) 820*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3) 821*88e42b0fSchristos _GL_ARG_NONNULL ((1, 2))); 822*88e42b0fSchristos # endif 823*88e42b0fSchristos _GL_CXXALIAS_RPL (fprintf, int, 824*88e42b0fSchristos (FILE *restrict fp, const char *restrict format, ...)); 825*88e42b0fSchristos # else 826*88e42b0fSchristos _GL_CXXALIAS_SYS (fprintf, int, 827*88e42b0fSchristos (FILE *restrict fp, const char *restrict format, ...)); 828*88e42b0fSchristos # endif 829*88e42b0fSchristos # if __GLIBC__ >= 2 830*88e42b0fSchristos _GL_CXXALIASWARN (fprintf); 831*88e42b0fSchristos # endif 832*88e42b0fSchristos #endif 833*88e42b0fSchristos #if !0 && defined GNULIB_POSIXCHECK 834*88e42b0fSchristos # if !GNULIB_overrides_fprintf 835*88e42b0fSchristos # undef fprintf 836*88e42b0fSchristos # endif 837*88e42b0fSchristos /* Assume fprintf is always declared. */ 838*88e42b0fSchristos _GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX compliant - " 839*88e42b0fSchristos "use gnulib module fprintf-posix for portable " 840*88e42b0fSchristos "POSIX compliance"); 841*88e42b0fSchristos #endif 842*88e42b0fSchristos 843*88e42b0fSchristos #if 0 844*88e42b0fSchristos /* Discard all pending buffered I/O data on STREAM. 845*88e42b0fSchristos STREAM must not be wide-character oriented. 846*88e42b0fSchristos When discarding pending output, the file position is set back to where it 847*88e42b0fSchristos was before the write calls. When discarding pending input, the file 848*88e42b0fSchristos position is advanced to match the end of the previously read input. 849*88e42b0fSchristos Return 0 if successful. Upon error, return -1 and set errno. */ 850*88e42b0fSchristos # if 0 851*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 852*88e42b0fSchristos # define fpurge rpl_fpurge 853*88e42b0fSchristos # endif 854*88e42b0fSchristos _GL_FUNCDECL_RPL (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1))); 855*88e42b0fSchristos _GL_CXXALIAS_RPL (fpurge, int, (FILE *gl_stream)); 856*88e42b0fSchristos # else 857*88e42b0fSchristos # if !1 858*88e42b0fSchristos _GL_FUNCDECL_SYS (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1))); 859*88e42b0fSchristos # endif 860*88e42b0fSchristos _GL_CXXALIAS_SYS (fpurge, int, (FILE *gl_stream)); 861*88e42b0fSchristos # endif 862*88e42b0fSchristos _GL_CXXALIASWARN (fpurge); 863*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 864*88e42b0fSchristos # undef fpurge 865*88e42b0fSchristos # if HAVE_RAW_DECL_FPURGE 866*88e42b0fSchristos _GL_WARN_ON_USE (fpurge, "fpurge is not always present - " 867*88e42b0fSchristos "use gnulib module fpurge for portability"); 868*88e42b0fSchristos # endif 869*88e42b0fSchristos #endif 870*88e42b0fSchristos 871*88e42b0fSchristos #if 1 872*88e42b0fSchristos # if 0 && (0 || 0) 873*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 874*88e42b0fSchristos # undef fputc 875*88e42b0fSchristos # define fputc rpl_fputc 876*88e42b0fSchristos # endif 877*88e42b0fSchristos _GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2))); 878*88e42b0fSchristos _GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream)); 879*88e42b0fSchristos # else 880*88e42b0fSchristos _GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream)); 881*88e42b0fSchristos # endif 882*88e42b0fSchristos # if __GLIBC__ >= 2 883*88e42b0fSchristos _GL_CXXALIASWARN (fputc); 884*88e42b0fSchristos # endif 885*88e42b0fSchristos #endif 886*88e42b0fSchristos 887*88e42b0fSchristos #if 1 888*88e42b0fSchristos # if 0 && (0 || 0) 889*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 890*88e42b0fSchristos # undef fputs 891*88e42b0fSchristos # define fputs rpl_fputs 892*88e42b0fSchristos # endif 893*88e42b0fSchristos _GL_FUNCDECL_RPL (fputs, int, 894*88e42b0fSchristos (const char *restrict string, FILE *restrict stream) 895*88e42b0fSchristos _GL_ARG_NONNULL ((1, 2))); 896*88e42b0fSchristos _GL_CXXALIAS_RPL (fputs, int, 897*88e42b0fSchristos (const char *restrict string, FILE *restrict stream)); 898*88e42b0fSchristos # else 899*88e42b0fSchristos _GL_CXXALIAS_SYS (fputs, int, 900*88e42b0fSchristos (const char *restrict string, FILE *restrict stream)); 901*88e42b0fSchristos # endif 902*88e42b0fSchristos # if __GLIBC__ >= 2 903*88e42b0fSchristos _GL_CXXALIASWARN (fputs); 904*88e42b0fSchristos # endif 905*88e42b0fSchristos #endif 906*88e42b0fSchristos 907*88e42b0fSchristos #if 1 908*88e42b0fSchristos # if 0 && 0 909*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 910*88e42b0fSchristos # undef fread 911*88e42b0fSchristos # define fread rpl_fread 912*88e42b0fSchristos # endif 913*88e42b0fSchristos _GL_FUNCDECL_RPL (fread, size_t, 914*88e42b0fSchristos (void *restrict ptr, size_t s, size_t n, 915*88e42b0fSchristos FILE *restrict stream) 916*88e42b0fSchristos _GL_ARG_NONNULL ((4))); 917*88e42b0fSchristos _GL_CXXALIAS_RPL (fread, size_t, 918*88e42b0fSchristos (void *restrict ptr, size_t s, size_t n, 919*88e42b0fSchristos FILE *restrict stream)); 920*88e42b0fSchristos # else 921*88e42b0fSchristos _GL_CXXALIAS_SYS (fread, size_t, 922*88e42b0fSchristos (void *restrict ptr, size_t s, size_t n, 923*88e42b0fSchristos FILE *restrict stream)); 924*88e42b0fSchristos # endif 925*88e42b0fSchristos # if __GLIBC__ >= 2 926*88e42b0fSchristos _GL_CXXALIASWARN (fread); 927*88e42b0fSchristos # endif 928*88e42b0fSchristos #endif 929*88e42b0fSchristos 930*88e42b0fSchristos #if 0 931*88e42b0fSchristos # if 0 932*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 933*88e42b0fSchristos # undef freopen 934*88e42b0fSchristos # define freopen rpl_freopen 935*88e42b0fSchristos # endif 936*88e42b0fSchristos _GL_FUNCDECL_RPL (freopen, FILE *, 937*88e42b0fSchristos (const char *restrict filename, const char *restrict mode, 938*88e42b0fSchristos FILE *restrict stream) 939*88e42b0fSchristos _GL_ARG_NONNULL ((2, 3))); 940*88e42b0fSchristos _GL_CXXALIAS_RPL (freopen, FILE *, 941*88e42b0fSchristos (const char *restrict filename, const char *restrict mode, 942*88e42b0fSchristos FILE *restrict stream)); 943*88e42b0fSchristos # else 944*88e42b0fSchristos _GL_CXXALIAS_SYS (freopen, FILE *, 945*88e42b0fSchristos (const char *restrict filename, const char *restrict mode, 946*88e42b0fSchristos FILE *restrict stream)); 947*88e42b0fSchristos # endif 948*88e42b0fSchristos # if __GLIBC__ >= 2 949*88e42b0fSchristos _GL_CXXALIASWARN (freopen); 950*88e42b0fSchristos # endif 951*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 952*88e42b0fSchristos # undef freopen 953*88e42b0fSchristos /* Assume freopen is always declared. */ 954*88e42b0fSchristos _GL_WARN_ON_USE (freopen, 955*88e42b0fSchristos "freopen on native Windows platforms is not POSIX compliant - " 956*88e42b0fSchristos "use gnulib module freopen for portability"); 957*88e42b0fSchristos #endif 958*88e42b0fSchristos 959*88e42b0fSchristos #if 1 960*88e42b0fSchristos # if 0 && 0 961*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 962*88e42b0fSchristos # undef fscanf 963*88e42b0fSchristos # define fscanf rpl_fscanf 964*88e42b0fSchristos # endif 965*88e42b0fSchristos _GL_FUNCDECL_RPL (fscanf, int, 966*88e42b0fSchristos (FILE *restrict stream, const char *restrict format, ...) 967*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3) 968*88e42b0fSchristos _GL_ARG_NONNULL ((1, 2))); 969*88e42b0fSchristos _GL_CXXALIAS_RPL (fscanf, int, 970*88e42b0fSchristos (FILE *restrict stream, const char *restrict format, ...)); 971*88e42b0fSchristos # else 972*88e42b0fSchristos _GL_CXXALIAS_SYS (fscanf, int, 973*88e42b0fSchristos (FILE *restrict stream, const char *restrict format, ...)); 974*88e42b0fSchristos # endif 975*88e42b0fSchristos # if __GLIBC__ >= 2 976*88e42b0fSchristos _GL_CXXALIASWARN (fscanf); 977*88e42b0fSchristos # endif 978*88e42b0fSchristos #endif 979*88e42b0fSchristos 980*88e42b0fSchristos 981*88e42b0fSchristos /* Set up the following warnings, based on which modules are in use. 982*88e42b0fSchristos GNU Coding Standards discourage the use of fseek, since it imposes 983*88e42b0fSchristos an arbitrary limitation on some 32-bit hosts. Remember that the 984*88e42b0fSchristos fseek module depends on the fseeko module, so we only have three 985*88e42b0fSchristos cases to consider: 986*88e42b0fSchristos 987*88e42b0fSchristos 1. The developer is not using either module. Issue a warning under 988*88e42b0fSchristos GNULIB_POSIXCHECK for both functions, to remind them that both 989*88e42b0fSchristos functions have bugs on some systems. _GL_NO_LARGE_FILES has no 990*88e42b0fSchristos impact on this warning. 991*88e42b0fSchristos 992*88e42b0fSchristos 2. The developer is using both modules. They may be unaware of the 993*88e42b0fSchristos arbitrary limitations of fseek, so issue a warning under 994*88e42b0fSchristos GNULIB_POSIXCHECK. On the other hand, they may be using both 995*88e42b0fSchristos modules intentionally, so the developer can define 996*88e42b0fSchristos _GL_NO_LARGE_FILES in the compilation units where the use of fseek 997*88e42b0fSchristos is safe, to silence the warning. 998*88e42b0fSchristos 999*88e42b0fSchristos 3. The developer is using the fseeko module, but not fseek. Gnulib 1000*88e42b0fSchristos guarantees that fseek will still work around platform bugs in that 1001*88e42b0fSchristos case, but we presume that the developer is aware of the pitfalls of 1002*88e42b0fSchristos fseek and was trying to avoid it, so issue a warning even when 1003*88e42b0fSchristos GNULIB_POSIXCHECK is undefined. Again, _GL_NO_LARGE_FILES can be 1004*88e42b0fSchristos defined to silence the warning in particular compilation units. 1005*88e42b0fSchristos In C++ compilations with GNULIB_NAMESPACE, in order to avoid that 1006*88e42b0fSchristos fseek gets defined as a macro, it is recommended that the developer 1007*88e42b0fSchristos uses the fseek module, even if he is not calling the fseek function. 1008*88e42b0fSchristos 1009*88e42b0fSchristos Most gnulib clients that perform stream operations should fall into 1010*88e42b0fSchristos category 3. */ 1011*88e42b0fSchristos 1012*88e42b0fSchristos #if 0 1013*88e42b0fSchristos # if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES 1014*88e42b0fSchristos # define _GL_FSEEK_WARN /* Category 2, above. */ 1015*88e42b0fSchristos # undef fseek 1016*88e42b0fSchristos # endif 1017*88e42b0fSchristos # if 0 1018*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1019*88e42b0fSchristos # undef fseek 1020*88e42b0fSchristos # define fseek rpl_fseek 1021*88e42b0fSchristos # endif 1022*88e42b0fSchristos _GL_FUNCDECL_RPL (fseek, int, (FILE *fp, long offset, int whence) 1023*88e42b0fSchristos _GL_ARG_NONNULL ((1))); 1024*88e42b0fSchristos _GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence)); 1025*88e42b0fSchristos # else 1026*88e42b0fSchristos _GL_CXXALIAS_SYS (fseek, int, (FILE *fp, long offset, int whence)); 1027*88e42b0fSchristos # endif 1028*88e42b0fSchristos # if __GLIBC__ >= 2 1029*88e42b0fSchristos _GL_CXXALIASWARN (fseek); 1030*88e42b0fSchristos # endif 1031*88e42b0fSchristos #endif 1032*88e42b0fSchristos 1033*88e42b0fSchristos #if 0 1034*88e42b0fSchristos # if !0 && !defined _GL_NO_LARGE_FILES 1035*88e42b0fSchristos # define _GL_FSEEK_WARN /* Category 3, above. */ 1036*88e42b0fSchristos # undef fseek 1037*88e42b0fSchristos # endif 1038*88e42b0fSchristos # if 0 1039*88e42b0fSchristos /* Provide an fseeko function that is aware of a preceding fflush(), and which 1040*88e42b0fSchristos detects pipes. */ 1041*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1042*88e42b0fSchristos # undef fseeko 1043*88e42b0fSchristos # define fseeko rpl_fseeko 1044*88e42b0fSchristos # endif 1045*88e42b0fSchristos _GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence) 1046*88e42b0fSchristos _GL_ARG_NONNULL ((1))); 1047*88e42b0fSchristos _GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence)); 1048*88e42b0fSchristos # else 1049*88e42b0fSchristos # if ! 1 1050*88e42b0fSchristos _GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence) 1051*88e42b0fSchristos _GL_ARG_NONNULL ((1))); 1052*88e42b0fSchristos # endif 1053*88e42b0fSchristos _GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)); 1054*88e42b0fSchristos # endif 1055*88e42b0fSchristos _GL_CXXALIASWARN (fseeko); 1056*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1057*88e42b0fSchristos # define _GL_FSEEK_WARN /* Category 1, above. */ 1058*88e42b0fSchristos # undef fseek 1059*88e42b0fSchristos # undef fseeko 1060*88e42b0fSchristos # if HAVE_RAW_DECL_FSEEKO 1061*88e42b0fSchristos _GL_WARN_ON_USE (fseeko, "fseeko is unportable - " 1062*88e42b0fSchristos "use gnulib module fseeko for portability"); 1063*88e42b0fSchristos # endif 1064*88e42b0fSchristos #endif 1065*88e42b0fSchristos 1066*88e42b0fSchristos #ifdef _GL_FSEEK_WARN 1067*88e42b0fSchristos # undef _GL_FSEEK_WARN 1068*88e42b0fSchristos /* Here, either fseek is undefined (but C89 guarantees that it is 1069*88e42b0fSchristos declared), or it is defined as rpl_fseek (declared above). */ 1070*88e42b0fSchristos _GL_WARN_ON_USE (fseek, "fseek cannot handle files larger than 4 GB " 1071*88e42b0fSchristos "on 32-bit platforms - " 1072*88e42b0fSchristos "use fseeko function for handling of large files"); 1073*88e42b0fSchristos #endif 1074*88e42b0fSchristos 1075*88e42b0fSchristos 1076*88e42b0fSchristos /* ftell, ftello. See the comments on fseek/fseeko. */ 1077*88e42b0fSchristos 1078*88e42b0fSchristos #if 0 1079*88e42b0fSchristos # if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES 1080*88e42b0fSchristos # define _GL_FTELL_WARN /* Category 2, above. */ 1081*88e42b0fSchristos # undef ftell 1082*88e42b0fSchristos # endif 1083*88e42b0fSchristos # if 0 1084*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1085*88e42b0fSchristos # undef ftell 1086*88e42b0fSchristos # define ftell rpl_ftell 1087*88e42b0fSchristos # endif 1088*88e42b0fSchristos _GL_FUNCDECL_RPL (ftell, long, (FILE *fp) _GL_ARG_NONNULL ((1))); 1089*88e42b0fSchristos _GL_CXXALIAS_RPL (ftell, long, (FILE *fp)); 1090*88e42b0fSchristos # else 1091*88e42b0fSchristos _GL_CXXALIAS_SYS (ftell, long, (FILE *fp)); 1092*88e42b0fSchristos # endif 1093*88e42b0fSchristos # if __GLIBC__ >= 2 1094*88e42b0fSchristos _GL_CXXALIASWARN (ftell); 1095*88e42b0fSchristos # endif 1096*88e42b0fSchristos #endif 1097*88e42b0fSchristos 1098*88e42b0fSchristos #if 0 1099*88e42b0fSchristos # if !0 && !defined _GL_NO_LARGE_FILES 1100*88e42b0fSchristos # define _GL_FTELL_WARN /* Category 3, above. */ 1101*88e42b0fSchristos # undef ftell 1102*88e42b0fSchristos # endif 1103*88e42b0fSchristos # if 0 1104*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1105*88e42b0fSchristos # undef ftello 1106*88e42b0fSchristos # define ftello rpl_ftello 1107*88e42b0fSchristos # endif 1108*88e42b0fSchristos _GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1))); 1109*88e42b0fSchristos _GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp)); 1110*88e42b0fSchristos # else 1111*88e42b0fSchristos # if ! 1 1112*88e42b0fSchristos _GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1))); 1113*88e42b0fSchristos # endif 1114*88e42b0fSchristos _GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp)); 1115*88e42b0fSchristos # endif 1116*88e42b0fSchristos _GL_CXXALIASWARN (ftello); 1117*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1118*88e42b0fSchristos # define _GL_FTELL_WARN /* Category 1, above. */ 1119*88e42b0fSchristos # undef ftell 1120*88e42b0fSchristos # undef ftello 1121*88e42b0fSchristos # if HAVE_RAW_DECL_FTELLO 1122*88e42b0fSchristos _GL_WARN_ON_USE (ftello, "ftello is unportable - " 1123*88e42b0fSchristos "use gnulib module ftello for portability"); 1124*88e42b0fSchristos # endif 1125*88e42b0fSchristos #endif 1126*88e42b0fSchristos 1127*88e42b0fSchristos #ifdef _GL_FTELL_WARN 1128*88e42b0fSchristos # undef _GL_FTELL_WARN 1129*88e42b0fSchristos /* Here, either ftell is undefined (but C89 guarantees that it is 1130*88e42b0fSchristos declared), or it is defined as rpl_ftell (declared above). */ 1131*88e42b0fSchristos _GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB " 1132*88e42b0fSchristos "on 32-bit platforms - " 1133*88e42b0fSchristos "use ftello function for handling of large files"); 1134*88e42b0fSchristos #endif 1135*88e42b0fSchristos 1136*88e42b0fSchristos 1137*88e42b0fSchristos #if 1 1138*88e42b0fSchristos # if 0 && (0 || 0) 1139*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1140*88e42b0fSchristos # undef fwrite 1141*88e42b0fSchristos # define fwrite rpl_fwrite 1142*88e42b0fSchristos # endif 1143*88e42b0fSchristos _GL_FUNCDECL_RPL (fwrite, size_t, 1144*88e42b0fSchristos (const void *restrict ptr, size_t s, size_t n, 1145*88e42b0fSchristos FILE *restrict stream) 1146*88e42b0fSchristos _GL_ARG_NONNULL ((1, 4))); 1147*88e42b0fSchristos _GL_CXXALIAS_RPL (fwrite, size_t, 1148*88e42b0fSchristos (const void *restrict ptr, size_t s, size_t n, 1149*88e42b0fSchristos FILE *restrict stream)); 1150*88e42b0fSchristos # else 1151*88e42b0fSchristos _GL_CXXALIAS_SYS (fwrite, size_t, 1152*88e42b0fSchristos (const void *restrict ptr, size_t s, size_t n, 1153*88e42b0fSchristos FILE *restrict stream)); 1154*88e42b0fSchristos 1155*88e42b0fSchristos /* Work around bug 11959 when fortifying glibc 2.4 through 2.15 1156*88e42b0fSchristos <https://sourceware.org/bugzilla/show_bug.cgi?id=11959>, 1157*88e42b0fSchristos which sometimes causes an unwanted diagnostic for fwrite calls. 1158*88e42b0fSchristos This affects only function declaration attributes under certain 1159*88e42b0fSchristos versions of gcc and clang, and is not needed for C++. */ 1160*88e42b0fSchristos # if (0 < __USE_FORTIFY_LEVEL \ 1161*88e42b0fSchristos && __GLIBC__ == 2 && 4 <= __GLIBC_MINOR__ && __GLIBC_MINOR__ <= 15 \ 1162*88e42b0fSchristos && 3 < __GNUC__ + (4 <= __GNUC_MINOR__) \ 1163*88e42b0fSchristos && !defined __cplusplus) 1164*88e42b0fSchristos # undef fwrite 1165*88e42b0fSchristos # undef fwrite_unlocked 1166*88e42b0fSchristos extern size_t __REDIRECT (rpl_fwrite, 1167*88e42b0fSchristos (const void *__restrict, size_t, size_t, 1168*88e42b0fSchristos FILE *__restrict), 1169*88e42b0fSchristos fwrite); 1170*88e42b0fSchristos extern size_t __REDIRECT (rpl_fwrite_unlocked, 1171*88e42b0fSchristos (const void *__restrict, size_t, size_t, 1172*88e42b0fSchristos FILE *__restrict), 1173*88e42b0fSchristos fwrite_unlocked); 1174*88e42b0fSchristos # define fwrite rpl_fwrite 1175*88e42b0fSchristos # define fwrite_unlocked rpl_fwrite_unlocked 1176*88e42b0fSchristos # endif 1177*88e42b0fSchristos # endif 1178*88e42b0fSchristos # if __GLIBC__ >= 2 1179*88e42b0fSchristos _GL_CXXALIASWARN (fwrite); 1180*88e42b0fSchristos # endif 1181*88e42b0fSchristos #endif 1182*88e42b0fSchristos 1183*88e42b0fSchristos #if 1 1184*88e42b0fSchristos # if 0 && 0 1185*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1186*88e42b0fSchristos # undef getc 1187*88e42b0fSchristos # define getc rpl_fgetc 1188*88e42b0fSchristos # endif 1189*88e42b0fSchristos _GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1))); 1190*88e42b0fSchristos _GL_CXXALIAS_RPL_1 (getc, rpl_fgetc, int, (FILE *stream)); 1191*88e42b0fSchristos # else 1192*88e42b0fSchristos _GL_CXXALIAS_SYS (getc, int, (FILE *stream)); 1193*88e42b0fSchristos # endif 1194*88e42b0fSchristos # if __GLIBC__ >= 2 1195*88e42b0fSchristos _GL_CXXALIASWARN (getc); 1196*88e42b0fSchristos # endif 1197*88e42b0fSchristos #endif 1198*88e42b0fSchristos 1199*88e42b0fSchristos #if 1 1200*88e42b0fSchristos # if 0 && 0 1201*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1202*88e42b0fSchristos # undef getchar 1203*88e42b0fSchristos # define getchar rpl_getchar 1204*88e42b0fSchristos # endif 1205*88e42b0fSchristos _GL_FUNCDECL_RPL (getchar, int, (void)); 1206*88e42b0fSchristos _GL_CXXALIAS_RPL (getchar, int, (void)); 1207*88e42b0fSchristos # else 1208*88e42b0fSchristos _GL_CXXALIAS_SYS (getchar, int, (void)); 1209*88e42b0fSchristos # endif 1210*88e42b0fSchristos # if __GLIBC__ >= 2 1211*88e42b0fSchristos _GL_CXXALIASWARN (getchar); 1212*88e42b0fSchristos # endif 1213*88e42b0fSchristos #endif 1214*88e42b0fSchristos 1215*88e42b0fSchristos #if 0 1216*88e42b0fSchristos /* Read input, up to (and including) the next occurrence of DELIMITER, from 1217*88e42b0fSchristos STREAM, store it in *LINEPTR (and NUL-terminate it). 1218*88e42b0fSchristos *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE 1219*88e42b0fSchristos bytes of space. It is realloc'd as necessary. 1220*88e42b0fSchristos Return the number of bytes read and stored at *LINEPTR (not including the 1221*88e42b0fSchristos NUL terminator), or -1 on error or EOF. */ 1222*88e42b0fSchristos # if 0 1223*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1224*88e42b0fSchristos # undef getdelim 1225*88e42b0fSchristos # define getdelim rpl_getdelim 1226*88e42b0fSchristos # endif 1227*88e42b0fSchristos _GL_FUNCDECL_RPL (getdelim, ssize_t, 1228*88e42b0fSchristos (char **restrict lineptr, size_t *restrict linesize, 1229*88e42b0fSchristos int delimiter, 1230*88e42b0fSchristos FILE *restrict stream) 1231*88e42b0fSchristos _GL_ARG_NONNULL ((1, 2, 4))); 1232*88e42b0fSchristos _GL_CXXALIAS_RPL (getdelim, ssize_t, 1233*88e42b0fSchristos (char **restrict lineptr, size_t *restrict linesize, 1234*88e42b0fSchristos int delimiter, 1235*88e42b0fSchristos FILE *restrict stream)); 1236*88e42b0fSchristos # else 1237*88e42b0fSchristos # if !1 1238*88e42b0fSchristos _GL_FUNCDECL_SYS (getdelim, ssize_t, 1239*88e42b0fSchristos (char **restrict lineptr, size_t *restrict linesize, 1240*88e42b0fSchristos int delimiter, 1241*88e42b0fSchristos FILE *restrict stream) 1242*88e42b0fSchristos _GL_ARG_NONNULL ((1, 2, 4))); 1243*88e42b0fSchristos # endif 1244*88e42b0fSchristos _GL_CXXALIAS_SYS (getdelim, ssize_t, 1245*88e42b0fSchristos (char **restrict lineptr, size_t *restrict linesize, 1246*88e42b0fSchristos int delimiter, 1247*88e42b0fSchristos FILE *restrict stream)); 1248*88e42b0fSchristos # endif 1249*88e42b0fSchristos _GL_CXXALIASWARN (getdelim); 1250*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1251*88e42b0fSchristos # undef getdelim 1252*88e42b0fSchristos # if HAVE_RAW_DECL_GETDELIM 1253*88e42b0fSchristos _GL_WARN_ON_USE (getdelim, "getdelim is unportable - " 1254*88e42b0fSchristos "use gnulib module getdelim for portability"); 1255*88e42b0fSchristos # endif 1256*88e42b0fSchristos #endif 1257*88e42b0fSchristos 1258*88e42b0fSchristos #if 0 1259*88e42b0fSchristos /* Read a line, up to (and including) the next newline, from STREAM, store it 1260*88e42b0fSchristos in *LINEPTR (and NUL-terminate it). 1261*88e42b0fSchristos *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE 1262*88e42b0fSchristos bytes of space. It is realloc'd as necessary. 1263*88e42b0fSchristos Return the number of bytes read and stored at *LINEPTR (not including the 1264*88e42b0fSchristos NUL terminator), or -1 on error or EOF. */ 1265*88e42b0fSchristos # if 0 1266*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1267*88e42b0fSchristos # undef getline 1268*88e42b0fSchristos # define getline rpl_getline 1269*88e42b0fSchristos # endif 1270*88e42b0fSchristos _GL_FUNCDECL_RPL (getline, ssize_t, 1271*88e42b0fSchristos (char **restrict lineptr, size_t *restrict linesize, 1272*88e42b0fSchristos FILE *restrict stream) 1273*88e42b0fSchristos _GL_ARG_NONNULL ((1, 2, 3))); 1274*88e42b0fSchristos _GL_CXXALIAS_RPL (getline, ssize_t, 1275*88e42b0fSchristos (char **restrict lineptr, size_t *restrict linesize, 1276*88e42b0fSchristos FILE *restrict stream)); 1277*88e42b0fSchristos # else 1278*88e42b0fSchristos # if !1 1279*88e42b0fSchristos _GL_FUNCDECL_SYS (getline, ssize_t, 1280*88e42b0fSchristos (char **restrict lineptr, size_t *restrict linesize, 1281*88e42b0fSchristos FILE *restrict stream) 1282*88e42b0fSchristos _GL_ARG_NONNULL ((1, 2, 3))); 1283*88e42b0fSchristos # endif 1284*88e42b0fSchristos _GL_CXXALIAS_SYS (getline, ssize_t, 1285*88e42b0fSchristos (char **restrict lineptr, size_t *restrict linesize, 1286*88e42b0fSchristos FILE *restrict stream)); 1287*88e42b0fSchristos # endif 1288*88e42b0fSchristos # if 1 1289*88e42b0fSchristos _GL_CXXALIASWARN (getline); 1290*88e42b0fSchristos # endif 1291*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1292*88e42b0fSchristos # undef getline 1293*88e42b0fSchristos # if HAVE_RAW_DECL_GETLINE 1294*88e42b0fSchristos _GL_WARN_ON_USE (getline, "getline is unportable - " 1295*88e42b0fSchristos "use gnulib module getline for portability"); 1296*88e42b0fSchristos # endif 1297*88e42b0fSchristos #endif 1298*88e42b0fSchristos 1299*88e42b0fSchristos /* It is very rare that the developer ever has full control of stdin, 1300*88e42b0fSchristos so any use of gets warrants an unconditional warning; besides, C11 1301*88e42b0fSchristos removed it. */ 1302*88e42b0fSchristos #undef gets 1303*88e42b0fSchristos #if HAVE_RAW_DECL_GETS && !defined __cplusplus 1304*88e42b0fSchristos _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); 1305*88e42b0fSchristos #endif 1306*88e42b0fSchristos 1307*88e42b0fSchristos #if 0 || 0 1308*88e42b0fSchristos struct obstack; 1309*88e42b0fSchristos /* Grow an obstack with formatted output. Return the number of 1310*88e42b0fSchristos bytes added to OBS. No trailing nul byte is added, and the 1311*88e42b0fSchristos object should be closed with obstack_finish before use. Upon 1312*88e42b0fSchristos memory allocation error, call obstack_alloc_failed_handler. Upon 1313*88e42b0fSchristos other error, return -1. */ 1314*88e42b0fSchristos # if 0 1315*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1316*88e42b0fSchristos # define obstack_printf rpl_obstack_printf 1317*88e42b0fSchristos # endif 1318*88e42b0fSchristos _GL_FUNCDECL_RPL (obstack_printf, int, 1319*88e42b0fSchristos (struct obstack *obs, const char *format, ...) 1320*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) 1321*88e42b0fSchristos _GL_ARG_NONNULL ((1, 2))); 1322*88e42b0fSchristos _GL_CXXALIAS_RPL (obstack_printf, int, 1323*88e42b0fSchristos (struct obstack *obs, const char *format, ...)); 1324*88e42b0fSchristos # else 1325*88e42b0fSchristos # if !1 1326*88e42b0fSchristos _GL_FUNCDECL_SYS (obstack_printf, int, 1327*88e42b0fSchristos (struct obstack *obs, const char *format, ...) 1328*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) 1329*88e42b0fSchristos _GL_ARG_NONNULL ((1, 2))); 1330*88e42b0fSchristos # endif 1331*88e42b0fSchristos _GL_CXXALIAS_SYS (obstack_printf, int, 1332*88e42b0fSchristos (struct obstack *obs, const char *format, ...)); 1333*88e42b0fSchristos # endif 1334*88e42b0fSchristos _GL_CXXALIASWARN (obstack_printf); 1335*88e42b0fSchristos # if 0 1336*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1337*88e42b0fSchristos # define obstack_vprintf rpl_obstack_vprintf 1338*88e42b0fSchristos # endif 1339*88e42b0fSchristos _GL_FUNCDECL_RPL (obstack_vprintf, int, 1340*88e42b0fSchristos (struct obstack *obs, const char *format, va_list args) 1341*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) 1342*88e42b0fSchristos _GL_ARG_NONNULL ((1, 2))); 1343*88e42b0fSchristos _GL_CXXALIAS_RPL (obstack_vprintf, int, 1344*88e42b0fSchristos (struct obstack *obs, const char *format, va_list args)); 1345*88e42b0fSchristos # else 1346*88e42b0fSchristos # if !1 1347*88e42b0fSchristos _GL_FUNCDECL_SYS (obstack_vprintf, int, 1348*88e42b0fSchristos (struct obstack *obs, const char *format, va_list args) 1349*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) 1350*88e42b0fSchristos _GL_ARG_NONNULL ((1, 2))); 1351*88e42b0fSchristos # endif 1352*88e42b0fSchristos _GL_CXXALIAS_SYS (obstack_vprintf, int, 1353*88e42b0fSchristos (struct obstack *obs, const char *format, va_list args)); 1354*88e42b0fSchristos # endif 1355*88e42b0fSchristos _GL_CXXALIASWARN (obstack_vprintf); 1356*88e42b0fSchristos #endif 1357*88e42b0fSchristos 1358*88e42b0fSchristos #if 0 1359*88e42b0fSchristos # if !1 1360*88e42b0fSchristos _GL_FUNCDECL_SYS (pclose, int, (FILE *stream) _GL_ARG_NONNULL ((1))); 1361*88e42b0fSchristos # endif 1362*88e42b0fSchristos _GL_CXXALIAS_SYS (pclose, int, (FILE *stream)); 1363*88e42b0fSchristos _GL_CXXALIASWARN (pclose); 1364*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1365*88e42b0fSchristos # undef pclose 1366*88e42b0fSchristos # if HAVE_RAW_DECL_PCLOSE 1367*88e42b0fSchristos _GL_WARN_ON_USE (pclose, "pclose is unportable - " 1368*88e42b0fSchristos "use gnulib module pclose for more portability"); 1369*88e42b0fSchristos # endif 1370*88e42b0fSchristos #endif 1371*88e42b0fSchristos 1372*88e42b0fSchristos #if 0 1373*88e42b0fSchristos /* Print a message to standard error, describing the value of ERRNO, 1374*88e42b0fSchristos (if STRING is not NULL and not empty) prefixed with STRING and ": ", 1375*88e42b0fSchristos and terminated with a newline. */ 1376*88e42b0fSchristos # if 0 1377*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1378*88e42b0fSchristos # define perror rpl_perror 1379*88e42b0fSchristos # endif 1380*88e42b0fSchristos _GL_FUNCDECL_RPL (perror, void, (const char *string)); 1381*88e42b0fSchristos _GL_CXXALIAS_RPL (perror, void, (const char *string)); 1382*88e42b0fSchristos # else 1383*88e42b0fSchristos _GL_CXXALIAS_SYS (perror, void, (const char *string)); 1384*88e42b0fSchristos # endif 1385*88e42b0fSchristos # if __GLIBC__ >= 2 1386*88e42b0fSchristos _GL_CXXALIASWARN (perror); 1387*88e42b0fSchristos # endif 1388*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1389*88e42b0fSchristos # undef perror 1390*88e42b0fSchristos /* Assume perror is always declared. */ 1391*88e42b0fSchristos _GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - " 1392*88e42b0fSchristos "use gnulib module perror for portability"); 1393*88e42b0fSchristos #endif 1394*88e42b0fSchristos 1395*88e42b0fSchristos #if 0 1396*88e42b0fSchristos # if 0 1397*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1398*88e42b0fSchristos # undef popen 1399*88e42b0fSchristos # define popen rpl_popen 1400*88e42b0fSchristos # endif 1401*88e42b0fSchristos _GL_FUNCDECL_RPL (popen, FILE *, (const char *cmd, const char *mode) 1402*88e42b0fSchristos _GL_ARG_NONNULL ((1, 2))); 1403*88e42b0fSchristos _GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode)); 1404*88e42b0fSchristos # else 1405*88e42b0fSchristos # if !1 1406*88e42b0fSchristos _GL_FUNCDECL_SYS (popen, FILE *, (const char *cmd, const char *mode) 1407*88e42b0fSchristos _GL_ARG_NONNULL ((1, 2))); 1408*88e42b0fSchristos # endif 1409*88e42b0fSchristos _GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode)); 1410*88e42b0fSchristos # endif 1411*88e42b0fSchristos _GL_CXXALIASWARN (popen); 1412*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1413*88e42b0fSchristos # undef popen 1414*88e42b0fSchristos # if HAVE_RAW_DECL_POPEN 1415*88e42b0fSchristos _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - " 1416*88e42b0fSchristos "use gnulib module popen or pipe for more portability"); 1417*88e42b0fSchristos # endif 1418*88e42b0fSchristos #endif 1419*88e42b0fSchristos 1420*88e42b0fSchristos #if 0 || 1 1421*88e42b0fSchristos # if (0 && 0) \ 1422*88e42b0fSchristos || (1 && 0 && (0 || 0)) 1423*88e42b0fSchristos # if defined __GNUC__ 1424*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1425*88e42b0fSchristos /* Don't break __attribute__((format(printf,M,N))). */ 1426*88e42b0fSchristos # define printf __printf__ 1427*88e42b0fSchristos # endif 1428*88e42b0fSchristos # if 0 || 0 1429*88e42b0fSchristos _GL_FUNCDECL_RPL_1 (__printf__, int, 1430*88e42b0fSchristos (const char *restrict format, ...) 1431*88e42b0fSchristos __asm__ ( 1432*88e42b0fSchristos _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)) 1433*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2) 1434*88e42b0fSchristos _GL_ARG_NONNULL ((1))); 1435*88e42b0fSchristos # else 1436*88e42b0fSchristos _GL_FUNCDECL_RPL_1 (__printf__, int, 1437*88e42b0fSchristos (const char *restrict format, ...) 1438*88e42b0fSchristos __asm__ ( 1439*88e42b0fSchristos _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)) 1440*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2) 1441*88e42b0fSchristos _GL_ARG_NONNULL ((1))); 1442*88e42b0fSchristos # endif 1443*88e42b0fSchristos _GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...)); 1444*88e42b0fSchristos # else 1445*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1446*88e42b0fSchristos # define printf rpl_printf 1447*88e42b0fSchristos # endif 1448*88e42b0fSchristos _GL_FUNCDECL_RPL (printf, int, 1449*88e42b0fSchristos (const char *restrict format, ...) 1450*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2) 1451*88e42b0fSchristos _GL_ARG_NONNULL ((1))); 1452*88e42b0fSchristos _GL_CXXALIAS_RPL (printf, int, (const char *restrict format, ...)); 1453*88e42b0fSchristos # endif 1454*88e42b0fSchristos # define GNULIB_overrides_printf 1 1455*88e42b0fSchristos # else 1456*88e42b0fSchristos _GL_CXXALIAS_SYS (printf, int, (const char *restrict format, ...)); 1457*88e42b0fSchristos # endif 1458*88e42b0fSchristos # if __GLIBC__ >= 2 1459*88e42b0fSchristos _GL_CXXALIASWARN (printf); 1460*88e42b0fSchristos # endif 1461*88e42b0fSchristos #endif 1462*88e42b0fSchristos #if !0 && defined GNULIB_POSIXCHECK 1463*88e42b0fSchristos # if !GNULIB_overrides_printf 1464*88e42b0fSchristos # undef printf 1465*88e42b0fSchristos # endif 1466*88e42b0fSchristos /* Assume printf is always declared. */ 1467*88e42b0fSchristos _GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - " 1468*88e42b0fSchristos "use gnulib module printf-posix for portable " 1469*88e42b0fSchristos "POSIX compliance"); 1470*88e42b0fSchristos #endif 1471*88e42b0fSchristos 1472*88e42b0fSchristos #if 1 1473*88e42b0fSchristos # if 0 && (0 || 0) 1474*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1475*88e42b0fSchristos # undef putc 1476*88e42b0fSchristos # define putc rpl_fputc 1477*88e42b0fSchristos # endif 1478*88e42b0fSchristos _GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2))); 1479*88e42b0fSchristos _GL_CXXALIAS_RPL_1 (putc, rpl_fputc, int, (int c, FILE *stream)); 1480*88e42b0fSchristos # else 1481*88e42b0fSchristos _GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream)); 1482*88e42b0fSchristos # endif 1483*88e42b0fSchristos # if __GLIBC__ >= 2 1484*88e42b0fSchristos _GL_CXXALIASWARN (putc); 1485*88e42b0fSchristos # endif 1486*88e42b0fSchristos #endif 1487*88e42b0fSchristos 1488*88e42b0fSchristos #if 1 1489*88e42b0fSchristos # if 0 && (0 || 0) 1490*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1491*88e42b0fSchristos # undef putchar 1492*88e42b0fSchristos # define putchar rpl_putchar 1493*88e42b0fSchristos # endif 1494*88e42b0fSchristos _GL_FUNCDECL_RPL (putchar, int, (int c)); 1495*88e42b0fSchristos _GL_CXXALIAS_RPL (putchar, int, (int c)); 1496*88e42b0fSchristos # else 1497*88e42b0fSchristos _GL_CXXALIAS_SYS (putchar, int, (int c)); 1498*88e42b0fSchristos # endif 1499*88e42b0fSchristos # if __GLIBC__ >= 2 1500*88e42b0fSchristos _GL_CXXALIASWARN (putchar); 1501*88e42b0fSchristos # endif 1502*88e42b0fSchristos #endif 1503*88e42b0fSchristos 1504*88e42b0fSchristos #if 1 1505*88e42b0fSchristos # if 0 && (0 || 0) 1506*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1507*88e42b0fSchristos # undef puts 1508*88e42b0fSchristos # define puts rpl_puts 1509*88e42b0fSchristos # endif 1510*88e42b0fSchristos _GL_FUNCDECL_RPL (puts, int, (const char *string) _GL_ARG_NONNULL ((1))); 1511*88e42b0fSchristos _GL_CXXALIAS_RPL (puts, int, (const char *string)); 1512*88e42b0fSchristos # else 1513*88e42b0fSchristos _GL_CXXALIAS_SYS (puts, int, (const char *string)); 1514*88e42b0fSchristos # endif 1515*88e42b0fSchristos # if __GLIBC__ >= 2 1516*88e42b0fSchristos _GL_CXXALIASWARN (puts); 1517*88e42b0fSchristos # endif 1518*88e42b0fSchristos #endif 1519*88e42b0fSchristos 1520*88e42b0fSchristos #if 0 1521*88e42b0fSchristos # if 0 1522*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1523*88e42b0fSchristos # undef remove 1524*88e42b0fSchristos # define remove rpl_remove 1525*88e42b0fSchristos # endif 1526*88e42b0fSchristos _GL_FUNCDECL_RPL (remove, int, (const char *name) _GL_ARG_NONNULL ((1))); 1527*88e42b0fSchristos _GL_CXXALIAS_RPL (remove, int, (const char *name)); 1528*88e42b0fSchristos # else 1529*88e42b0fSchristos _GL_CXXALIAS_SYS (remove, int, (const char *name)); 1530*88e42b0fSchristos # endif 1531*88e42b0fSchristos # if __GLIBC__ >= 2 1532*88e42b0fSchristos _GL_CXXALIASWARN (remove); 1533*88e42b0fSchristos # endif 1534*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1535*88e42b0fSchristos # undef remove 1536*88e42b0fSchristos /* Assume remove is always declared. */ 1537*88e42b0fSchristos _GL_WARN_ON_USE (remove, "remove cannot handle directories on some platforms - " 1538*88e42b0fSchristos "use gnulib module remove for more portability"); 1539*88e42b0fSchristos #endif 1540*88e42b0fSchristos 1541*88e42b0fSchristos #if 1 1542*88e42b0fSchristos # if 0 1543*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1544*88e42b0fSchristos # undef rename 1545*88e42b0fSchristos # define rename rpl_rename 1546*88e42b0fSchristos # endif 1547*88e42b0fSchristos _GL_FUNCDECL_RPL (rename, int, 1548*88e42b0fSchristos (const char *old_filename, const char *new_filename) 1549*88e42b0fSchristos _GL_ARG_NONNULL ((1, 2))); 1550*88e42b0fSchristos _GL_CXXALIAS_RPL (rename, int, 1551*88e42b0fSchristos (const char *old_filename, const char *new_filename)); 1552*88e42b0fSchristos # else 1553*88e42b0fSchristos _GL_CXXALIAS_SYS (rename, int, 1554*88e42b0fSchristos (const char *old_filename, const char *new_filename)); 1555*88e42b0fSchristos # endif 1556*88e42b0fSchristos # if __GLIBC__ >= 2 1557*88e42b0fSchristos _GL_CXXALIASWARN (rename); 1558*88e42b0fSchristos # endif 1559*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1560*88e42b0fSchristos # undef rename 1561*88e42b0fSchristos /* Assume rename is always declared. */ 1562*88e42b0fSchristos _GL_WARN_ON_USE (rename, "rename is buggy on some platforms - " 1563*88e42b0fSchristos "use gnulib module rename for more portability"); 1564*88e42b0fSchristos #endif 1565*88e42b0fSchristos 1566*88e42b0fSchristos #if 0 1567*88e42b0fSchristos # if 0 1568*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1569*88e42b0fSchristos # undef renameat 1570*88e42b0fSchristos # define renameat rpl_renameat 1571*88e42b0fSchristos # endif 1572*88e42b0fSchristos _GL_FUNCDECL_RPL (renameat, int, 1573*88e42b0fSchristos (int fd1, char const *file1, int fd2, char const *file2) 1574*88e42b0fSchristos _GL_ARG_NONNULL ((2, 4))); 1575*88e42b0fSchristos _GL_CXXALIAS_RPL (renameat, int, 1576*88e42b0fSchristos (int fd1, char const *file1, int fd2, char const *file2)); 1577*88e42b0fSchristos # else 1578*88e42b0fSchristos # if !1 1579*88e42b0fSchristos _GL_FUNCDECL_SYS (renameat, int, 1580*88e42b0fSchristos (int fd1, char const *file1, int fd2, char const *file2) 1581*88e42b0fSchristos _GL_ARG_NONNULL ((2, 4))); 1582*88e42b0fSchristos # endif 1583*88e42b0fSchristos _GL_CXXALIAS_SYS (renameat, int, 1584*88e42b0fSchristos (int fd1, char const *file1, int fd2, char const *file2)); 1585*88e42b0fSchristos # endif 1586*88e42b0fSchristos _GL_CXXALIASWARN (renameat); 1587*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1588*88e42b0fSchristos # undef renameat 1589*88e42b0fSchristos # if HAVE_RAW_DECL_RENAMEAT 1590*88e42b0fSchristos _GL_WARN_ON_USE (renameat, "renameat is not portable - " 1591*88e42b0fSchristos "use gnulib module renameat for portability"); 1592*88e42b0fSchristos # endif 1593*88e42b0fSchristos #endif 1594*88e42b0fSchristos 1595*88e42b0fSchristos #if 1 1596*88e42b0fSchristos # if 0 && 0 1597*88e42b0fSchristos # if defined __GNUC__ 1598*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1599*88e42b0fSchristos # undef scanf 1600*88e42b0fSchristos /* Don't break __attribute__((format(scanf,M,N))). */ 1601*88e42b0fSchristos # define scanf __scanf__ 1602*88e42b0fSchristos # endif 1603*88e42b0fSchristos _GL_FUNCDECL_RPL_1 (__scanf__, int, 1604*88e42b0fSchristos (const char *restrict format, ...) 1605*88e42b0fSchristos __asm__ ( 1606*88e42b0fSchristos _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf)) 1607*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2) 1608*88e42b0fSchristos _GL_ARG_NONNULL ((1))); 1609*88e42b0fSchristos _GL_CXXALIAS_RPL_1 (scanf, __scanf__, int, (const char *restrict format, ...)); 1610*88e42b0fSchristos # else 1611*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1612*88e42b0fSchristos # undef scanf 1613*88e42b0fSchristos # define scanf rpl_scanf 1614*88e42b0fSchristos # endif 1615*88e42b0fSchristos _GL_FUNCDECL_RPL (scanf, int, (const char *restrict format, ...) 1616*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2) 1617*88e42b0fSchristos _GL_ARG_NONNULL ((1))); 1618*88e42b0fSchristos _GL_CXXALIAS_RPL (scanf, int, (const char *restrict format, ...)); 1619*88e42b0fSchristos # endif 1620*88e42b0fSchristos # else 1621*88e42b0fSchristos _GL_CXXALIAS_SYS (scanf, int, (const char *restrict format, ...)); 1622*88e42b0fSchristos # endif 1623*88e42b0fSchristos # if __GLIBC__ >= 2 1624*88e42b0fSchristos _GL_CXXALIASWARN (scanf); 1625*88e42b0fSchristos # endif 1626*88e42b0fSchristos #endif 1627*88e42b0fSchristos 1628*88e42b0fSchristos #if 0 1629*88e42b0fSchristos # if 0 1630*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1631*88e42b0fSchristos # define snprintf rpl_snprintf 1632*88e42b0fSchristos # endif 1633*88e42b0fSchristos _GL_FUNCDECL_RPL (snprintf, int, 1634*88e42b0fSchristos (char *restrict str, size_t size, 1635*88e42b0fSchristos const char *restrict format, ...) 1636*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4) 1637*88e42b0fSchristos _GL_ARG_NONNULL ((3))); 1638*88e42b0fSchristos _GL_CXXALIAS_RPL (snprintf, int, 1639*88e42b0fSchristos (char *restrict str, size_t size, 1640*88e42b0fSchristos const char *restrict format, ...)); 1641*88e42b0fSchristos # else 1642*88e42b0fSchristos # if !1 1643*88e42b0fSchristos _GL_FUNCDECL_SYS (snprintf, int, 1644*88e42b0fSchristos (char *restrict str, size_t size, 1645*88e42b0fSchristos const char *restrict format, ...) 1646*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4) 1647*88e42b0fSchristos _GL_ARG_NONNULL ((3))); 1648*88e42b0fSchristos # endif 1649*88e42b0fSchristos _GL_CXXALIAS_SYS (snprintf, int, 1650*88e42b0fSchristos (char *restrict str, size_t size, 1651*88e42b0fSchristos const char *restrict format, ...)); 1652*88e42b0fSchristos # endif 1653*88e42b0fSchristos _GL_CXXALIASWARN (snprintf); 1654*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1655*88e42b0fSchristos # undef snprintf 1656*88e42b0fSchristos # if HAVE_RAW_DECL_SNPRINTF 1657*88e42b0fSchristos _GL_WARN_ON_USE (snprintf, "snprintf is unportable - " 1658*88e42b0fSchristos "use gnulib module snprintf for portability"); 1659*88e42b0fSchristos # endif 1660*88e42b0fSchristos #endif 1661*88e42b0fSchristos 1662*88e42b0fSchristos /* Some people would argue that all sprintf uses should be warned about 1663*88e42b0fSchristos (for example, OpenBSD issues a link warning for it), 1664*88e42b0fSchristos since it can cause security holes due to buffer overruns. 1665*88e42b0fSchristos However, we believe that sprintf can be used safely, and is more 1666*88e42b0fSchristos efficient than snprintf in those safe cases; and as proof of our 1667*88e42b0fSchristos belief, we use sprintf in several gnulib modules. So this header 1668*88e42b0fSchristos intentionally avoids adding a warning to sprintf except when 1669*88e42b0fSchristos GNULIB_POSIXCHECK is defined. */ 1670*88e42b0fSchristos 1671*88e42b0fSchristos #if 0 1672*88e42b0fSchristos # if 0 1673*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1674*88e42b0fSchristos # define sprintf rpl_sprintf 1675*88e42b0fSchristos # endif 1676*88e42b0fSchristos _GL_FUNCDECL_RPL (sprintf, int, 1677*88e42b0fSchristos (char *restrict str, const char *restrict format, ...) 1678*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) 1679*88e42b0fSchristos _GL_ARG_NONNULL ((1, 2))); 1680*88e42b0fSchristos _GL_CXXALIAS_RPL (sprintf, int, 1681*88e42b0fSchristos (char *restrict str, const char *restrict format, ...)); 1682*88e42b0fSchristos # else 1683*88e42b0fSchristos _GL_CXXALIAS_SYS (sprintf, int, 1684*88e42b0fSchristos (char *restrict str, const char *restrict format, ...)); 1685*88e42b0fSchristos # endif 1686*88e42b0fSchristos # if __GLIBC__ >= 2 1687*88e42b0fSchristos _GL_CXXALIASWARN (sprintf); 1688*88e42b0fSchristos # endif 1689*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1690*88e42b0fSchristos # undef sprintf 1691*88e42b0fSchristos /* Assume sprintf is always declared. */ 1692*88e42b0fSchristos _GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - " 1693*88e42b0fSchristos "use gnulib module sprintf-posix for portable " 1694*88e42b0fSchristos "POSIX compliance"); 1695*88e42b0fSchristos #endif 1696*88e42b0fSchristos 1697*88e42b0fSchristos #if 0 1698*88e42b0fSchristos # if 0 1699*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1700*88e42b0fSchristos # define tmpfile rpl_tmpfile 1701*88e42b0fSchristos # endif 1702*88e42b0fSchristos _GL_FUNCDECL_RPL (tmpfile, FILE *, (void)); 1703*88e42b0fSchristos _GL_CXXALIAS_RPL (tmpfile, FILE *, (void)); 1704*88e42b0fSchristos # else 1705*88e42b0fSchristos _GL_CXXALIAS_SYS (tmpfile, FILE *, (void)); 1706*88e42b0fSchristos # endif 1707*88e42b0fSchristos # if __GLIBC__ >= 2 1708*88e42b0fSchristos _GL_CXXALIASWARN (tmpfile); 1709*88e42b0fSchristos # endif 1710*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1711*88e42b0fSchristos # undef tmpfile 1712*88e42b0fSchristos # if HAVE_RAW_DECL_TMPFILE 1713*88e42b0fSchristos _GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - " 1714*88e42b0fSchristos "use gnulib module tmpfile for portability"); 1715*88e42b0fSchristos # endif 1716*88e42b0fSchristos #endif 1717*88e42b0fSchristos 1718*88e42b0fSchristos #if 0 1719*88e42b0fSchristos /* Write formatted output to a string dynamically allocated with malloc(). 1720*88e42b0fSchristos If the memory allocation succeeds, store the address of the string in 1721*88e42b0fSchristos *RESULT and return the number of resulting bytes, excluding the trailing 1722*88e42b0fSchristos NUL. Upon memory allocation error, or some other error, return -1. */ 1723*88e42b0fSchristos # if 0 1724*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1725*88e42b0fSchristos # define asprintf rpl_asprintf 1726*88e42b0fSchristos # endif 1727*88e42b0fSchristos _GL_FUNCDECL_RPL (asprintf, int, 1728*88e42b0fSchristos (char **result, const char *format, ...) 1729*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) 1730*88e42b0fSchristos _GL_ARG_NONNULL ((1, 2))); 1731*88e42b0fSchristos _GL_CXXALIAS_RPL (asprintf, int, 1732*88e42b0fSchristos (char **result, const char *format, ...)); 1733*88e42b0fSchristos # else 1734*88e42b0fSchristos # if !1 1735*88e42b0fSchristos _GL_FUNCDECL_SYS (asprintf, int, 1736*88e42b0fSchristos (char **result, const char *format, ...) 1737*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) 1738*88e42b0fSchristos _GL_ARG_NONNULL ((1, 2))); 1739*88e42b0fSchristos # endif 1740*88e42b0fSchristos _GL_CXXALIAS_SYS (asprintf, int, 1741*88e42b0fSchristos (char **result, const char *format, ...)); 1742*88e42b0fSchristos # endif 1743*88e42b0fSchristos _GL_CXXALIASWARN (asprintf); 1744*88e42b0fSchristos # if 0 1745*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1746*88e42b0fSchristos # define vasprintf rpl_vasprintf 1747*88e42b0fSchristos # endif 1748*88e42b0fSchristos _GL_FUNCDECL_RPL (vasprintf, int, 1749*88e42b0fSchristos (char **result, const char *format, va_list args) 1750*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) 1751*88e42b0fSchristos _GL_ARG_NONNULL ((1, 2))); 1752*88e42b0fSchristos _GL_CXXALIAS_RPL (vasprintf, int, 1753*88e42b0fSchristos (char **result, const char *format, va_list args)); 1754*88e42b0fSchristos # else 1755*88e42b0fSchristos # if !1 1756*88e42b0fSchristos _GL_FUNCDECL_SYS (vasprintf, int, 1757*88e42b0fSchristos (char **result, const char *format, va_list args) 1758*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) 1759*88e42b0fSchristos _GL_ARG_NONNULL ((1, 2))); 1760*88e42b0fSchristos # endif 1761*88e42b0fSchristos _GL_CXXALIAS_SYS (vasprintf, int, 1762*88e42b0fSchristos (char **result, const char *format, va_list args)); 1763*88e42b0fSchristos # endif 1764*88e42b0fSchristos _GL_CXXALIASWARN (vasprintf); 1765*88e42b0fSchristos #endif 1766*88e42b0fSchristos 1767*88e42b0fSchristos #if 0 1768*88e42b0fSchristos # if 0 1769*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1770*88e42b0fSchristos # define vdprintf rpl_vdprintf 1771*88e42b0fSchristos # endif 1772*88e42b0fSchristos _GL_FUNCDECL_RPL (vdprintf, int, 1773*88e42b0fSchristos (int fd, const char *restrict format, va_list args) 1774*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) 1775*88e42b0fSchristos _GL_ARG_NONNULL ((2))); 1776*88e42b0fSchristos _GL_CXXALIAS_RPL (vdprintf, int, 1777*88e42b0fSchristos (int fd, const char *restrict format, va_list args)); 1778*88e42b0fSchristos # else 1779*88e42b0fSchristos # if !1 1780*88e42b0fSchristos _GL_FUNCDECL_SYS (vdprintf, int, 1781*88e42b0fSchristos (int fd, const char *restrict format, va_list args) 1782*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) 1783*88e42b0fSchristos _GL_ARG_NONNULL ((2))); 1784*88e42b0fSchristos # endif 1785*88e42b0fSchristos /* Need to cast, because on Solaris, the third parameter will likely be 1786*88e42b0fSchristos __va_list args. */ 1787*88e42b0fSchristos _GL_CXXALIAS_SYS_CAST (vdprintf, int, 1788*88e42b0fSchristos (int fd, const char *restrict format, va_list args)); 1789*88e42b0fSchristos # endif 1790*88e42b0fSchristos # if __GLIBC__ >= 2 1791*88e42b0fSchristos _GL_CXXALIASWARN (vdprintf); 1792*88e42b0fSchristos # endif 1793*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1794*88e42b0fSchristos # undef vdprintf 1795*88e42b0fSchristos # if HAVE_RAW_DECL_VDPRINTF 1796*88e42b0fSchristos _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - " 1797*88e42b0fSchristos "use gnulib module vdprintf for portability"); 1798*88e42b0fSchristos # endif 1799*88e42b0fSchristos #endif 1800*88e42b0fSchristos 1801*88e42b0fSchristos #if 0 || 1 1802*88e42b0fSchristos # if (0 && 0) \ 1803*88e42b0fSchristos || (1 && 0 && (0 || 0)) 1804*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1805*88e42b0fSchristos # define vfprintf rpl_vfprintf 1806*88e42b0fSchristos # endif 1807*88e42b0fSchristos # define GNULIB_overrides_vfprintf 1 1808*88e42b0fSchristos # if 0 1809*88e42b0fSchristos _GL_FUNCDECL_RPL (vfprintf, int, 1810*88e42b0fSchristos (FILE *restrict fp, 1811*88e42b0fSchristos const char *restrict format, va_list args) 1812*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) 1813*88e42b0fSchristos _GL_ARG_NONNULL ((1, 2))); 1814*88e42b0fSchristos # else 1815*88e42b0fSchristos _GL_FUNCDECL_RPL (vfprintf, int, 1816*88e42b0fSchristos (FILE *restrict fp, 1817*88e42b0fSchristos const char *restrict format, va_list args) 1818*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0) 1819*88e42b0fSchristos _GL_ARG_NONNULL ((1, 2))); 1820*88e42b0fSchristos # endif 1821*88e42b0fSchristos _GL_CXXALIAS_RPL (vfprintf, int, 1822*88e42b0fSchristos (FILE *restrict fp, 1823*88e42b0fSchristos const char *restrict format, va_list args)); 1824*88e42b0fSchristos # else 1825*88e42b0fSchristos /* Need to cast, because on Solaris, the third parameter is 1826*88e42b0fSchristos __va_list args 1827*88e42b0fSchristos and GCC's fixincludes did not change this to __gnuc_va_list. */ 1828*88e42b0fSchristos _GL_CXXALIAS_SYS_CAST (vfprintf, int, 1829*88e42b0fSchristos (FILE *restrict fp, 1830*88e42b0fSchristos const char *restrict format, va_list args)); 1831*88e42b0fSchristos # endif 1832*88e42b0fSchristos # if __GLIBC__ >= 2 1833*88e42b0fSchristos _GL_CXXALIASWARN (vfprintf); 1834*88e42b0fSchristos # endif 1835*88e42b0fSchristos #endif 1836*88e42b0fSchristos #if !0 && defined GNULIB_POSIXCHECK 1837*88e42b0fSchristos # if !GNULIB_overrides_vfprintf 1838*88e42b0fSchristos # undef vfprintf 1839*88e42b0fSchristos # endif 1840*88e42b0fSchristos /* Assume vfprintf is always declared. */ 1841*88e42b0fSchristos _GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - " 1842*88e42b0fSchristos "use gnulib module vfprintf-posix for portable " 1843*88e42b0fSchristos "POSIX compliance"); 1844*88e42b0fSchristos #endif 1845*88e42b0fSchristos 1846*88e42b0fSchristos #if 0 1847*88e42b0fSchristos # if 0 && 0 1848*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1849*88e42b0fSchristos # undef vfscanf 1850*88e42b0fSchristos # define vfscanf rpl_vfscanf 1851*88e42b0fSchristos # endif 1852*88e42b0fSchristos _GL_FUNCDECL_RPL (vfscanf, int, 1853*88e42b0fSchristos (FILE *restrict stream, 1854*88e42b0fSchristos const char *restrict format, va_list args) 1855*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0) 1856*88e42b0fSchristos _GL_ARG_NONNULL ((1, 2))); 1857*88e42b0fSchristos _GL_CXXALIAS_RPL (vfscanf, int, 1858*88e42b0fSchristos (FILE *restrict stream, 1859*88e42b0fSchristos const char *restrict format, va_list args)); 1860*88e42b0fSchristos # else 1861*88e42b0fSchristos _GL_CXXALIAS_SYS (vfscanf, int, 1862*88e42b0fSchristos (FILE *restrict stream, 1863*88e42b0fSchristos const char *restrict format, va_list args)); 1864*88e42b0fSchristos # endif 1865*88e42b0fSchristos _GL_CXXALIASWARN (vfscanf); 1866*88e42b0fSchristos #endif 1867*88e42b0fSchristos 1868*88e42b0fSchristos #if 0 || 1 1869*88e42b0fSchristos # if (0 && 0) \ 1870*88e42b0fSchristos || (1 && 0 && (0 || 0)) 1871*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1872*88e42b0fSchristos # define vprintf rpl_vprintf 1873*88e42b0fSchristos # endif 1874*88e42b0fSchristos # define GNULIB_overrides_vprintf 1 1875*88e42b0fSchristos # if 0 || 0 1876*88e42b0fSchristos _GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args) 1877*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT_PRINTF (1, 0) 1878*88e42b0fSchristos _GL_ARG_NONNULL ((1))); 1879*88e42b0fSchristos # else 1880*88e42b0fSchristos _GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args) 1881*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0) 1882*88e42b0fSchristos _GL_ARG_NONNULL ((1))); 1883*88e42b0fSchristos # endif 1884*88e42b0fSchristos _GL_CXXALIAS_RPL (vprintf, int, (const char *restrict format, va_list args)); 1885*88e42b0fSchristos # else 1886*88e42b0fSchristos /* Need to cast, because on Solaris, the second parameter is 1887*88e42b0fSchristos __va_list args 1888*88e42b0fSchristos and GCC's fixincludes did not change this to __gnuc_va_list. */ 1889*88e42b0fSchristos _GL_CXXALIAS_SYS_CAST (vprintf, int, 1890*88e42b0fSchristos (const char *restrict format, va_list args)); 1891*88e42b0fSchristos # endif 1892*88e42b0fSchristos # if __GLIBC__ >= 2 1893*88e42b0fSchristos _GL_CXXALIASWARN (vprintf); 1894*88e42b0fSchristos # endif 1895*88e42b0fSchristos #endif 1896*88e42b0fSchristos #if !0 && defined GNULIB_POSIXCHECK 1897*88e42b0fSchristos # if !GNULIB_overrides_vprintf 1898*88e42b0fSchristos # undef vprintf 1899*88e42b0fSchristos # endif 1900*88e42b0fSchristos /* Assume vprintf is always declared. */ 1901*88e42b0fSchristos _GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - " 1902*88e42b0fSchristos "use gnulib module vprintf-posix for portable " 1903*88e42b0fSchristos "POSIX compliance"); 1904*88e42b0fSchristos #endif 1905*88e42b0fSchristos 1906*88e42b0fSchristos #if 0 1907*88e42b0fSchristos # if 0 && 0 1908*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1909*88e42b0fSchristos # undef vscanf 1910*88e42b0fSchristos # define vscanf rpl_vscanf 1911*88e42b0fSchristos # endif 1912*88e42b0fSchristos _GL_FUNCDECL_RPL (vscanf, int, (const char *restrict format, va_list args) 1913*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 0) 1914*88e42b0fSchristos _GL_ARG_NONNULL ((1))); 1915*88e42b0fSchristos _GL_CXXALIAS_RPL (vscanf, int, (const char *restrict format, va_list args)); 1916*88e42b0fSchristos # else 1917*88e42b0fSchristos _GL_CXXALIAS_SYS (vscanf, int, (const char *restrict format, va_list args)); 1918*88e42b0fSchristos # endif 1919*88e42b0fSchristos _GL_CXXALIASWARN (vscanf); 1920*88e42b0fSchristos #endif 1921*88e42b0fSchristos 1922*88e42b0fSchristos #if 0 1923*88e42b0fSchristos # if 0 1924*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1925*88e42b0fSchristos # define vsnprintf rpl_vsnprintf 1926*88e42b0fSchristos # endif 1927*88e42b0fSchristos _GL_FUNCDECL_RPL (vsnprintf, int, 1928*88e42b0fSchristos (char *restrict str, size_t size, 1929*88e42b0fSchristos const char *restrict format, va_list args) 1930*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0) 1931*88e42b0fSchristos _GL_ARG_NONNULL ((3))); 1932*88e42b0fSchristos _GL_CXXALIAS_RPL (vsnprintf, int, 1933*88e42b0fSchristos (char *restrict str, size_t size, 1934*88e42b0fSchristos const char *restrict format, va_list args)); 1935*88e42b0fSchristos # else 1936*88e42b0fSchristos # if !1 1937*88e42b0fSchristos _GL_FUNCDECL_SYS (vsnprintf, int, 1938*88e42b0fSchristos (char *restrict str, size_t size, 1939*88e42b0fSchristos const char *restrict format, va_list args) 1940*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0) 1941*88e42b0fSchristos _GL_ARG_NONNULL ((3))); 1942*88e42b0fSchristos # endif 1943*88e42b0fSchristos _GL_CXXALIAS_SYS (vsnprintf, int, 1944*88e42b0fSchristos (char *restrict str, size_t size, 1945*88e42b0fSchristos const char *restrict format, va_list args)); 1946*88e42b0fSchristos # endif 1947*88e42b0fSchristos _GL_CXXALIASWARN (vsnprintf); 1948*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1949*88e42b0fSchristos # undef vsnprintf 1950*88e42b0fSchristos # if HAVE_RAW_DECL_VSNPRINTF 1951*88e42b0fSchristos _GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - " 1952*88e42b0fSchristos "use gnulib module vsnprintf for portability"); 1953*88e42b0fSchristos # endif 1954*88e42b0fSchristos #endif 1955*88e42b0fSchristos 1956*88e42b0fSchristos #if 0 1957*88e42b0fSchristos # if 0 1958*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1959*88e42b0fSchristos # define vsprintf rpl_vsprintf 1960*88e42b0fSchristos # endif 1961*88e42b0fSchristos _GL_FUNCDECL_RPL (vsprintf, int, 1962*88e42b0fSchristos (char *restrict str, 1963*88e42b0fSchristos const char *restrict format, va_list args) 1964*88e42b0fSchristos _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) 1965*88e42b0fSchristos _GL_ARG_NONNULL ((1, 2))); 1966*88e42b0fSchristos _GL_CXXALIAS_RPL (vsprintf, int, 1967*88e42b0fSchristos (char *restrict str, 1968*88e42b0fSchristos const char *restrict format, va_list args)); 1969*88e42b0fSchristos # else 1970*88e42b0fSchristos /* Need to cast, because on Solaris, the third parameter is 1971*88e42b0fSchristos __va_list args 1972*88e42b0fSchristos and GCC's fixincludes did not change this to __gnuc_va_list. */ 1973*88e42b0fSchristos _GL_CXXALIAS_SYS_CAST (vsprintf, int, 1974*88e42b0fSchristos (char *restrict str, 1975*88e42b0fSchristos const char *restrict format, va_list args)); 1976*88e42b0fSchristos # endif 1977*88e42b0fSchristos # if __GLIBC__ >= 2 1978*88e42b0fSchristos _GL_CXXALIASWARN (vsprintf); 1979*88e42b0fSchristos # endif 1980*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1981*88e42b0fSchristos # undef vsprintf 1982*88e42b0fSchristos /* Assume vsprintf is always declared. */ 1983*88e42b0fSchristos _GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - " 1984*88e42b0fSchristos "use gnulib module vsprintf-posix for portable " 1985*88e42b0fSchristos "POSIX compliance"); 1986*88e42b0fSchristos #endif 1987*88e42b0fSchristos 1988*88e42b0fSchristos #endif /* _GL_STDIO_H */ 1989*88e42b0fSchristos #endif /* _GL_STDIO_H */ 1990*88e42b0fSchristos #endif 1991