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