Mercurial > hg > octave-kai > gnulib-hg
annotate lib/stdio.in.h @ 13122:01741ff1a40e
ftello: Fix C++ test error on mingw.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sat, 03 Apr 2010 14:25:24 +0200 |
parents | 472aa3de0fbb |
children | f42a08f19992 |
rev | line source |
---|---|
9262 | 1 /* A GNU-like <stdio.h>. |
2 | |
12559
c2cbabec01dd
update nearly all FSF copyright year lists to include 2010
Jim Meyering <meyering@redhat.com>
parents:
12488
diff
changeset
|
3 Copyright (C) 2004, 2007-2010 Free Software Foundation, Inc. |
9262 | 4 |
5 This program is free software; you can redistribute it and/or modify | |
6 it under the terms of the GNU General Public License as published by | |
7 the Free Software Foundation; either version 2, or (at your option) | |
8 any later version. | |
9 | |
10 This program 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 General Public License for more details. | |
14 | |
15 You should have received a copy of the GNU General Public License | |
16 along with this program; if not, write to the Free Software Foundation, | |
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ | |
18 | |
10655
8668b19a7032
Avoid gcc warnings because of #pragma GCC system_header on older gcc.
Bruno Haible <bruno@clisp.org>
parents:
10622
diff
changeset
|
19 #if __GNUC__ >= 3 |
10375
f96e845fc36d
Avoid some "gcc -pedantic" warnings.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
20 @PRAGMA_SYSTEM_HEADER@ |
10655
8668b19a7032
Avoid gcc warnings because of #pragma GCC system_header on older gcc.
Bruno Haible <bruno@clisp.org>
parents:
10622
diff
changeset
|
21 #endif |
10375
f96e845fc36d
Avoid some "gcc -pedantic" warnings.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
22 |
9262 | 23 #if defined __need_FILE || defined __need___FILE |
24 /* Special invocation convention inside glibc header files. */ | |
25 | |
26 #@INCLUDE_NEXT@ @NEXT_STDIO_H@ | |
27 | |
28 #else | |
29 /* Normal invocation convention. */ | |
30 | |
31 #ifndef _GL_STDIO_H | |
32 | |
33 /* The include_next requires a split double-inclusion guard. */ | |
34 #@INCLUDE_NEXT@ @NEXT_STDIO_H@ | |
35 | |
36 #ifndef _GL_STDIO_H | |
37 #define _GL_STDIO_H | |
38 | |
12600
742a202062e7
stdio: Ensure <stdio.h> defines off_t, ssize_t, va_list.
Bruno Haible <bruno@clisp.org>
parents:
12584
diff
changeset
|
39 /* Get va_list. Needed on many systems, including glibc 2.8. */ |
9262 | 40 #include <stdarg.h> |
12600
742a202062e7
stdio: Ensure <stdio.h> defines off_t, ssize_t, va_list.
Bruno Haible <bruno@clisp.org>
parents:
12584
diff
changeset
|
41 |
9262 | 42 #include <stddef.h> |
43 | |
12600
742a202062e7
stdio: Ensure <stdio.h> defines off_t, ssize_t, va_list.
Bruno Haible <bruno@clisp.org>
parents:
12584
diff
changeset
|
44 /* Get off_t and ssize_t. Needed on many systems, including glibc 2.8. */ |
742a202062e7
stdio: Ensure <stdio.h> defines off_t, ssize_t, va_list.
Bruno Haible <bruno@clisp.org>
parents:
12584
diff
changeset
|
45 #include <sys/types.h> |
9262 | 46 |
47 #ifndef __attribute__ | |
12762
410eaa89fb57
Avoid a link error due to the __printf__ symbol.
Bruno Haible <bruno@clisp.org>
parents:
12734
diff
changeset
|
48 /* The __attribute__ feature is available in gcc versions 2.5 and later. |
410eaa89fb57
Avoid a link error due to the __printf__ symbol.
Bruno Haible <bruno@clisp.org>
parents:
12734
diff
changeset
|
49 The __-protected variants of the attributes 'format' and 'printf' are |
410eaa89fb57
Avoid a link error due to the __printf__ symbol.
Bruno Haible <bruno@clisp.org>
parents:
12734
diff
changeset
|
50 accepted by gcc versions 2.6.4 (effectively 2.7) and later. |
410eaa89fb57
Avoid a link error due to the __printf__ symbol.
Bruno Haible <bruno@clisp.org>
parents:
12734
diff
changeset
|
51 We enable __attribute__ only if these are supported too, because |
410eaa89fb57
Avoid a link error due to the __printf__ symbol.
Bruno Haible <bruno@clisp.org>
parents:
12734
diff
changeset
|
52 gnulib and libintl do '#define printf __printf__' when they override |
410eaa89fb57
Avoid a link error due to the __printf__ symbol.
Bruno Haible <bruno@clisp.org>
parents:
12734
diff
changeset
|
53 the 'printf' function. */ |
9262 | 54 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) |
12762
410eaa89fb57
Avoid a link error due to the __printf__ symbol.
Bruno Haible <bruno@clisp.org>
parents:
12734
diff
changeset
|
55 # define __attribute__(Spec) /* empty */ |
9262 | 56 # endif |
57 #endif | |
58 | |
59 | |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
60 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
61 |
12422
f7842310a565
New module 'arg-nonnull'. Declare which arguments expect non-NULL values.
Bruno Haible <bruno@clisp.org>
parents:
12421
diff
changeset
|
62 /* The definition of _GL_ARG_NONNULL is copied here. */ |
f7842310a565
New module 'arg-nonnull'. Declare which arguments expect non-NULL values.
Bruno Haible <bruno@clisp.org>
parents:
12421
diff
changeset
|
63 |
12724 | 64 /* The definition of _GL_WARN_ON_USE is copied here. */ |
65 | |
9262 | 66 |
11971 | 67 #if @GNULIB_DPRINTF@ |
68 # if @REPLACE_DPRINTF@ | |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
69 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
70 # define dprintf rpl_dprintf |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
71 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
72 _GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *format, ...) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
73 __attribute__ ((__format__ (__printf__, 2, 3))) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
74 _GL_ARG_NONNULL ((2))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
75 _GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *format, ...)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
76 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
77 # if !@HAVE_DPRINTF@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
78 _GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *format, ...) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
79 __attribute__ ((__format__ (__printf__, 2, 3))) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
80 _GL_ARG_NONNULL ((2))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
81 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
82 _GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *format, ...)); |
11971 | 83 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
84 _GL_CXXALIASWARN (dprintf); |
11971 | 85 #elif defined GNULIB_POSIXCHECK |
86 # undef dprintf | |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
87 # if HAVE_RAW_DECL_DPRINTF |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
88 _GL_WARN_ON_USE (dprintf, "dprintf is unportable - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
89 "use gnulib module dprintf for portability"); |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
90 # endif |
11971 | 91 #endif |
92 | |
93 #if @GNULIB_FCLOSE@ | |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
94 /* Close STREAM and its underlying file descriptor. */ |
11971 | 95 # if @REPLACE_FCLOSE@ |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
96 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
97 # define fclose rpl_fclose |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
98 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
99 _GL_FUNCDECL_RPL (fclose, int, (FILE *stream) _GL_ARG_NONNULL ((1))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
100 _GL_CXXALIAS_RPL (fclose, int, (FILE *stream)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
101 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
102 _GL_CXXALIAS_SYS (fclose, int, (FILE *stream)); |
11971 | 103 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
104 _GL_CXXALIASWARN (fclose); |
11971 | 105 #elif defined GNULIB_POSIXCHECK |
106 # undef fclose | |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
107 /* Assume fclose is always declared. */ |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
108 _GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
109 "use gnulib module fclose for portable POSIX compliance"); |
11971 | 110 #endif |
111 | |
112 #if @GNULIB_FFLUSH@ | |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
113 /* Flush all pending data on STREAM according to POSIX rules. Both |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
114 output and seekable input streams are supported. |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
115 Note! LOSS OF DATA can occur if fflush is applied on an input stream |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
116 that is _not_seekable_ or on an update stream that is _not_seekable_ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
117 and in which the most recent operation was input. Seekability can |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
118 be tested with lseek(fileno(fp),0,SEEK_CUR). */ |
11971 | 119 # if @REPLACE_FFLUSH@ |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
120 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
121 # define fflush rpl_fflush |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
122 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
123 _GL_FUNCDECL_RPL (fflush, int, (FILE *gl_stream)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
124 _GL_CXXALIAS_RPL (fflush, int, (FILE *gl_stream)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
125 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
126 _GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream)); |
11971 | 127 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
128 _GL_CXXALIASWARN (fflush); |
11971 | 129 #elif defined GNULIB_POSIXCHECK |
130 # undef fflush | |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
131 /* Assume fflush is always declared. */ |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
132 _GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
133 "use gnulib module fflush for portable POSIX compliance"); |
11971 | 134 #endif |
135 | |
12724 | 136 /* It is very rare that the developer ever has full control of stdin, |
137 so any use of gets warrants an unconditional warning. Assume it is | |
138 always declared, since it is required by C89. */ | |
139 #undef gets | |
140 _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); | |
141 | |
11971 | 142 #if @GNULIB_FOPEN@ |
143 # if @REPLACE_FOPEN@ | |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
144 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
145 # undef fopen |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
146 # define fopen rpl_fopen |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
147 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
148 _GL_FUNCDECL_RPL (fopen, FILE *, (const char *filename, const char *mode) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
149 _GL_ARG_NONNULL ((1, 2))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
150 _GL_CXXALIAS_RPL (fopen, FILE *, (const char *filename, const char *mode)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
151 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
152 _GL_CXXALIAS_SYS (fopen, FILE *, (const char *filename, const char *mode)); |
11971 | 153 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
154 _GL_CXXALIASWARN (fopen); |
11971 | 155 #elif defined GNULIB_POSIXCHECK |
156 # undef fopen | |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
157 /* Assume fopen is always declared. */ |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
158 _GL_WARN_ON_USE (fopen, "fopen on Win32 platforms is not POSIX compatible - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
159 "use gnulib module fopen for portability"); |
11971 | 160 #endif |
9262 | 161 |
12879
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
162 #if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@ |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
163 # if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \ |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
164 || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@) |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
165 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
166 # define fprintf rpl_fprintf |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
167 # endif |
12879
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
168 # define GNULIB_overrides_fprintf 1 |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
169 _GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
170 __attribute__ ((__format__ (__printf__, 2, 3))) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
171 _GL_ARG_NONNULL ((1, 2))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
172 _GL_CXXALIAS_RPL (fprintf, int, (FILE *fp, const char *format, ...)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
173 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
174 _GL_CXXALIAS_SYS (fprintf, int, (FILE *fp, const char *format, ...)); |
9262 | 175 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
176 _GL_CXXALIASWARN (fprintf); |
12879
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
177 #endif |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
178 #if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
179 # if !GNULIB_overrides_fprintf |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
180 # undef fprintf |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
181 # endif |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
182 /* Assume fprintf is always declared. */ |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
183 _GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX compliant - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
184 "use gnulib module fprintf-posix for portable " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
185 "POSIX compliance"); |
9262 | 186 #endif |
187 | |
11971 | 188 #if @GNULIB_FPURGE@ |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
189 /* Discard all pending buffered I/O data on STREAM. |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
190 STREAM must not be wide-character oriented. |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
191 When discarding pending output, the file position is set back to where it |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
192 was before the write calls. When discarding pending input, the file |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
193 position is advanced to match the end of the previously read input. |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
194 Return 0 if successful. Upon error, return -1 and set errno. */ |
11971 | 195 # if @REPLACE_FPURGE@ |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
196 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
197 # define fpurge rpl_fpurge |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
198 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
199 _GL_FUNCDECL_RPL (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
200 _GL_CXXALIAS_RPL (fpurge, int, (FILE *gl_stream)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
201 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
202 # if !@HAVE_DECL_FPURGE@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
203 _GL_FUNCDECL_SYS (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
204 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
205 _GL_CXXALIAS_SYS (fpurge, int, (FILE *gl_stream)); |
9262 | 206 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
207 _GL_CXXALIASWARN (fpurge); |
9262 | 208 #elif defined GNULIB_POSIXCHECK |
11971 | 209 # undef fpurge |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
210 # if HAVE_RAW_DECL_FPURGE |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
211 _GL_WARN_ON_USE (fpurge, "fpurge is not always present - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
212 "use gnulib module fpurge for portability"); |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
213 # endif |
11035
bf21f4597784
New modules 'dprintf', 'dprintf-posix'.
Bruno Haible <bruno@clisp.org>
parents:
11033
diff
changeset
|
214 #endif |
bf21f4597784
New modules 'dprintf', 'dprintf-posix'.
Bruno Haible <bruno@clisp.org>
parents:
11033
diff
changeset
|
215 |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
216 #if @GNULIB_FPUTC@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
217 # if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
218 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
219 # undef fputc |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
220 # define fputc rpl_fputc |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
221 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
222 _GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
223 _GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
224 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
225 _GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
226 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
227 _GL_CXXALIASWARN (fputc); |
9262 | 228 #endif |
229 | |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
230 #if @GNULIB_FPUTS@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
231 # if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
232 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
233 # undef fputs |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
234 # define fputs rpl_fputs |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
235 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
236 _GL_FUNCDECL_RPL (fputs, int, (const char *string, FILE *stream) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
237 _GL_ARG_NONNULL ((1, 2))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
238 _GL_CXXALIAS_RPL (fputs, int, (const char *string, FILE *stream)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
239 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
240 _GL_CXXALIAS_SYS (fputs, int, (const char *string, FILE *stream)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
241 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
242 _GL_CXXALIASWARN (fputs); |
9301
98e1721b4e40
New modules 'fopen' and 'freopen'.
Bruno Haible <bruno@clisp.org>
parents:
9262
diff
changeset
|
243 #endif |
98e1721b4e40
New modules 'fopen' and 'freopen'.
Bruno Haible <bruno@clisp.org>
parents:
9262
diff
changeset
|
244 |
98e1721b4e40
New modules 'fopen' and 'freopen'.
Bruno Haible <bruno@clisp.org>
parents:
9262
diff
changeset
|
245 #if @GNULIB_FREOPEN@ |
98e1721b4e40
New modules 'fopen' and 'freopen'.
Bruno Haible <bruno@clisp.org>
parents:
9262
diff
changeset
|
246 # if @REPLACE_FREOPEN@ |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
247 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
248 # undef freopen |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
249 # define freopen rpl_freopen |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
250 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
251 _GL_FUNCDECL_RPL (freopen, FILE *, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
252 (const char *filename, const char *mode, FILE *stream) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
253 _GL_ARG_NONNULL ((2, 3))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
254 _GL_CXXALIAS_RPL (freopen, FILE *, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
255 (const char *filename, const char *mode, FILE *stream)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
256 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
257 _GL_CXXALIAS_SYS (freopen, FILE *, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
258 (const char *filename, const char *mode, FILE *stream)); |
9301
98e1721b4e40
New modules 'fopen' and 'freopen'.
Bruno Haible <bruno@clisp.org>
parents:
9262
diff
changeset
|
259 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
260 _GL_CXXALIASWARN (freopen); |
9301
98e1721b4e40
New modules 'fopen' and 'freopen'.
Bruno Haible <bruno@clisp.org>
parents:
9262
diff
changeset
|
261 #elif defined GNULIB_POSIXCHECK |
98e1721b4e40
New modules 'fopen' and 'freopen'.
Bruno Haible <bruno@clisp.org>
parents:
9262
diff
changeset
|
262 # undef freopen |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
263 /* Assume freopen is always declared. */ |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
264 _GL_WARN_ON_USE (freopen, "freopen on Win32 platforms is not POSIX compatible - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
265 "use gnulib module freopen for portability"); |
9301
98e1721b4e40
New modules 'fopen' and 'freopen'.
Bruno Haible <bruno@clisp.org>
parents:
9262
diff
changeset
|
266 #endif |
98e1721b4e40
New modules 'fopen' and 'freopen'.
Bruno Haible <bruno@clisp.org>
parents:
9262
diff
changeset
|
267 |
12878 | 268 |
12724 | 269 /* Set up the following warnings, based on which modules are in use. |
270 GNU Coding Standards discourage the use of fseek, since it imposes | |
271 an arbitrary limitation on some 32-bit hosts. Remember that the | |
272 fseek module depends on the fseeko module, so we only have three | |
273 cases to consider: | |
274 | |
275 1. The developer is not using either module. Issue a warning under | |
276 GNULIB_POSIXCHECK for both functions, to remind them that both | |
277 functions have bugs on some systems. _GL_NO_LARGE_FILES has no | |
278 impact on this warning. | |
279 | |
280 2. The developer is using both modules. They may be unaware of the | |
281 arbitrary limitations of fseek, so issue a warning under | |
282 GNULIB_POSIXCHECK. On the other hand, they may be using both | |
283 modules intentionally, so the developer can define | |
284 _GL_NO_LARGE_FILES in the compilation units where the use of fseek | |
285 is safe, to silence the warning. | |
286 | |
287 3. The developer is using the fseeko module, but not fseek. Gnulib | |
288 guarantees that fseek will still work around platform bugs in that | |
289 case, but we presume that the developer is aware of the pitfalls of | |
290 fseek and was trying to avoid it, so issue a warning even when | |
291 GNULIB_POSIXCHECK is undefined. Again, _GL_NO_LARGE_FILES can be | |
292 defined to silence the warning in particular compilation units. | |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
293 In C++ compilations with GNULIB_NAMESPACE, in order to avoid that |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
294 fseek gets defined as a macro, it is recommended that the developer |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
295 uses the fseek module, even if he is not calling the fseek function. |
12724 | 296 |
297 Most gnulib clients that perform stream operations should fall into | |
12878 | 298 category 3. */ |
12724 | 299 |
300 #if @GNULIB_FSEEK@ | |
301 # if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES | |
302 # define _GL_FSEEK_WARN /* Category 2, above. */ | |
303 # undef fseek | |
304 # endif | |
305 # if @REPLACE_FSEEK@ | |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
306 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
307 # undef fseek |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
308 # define fseek rpl_fseek |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
309 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
310 _GL_FUNCDECL_RPL (fseek, int, (FILE *fp, long offset, int whence) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
311 _GL_ARG_NONNULL ((1))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
312 _GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
313 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
314 _GL_CXXALIAS_SYS (fseek, int, (FILE *fp, long offset, int whence)); |
9262 | 315 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
316 _GL_CXXALIASWARN (fseek); |
9262 | 317 #endif |
318 | |
11971 | 319 #if @GNULIB_FSEEKO@ |
12724 | 320 # if !@GNULIB_FSEEK@ && !defined _GL_NO_LARGE_FILES |
321 # define _GL_FSEEK_WARN /* Category 3, above. */ | |
322 # undef fseek | |
323 # endif | |
11971 | 324 # if @REPLACE_FSEEKO@ |
13121
472aa3de0fbb
fseeko: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
12940
diff
changeset
|
325 /* Provide an fseeko function that is aware of a preceding fflush(), and which |
472aa3de0fbb
fseeko: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
12940
diff
changeset
|
326 detects pipes. */ |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
327 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
328 # undef fseeko |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
329 # define fseeko rpl_fseeko |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
330 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
331 _GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
332 _GL_ARG_NONNULL ((1))); |
13121
472aa3de0fbb
fseeko: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
12940
diff
changeset
|
333 _GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence)); |
472aa3de0fbb
fseeko: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
12940
diff
changeset
|
334 # else |
472aa3de0fbb
fseeko: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
12940
diff
changeset
|
335 # if ! @HAVE_FSEEKO@ |
472aa3de0fbb
fseeko: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
12940
diff
changeset
|
336 _GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence) |
472aa3de0fbb
fseeko: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
12940
diff
changeset
|
337 _GL_ARG_NONNULL ((1))); |
472aa3de0fbb
fseeko: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
12940
diff
changeset
|
338 # endif |
472aa3de0fbb
fseeko: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
12940
diff
changeset
|
339 _GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)); |
472aa3de0fbb
fseeko: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
12940
diff
changeset
|
340 # endif |
472aa3de0fbb
fseeko: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
12940
diff
changeset
|
341 _GL_CXXALIASWARN (fseeko); |
472aa3de0fbb
fseeko: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
12940
diff
changeset
|
342 # if (@REPLACE_FSEEKO@ || !@HAVE_FSEEKO@) && !@GNULIB_FSEEK@ |
472aa3de0fbb
fseeko: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
12940
diff
changeset
|
343 /* Provide an fseek function that is consistent with fseeko. */ |
472aa3de0fbb
fseeko: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
12940
diff
changeset
|
344 /* In order to avoid that fseek gets defined as a macro here, the |
472aa3de0fbb
fseeko: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
12940
diff
changeset
|
345 developer can request the 'fseek' module. */ |
472aa3de0fbb
fseeko: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
12940
diff
changeset
|
346 # undef fseek |
472aa3de0fbb
fseeko: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
12940
diff
changeset
|
347 # define fseek rpl_fseek |
12724 | 348 static inline int _GL_ARG_NONNULL ((1)) |
349 rpl_fseek (FILE *fp, long offset, int whence) | |
350 { | |
13121
472aa3de0fbb
fseeko: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
12940
diff
changeset
|
351 # if @REPLACE_FSEEKO@ |
472aa3de0fbb
fseeko: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
12940
diff
changeset
|
352 return rpl_fseeko (fp, offset, whence); |
472aa3de0fbb
fseeko: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
12940
diff
changeset
|
353 # else |
12724 | 354 return fseeko (fp, offset, whence); |
12202
a0f033ee41af
fseek: avoid compilation failure when fflush is replaced
Eric Blake <ebb9@byu.net>
parents:
12100
diff
changeset
|
355 # endif |
13121
472aa3de0fbb
fseeko: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
12940
diff
changeset
|
356 } |
9262 | 357 # endif |
358 #elif defined GNULIB_POSIXCHECK | |
12724 | 359 # define _GL_FSEEK_WARN /* Category 1, above. */ |
360 # undef fseek | |
11971 | 361 # undef fseeko |
12724 | 362 # if HAVE_RAW_DECL_FSEEKO |
363 _GL_WARN_ON_USE (fseeko, "fseeko is unportable - " | |
364 "use gnulib module fseeko for portability"); | |
365 # endif | |
9262 | 366 #endif |
367 | |
12724 | 368 #ifdef _GL_FSEEK_WARN |
369 # undef _GL_FSEEK_WARN | |
370 /* Here, either fseek is undefined (but C89 guarantees that it is | |
371 declared), or it is defined as rpl_fseek (declared above). */ | |
372 _GL_WARN_ON_USE (fseek, "fseek cannot handle files larger than 4 GB " | |
373 "on 32-bit platforms - " | |
374 "use fseeko function for handling of large files"); | |
375 #endif | |
376 | |
12878 | 377 |
378 /* ftell, ftello. See the comments on fseek/fseeko. */ | |
12724 | 379 |
380 #if @GNULIB_FTELL@ | |
381 # if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES | |
382 # define _GL_FTELL_WARN /* Category 2, above. */ | |
383 # undef ftell | |
384 # endif | |
12734
b31438706e9b
lib/stdio.in.h: Fix typo.
Simon Josefsson <simon@josefsson.org>
parents:
12724
diff
changeset
|
385 # if @REPLACE_FTELL@ |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
386 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
387 # undef ftell |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
388 # define ftell rpl_ftell |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
389 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
390 _GL_FUNCDECL_RPL (ftell, long, (FILE *fp) _GL_ARG_NONNULL ((1))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
391 _GL_CXXALIAS_RPL (ftell, long, (FILE *fp)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
392 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
393 _GL_CXXALIAS_SYS (ftell, long, (FILE *fp)); |
9262 | 394 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
395 _GL_CXXALIASWARN (ftell); |
9262 | 396 #endif |
397 | |
11971 | 398 #if @GNULIB_FTELLO@ |
12724 | 399 # if !@GNULIB_FTELL@ && !defined _GL_NO_LARGE_FILES |
400 # define _GL_FTELL_WARN /* Category 3, above. */ | |
401 # undef ftell | |
402 # endif | |
11971 | 403 # if @REPLACE_FTELLO@ |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
404 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
405 # undef ftello |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
406 # define ftello rpl_ftello |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
407 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
408 _GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1))); |
13122
01741ff1a40e
ftello: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
13121
diff
changeset
|
409 _GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp)); |
01741ff1a40e
ftello: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
13121
diff
changeset
|
410 # else |
01741ff1a40e
ftello: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
13121
diff
changeset
|
411 # if ! @HAVE_FTELLO@ |
01741ff1a40e
ftello: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
13121
diff
changeset
|
412 _GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1))); |
01741ff1a40e
ftello: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
13121
diff
changeset
|
413 # endif |
01741ff1a40e
ftello: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
13121
diff
changeset
|
414 _GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp)); |
01741ff1a40e
ftello: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
13121
diff
changeset
|
415 # endif |
01741ff1a40e
ftello: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
13121
diff
changeset
|
416 _GL_CXXALIASWARN (ftello); |
01741ff1a40e
ftello: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
13121
diff
changeset
|
417 # if (@REPLACE_FTELLO@ || !@HAVE_FTELLO@) && !@GNULIB_FTELL@ |
01741ff1a40e
ftello: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
13121
diff
changeset
|
418 /* Provide an ftell function that is consistent with ftello. */ |
01741ff1a40e
ftello: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
13121
diff
changeset
|
419 /* In order to avoid that ftell gets defined as a macro here, the |
01741ff1a40e
ftello: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
13121
diff
changeset
|
420 developer can request the 'ftell' module. */ |
01741ff1a40e
ftello: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
13121
diff
changeset
|
421 # undef ftell |
01741ff1a40e
ftello: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
13121
diff
changeset
|
422 # define ftell rpl_ftell |
12724 | 423 static inline long _GL_ARG_NONNULL ((1)) |
424 rpl_ftell (FILE *f) | |
425 { | |
13122
01741ff1a40e
ftello: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
13121
diff
changeset
|
426 # if @REPLACE_FTELLO@ |
01741ff1a40e
ftello: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
13121
diff
changeset
|
427 return rpl_ftello (f); |
01741ff1a40e
ftello: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
13121
diff
changeset
|
428 # else |
12724 | 429 return ftello (f); |
12202
a0f033ee41af
fseek: avoid compilation failure when fflush is replaced
Eric Blake <ebb9@byu.net>
parents:
12100
diff
changeset
|
430 # endif |
13122
01741ff1a40e
ftello: Fix C++ test error on mingw.
Bruno Haible <bruno@clisp.org>
parents:
13121
diff
changeset
|
431 } |
11653 | 432 # endif |
433 #elif defined GNULIB_POSIXCHECK | |
12724 | 434 # define _GL_FTELL_WARN /* Category 1, above. */ |
435 # undef ftell | |
11971 | 436 # undef ftello |
12724 | 437 # if HAVE_RAW_DECL_FTELLO |
438 _GL_WARN_ON_USE (ftello, "ftello is unportable - " | |
439 "use gnulib module ftello for portability"); | |
440 # endif | |
441 #endif | |
442 | |
443 #ifdef _GL_FTELL_WARN | |
444 # undef _GL_FTELL_WARN | |
445 /* Here, either ftell is undefined (but C89 guarantees that it is | |
446 declared), or it is defined as rpl_ftell (declared above). */ | |
447 _GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB " | |
448 "on 32-bit platforms - " | |
449 "use ftello function for handling of large files"); | |
10487
953f72c1ffcc
Support SIGPIPE in stdio functions for writing.
Bruno Haible <bruno@clisp.org>
parents:
10433
diff
changeset
|
450 #endif |
953f72c1ffcc
Support SIGPIPE in stdio functions for writing.
Bruno Haible <bruno@clisp.org>
parents:
10433
diff
changeset
|
451 |
12878 | 452 |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
453 #if @GNULIB_FWRITE@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
454 # if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
455 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
456 # undef fwrite |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
457 # define fwrite rpl_fwrite |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
458 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
459 _GL_FUNCDECL_RPL (fwrite, size_t, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
460 (const void *ptr, size_t s, size_t n, FILE *stream) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
461 _GL_ARG_NONNULL ((1, 4))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
462 _GL_CXXALIAS_RPL (fwrite, size_t, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
463 (const void *ptr, size_t s, size_t n, FILE *stream)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
464 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
465 _GL_CXXALIAS_SYS (fwrite, size_t, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
466 (const void *ptr, size_t s, size_t n, FILE *stream)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
467 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
468 _GL_CXXALIASWARN (fwrite); |
10487
953f72c1ffcc
Support SIGPIPE in stdio functions for writing.
Bruno Haible <bruno@clisp.org>
parents:
10433
diff
changeset
|
469 #endif |
953f72c1ffcc
Support SIGPIPE in stdio functions for writing.
Bruno Haible <bruno@clisp.org>
parents:
10433
diff
changeset
|
470 |
9262 | 471 #if @GNULIB_GETDELIM@ |
472 /* Read input, up to (and including) the next occurrence of DELIMITER, from | |
473 STREAM, store it in *LINEPTR (and NUL-terminate it). | |
474 *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE | |
475 bytes of space. It is realloc'd as necessary. | |
476 Return the number of bytes read and stored at *LINEPTR (not including the | |
477 NUL terminator), or -1 on error or EOF. */ | |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
478 # if @REPLACE_GETDELIM@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
479 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
480 # undef getdelim |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
481 # define getdelim rpl_getdelim |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
482 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
483 _GL_FUNCDECL_RPL (getdelim, ssize_t, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
484 (char **lineptr, size_t *linesize, int delimiter, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
485 FILE *stream) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
486 _GL_ARG_NONNULL ((1, 2, 4))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
487 _GL_CXXALIAS_RPL (getdelim, ssize_t, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
488 (char **lineptr, size_t *linesize, int delimiter, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
489 FILE *stream)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
490 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
491 # if !@HAVE_DECL_GETDELIM@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
492 _GL_FUNCDECL_SYS (getdelim, ssize_t, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
493 (char **lineptr, size_t *linesize, int delimiter, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
494 FILE *stream) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
495 _GL_ARG_NONNULL ((1, 2, 4))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
496 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
497 _GL_CXXALIAS_SYS (getdelim, ssize_t, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
498 (char **lineptr, size_t *linesize, int delimiter, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
499 FILE *stream)); |
9262 | 500 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
501 _GL_CXXALIASWARN (getdelim); |
9262 | 502 #elif defined GNULIB_POSIXCHECK |
503 # undef getdelim | |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
504 # if HAVE_RAW_DECL_GETDELIM |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
505 _GL_WARN_ON_USE (getdelim, "getdelim is unportable - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
506 "use gnulib module getdelim for portability"); |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
507 # endif |
9262 | 508 #endif |
509 | |
510 #if @GNULIB_GETLINE@ | |
511 /* Read a line, up to (and including) the next newline, from STREAM, store it | |
512 in *LINEPTR (and NUL-terminate it). | |
513 *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE | |
514 bytes of space. It is realloc'd as necessary. | |
515 Return the number of bytes read and stored at *LINEPTR (not including the | |
516 NUL terminator), or -1 on error or EOF. */ | |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
517 # if @REPLACE_GETLINE@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
518 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
519 # undef getline |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
520 # define getline rpl_getline |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
521 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
522 _GL_FUNCDECL_RPL (getline, ssize_t, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
523 (char **lineptr, size_t *linesize, FILE *stream) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
524 _GL_ARG_NONNULL ((1, 2, 3))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
525 _GL_CXXALIAS_RPL (getline, ssize_t, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
526 (char **lineptr, size_t *linesize, FILE *stream)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
527 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
528 # if !@HAVE_DECL_GETLINE@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
529 _GL_FUNCDECL_SYS (getline, ssize_t, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
530 (char **lineptr, size_t *linesize, FILE *stream) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
531 _GL_ARG_NONNULL ((1, 2, 3))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
532 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
533 _GL_CXXALIAS_SYS (getline, ssize_t, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
534 (char **lineptr, size_t *linesize, FILE *stream)); |
9262 | 535 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
536 _GL_CXXALIASWARN (getline); |
9262 | 537 #elif defined GNULIB_POSIXCHECK |
538 # undef getline | |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
539 # if HAVE_RAW_DECL_GETLINE |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
540 _GL_WARN_ON_USE (getline, "getline is unportable - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
541 "use gnulib module getline for portability"); |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
542 # endif |
9262 | 543 #endif |
544 | |
12860
1825e6a0ff37
obstack-printf-posix: ensure declaration
Eric Blake <ebb9@byu.net>
parents:
12839
diff
changeset
|
545 #if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@ |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
546 struct obstack; |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
547 /* Grow an obstack with formatted output. Return the number of |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
548 bytes added to OBS. No trailing nul byte is added, and the |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
549 object should be closed with obstack_finish before use. Upon |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
550 memory allocation error, call obstack_alloc_failed_handler. Upon |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
551 other error, return -1. */ |
11971 | 552 # if @REPLACE_OBSTACK_PRINTF@ |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
553 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
554 # define obstack_printf rpl_obstack_printf |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
555 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
556 _GL_FUNCDECL_RPL (obstack_printf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
557 (struct obstack *obs, const char *format, ...) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
558 __attribute__ ((__format__ (__printf__, 2, 3))) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
559 _GL_ARG_NONNULL ((1, 2))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
560 _GL_CXXALIAS_RPL (obstack_printf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
561 (struct obstack *obs, const char *format, ...)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
562 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
563 # if !@HAVE_DECL_OBSTACK_PRINTF@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
564 _GL_FUNCDECL_SYS (obstack_printf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
565 (struct obstack *obs, const char *format, ...) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
566 __attribute__ ((__format__ (__printf__, 2, 3))) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
567 _GL_ARG_NONNULL ((1, 2))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
568 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
569 _GL_CXXALIAS_SYS (obstack_printf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
570 (struct obstack *obs, const char *format, ...)); |
11971 | 571 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
572 _GL_CXXALIASWARN (obstack_printf); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
573 # if @REPLACE_OBSTACK_PRINTF@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
574 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
575 # define obstack_vprintf rpl_obstack_vprintf |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
576 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
577 _GL_FUNCDECL_RPL (obstack_vprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
578 (struct obstack *obs, const char *format, va_list args) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
579 __attribute__ ((__format__ (__printf__, 2, 0))) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
580 _GL_ARG_NONNULL ((1, 2))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
581 _GL_CXXALIAS_RPL (obstack_vprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
582 (struct obstack *obs, const char *format, va_list args)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
583 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
584 # if !@HAVE_DECL_OBSTACK_PRINTF@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
585 _GL_FUNCDECL_SYS (obstack_vprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
586 (struct obstack *obs, const char *format, va_list args) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
587 __attribute__ ((__format__ (__printf__, 2, 0))) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
588 _GL_ARG_NONNULL ((1, 2))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
589 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
590 _GL_CXXALIAS_SYS (obstack_vprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
591 (struct obstack *obs, const char *format, va_list args)); |
11971 | 592 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
593 _GL_CXXALIASWARN (obstack_vprintf); |
11971 | 594 #endif |
595 | |
10433 | 596 #if @GNULIB_PERROR@ |
597 /* Print a message to standard error, describing the value of ERRNO, | |
598 (if STRING is not NULL and not empty) prefixed with STRING and ": ", | |
599 and terminated with a newline. */ | |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
600 # if @REPLACE_PERROR@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
601 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
602 # define perror rpl_perror |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
603 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
604 _GL_FUNCDECL_RPL (perror, void, (const char *string)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
605 _GL_CXXALIAS_RPL (perror, void, (const char *string)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
606 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
607 _GL_CXXALIAS_SYS (perror, void, (const char *string)); |
10433 | 608 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
609 _GL_CXXALIASWARN (perror); |
10433 | 610 #elif defined GNULIB_POSIXCHECK |
611 # undef perror | |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
612 /* Assume perror is always declared. */ |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
613 _GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
614 "use gnulib module perror for portability"); |
10433 | 615 #endif |
616 | |
11971 | 617 #if @GNULIB_POPEN@ |
618 # if @REPLACE_POPEN@ | |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
619 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
620 # undef popen |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
621 # define popen rpl_popen |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
622 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
623 _GL_FUNCDECL_RPL (popen, FILE *, (const char *cmd, const char *mode) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
624 _GL_ARG_NONNULL ((1, 2))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
625 _GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
626 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
627 _GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode)); |
11971 | 628 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
629 _GL_CXXALIASWARN (popen); |
11971 | 630 #elif defined GNULIB_POSIXCHECK |
631 # undef popen | |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
632 # if HAVE_RAW_DECL_POPEN |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
633 _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
634 "use gnulib module popen or pipe for more portability"); |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
635 # endif |
11971 | 636 #endif |
637 | |
12879
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
638 #if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@ |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
639 # if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \ |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
640 || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@) |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
641 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
11971 | 642 /* Don't break __attribute__((format(printf,M,N))). */ |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
643 # define printf __printf__ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
644 # endif |
12879
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
645 # define GNULIB_overrides_printf 1 |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
646 _GL_FUNCDECL_RPL_1 (__printf__, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
647 (const char *format, ...) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
648 __attribute__ ((__format__ (__printf__, 1, 2))) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
649 _GL_ARG_NONNULL ((1))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
650 _GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
651 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
652 _GL_CXXALIAS_SYS (printf, int, (const char *format, ...)); |
11971 | 653 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
654 _GL_CXXALIASWARN (printf); |
12879
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
655 #endif |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
656 #if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
657 # if !GNULIB_overrides_printf |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
658 # undef printf |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
659 # endif |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
660 /* Assume printf is always declared. */ |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
661 _GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
662 "use gnulib module printf-posix for portable " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
663 "POSIX compliance"); |
11971 | 664 #endif |
665 | |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
666 #if @GNULIB_PUTC@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
667 # if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
668 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
669 # undef putc |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
670 # define putc rpl_fputc |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
671 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
672 _GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
673 _GL_CXXALIAS_RPL_1 (putc, rpl_fputc, int, (int c, FILE *stream)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
674 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
675 _GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
676 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
677 _GL_CXXALIASWARN (putc); |
11971 | 678 #endif |
679 | |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
680 #if @GNULIB_PUTCHAR@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
681 # if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
682 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
683 # undef putchar |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
684 # define putchar rpl_putchar |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
685 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
686 _GL_FUNCDECL_RPL (putchar, int, (int c)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
687 _GL_CXXALIAS_RPL (putchar, int, (int c)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
688 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
689 _GL_CXXALIAS_SYS (putchar, int, (int c)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
690 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
691 _GL_CXXALIASWARN (putchar); |
11971 | 692 #endif |
693 | |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
694 #if @GNULIB_PUTS@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
695 # if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
696 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
697 # undef puts |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
698 # define puts rpl_puts |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
699 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
700 _GL_FUNCDECL_RPL (puts, int, (const char *string) _GL_ARG_NONNULL ((1))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
701 _GL_CXXALIAS_RPL (puts, int, (const char *string)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
702 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
703 _GL_CXXALIAS_SYS (puts, int, (const char *string)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
704 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
705 _GL_CXXALIASWARN (puts); |
11971 | 706 #endif |
707 | |
12041
73e9ab6e2c90
remove: new module, for mingw and Solaris 9 bugs
Eric Blake <ebb9@byu.net>
parents:
11972
diff
changeset
|
708 #if @GNULIB_REMOVE@ |
73e9ab6e2c90
remove: new module, for mingw and Solaris 9 bugs
Eric Blake <ebb9@byu.net>
parents:
11972
diff
changeset
|
709 # if @REPLACE_REMOVE@ |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
710 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
711 # undef remove |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
712 # define remove rpl_remove |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
713 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
714 _GL_FUNCDECL_RPL (remove, int, (const char *name) _GL_ARG_NONNULL ((1))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
715 _GL_CXXALIAS_RPL (remove, int, (const char *name)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
716 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
717 _GL_CXXALIAS_SYS (remove, int, (const char *name)); |
12041
73e9ab6e2c90
remove: new module, for mingw and Solaris 9 bugs
Eric Blake <ebb9@byu.net>
parents:
11972
diff
changeset
|
718 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
719 _GL_CXXALIASWARN (remove); |
12041
73e9ab6e2c90
remove: new module, for mingw and Solaris 9 bugs
Eric Blake <ebb9@byu.net>
parents:
11972
diff
changeset
|
720 #elif defined GNULIB_POSIXCHECK |
73e9ab6e2c90
remove: new module, for mingw and Solaris 9 bugs
Eric Blake <ebb9@byu.net>
parents:
11972
diff
changeset
|
721 # undef remove |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
722 /* Assume remove is always declared. */ |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
723 _GL_WARN_ON_USE (remove, "remove cannot handle directories on some platforms - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
724 "use gnulib module remove for more portability"); |
12041
73e9ab6e2c90
remove: new module, for mingw and Solaris 9 bugs
Eric Blake <ebb9@byu.net>
parents:
11972
diff
changeset
|
725 #endif |
73e9ab6e2c90
remove: new module, for mingw and Solaris 9 bugs
Eric Blake <ebb9@byu.net>
parents:
11972
diff
changeset
|
726 |
11972 | 727 #if @GNULIB_RENAME@ |
728 # if @REPLACE_RENAME@ | |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
729 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
730 # undef rename |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
731 # define rename rpl_rename |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
732 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
733 _GL_FUNCDECL_RPL (rename, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
734 (const char *old_filename, const char *new_filename) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
735 _GL_ARG_NONNULL ((1, 2))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
736 _GL_CXXALIAS_RPL (rename, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
737 (const char *old_filename, const char *new_filename)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
738 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
739 _GL_CXXALIAS_SYS (rename, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
740 (const char *old_filename, const char *new_filename)); |
11972 | 741 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
742 _GL_CXXALIASWARN (rename); |
11972 | 743 #elif defined GNULIB_POSIXCHECK |
744 # undef rename | |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
745 /* Assume rename is always declared. */ |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
746 _GL_WARN_ON_USE (rename, "rename is buggy on some platforms - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
747 "use gnulib module rename for more portability"); |
11972 | 748 #endif |
749 | |
12099 | 750 #if @GNULIB_RENAMEAT@ |
12100 | 751 # if @REPLACE_RENAMEAT@ |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
752 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
753 # undef renameat |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
754 # define renameat rpl_renameat |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
755 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
756 _GL_FUNCDECL_RPL (renameat, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
757 (int fd1, char const *file1, int fd2, char const *file2) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
758 _GL_ARG_NONNULL ((2, 4))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
759 _GL_CXXALIAS_RPL (renameat, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
760 (int fd1, char const *file1, int fd2, char const *file2)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
761 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
762 # if !@HAVE_RENAMEAT@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
763 _GL_FUNCDECL_SYS (renameat, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
764 (int fd1, char const *file1, int fd2, char const *file2) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
765 _GL_ARG_NONNULL ((2, 4))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
766 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
767 _GL_CXXALIAS_SYS (renameat, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
768 (int fd1, char const *file1, int fd2, char const *file2)); |
12100 | 769 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
770 _GL_CXXALIASWARN (renameat); |
12099 | 771 #elif defined GNULIB_POSIXCHECK |
772 # undef renameat | |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
773 # if HAVE_RAW_DECL_RENAMEAT |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
774 _GL_WARN_ON_USE (renameat, "renameat is not portable - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
775 "use gnulib module renameat for portability"); |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
776 # endif |
12099 | 777 #endif |
778 | |
11971 | 779 #if @GNULIB_SNPRINTF@ |
780 # if @REPLACE_SNPRINTF@ | |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
781 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
782 # define snprintf rpl_snprintf |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
783 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
784 _GL_FUNCDECL_RPL (snprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
785 (char *str, size_t size, const char *format, ...) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
786 __attribute__ ((__format__ (__printf__, 3, 4))) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
787 _GL_ARG_NONNULL ((3))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
788 _GL_CXXALIAS_RPL (snprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
789 (char *str, size_t size, const char *format, ...)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
790 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
791 # if !@HAVE_DECL_SNPRINTF@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
792 _GL_FUNCDECL_SYS (snprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
793 (char *str, size_t size, const char *format, ...) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
794 __attribute__ ((__format__ (__printf__, 3, 4))) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
795 _GL_ARG_NONNULL ((3))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
796 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
797 _GL_CXXALIAS_SYS (snprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
798 (char *str, size_t size, const char *format, ...)); |
11971 | 799 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
800 _GL_CXXALIASWARN (snprintf); |
11971 | 801 #elif defined GNULIB_POSIXCHECK |
802 # undef snprintf | |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
803 # if HAVE_RAW_DECL_SNPRINTF |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
804 _GL_WARN_ON_USE (snprintf, "snprintf is unportable - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
805 "use gnulib module snprintf for portability"); |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
806 # endif |
11971 | 807 #endif |
808 | |
12724 | 809 /* Some people would argue that sprintf should be handled like gets |
810 (for example, OpenBSD issues a link warning for both functions), | |
811 since both can cause security holes due to buffer overruns. | |
812 However, we believe that sprintf can be used safely, and is more | |
813 efficient than snprintf in those safe cases; and as proof of our | |
814 belief, we use sprintf in several gnulib modules. So this header | |
815 intentionally avoids adding a warning to sprintf except when | |
816 GNULIB_POSIXCHECK is defined. */ | |
817 | |
11971 | 818 #if @GNULIB_SPRINTF_POSIX@ |
819 # if @REPLACE_SPRINTF@ | |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
820 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
821 # define sprintf rpl_sprintf |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
822 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
823 _GL_FUNCDECL_RPL (sprintf, int, (char *str, const char *format, ...) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
824 __attribute__ ((__format__ (__printf__, 2, 3))) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
825 _GL_ARG_NONNULL ((1, 2))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
826 _GL_CXXALIAS_RPL (sprintf, int, (char *str, const char *format, ...)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
827 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
828 _GL_CXXALIAS_SYS (sprintf, int, (char *str, const char *format, ...)); |
11971 | 829 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
830 _GL_CXXALIASWARN (sprintf); |
11971 | 831 #elif defined GNULIB_POSIXCHECK |
832 # undef sprintf | |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
833 /* Assume sprintf is always declared. */ |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
834 _GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
835 "use gnulib module sprintf-posix for portable " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
836 "POSIX compliance"); |
11971 | 837 #endif |
838 | |
839 #if @GNULIB_VASPRINTF@ | |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
840 /* Write formatted output to a string dynamically allocated with malloc(). |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
841 If the memory allocation succeeds, store the address of the string in |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
842 *RESULT and return the number of resulting bytes, excluding the trailing |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
843 NUL. Upon memory allocation error, or some other error, return -1. */ |
11971 | 844 # if @REPLACE_VASPRINTF@ |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
845 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
846 # define asprintf rpl_asprintf |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
847 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
848 _GL_FUNCDECL_RPL (asprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
849 (char **result, const char *format, ...) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
850 __attribute__ ((__format__ (__printf__, 2, 3))) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
851 _GL_ARG_NONNULL ((1, 2))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
852 _GL_CXXALIAS_RPL (asprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
853 (char **result, const char *format, ...)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
854 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
855 # if !@HAVE_VASPRINTF@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
856 _GL_FUNCDECL_SYS (asprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
857 (char **result, const char *format, ...) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
858 __attribute__ ((__format__ (__printf__, 2, 3))) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
859 _GL_ARG_NONNULL ((1, 2))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
860 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
861 _GL_CXXALIAS_SYS (asprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
862 (char **result, const char *format, ...)); |
11971 | 863 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
864 _GL_CXXALIASWARN (asprintf); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
865 # if @REPLACE_VASPRINTF@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
866 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
867 # define vasprintf rpl_vasprintf |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
868 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
869 _GL_FUNCDECL_RPL (vasprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
870 (char **result, const char *format, va_list args) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
871 __attribute__ ((__format__ (__printf__, 2, 0))) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
872 _GL_ARG_NONNULL ((1, 2))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
873 _GL_CXXALIAS_RPL (vasprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
874 (char **result, const char *format, va_list args)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
875 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
876 # if !@HAVE_VASPRINTF@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
877 _GL_FUNCDECL_SYS (vasprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
878 (char **result, const char *format, va_list args) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
879 __attribute__ ((__format__ (__printf__, 2, 0))) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
880 _GL_ARG_NONNULL ((1, 2))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
881 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
882 _GL_CXXALIAS_SYS (vasprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
883 (char **result, const char *format, va_list args)); |
11971 | 884 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
885 _GL_CXXALIASWARN (vasprintf); |
11971 | 886 #endif |
887 | |
888 #if @GNULIB_VDPRINTF@ | |
889 # if @REPLACE_VDPRINTF@ | |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
890 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
891 # define vdprintf rpl_vdprintf |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
892 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
893 _GL_FUNCDECL_RPL (vdprintf, int, (int fd, const char *format, va_list args) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
894 __attribute__ ((__format__ (__printf__, 2, 0))) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
895 _GL_ARG_NONNULL ((2))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
896 _GL_CXXALIAS_RPL (vdprintf, int, (int fd, const char *format, va_list args)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
897 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
898 # if !@HAVE_VDPRINTF@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
899 _GL_FUNCDECL_SYS (vdprintf, int, (int fd, const char *format, va_list args) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
900 __attribute__ ((__format__ (__printf__, 2, 0))) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
901 _GL_ARG_NONNULL ((2))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
902 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
903 _GL_CXXALIAS_SYS (vdprintf, int, (int fd, const char *format, va_list args)); |
11971 | 904 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
905 _GL_CXXALIASWARN (vdprintf); |
11971 | 906 #elif defined GNULIB_POSIXCHECK |
907 # undef vdprintf | |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
908 # if HAVE_RAW_DECL_VDPRINTF |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
909 _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
910 "use gnulib module vdprintf for portability"); |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
911 # endif |
11971 | 912 #endif |
913 | |
12879
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
914 #if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@ |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
915 # if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \ |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
916 || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@) |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
917 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
918 # define vfprintf rpl_vfprintf |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
919 # endif |
12879
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
920 # define GNULIB_overrides_vfprintf 1 |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
921 _GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
922 __attribute__ ((__format__ (__printf__, 2, 0))) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
923 _GL_ARG_NONNULL ((1, 2))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
924 _GL_CXXALIAS_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
925 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
926 _GL_CXXALIAS_SYS (vfprintf, int, (FILE *fp, const char *format, va_list args)); |
11971 | 927 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
928 _GL_CXXALIASWARN (vfprintf); |
12879
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
929 #endif |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
930 #if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
931 # if !GNULIB_overrides_vfprintf |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
932 # undef vfprintf |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
933 # endif |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
934 /* Assume vfprintf is always declared. */ |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
935 _GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
936 "use gnulib module vfprintf-posix for portable " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
937 "POSIX compliance"); |
11971 | 938 #endif |
939 | |
12879
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
940 #if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@ |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
941 # if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \ |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
942 || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@) |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
943 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
944 # define vprintf rpl_vprintf |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
945 # endif |
12879
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
946 # define GNULIB_overrides_vprintf 1 |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
947 _GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
948 __attribute__ ((__format__ (__printf__, 1, 0))) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
949 _GL_ARG_NONNULL ((1))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
950 _GL_CXXALIAS_RPL (vprintf, int, (const char *format, va_list args)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
951 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
952 _GL_CXXALIAS_SYS (vprintf, int, (const char *format, va_list args)); |
11971 | 953 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
954 _GL_CXXALIASWARN (vprintf); |
12879
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
955 #endif |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
956 #if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
957 # if !GNULIB_overrides_vprintf |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
958 # undef vprintf |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
959 # endif |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
960 /* Assume vprintf is always declared. */ |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
961 _GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
962 "use gnulib module vprintf-posix for portable " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
963 "POSIX compliance"); |
11971 | 964 #endif |
965 | |
966 #if @GNULIB_VSNPRINTF@ | |
967 # if @REPLACE_VSNPRINTF@ | |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
968 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
969 # define vsnprintf rpl_vsnprintf |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
970 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
971 _GL_FUNCDECL_RPL (vsnprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
972 (char *str, size_t size, const char *format, va_list args) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
973 __attribute__ ((__format__ (__printf__, 3, 0))) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
974 _GL_ARG_NONNULL ((3))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
975 _GL_CXXALIAS_RPL (vsnprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
976 (char *str, size_t size, const char *format, va_list args)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
977 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
978 # if !@HAVE_DECL_VSNPRINTF@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
979 _GL_FUNCDECL_SYS (vsnprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
980 (char *str, size_t size, const char *format, va_list args) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
981 __attribute__ ((__format__ (__printf__, 3, 0))) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
982 _GL_ARG_NONNULL ((3))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
983 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
984 _GL_CXXALIAS_SYS (vsnprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
985 (char *str, size_t size, const char *format, va_list args)); |
11971 | 986 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
987 _GL_CXXALIASWARN (vsnprintf); |
11971 | 988 #elif defined GNULIB_POSIXCHECK |
989 # undef vsnprintf | |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
990 # if HAVE_RAW_DECL_VSNPRINTF |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
991 _GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
992 "use gnulib module vsnprintf for portability"); |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
993 # endif |
11971 | 994 #endif |
995 | |
996 #if @GNULIB_VSPRINTF_POSIX@ | |
997 # if @REPLACE_VSPRINTF@ | |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
998 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
999 # define vsprintf rpl_vsprintf |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
1000 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
1001 _GL_FUNCDECL_RPL (vsprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
1002 (char *str, const char *format, va_list args) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
1003 __attribute__ ((__format__ (__printf__, 2, 0))) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
1004 _GL_ARG_NONNULL ((1, 2))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
1005 _GL_CXXALIAS_RPL (vsprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
1006 (char *str, const char *format, va_list args)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
1007 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
1008 _GL_CXXALIAS_SYS (vsprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
1009 (char *str, const char *format, va_list args)); |
11971 | 1010 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
1011 _GL_CXXALIASWARN (vsprintf); |
11971 | 1012 #elif defined GNULIB_POSIXCHECK |
1013 # undef vsprintf | |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
1014 /* Assume vsprintf is always declared. */ |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
1015 _GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
1016 "use gnulib module vsprintf-posix for portable " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
1017 "POSIX compliance"); |
11971 | 1018 #endif |
1019 | |
9262 | 1020 |
1021 #endif /* _GL_STDIO_H */ | |
1022 #endif /* _GL_STDIO_H */ | |
1023 #endif |