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