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