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