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