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