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