1 : /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2 : /* A GNU-like <stdio.h>.
3 :
4 : Copyright (C) 2004, 2007-2010 Free Software Foundation, Inc.
5 :
6 : This program is free software; you can redistribute it and/or modify
7 : it under the terms of the GNU General Public License as published by
8 : the Free Software Foundation; either version 3, or (at your option)
9 : any later version.
10 :
11 : This program is distributed in the hope that it will be useful,
12 : but WITHOUT ANY WARRANTY; without even the implied warranty of
13 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 : GNU General Public License for more details.
15 :
16 : You should have received a copy of the GNU General Public License
17 : along with this program; if not, write to the Free Software Foundation,
18 : Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
19 :
20 : #if __GNUC__ >= 3
21 : #pragma GCC system_header
22 : #endif
23 :
24 : #if defined __need_FILE || defined __need___FILE
25 : /* Special invocation convention inside glibc header files. */
26 :
27 : #include_next <stdio.h>
28 :
29 : #else
30 : /* Normal invocation convention. */
31 :
32 : #ifndef _GL_STDIO_H
33 :
34 : /* The include_next requires a split double-inclusion guard. */
35 : #include_next <stdio.h>
36 :
37 : #ifndef _GL_STDIO_H
38 : #define _GL_STDIO_H
39 :
40 : /* Get va_list. Needed on many systems, including glibc 2.8. */
41 : #include <stdarg.h>
42 :
43 : #include <stddef.h>
44 :
45 : /* Get off_t and ssize_t. Needed on many systems, including glibc 2.8. */
46 : #include <sys/types.h>
47 :
48 : #ifndef __attribute__
49 : /* The __attribute__ feature is available in gcc versions 2.5 and later.
50 : The __-protected variants of the attributes 'format' and 'printf' are
51 : accepted by gcc versions 2.6.4 (effectively 2.7) and later.
52 : We enable __attribute__ only if these are supported too, because
53 : gnulib and libintl do '#define printf __printf__' when they override
54 : the 'printf' function. */
55 : # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
56 : # define __attribute__(Spec) /* empty */
57 : # endif
58 : #endif
59 :
60 :
61 : /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
62 : #ifndef _GL_CXXDEFS_H
63 : #define _GL_CXXDEFS_H
64 :
65 : /* The three most frequent use cases of these macros are:
66 :
67 : * For providing a substitute for a function that is missing on some
68 : platforms, but is declared and works fine on the platforms on which
69 : it exists:
70 :
71 : #if @GNULIB_FOO@
72 : # if !@HAVE_FOO@
73 : _GL_FUNCDECL_SYS (foo, ...);
74 : # endif
75 : _GL_CXXALIAS_SYS (foo, ...);
76 : _GL_CXXALIASWARN (foo);
77 : #elif defined GNULIB_POSIXCHECK
78 : ...
79 : #endif
80 :
81 : * For providing a replacement for a function that exists on all platforms,
82 : but is broken/insufficient and needs to be replaced on some platforms:
83 :
84 : #if @GNULIB_FOO@
85 : # if @REPLACE_FOO@
86 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
87 : # undef foo
88 : # define foo rpl_foo
89 : # endif
90 : _GL_FUNCDECL_RPL (foo, ...);
91 : _GL_CXXALIAS_RPL (foo, ...);
92 : # else
93 : _GL_CXXALIAS_SYS (foo, ...);
94 : # endif
95 : _GL_CXXALIASWARN (foo);
96 : #elif defined GNULIB_POSIXCHECK
97 : ...
98 : #endif
99 :
100 : * For providing a replacement for a function that exists on some platforms
101 : but is broken/insufficient and needs to be replaced on some of them and
102 : is additionally either missing or undeclared on some other platforms:
103 :
104 : #if @GNULIB_FOO@
105 : # if @REPLACE_FOO@
106 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
107 : # undef foo
108 : # define foo rpl_foo
109 : # endif
110 : _GL_FUNCDECL_RPL (foo, ...);
111 : _GL_CXXALIAS_RPL (foo, ...);
112 : # else
113 : # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@
114 : _GL_FUNCDECL_SYS (foo, ...);
115 : # endif
116 : _GL_CXXALIAS_SYS (foo, ...);
117 : # endif
118 : _GL_CXXALIASWARN (foo);
119 : #elif defined GNULIB_POSIXCHECK
120 : ...
121 : #endif
122 : */
123 :
124 : /* _GL_EXTERN_C declaration;
125 : performs the declaration with C linkage. */
126 : #if defined __cplusplus
127 : # define _GL_EXTERN_C extern "C"
128 : #else
129 : # define _GL_EXTERN_C extern
130 : #endif
131 :
132 : /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
133 : declares a replacement function, named rpl_func, with the given prototype,
134 : consisting of return type, parameters, and attributes.
135 : Example:
136 : _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
137 : _GL_ARG_NONNULL ((1)));
138 : */
139 : #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
140 : _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
141 : #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
142 : _GL_EXTERN_C rettype rpl_func parameters_and_attributes
143 :
144 : /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
145 : declares the system function, named func, with the given prototype,
146 : consisting of return type, parameters, and attributes.
147 : Example:
148 : _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
149 : _GL_ARG_NONNULL ((1)));
150 : */
151 : #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
152 : _GL_EXTERN_C rettype func parameters_and_attributes
153 :
154 : /* _GL_CXXALIAS_RPL (func, rettype, parameters);
155 : declares a C++ alias called GNULIB_NAMESPACE::func
156 : that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
157 : Example:
158 : _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
159 : */
160 : #define _GL_CXXALIAS_RPL(func,rettype,parameters) \
161 : _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
162 : #if defined __cplusplus && defined GNULIB_NAMESPACE
163 : # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
164 : namespace GNULIB_NAMESPACE \
165 : { \
166 : rettype (*const func) parameters = ::rpl_func; \
167 : } \
168 : _GL_EXTERN_C int _gl_cxxalias_dummy
169 : #else
170 : # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
171 : _GL_EXTERN_C int _gl_cxxalias_dummy
172 : #endif
173 :
174 : /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
175 : is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
176 : except that the C function rpl_func may have a slightly different
177 : declaration. A cast is used to silence the "invalid conversion" error
178 : that would otherwise occur. */
179 : #if defined __cplusplus && defined GNULIB_NAMESPACE
180 : # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
181 : namespace GNULIB_NAMESPACE \
182 : { \
183 : rettype (*const func) parameters = \
184 : reinterpret_cast<rettype(*)parameters>(::rpl_func); \
185 : } \
186 : _GL_EXTERN_C int _gl_cxxalias_dummy
187 : #else
188 : # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
189 : _GL_EXTERN_C int _gl_cxxalias_dummy
190 : #endif
191 :
192 : /* _GL_CXXALIAS_SYS (func, rettype, parameters);
193 : declares a C++ alias called GNULIB_NAMESPACE::func
194 : that redirects to the system provided function func, if GNULIB_NAMESPACE
195 : is defined.
196 : Example:
197 : _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
198 : */
199 : #if defined __cplusplus && defined GNULIB_NAMESPACE
200 : /* If we were to write
201 : rettype (*const func) parameters = ::func;
202 : like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls
203 : better (remove an indirection through a 'static' pointer variable),
204 : but then the _GL_CXXALIASWARN macro below would cause a warning not only
205 : for uses of ::func but also for uses of GNULIB_NAMESPACE::func. */
206 : # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
207 : namespace GNULIB_NAMESPACE \
208 : { \
209 : static rettype (*func) parameters = ::func; \
210 : } \
211 : _GL_EXTERN_C int _gl_cxxalias_dummy
212 : #else
213 : # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
214 : _GL_EXTERN_C int _gl_cxxalias_dummy
215 : #endif
216 :
217 : /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
218 : is like _GL_CXXALIAS_SYS (func, rettype, parameters);
219 : except that the C function func may have a slightly different declaration.
220 : A cast is used to silence the "invalid conversion" error that would
221 : otherwise occur. */
222 : #if defined __cplusplus && defined GNULIB_NAMESPACE
223 : # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
224 : namespace GNULIB_NAMESPACE \
225 : { \
226 : static rettype (*func) parameters = \
227 : reinterpret_cast<rettype(*)parameters>(::func); \
228 : } \
229 : _GL_EXTERN_C int _gl_cxxalias_dummy
230 : #else
231 : # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
232 : _GL_EXTERN_C int _gl_cxxalias_dummy
233 : #endif
234 :
235 : /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
236 : is like _GL_CXXALIAS_SYS (func, rettype, parameters);
237 : except that the C function is picked among a set of overloaded functions,
238 : namely the one with rettype2 and parameters2. Two consecutive casts
239 : are used to silence the "cannot find a match" and "invalid conversion"
240 : errors that would otherwise occur. */
241 : #if defined __cplusplus && defined GNULIB_NAMESPACE
242 : /* The outer cast must be a reinterpret_cast.
243 : The inner cast: When the function is defined as a set of overloaded
244 : functions, it works as a static_cast<>, choosing the designated variant.
245 : When the function is defined as a single variant, it works as a
246 : reinterpret_cast<>. The parenthesized cast syntax works both ways. */
247 : # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
248 : namespace GNULIB_NAMESPACE \
249 : { \
250 : static rettype (*func) parameters = \
251 : reinterpret_cast<rettype(*)parameters>( \
252 : (rettype2(*)parameters2)(::func)); \
253 : } \
254 : _GL_EXTERN_C int _gl_cxxalias_dummy
255 : #else
256 : # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
257 : _GL_EXTERN_C int _gl_cxxalias_dummy
258 : #endif
259 :
260 : /* _GL_CXXALIASWARN (func);
261 : causes a warning to be emitted when ::func is used but not when
262 : GNULIB_NAMESPACE::func is used. func must be defined without overloaded
263 : variants. */
264 : #if defined __cplusplus && defined GNULIB_NAMESPACE
265 : # define _GL_CXXALIASWARN(func) \
266 : _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
267 : # define _GL_CXXALIASWARN_1(func,namespace) \
268 : _GL_CXXALIASWARN_2 (func, namespace)
269 : /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
270 : we enable the warning only when not optimizing. */
271 : # if !__OPTIMIZE__
272 : # define _GL_CXXALIASWARN_2(func,namespace) \
273 : _GL_WARN_ON_USE (func, \
274 : "The symbol ::" #func " refers to the system function. " \
275 : "Use " #namespace "::" #func " instead.")
276 : # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
277 : # define _GL_CXXALIASWARN_2(func,namespace) \
278 : extern __typeof__ (func) func
279 : # else
280 : # define _GL_CXXALIASWARN_2(func,namespace) \
281 : _GL_EXTERN_C int _gl_cxxalias_dummy
282 : # endif
283 : #else
284 : # define _GL_CXXALIASWARN(func) \
285 : _GL_EXTERN_C int _gl_cxxalias_dummy
286 : #endif
287 :
288 : /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
289 : causes a warning to be emitted when the given overloaded variant of ::func
290 : is used but not when GNULIB_NAMESPACE::func is used. */
291 : #if defined __cplusplus && defined GNULIB_NAMESPACE
292 : # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
293 : _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
294 : GNULIB_NAMESPACE)
295 : # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
296 : _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
297 : /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
298 : we enable the warning only when not optimizing. */
299 : # if !__OPTIMIZE__
300 : # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
301 : _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
302 : "The symbol ::" #func " refers to the system function. " \
303 : "Use " #namespace "::" #func " instead.")
304 : # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
305 : # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
306 : extern __typeof__ (func) func
307 : # else
308 : # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
309 : _GL_EXTERN_C int _gl_cxxalias_dummy
310 : # endif
311 : #else
312 : # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
313 : _GL_EXTERN_C int _gl_cxxalias_dummy
314 : #endif
315 :
316 : #endif /* _GL_CXXDEFS_H */
317 :
318 : /* The definition of _GL_ARG_NONNULL is copied here. */
319 : /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
320 : that the values passed as arguments n, ..., m must be non-NULL pointers.
321 : n = 1 stands for the first argument, n = 2 for the second argument etc. */
322 : #ifndef _GL_ARG_NONNULL
323 : # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
324 : # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
325 : # else
326 : # define _GL_ARG_NONNULL(params)
327 : # endif
328 : #endif
329 :
330 : /* The definition of _GL_WARN_ON_USE is copied here. */
331 : #ifndef _GL_WARN_ON_USE
332 :
333 : # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
334 : /* A compiler attribute is available in gcc versions 4.3.0 and later. */
335 : # define _GL_WARN_ON_USE(function, message) \
336 : extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
337 : # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
338 : /* Verify the existence of the function. */
339 : # define _GL_WARN_ON_USE(function, message) \
340 : extern __typeof__ (function) function
341 : # else /* Unsupported. */
342 : # define _GL_WARN_ON_USE(function, message) \
343 : _GL_WARN_EXTERN_C int _gl_warn_on_use
344 : # endif
345 : #endif
346 :
347 : /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
348 : is like _GL_WARN_ON_USE (function, "string"), except that the function is
349 : declared with the given prototype, consisting of return type, parameters,
350 : and attributes.
351 : This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
352 : not work in this case. */
353 : #ifndef _GL_WARN_ON_USE_CXX
354 : # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
355 : # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
356 : extern rettype function parameters_and_attributes \
357 : __attribute__ ((__warning__ (msg)))
358 : # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
359 : /* Verify the existence of the function. */
360 : # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
361 : extern rettype function parameters_and_attributes
362 : # else /* Unsupported. */
363 : # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
364 : _GL_WARN_EXTERN_C int _gl_warn_on_use
365 : # endif
366 : #endif
367 :
368 : /* _GL_WARN_EXTERN_C declaration;
369 : performs the declaration with C linkage. */
370 : #ifndef _GL_WARN_EXTERN_C
371 : # if defined __cplusplus
372 : # define _GL_WARN_EXTERN_C extern "C"
373 : # else
374 : # define _GL_WARN_EXTERN_C extern
375 : # endif
376 : #endif
377 :
378 : /* Macros for stringification. */
379 : #define _GL_STDIO_STRINGIZE(token) #token
380 : #define _GL_STDIO_MACROEXPAND_AND_STRINGIZE(token) _GL_STDIO_STRINGIZE(token)
381 :
382 :
383 : #if 0
384 : # if 0
385 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
386 : # define dprintf rpl_dprintf
387 : # endif
388 : _GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *format, ...)
389 : __attribute__ ((__format__ (__printf__, 2, 3)))
390 : _GL_ARG_NONNULL ((2)));
391 : _GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *format, ...));
392 : # else
393 : # if !1
394 : _GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *format, ...)
395 : __attribute__ ((__format__ (__printf__, 2, 3)))
396 : _GL_ARG_NONNULL ((2)));
397 : # endif
398 : _GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *format, ...));
399 : # endif
400 : _GL_CXXALIASWARN (dprintf);
401 : #elif defined GNULIB_POSIXCHECK
402 : # undef dprintf
403 : # if HAVE_RAW_DECL_DPRINTF
404 : _GL_WARN_ON_USE (dprintf, "dprintf is unportable - "
405 : "use gnulib module dprintf for portability");
406 : # endif
407 : #endif
408 :
409 : #if 0
410 : /* Close STREAM and its underlying file descriptor. */
411 : # if 0
412 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
413 : # define fclose rpl_fclose
414 : # endif
415 : _GL_FUNCDECL_RPL (fclose, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
416 : _GL_CXXALIAS_RPL (fclose, int, (FILE *stream));
417 : # else
418 : _GL_CXXALIAS_SYS (fclose, int, (FILE *stream));
419 : # endif
420 : _GL_CXXALIASWARN (fclose);
421 : #elif defined GNULIB_POSIXCHECK
422 : # undef fclose
423 : /* Assume fclose is always declared. */
424 : _GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - "
425 : "use gnulib module fclose for portable POSIX compliance");
426 : #endif
427 :
428 : #if 1
429 : /* Flush all pending data on STREAM according to POSIX rules. Both
430 : output and seekable input streams are supported.
431 : Note! LOSS OF DATA can occur if fflush is applied on an input stream
432 : that is _not_seekable_ or on an update stream that is _not_seekable_
433 : and in which the most recent operation was input. Seekability can
434 : be tested with lseek(fileno(fp),0,SEEK_CUR). */
435 : # if 1
436 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
437 : # define fflush rpl_fflush
438 : # endif
439 : _GL_FUNCDECL_RPL (fflush, int, (FILE *gl_stream));
440 : _GL_CXXALIAS_RPL (fflush, int, (FILE *gl_stream));
441 : # else
442 : _GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream));
443 : # endif
444 : _GL_CXXALIASWARN (fflush);
445 : #elif defined GNULIB_POSIXCHECK
446 : # undef fflush
447 : /* Assume fflush is always declared. */
448 : _GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - "
449 : "use gnulib module fflush for portable POSIX compliance");
450 : #endif
451 :
452 : /* It is very rare that the developer ever has full control of stdin,
453 : so any use of gets warrants an unconditional warning. Assume it is
454 : always declared, since it is required by C89. */
455 : #undef gets
456 : _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
457 :
458 : #if 1
459 : # if 0
460 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
461 : # undef fopen
462 : # define fopen rpl_fopen
463 : # endif
464 : _GL_FUNCDECL_RPL (fopen, FILE *, (const char *filename, const char *mode)
465 : _GL_ARG_NONNULL ((1, 2)));
466 : _GL_CXXALIAS_RPL (fopen, FILE *, (const char *filename, const char *mode));
467 : # else
468 : _GL_CXXALIAS_SYS (fopen, FILE *, (const char *filename, const char *mode));
469 : # endif
470 : _GL_CXXALIASWARN (fopen);
471 : #elif defined GNULIB_POSIXCHECK
472 : # undef fopen
473 : /* Assume fopen is always declared. */
474 : _GL_WARN_ON_USE (fopen, "fopen on Win32 platforms is not POSIX compatible - "
475 : "use gnulib module fopen for portability");
476 : #endif
477 :
478 : #if 0 || 1
479 : # if (0 && 0) \
480 : || (1 && 0 && 0)
481 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
482 : # define fprintf rpl_fprintf
483 : # endif
484 : # define GNULIB_overrides_fprintf 1
485 : _GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...)
486 : __attribute__ ((__format__ (__printf__, 2, 3)))
487 : _GL_ARG_NONNULL ((1, 2)));
488 : _GL_CXXALIAS_RPL (fprintf, int, (FILE *fp, const char *format, ...));
489 : # else
490 : _GL_CXXALIAS_SYS (fprintf, int, (FILE *fp, const char *format, ...));
491 : # endif
492 : _GL_CXXALIASWARN (fprintf);
493 : #endif
494 : #if !0 && defined GNULIB_POSIXCHECK
495 : # if !GNULIB_overrides_fprintf
496 : # undef fprintf
497 : # endif
498 : /* Assume fprintf is always declared. */
499 : _GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX compliant - "
500 : "use gnulib module fprintf-posix for portable "
501 : "POSIX compliance");
502 : #endif
503 :
504 : #if 1
505 : /* Discard all pending buffered I/O data on STREAM.
506 : STREAM must not be wide-character oriented.
507 : When discarding pending output, the file position is set back to where it
508 : was before the write calls. When discarding pending input, the file
509 : position is advanced to match the end of the previously read input.
510 : Return 0 if successful. Upon error, return -1 and set errno. */
511 : # if 0
512 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
513 : # define fpurge rpl_fpurge
514 : # endif
515 : _GL_FUNCDECL_RPL (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1)));
516 : _GL_CXXALIAS_RPL (fpurge, int, (FILE *gl_stream));
517 : # else
518 : # if !0
519 : _GL_FUNCDECL_SYS (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1)));
520 : # endif
521 : _GL_CXXALIAS_SYS (fpurge, int, (FILE *gl_stream));
522 : # endif
523 : _GL_CXXALIASWARN (fpurge);
524 : #elif defined GNULIB_POSIXCHECK
525 : # undef fpurge
526 : # if HAVE_RAW_DECL_FPURGE
527 : _GL_WARN_ON_USE (fpurge, "fpurge is not always present - "
528 : "use gnulib module fpurge for portability");
529 : # endif
530 : #endif
531 :
532 : #if 1
533 : # if 0 && 0
534 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
535 : # undef fputc
536 : # define fputc rpl_fputc
537 : # endif
538 : _GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2)));
539 : _GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream));
540 : # else
541 : _GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream));
542 : # endif
543 : _GL_CXXALIASWARN (fputc);
544 : #endif
545 :
546 : #if 1
547 : # if 0 && 0
548 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
549 : # undef fputs
550 : # define fputs rpl_fputs
551 : # endif
552 : _GL_FUNCDECL_RPL (fputs, int, (const char *string, FILE *stream)
553 : _GL_ARG_NONNULL ((1, 2)));
554 : _GL_CXXALIAS_RPL (fputs, int, (const char *string, FILE *stream));
555 : # else
556 : _GL_CXXALIAS_SYS (fputs, int, (const char *string, FILE *stream));
557 : # endif
558 : _GL_CXXALIASWARN (fputs);
559 : #endif
560 :
561 : #if 1
562 : # if 0
563 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
564 : # undef freopen
565 : # define freopen rpl_freopen
566 : # endif
567 : _GL_FUNCDECL_RPL (freopen, FILE *,
568 : (const char *filename, const char *mode, FILE *stream)
569 : _GL_ARG_NONNULL ((2, 3)));
570 : _GL_CXXALIAS_RPL (freopen, FILE *,
571 : (const char *filename, const char *mode, FILE *stream));
572 : # else
573 : _GL_CXXALIAS_SYS (freopen, FILE *,
574 : (const char *filename, const char *mode, FILE *stream));
575 : # endif
576 : _GL_CXXALIASWARN (freopen);
577 : #elif defined GNULIB_POSIXCHECK
578 : # undef freopen
579 : /* Assume freopen is always declared. */
580 : _GL_WARN_ON_USE (freopen, "freopen on Win32 platforms is not POSIX compatible - "
581 : "use gnulib module freopen for portability");
582 : #endif
583 :
584 :
585 : /* Set up the following warnings, based on which modules are in use.
586 : GNU Coding Standards discourage the use of fseek, since it imposes
587 : an arbitrary limitation on some 32-bit hosts. Remember that the
588 : fseek module depends on the fseeko module, so we only have three
589 : cases to consider:
590 :
591 : 1. The developer is not using either module. Issue a warning under
592 : GNULIB_POSIXCHECK for both functions, to remind them that both
593 : functions have bugs on some systems. _GL_NO_LARGE_FILES has no
594 : impact on this warning.
595 :
596 : 2. The developer is using both modules. They may be unaware of the
597 : arbitrary limitations of fseek, so issue a warning under
598 : GNULIB_POSIXCHECK. On the other hand, they may be using both
599 : modules intentionally, so the developer can define
600 : _GL_NO_LARGE_FILES in the compilation units where the use of fseek
601 : is safe, to silence the warning.
602 :
603 : 3. The developer is using the fseeko module, but not fseek. Gnulib
604 : guarantees that fseek will still work around platform bugs in that
605 : case, but we presume that the developer is aware of the pitfalls of
606 : fseek and was trying to avoid it, so issue a warning even when
607 : GNULIB_POSIXCHECK is undefined. Again, _GL_NO_LARGE_FILES can be
608 : defined to silence the warning in particular compilation units.
609 : In C++ compilations with GNULIB_NAMESPACE, in order to avoid that
610 : fseek gets defined as a macro, it is recommended that the developer
611 : uses the fseek module, even if he is not calling the fseek function.
612 :
613 : Most gnulib clients that perform stream operations should fall into
614 : category 3. */
615 :
616 : #if 0
617 : # if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
618 : # define _GL_FSEEK_WARN /* Category 2, above. */
619 : # undef fseek
620 : # endif
621 : # if 0
622 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
623 : # undef fseek
624 : # define fseek rpl_fseek
625 : # endif
626 : _GL_FUNCDECL_RPL (fseek, int, (FILE *fp, long offset, int whence)
627 : _GL_ARG_NONNULL ((1)));
628 : _GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence));
629 : # else
630 : _GL_CXXALIAS_SYS (fseek, int, (FILE *fp, long offset, int whence));
631 : # endif
632 : _GL_CXXALIASWARN (fseek);
633 : #endif
634 :
635 : #if 1
636 : # if !0 && !defined _GL_NO_LARGE_FILES
637 : # define _GL_FSEEK_WARN /* Category 3, above. */
638 : # undef fseek
639 : # endif
640 : # if 1
641 : /* Provide an fseeko function that is aware of a preceding fflush(), and which
642 : detects pipes. */
643 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
644 : # undef fseeko
645 : # define fseeko rpl_fseeko
646 : # endif
647 : _GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence)
648 : _GL_ARG_NONNULL ((1)));
649 : _GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence));
650 : # else
651 : # if ! 1
652 : _GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)
653 : _GL_ARG_NONNULL ((1)));
654 : # endif
655 : _GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence));
656 : # endif
657 : _GL_CXXALIASWARN (fseeko);
658 : # if (1 || !1) && !0
659 : /* Provide an fseek function that is consistent with fseeko. */
660 : /* In order to avoid that fseek gets defined as a macro here, the
661 : developer can request the 'fseek' module. */
662 : # undef fseek
663 : # define fseek rpl_fseek
664 : static inline int _GL_ARG_NONNULL ((1))
665 : rpl_fseek (FILE *fp, long offset, int whence)
666 : {
667 : # if 1
668 48 : return rpl_fseeko (fp, offset, whence);
669 : # else
670 : return fseeko (fp, offset, whence);
671 : # endif
672 : }
673 : # endif
674 : #elif defined GNULIB_POSIXCHECK
675 : # define _GL_FSEEK_WARN /* Category 1, above. */
676 : # undef fseek
677 : # undef fseeko
678 : # if HAVE_RAW_DECL_FSEEKO
679 : _GL_WARN_ON_USE (fseeko, "fseeko is unportable - "
680 : "use gnulib module fseeko for portability");
681 : # endif
682 : #endif
683 :
684 : #ifdef _GL_FSEEK_WARN
685 : # undef _GL_FSEEK_WARN
686 : /* Here, either fseek is undefined (but C89 guarantees that it is
687 : declared), or it is defined as rpl_fseek (declared above). */
688 : _GL_WARN_ON_USE (fseek, "fseek cannot handle files larger than 4 GB "
689 : "on 32-bit platforms - "
690 : "use fseeko function for handling of large files");
691 : #endif
692 :
693 :
694 : /* ftell, ftello. See the comments on fseek/fseeko. */
695 :
696 : #if 0
697 : # if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
698 : # define _GL_FTELL_WARN /* Category 2, above. */
699 : # undef ftell
700 : # endif
701 : # if 0
702 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
703 : # undef ftell
704 : # define ftell rpl_ftell
705 : # endif
706 : _GL_FUNCDECL_RPL (ftell, long, (FILE *fp) _GL_ARG_NONNULL ((1)));
707 : _GL_CXXALIAS_RPL (ftell, long, (FILE *fp));
708 : # else
709 : _GL_CXXALIAS_SYS (ftell, long, (FILE *fp));
710 : # endif
711 : _GL_CXXALIASWARN (ftell);
712 : #endif
713 :
714 : #if 1
715 : # if !0 && !defined _GL_NO_LARGE_FILES
716 : # define _GL_FTELL_WARN /* Category 3, above. */
717 : # undef ftell
718 : # endif
719 : # if 0
720 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
721 : # undef ftello
722 : # define ftello rpl_ftello
723 : # endif
724 : _GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1)));
725 : _GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp));
726 : # else
727 : # if ! 1
728 : _GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1)));
729 : # endif
730 : _GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp));
731 : # endif
732 : _GL_CXXALIASWARN (ftello);
733 : # if (0 || !1) && !0
734 : /* Provide an ftell function that is consistent with ftello. */
735 : /* In order to avoid that ftell gets defined as a macro here, the
736 : developer can request the 'ftell' module. */
737 : # undef ftell
738 : # define ftell rpl_ftell
739 : static inline long _GL_ARG_NONNULL ((1))
740 : rpl_ftell (FILE *f)
741 : {
742 : # if 0
743 : return rpl_ftello (f);
744 : # else
745 : return ftello (f);
746 : # endif
747 : }
748 : # endif
749 : #elif defined GNULIB_POSIXCHECK
750 : # define _GL_FTELL_WARN /* Category 1, above. */
751 : # undef ftell
752 : # undef ftello
753 : # if HAVE_RAW_DECL_FTELLO
754 : _GL_WARN_ON_USE (ftello, "ftello is unportable - "
755 : "use gnulib module ftello for portability");
756 : # endif
757 : #endif
758 :
759 : #ifdef _GL_FTELL_WARN
760 : # undef _GL_FTELL_WARN
761 : /* Here, either ftell is undefined (but C89 guarantees that it is
762 : declared), or it is defined as rpl_ftell (declared above). */
763 : _GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB "
764 : "on 32-bit platforms - "
765 : "use ftello function for handling of large files");
766 : #endif
767 :
768 :
769 : #if 1
770 : # if 0 && 0
771 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
772 : # undef fwrite
773 : # define fwrite rpl_fwrite
774 : # endif
775 : _GL_FUNCDECL_RPL (fwrite, size_t,
776 : (const void *ptr, size_t s, size_t n, FILE *stream)
777 : _GL_ARG_NONNULL ((1, 4)));
778 : _GL_CXXALIAS_RPL (fwrite, size_t,
779 : (const void *ptr, size_t s, size_t n, FILE *stream));
780 : # else
781 : _GL_CXXALIAS_SYS (fwrite, size_t,
782 : (const void *ptr, size_t s, size_t n, FILE *stream));
783 : # endif
784 : _GL_CXXALIASWARN (fwrite);
785 : #endif
786 :
787 : #if 1
788 : /* Read input, up to (and including) the next occurrence of DELIMITER, from
789 : STREAM, store it in *LINEPTR (and NUL-terminate it).
790 : *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
791 : bytes of space. It is realloc'd as necessary.
792 : Return the number of bytes read and stored at *LINEPTR (not including the
793 : NUL terminator), or -1 on error or EOF. */
794 : # if 0
795 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
796 : # undef getdelim
797 : # define getdelim rpl_getdelim
798 : # endif
799 : _GL_FUNCDECL_RPL (getdelim, ssize_t,
800 : (char **lineptr, size_t *linesize, int delimiter,
801 : FILE *stream)
802 : _GL_ARG_NONNULL ((1, 2, 4)));
803 : _GL_CXXALIAS_RPL (getdelim, ssize_t,
804 : (char **lineptr, size_t *linesize, int delimiter,
805 : FILE *stream));
806 : # else
807 : # if !1
808 : _GL_FUNCDECL_SYS (getdelim, ssize_t,
809 : (char **lineptr, size_t *linesize, int delimiter,
810 : FILE *stream)
811 : _GL_ARG_NONNULL ((1, 2, 4)));
812 : # endif
813 : _GL_CXXALIAS_SYS (getdelim, ssize_t,
814 : (char **lineptr, size_t *linesize, int delimiter,
815 : FILE *stream));
816 : # endif
817 : _GL_CXXALIASWARN (getdelim);
818 : #elif defined GNULIB_POSIXCHECK
819 : # undef getdelim
820 : # if HAVE_RAW_DECL_GETDELIM
821 : _GL_WARN_ON_USE (getdelim, "getdelim is unportable - "
822 : "use gnulib module getdelim for portability");
823 : # endif
824 : #endif
825 :
826 : #if 1
827 : /* Read a line, up to (and including) the next newline, from STREAM, store it
828 : in *LINEPTR (and NUL-terminate it).
829 : *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
830 : bytes of space. It is realloc'd as necessary.
831 : Return the number of bytes read and stored at *LINEPTR (not including the
832 : NUL terminator), or -1 on error or EOF. */
833 : # if 0
834 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
835 : # undef getline
836 : # define getline rpl_getline
837 : # endif
838 : _GL_FUNCDECL_RPL (getline, ssize_t,
839 : (char **lineptr, size_t *linesize, FILE *stream)
840 : _GL_ARG_NONNULL ((1, 2, 3)));
841 : _GL_CXXALIAS_RPL (getline, ssize_t,
842 : (char **lineptr, size_t *linesize, FILE *stream));
843 : # else
844 : # if !1
845 : _GL_FUNCDECL_SYS (getline, ssize_t,
846 : (char **lineptr, size_t *linesize, FILE *stream)
847 : _GL_ARG_NONNULL ((1, 2, 3)));
848 : # endif
849 : _GL_CXXALIAS_SYS (getline, ssize_t,
850 : (char **lineptr, size_t *linesize, FILE *stream));
851 : # endif
852 : # if 1
853 : _GL_CXXALIASWARN (getline);
854 : # endif
855 : #elif defined GNULIB_POSIXCHECK
856 : # undef getline
857 : # if HAVE_RAW_DECL_GETLINE
858 : _GL_WARN_ON_USE (getline, "getline is unportable - "
859 : "use gnulib module getline for portability");
860 : # endif
861 : #endif
862 :
863 : #if 0 || 0
864 : struct obstack;
865 : /* Grow an obstack with formatted output. Return the number of
866 : bytes added to OBS. No trailing nul byte is added, and the
867 : object should be closed with obstack_finish before use. Upon
868 : memory allocation error, call obstack_alloc_failed_handler. Upon
869 : other error, return -1. */
870 : # if 0
871 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
872 : # define obstack_printf rpl_obstack_printf
873 : # endif
874 : _GL_FUNCDECL_RPL (obstack_printf, int,
875 : (struct obstack *obs, const char *format, ...)
876 : __attribute__ ((__format__ (__printf__, 2, 3)))
877 : _GL_ARG_NONNULL ((1, 2)));
878 : _GL_CXXALIAS_RPL (obstack_printf, int,
879 : (struct obstack *obs, const char *format, ...));
880 : # else
881 : # if !1
882 : _GL_FUNCDECL_SYS (obstack_printf, int,
883 : (struct obstack *obs, const char *format, ...)
884 : __attribute__ ((__format__ (__printf__, 2, 3)))
885 : _GL_ARG_NONNULL ((1, 2)));
886 : # endif
887 : _GL_CXXALIAS_SYS (obstack_printf, int,
888 : (struct obstack *obs, const char *format, ...));
889 : # endif
890 : _GL_CXXALIASWARN (obstack_printf);
891 : # if 0
892 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
893 : # define obstack_vprintf rpl_obstack_vprintf
894 : # endif
895 : _GL_FUNCDECL_RPL (obstack_vprintf, int,
896 : (struct obstack *obs, const char *format, va_list args)
897 : __attribute__ ((__format__ (__printf__, 2, 0)))
898 : _GL_ARG_NONNULL ((1, 2)));
899 : _GL_CXXALIAS_RPL (obstack_vprintf, int,
900 : (struct obstack *obs, const char *format, va_list args));
901 : # else
902 : # if !1
903 : _GL_FUNCDECL_SYS (obstack_vprintf, int,
904 : (struct obstack *obs, const char *format, va_list args)
905 : __attribute__ ((__format__ (__printf__, 2, 0)))
906 : _GL_ARG_NONNULL ((1, 2)));
907 : # endif
908 : _GL_CXXALIAS_SYS (obstack_vprintf, int,
909 : (struct obstack *obs, const char *format, va_list args));
910 : # endif
911 : _GL_CXXALIASWARN (obstack_vprintf);
912 : #endif
913 :
914 : #if 0
915 : /* Print a message to standard error, describing the value of ERRNO,
916 : (if STRING is not NULL and not empty) prefixed with STRING and ": ",
917 : and terminated with a newline. */
918 : # if 0
919 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
920 : # define perror rpl_perror
921 : # endif
922 : _GL_FUNCDECL_RPL (perror, void, (const char *string));
923 : _GL_CXXALIAS_RPL (perror, void, (const char *string));
924 : # else
925 : _GL_CXXALIAS_SYS (perror, void, (const char *string));
926 : # endif
927 : _GL_CXXALIASWARN (perror);
928 : #elif defined GNULIB_POSIXCHECK
929 : # undef perror
930 : /* Assume perror is always declared. */
931 : _GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - "
932 : "use gnulib module perror for portability");
933 : #endif
934 :
935 : #if 0
936 : # if 0
937 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
938 : # undef popen
939 : # define popen rpl_popen
940 : # endif
941 : _GL_FUNCDECL_RPL (popen, FILE *, (const char *cmd, const char *mode)
942 : _GL_ARG_NONNULL ((1, 2)));
943 : _GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode));
944 : # else
945 : _GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode));
946 : # endif
947 : _GL_CXXALIASWARN (popen);
948 : #elif defined GNULIB_POSIXCHECK
949 : # undef popen
950 : # if HAVE_RAW_DECL_POPEN
951 : _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - "
952 : "use gnulib module popen or pipe for more portability");
953 : # endif
954 : #endif
955 :
956 : #if 0 || 1
957 : # if (0 && 0) \
958 : || (1 && 0 && 0)
959 : # if defined __GNUC__
960 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
961 : /* Don't break __attribute__((format(printf,M,N))). */
962 : # define printf __printf__
963 : # endif
964 : _GL_FUNCDECL_RPL_1 (__printf__, int,
965 : (const char *format, ...)
966 : __asm__ (""
967 : _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf))
968 : __attribute__ ((__format__ (__printf__, 1, 2)))
969 : _GL_ARG_NONNULL ((1)));
970 : _GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...));
971 : # else
972 : _GL_FUNCDECL_RPL (printf, int,
973 : (const char *format, ...)
974 : __attribute__ ((__format__ (__printf__, 1, 2)))
975 : _GL_ARG_NONNULL ((1)));
976 : _GL_CXXALIAS_RPL (printf, int, (const char *format, ...));
977 : # endif
978 : # define GNULIB_overrides_printf 1
979 : # else
980 : _GL_CXXALIAS_SYS (printf, int, (const char *format, ...));
981 : # endif
982 : _GL_CXXALIASWARN (printf);
983 : #endif
984 : #if !0 && defined GNULIB_POSIXCHECK
985 : # if !GNULIB_overrides_printf
986 : # undef printf
987 : # endif
988 : /* Assume printf is always declared. */
989 : _GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - "
990 : "use gnulib module printf-posix for portable "
991 : "POSIX compliance");
992 : #endif
993 :
994 : #if 1
995 : # if 0 && 0
996 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
997 : # undef putc
998 : # define putc rpl_fputc
999 : # endif
1000 : _GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2)));
1001 : _GL_CXXALIAS_RPL_1 (putc, rpl_fputc, int, (int c, FILE *stream));
1002 : # else
1003 : _GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream));
1004 : # endif
1005 : _GL_CXXALIASWARN (putc);
1006 : #endif
1007 :
1008 : #if 1
1009 : # if 0 && 0
1010 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1011 : # undef putchar
1012 : # define putchar rpl_putchar
1013 : # endif
1014 : _GL_FUNCDECL_RPL (putchar, int, (int c));
1015 : _GL_CXXALIAS_RPL (putchar, int, (int c));
1016 : # else
1017 : _GL_CXXALIAS_SYS (putchar, int, (int c));
1018 : # endif
1019 : _GL_CXXALIASWARN (putchar);
1020 : #endif
1021 :
1022 : #if 1
1023 : # if 0 && 0
1024 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1025 : # undef puts
1026 : # define puts rpl_puts
1027 : # endif
1028 : _GL_FUNCDECL_RPL (puts, int, (const char *string) _GL_ARG_NONNULL ((1)));
1029 : _GL_CXXALIAS_RPL (puts, int, (const char *string));
1030 : # else
1031 : _GL_CXXALIAS_SYS (puts, int, (const char *string));
1032 : # endif
1033 : _GL_CXXALIASWARN (puts);
1034 : #endif
1035 :
1036 : #if 0
1037 : # if 0
1038 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1039 : # undef remove
1040 : # define remove rpl_remove
1041 : # endif
1042 : _GL_FUNCDECL_RPL (remove, int, (const char *name) _GL_ARG_NONNULL ((1)));
1043 : _GL_CXXALIAS_RPL (remove, int, (const char *name));
1044 : # else
1045 : _GL_CXXALIAS_SYS (remove, int, (const char *name));
1046 : # endif
1047 : _GL_CXXALIASWARN (remove);
1048 : #elif defined GNULIB_POSIXCHECK
1049 : # undef remove
1050 : /* Assume remove is always declared. */
1051 : _GL_WARN_ON_USE (remove, "remove cannot handle directories on some platforms - "
1052 : "use gnulib module remove for more portability");
1053 : #endif
1054 :
1055 : #if 0
1056 : # if 0
1057 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1058 : # undef rename
1059 : # define rename rpl_rename
1060 : # endif
1061 : _GL_FUNCDECL_RPL (rename, int,
1062 : (const char *old_filename, const char *new_filename)
1063 : _GL_ARG_NONNULL ((1, 2)));
1064 : _GL_CXXALIAS_RPL (rename, int,
1065 : (const char *old_filename, const char *new_filename));
1066 : # else
1067 : _GL_CXXALIAS_SYS (rename, int,
1068 : (const char *old_filename, const char *new_filename));
1069 : # endif
1070 : _GL_CXXALIASWARN (rename);
1071 : #elif defined GNULIB_POSIXCHECK
1072 : # undef rename
1073 : /* Assume rename is always declared. */
1074 : _GL_WARN_ON_USE (rename, "rename is buggy on some platforms - "
1075 : "use gnulib module rename for more portability");
1076 : #endif
1077 :
1078 : #if 0
1079 : # if 0
1080 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1081 : # undef renameat
1082 : # define renameat rpl_renameat
1083 : # endif
1084 : _GL_FUNCDECL_RPL (renameat, int,
1085 : (int fd1, char const *file1, int fd2, char const *file2)
1086 : _GL_ARG_NONNULL ((2, 4)));
1087 : _GL_CXXALIAS_RPL (renameat, int,
1088 : (int fd1, char const *file1, int fd2, char const *file2));
1089 : # else
1090 : # if !1
1091 : _GL_FUNCDECL_SYS (renameat, int,
1092 : (int fd1, char const *file1, int fd2, char const *file2)
1093 : _GL_ARG_NONNULL ((2, 4)));
1094 : # endif
1095 : _GL_CXXALIAS_SYS (renameat, int,
1096 : (int fd1, char const *file1, int fd2, char const *file2));
1097 : # endif
1098 : _GL_CXXALIASWARN (renameat);
1099 : #elif defined GNULIB_POSIXCHECK
1100 : # undef renameat
1101 : # if HAVE_RAW_DECL_RENAMEAT
1102 : _GL_WARN_ON_USE (renameat, "renameat is not portable - "
1103 : "use gnulib module renameat for portability");
1104 : # endif
1105 : #endif
1106 :
1107 : #if 0
1108 : # if 0
1109 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1110 : # define snprintf rpl_snprintf
1111 : # endif
1112 : _GL_FUNCDECL_RPL (snprintf, int,
1113 : (char *str, size_t size, const char *format, ...)
1114 : __attribute__ ((__format__ (__printf__, 3, 4)))
1115 : _GL_ARG_NONNULL ((3)));
1116 : _GL_CXXALIAS_RPL (snprintf, int,
1117 : (char *str, size_t size, const char *format, ...));
1118 : # else
1119 : # if !1
1120 : _GL_FUNCDECL_SYS (snprintf, int,
1121 : (char *str, size_t size, const char *format, ...)
1122 : __attribute__ ((__format__ (__printf__, 3, 4)))
1123 : _GL_ARG_NONNULL ((3)));
1124 : # endif
1125 : _GL_CXXALIAS_SYS (snprintf, int,
1126 : (char *str, size_t size, const char *format, ...));
1127 : # endif
1128 : _GL_CXXALIASWARN (snprintf);
1129 : #elif defined GNULIB_POSIXCHECK
1130 : # undef snprintf
1131 : # if HAVE_RAW_DECL_SNPRINTF
1132 : _GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
1133 : "use gnulib module snprintf for portability");
1134 : # endif
1135 : #endif
1136 :
1137 : /* Some people would argue that sprintf should be handled like gets
1138 : (for example, OpenBSD issues a link warning for both functions),
1139 : since both can cause security holes due to buffer overruns.
1140 : However, we believe that sprintf can be used safely, and is more
1141 : efficient than snprintf in those safe cases; and as proof of our
1142 : belief, we use sprintf in several gnulib modules. So this header
1143 : intentionally avoids adding a warning to sprintf except when
1144 : GNULIB_POSIXCHECK is defined. */
1145 :
1146 : #if 0
1147 : # if 0
1148 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1149 : # define sprintf rpl_sprintf
1150 : # endif
1151 : _GL_FUNCDECL_RPL (sprintf, int, (char *str, const char *format, ...)
1152 : __attribute__ ((__format__ (__printf__, 2, 3)))
1153 : _GL_ARG_NONNULL ((1, 2)));
1154 : _GL_CXXALIAS_RPL (sprintf, int, (char *str, const char *format, ...));
1155 : # else
1156 : _GL_CXXALIAS_SYS (sprintf, int, (char *str, const char *format, ...));
1157 : # endif
1158 : _GL_CXXALIASWARN (sprintf);
1159 : #elif defined GNULIB_POSIXCHECK
1160 : # undef sprintf
1161 : /* Assume sprintf is always declared. */
1162 : _GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - "
1163 : "use gnulib module sprintf-posix for portable "
1164 : "POSIX compliance");
1165 : #endif
1166 :
1167 : #if 1
1168 : # if 0
1169 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1170 : # define tmpfile rpl_tmpfile
1171 : # endif
1172 : _GL_FUNCDECL_RPL (tmpfile, FILE *, (void));
1173 : _GL_CXXALIAS_RPL (tmpfile, FILE *, (void));
1174 : # else
1175 : _GL_CXXALIAS_SYS (tmpfile, FILE *, (void));
1176 : # endif
1177 : _GL_CXXALIASWARN (tmpfile);
1178 : #elif defined GNULIB_POSIXCHECK
1179 : # undef tmpfile
1180 : # if HAVE_RAW_DECL_TMPFILE
1181 : _GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - "
1182 : "use gnulib module tmpfile for portability");
1183 : # endif
1184 : #endif
1185 :
1186 : #if 0
1187 : /* Write formatted output to a string dynamically allocated with malloc().
1188 : If the memory allocation succeeds, store the address of the string in
1189 : *RESULT and return the number of resulting bytes, excluding the trailing
1190 : NUL. Upon memory allocation error, or some other error, return -1. */
1191 : # if 0
1192 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1193 : # define asprintf rpl_asprintf
1194 : # endif
1195 : _GL_FUNCDECL_RPL (asprintf, int,
1196 : (char **result, const char *format, ...)
1197 : __attribute__ ((__format__ (__printf__, 2, 3)))
1198 : _GL_ARG_NONNULL ((1, 2)));
1199 : _GL_CXXALIAS_RPL (asprintf, int,
1200 : (char **result, const char *format, ...));
1201 : # else
1202 : # if !1
1203 : _GL_FUNCDECL_SYS (asprintf, int,
1204 : (char **result, const char *format, ...)
1205 : __attribute__ ((__format__ (__printf__, 2, 3)))
1206 : _GL_ARG_NONNULL ((1, 2)));
1207 : # endif
1208 : _GL_CXXALIAS_SYS (asprintf, int,
1209 : (char **result, const char *format, ...));
1210 : # endif
1211 : _GL_CXXALIASWARN (asprintf);
1212 : # if 0
1213 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1214 : # define vasprintf rpl_vasprintf
1215 : # endif
1216 : _GL_FUNCDECL_RPL (vasprintf, int,
1217 : (char **result, const char *format, va_list args)
1218 : __attribute__ ((__format__ (__printf__, 2, 0)))
1219 : _GL_ARG_NONNULL ((1, 2)));
1220 : _GL_CXXALIAS_RPL (vasprintf, int,
1221 : (char **result, const char *format, va_list args));
1222 : # else
1223 : # if !1
1224 : _GL_FUNCDECL_SYS (vasprintf, int,
1225 : (char **result, const char *format, va_list args)
1226 : __attribute__ ((__format__ (__printf__, 2, 0)))
1227 : _GL_ARG_NONNULL ((1, 2)));
1228 : # endif
1229 : _GL_CXXALIAS_SYS (vasprintf, int,
1230 : (char **result, const char *format, va_list args));
1231 : # endif
1232 : _GL_CXXALIASWARN (vasprintf);
1233 : #endif
1234 :
1235 : #if 0
1236 : # if 0
1237 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1238 : # define vdprintf rpl_vdprintf
1239 : # endif
1240 : _GL_FUNCDECL_RPL (vdprintf, int, (int fd, const char *format, va_list args)
1241 : __attribute__ ((__format__ (__printf__, 2, 0)))
1242 : _GL_ARG_NONNULL ((2)));
1243 : _GL_CXXALIAS_RPL (vdprintf, int, (int fd, const char *format, va_list args));
1244 : # else
1245 : # if !1
1246 : _GL_FUNCDECL_SYS (vdprintf, int, (int fd, const char *format, va_list args)
1247 : __attribute__ ((__format__ (__printf__, 2, 0)))
1248 : _GL_ARG_NONNULL ((2)));
1249 : # endif
1250 : /* Need to cast, because on Solaris, the third parameter will likely be
1251 : __va_list args. */
1252 : _GL_CXXALIAS_SYS_CAST (vdprintf, int,
1253 : (int fd, const char *format, va_list args));
1254 : # endif
1255 : _GL_CXXALIASWARN (vdprintf);
1256 : #elif defined GNULIB_POSIXCHECK
1257 : # undef vdprintf
1258 : # if HAVE_RAW_DECL_VDPRINTF
1259 : _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - "
1260 : "use gnulib module vdprintf for portability");
1261 : # endif
1262 : #endif
1263 :
1264 : #if 0 || 1
1265 : # if (0 && 0) \
1266 : || (1 && 0 && 0)
1267 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1268 : # define vfprintf rpl_vfprintf
1269 : # endif
1270 : # define GNULIB_overrides_vfprintf 1
1271 : _GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args)
1272 : __attribute__ ((__format__ (__printf__, 2, 0)))
1273 : _GL_ARG_NONNULL ((1, 2)));
1274 : _GL_CXXALIAS_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args));
1275 : # else
1276 : /* Need to cast, because on Solaris, the third parameter is
1277 : __va_list args
1278 : and GCC's fixincludes did not change this to __gnuc_va_list. */
1279 : _GL_CXXALIAS_SYS_CAST (vfprintf, int,
1280 : (FILE *fp, const char *format, va_list args));
1281 : # endif
1282 : _GL_CXXALIASWARN (vfprintf);
1283 : #endif
1284 : #if !0 && defined GNULIB_POSIXCHECK
1285 : # if !GNULIB_overrides_vfprintf
1286 : # undef vfprintf
1287 : # endif
1288 : /* Assume vfprintf is always declared. */
1289 : _GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - "
1290 : "use gnulib module vfprintf-posix for portable "
1291 : "POSIX compliance");
1292 : #endif
1293 :
1294 : #if 0 || 1
1295 : # if (0 && 0) \
1296 : || (1 && 0 && 0)
1297 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1298 : # define vprintf rpl_vprintf
1299 : # endif
1300 : # define GNULIB_overrides_vprintf 1
1301 : _GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args)
1302 : __attribute__ ((__format__ (__printf__, 1, 0)))
1303 : _GL_ARG_NONNULL ((1)));
1304 : _GL_CXXALIAS_RPL (vprintf, int, (const char *format, va_list args));
1305 : # else
1306 : /* Need to cast, because on Solaris, the second parameter is
1307 : __va_list args
1308 : and GCC's fixincludes did not change this to __gnuc_va_list. */
1309 : _GL_CXXALIAS_SYS_CAST (vprintf, int, (const char *format, va_list args));
1310 : # endif
1311 : _GL_CXXALIASWARN (vprintf);
1312 : #endif
1313 : #if !0 && defined GNULIB_POSIXCHECK
1314 : # if !GNULIB_overrides_vprintf
1315 : # undef vprintf
1316 : # endif
1317 : /* Assume vprintf is always declared. */
1318 : _GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - "
1319 : "use gnulib module vprintf-posix for portable "
1320 : "POSIX compliance");
1321 : #endif
1322 :
1323 : #if 0
1324 : # if 0
1325 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1326 : # define vsnprintf rpl_vsnprintf
1327 : # endif
1328 : _GL_FUNCDECL_RPL (vsnprintf, int,
1329 : (char *str, size_t size, const char *format, va_list args)
1330 : __attribute__ ((__format__ (__printf__, 3, 0)))
1331 : _GL_ARG_NONNULL ((3)));
1332 : _GL_CXXALIAS_RPL (vsnprintf, int,
1333 : (char *str, size_t size, const char *format, va_list args));
1334 : # else
1335 : # if !1
1336 : _GL_FUNCDECL_SYS (vsnprintf, int,
1337 : (char *str, size_t size, const char *format, va_list args)
1338 : __attribute__ ((__format__ (__printf__, 3, 0)))
1339 : _GL_ARG_NONNULL ((3)));
1340 : # endif
1341 : _GL_CXXALIAS_SYS (vsnprintf, int,
1342 : (char *str, size_t size, const char *format, va_list args));
1343 : # endif
1344 : _GL_CXXALIASWARN (vsnprintf);
1345 : #elif defined GNULIB_POSIXCHECK
1346 : # undef vsnprintf
1347 : # if HAVE_RAW_DECL_VSNPRINTF
1348 : _GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - "
1349 : "use gnulib module vsnprintf for portability");
1350 : # endif
1351 : #endif
1352 :
1353 : #if 0
1354 : # if 0
1355 : # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1356 : # define vsprintf rpl_vsprintf
1357 : # endif
1358 : _GL_FUNCDECL_RPL (vsprintf, int,
1359 : (char *str, const char *format, va_list args)
1360 : __attribute__ ((__format__ (__printf__, 2, 0)))
1361 : _GL_ARG_NONNULL ((1, 2)));
1362 : _GL_CXXALIAS_RPL (vsprintf, int,
1363 : (char *str, const char *format, va_list args));
1364 : # else
1365 : /* Need to cast, because on Solaris, the third parameter is
1366 : __va_list args
1367 : and GCC's fixincludes did not change this to __gnuc_va_list. */
1368 : _GL_CXXALIAS_SYS_CAST (vsprintf, int,
1369 : (char *str, const char *format, va_list args));
1370 : # endif
1371 : _GL_CXXALIASWARN (vsprintf);
1372 : #elif defined GNULIB_POSIXCHECK
1373 : # undef vsprintf
1374 : /* Assume vsprintf is always declared. */
1375 : _GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - "
1376 : "use gnulib module vsprintf-posix for portable "
1377 : "POSIX compliance");
1378 : #endif
1379 :
1380 :
1381 : #endif /* _GL_STDIO_H */
1382 : #endif /* _GL_STDIO_H */
1383 : #endif
|