Mercurial > hg > octave-shane > gnulib-hg
annotate lib/stdio.in.h @ 13121:472aa3de0fbb
fseeko: Fix C++ test error on mingw.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sat, 03 Apr 2010 14:08:25 +0200 (2010-04-03) |
parents | 4c61fd24cafa |
children | 01741ff1a40e |
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))); |
12202
a0f033ee41af
fseek: avoid compilation failure when fflush is replaced
Eric Blake <ebb9@byu.net>
parents:
12100
diff
changeset
|
409 # if !@GNULIB_FTELL@ |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
410 /* In order to avoid that ftell gets defined as a macro here, the |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
411 developer can request the 'ftell' module. */ |
12202
a0f033ee41af
fseek: avoid compilation failure when fflush is replaced
Eric Blake <ebb9@byu.net>
parents:
12100
diff
changeset
|
412 # undef ftell |
12724 | 413 # define ftell rpl_ftell |
414 static inline long _GL_ARG_NONNULL ((1)) | |
415 rpl_ftell (FILE *f) | |
416 { | |
417 return ftello (f); | |
418 } | |
12202
a0f033ee41af
fseek: avoid compilation failure when fflush is replaced
Eric Blake <ebb9@byu.net>
parents:
12100
diff
changeset
|
419 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
420 _GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
421 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
422 _GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp)); |
11653 | 423 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
424 _GL_CXXALIASWARN (ftello); |
11653 | 425 #elif defined GNULIB_POSIXCHECK |
12724 | 426 # define _GL_FTELL_WARN /* Category 1, above. */ |
427 # undef ftell | |
11971 | 428 # undef ftello |
12724 | 429 # if HAVE_RAW_DECL_FTELLO |
430 _GL_WARN_ON_USE (ftello, "ftello is unportable - " | |
431 "use gnulib module ftello for portability"); | |
432 # endif | |
433 #endif | |
434 | |
435 #ifdef _GL_FTELL_WARN | |
436 # undef _GL_FTELL_WARN | |
437 /* Here, either ftell is undefined (but C89 guarantees that it is | |
438 declared), or it is defined as rpl_ftell (declared above). */ | |
439 _GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB " | |
440 "on 32-bit platforms - " | |
441 "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
|
442 #endif |
953f72c1ffcc
Support SIGPIPE in stdio functions for writing.
Bruno Haible <bruno@clisp.org>
parents:
10433
diff
changeset
|
443 |
12878 | 444 |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
445 #if @GNULIB_FWRITE@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
446 # 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
|
447 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
448 # undef fwrite |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
449 # define fwrite rpl_fwrite |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
450 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
451 _GL_FUNCDECL_RPL (fwrite, size_t, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
452 (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
|
453 _GL_ARG_NONNULL ((1, 4))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
454 _GL_CXXALIAS_RPL (fwrite, size_t, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
455 (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
|
456 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
457 _GL_CXXALIAS_SYS (fwrite, size_t, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
458 (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
|
459 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
460 _GL_CXXALIASWARN (fwrite); |
10487
953f72c1ffcc
Support SIGPIPE in stdio functions for writing.
Bruno Haible <bruno@clisp.org>
parents:
10433
diff
changeset
|
461 #endif |
953f72c1ffcc
Support SIGPIPE in stdio functions for writing.
Bruno Haible <bruno@clisp.org>
parents:
10433
diff
changeset
|
462 |
9262 | 463 #if @GNULIB_GETDELIM@ |
464 /* Read input, up to (and including) the next occurrence of DELIMITER, from | |
465 STREAM, store it in *LINEPTR (and NUL-terminate it). | |
466 *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE | |
467 bytes of space. It is realloc'd as necessary. | |
468 Return the number of bytes read and stored at *LINEPTR (not including the | |
469 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
|
470 # if @REPLACE_GETDELIM@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
471 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
472 # undef getdelim |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
473 # define getdelim rpl_getdelim |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
474 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
475 _GL_FUNCDECL_RPL (getdelim, ssize_t, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
476 (char **lineptr, size_t *linesize, int delimiter, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
477 FILE *stream) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
478 _GL_ARG_NONNULL ((1, 2, 4))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
479 _GL_CXXALIAS_RPL (getdelim, ssize_t, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
480 (char **lineptr, size_t *linesize, int delimiter, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
481 FILE *stream)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
482 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
483 # if !@HAVE_DECL_GETDELIM@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
484 _GL_FUNCDECL_SYS (getdelim, ssize_t, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
485 (char **lineptr, size_t *linesize, int delimiter, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
486 FILE *stream) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
487 _GL_ARG_NONNULL ((1, 2, 4))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
488 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
489 _GL_CXXALIAS_SYS (getdelim, ssize_t, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
490 (char **lineptr, size_t *linesize, int delimiter, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
491 FILE *stream)); |
9262 | 492 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
493 _GL_CXXALIASWARN (getdelim); |
9262 | 494 #elif defined GNULIB_POSIXCHECK |
495 # undef getdelim | |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
496 # if HAVE_RAW_DECL_GETDELIM |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
497 _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
|
498 "use gnulib module getdelim for portability"); |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
499 # endif |
9262 | 500 #endif |
501 | |
502 #if @GNULIB_GETLINE@ | |
503 /* Read a line, up to (and including) the next newline, from STREAM, store it | |
504 in *LINEPTR (and NUL-terminate it). | |
505 *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE | |
506 bytes of space. It is realloc'd as necessary. | |
507 Return the number of bytes read and stored at *LINEPTR (not including the | |
508 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
|
509 # if @REPLACE_GETLINE@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
510 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
511 # undef getline |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
512 # define getline rpl_getline |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
513 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
514 _GL_FUNCDECL_RPL (getline, ssize_t, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
515 (char **lineptr, size_t *linesize, FILE *stream) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
516 _GL_ARG_NONNULL ((1, 2, 3))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
517 _GL_CXXALIAS_RPL (getline, ssize_t, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
518 (char **lineptr, size_t *linesize, FILE *stream)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
519 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
520 # if !@HAVE_DECL_GETLINE@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
521 _GL_FUNCDECL_SYS (getline, ssize_t, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
522 (char **lineptr, size_t *linesize, FILE *stream) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
523 _GL_ARG_NONNULL ((1, 2, 3))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
524 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
525 _GL_CXXALIAS_SYS (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)); |
9262 | 527 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
528 _GL_CXXALIASWARN (getline); |
9262 | 529 #elif defined GNULIB_POSIXCHECK |
530 # undef getline | |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
531 # if HAVE_RAW_DECL_GETLINE |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
532 _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
|
533 "use gnulib module getline for portability"); |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
534 # endif |
9262 | 535 #endif |
536 | |
12860
1825e6a0ff37
obstack-printf-posix: ensure declaration
Eric Blake <ebb9@byu.net>
parents:
12839
diff
changeset
|
537 #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
|
538 struct obstack; |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
539 /* 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
|
540 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
|
541 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
|
542 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
|
543 other error, return -1. */ |
11971 | 544 # if @REPLACE_OBSTACK_PRINTF@ |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
545 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
546 # define obstack_printf rpl_obstack_printf |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
547 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
548 _GL_FUNCDECL_RPL (obstack_printf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
549 (struct obstack *obs, const char *format, ...) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
550 __attribute__ ((__format__ (__printf__, 2, 3))) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
551 _GL_ARG_NONNULL ((1, 2))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
552 _GL_CXXALIAS_RPL (obstack_printf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
553 (struct obstack *obs, const char *format, ...)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
554 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
555 # if !@HAVE_DECL_OBSTACK_PRINTF@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
556 _GL_FUNCDECL_SYS (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 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
561 _GL_CXXALIAS_SYS (obstack_printf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
562 (struct obstack *obs, const char *format, ...)); |
11971 | 563 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
564 _GL_CXXALIASWARN (obstack_printf); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
565 # if @REPLACE_OBSTACK_PRINTF@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
566 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
567 # define obstack_vprintf rpl_obstack_vprintf |
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_FUNCDECL_RPL (obstack_vprintf, 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, va_list args) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
571 __attribute__ ((__format__ (__printf__, 2, 0))) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
572 _GL_ARG_NONNULL ((1, 2))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
573 _GL_CXXALIAS_RPL (obstack_vprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
574 (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
|
575 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
576 # if !@HAVE_DECL_OBSTACK_PRINTF@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
577 _GL_FUNCDECL_SYS (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 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
582 _GL_CXXALIAS_SYS (obstack_vprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
583 (struct obstack *obs, const char *format, va_list args)); |
11971 | 584 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
585 _GL_CXXALIASWARN (obstack_vprintf); |
11971 | 586 #endif |
587 | |
10433 | 588 #if @GNULIB_PERROR@ |
589 /* Print a message to standard error, describing the value of ERRNO, | |
590 (if STRING is not NULL and not empty) prefixed with STRING and ": ", | |
591 and terminated with a newline. */ | |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
592 # if @REPLACE_PERROR@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
593 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
594 # define perror rpl_perror |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
595 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
596 _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
|
597 _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
|
598 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
599 _GL_CXXALIAS_SYS (perror, void, (const char *string)); |
10433 | 600 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
601 _GL_CXXALIASWARN (perror); |
10433 | 602 #elif defined GNULIB_POSIXCHECK |
603 # undef perror | |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
604 /* Assume perror is always declared. */ |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
605 _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
|
606 "use gnulib module perror for portability"); |
10433 | 607 #endif |
608 | |
11971 | 609 #if @GNULIB_POPEN@ |
610 # if @REPLACE_POPEN@ | |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
611 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
612 # undef popen |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
613 # define popen rpl_popen |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
614 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
615 _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
|
616 _GL_ARG_NONNULL ((1, 2))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
617 _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
|
618 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
619 _GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode)); |
11971 | 620 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
621 _GL_CXXALIASWARN (popen); |
11971 | 622 #elif defined GNULIB_POSIXCHECK |
623 # undef popen | |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
624 # if HAVE_RAW_DECL_POPEN |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
625 _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
|
626 "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
|
627 # endif |
11971 | 628 #endif |
629 | |
12879
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
630 #if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@ |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
631 # if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \ |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
632 || (@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
|
633 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
11971 | 634 /* 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
|
635 # define printf __printf__ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
636 # endif |
12879
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
637 # define GNULIB_overrides_printf 1 |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
638 _GL_FUNCDECL_RPL_1 (__printf__, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
639 (const char *format, ...) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
640 __attribute__ ((__format__ (__printf__, 1, 2))) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
641 _GL_ARG_NONNULL ((1))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
642 _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
|
643 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
644 _GL_CXXALIAS_SYS (printf, int, (const char *format, ...)); |
11971 | 645 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
646 _GL_CXXALIASWARN (printf); |
12879
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
647 #endif |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
648 #if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
649 # if !GNULIB_overrides_printf |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
650 # undef printf |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
651 # endif |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
652 /* Assume printf is always declared. */ |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
653 _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
|
654 "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
|
655 "POSIX compliance"); |
11971 | 656 #endif |
657 | |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
658 #if @GNULIB_PUTC@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
659 # 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
|
660 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
661 # undef putc |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
662 # define putc rpl_fputc |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
663 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
664 _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
|
665 _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
|
666 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
667 _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
|
668 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
669 _GL_CXXALIASWARN (putc); |
11971 | 670 #endif |
671 | |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
672 #if @GNULIB_PUTCHAR@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
673 # 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
|
674 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
675 # undef putchar |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
676 # define putchar rpl_putchar |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
677 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
678 _GL_FUNCDECL_RPL (putchar, int, (int c)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
679 _GL_CXXALIAS_RPL (putchar, int, (int c)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
680 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
681 _GL_CXXALIAS_SYS (putchar, int, (int c)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
682 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
683 _GL_CXXALIASWARN (putchar); |
11971 | 684 #endif |
685 | |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
686 #if @GNULIB_PUTS@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
687 # 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
|
688 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
689 # undef puts |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
690 # define puts rpl_puts |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
691 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
692 _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
|
693 _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
|
694 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
695 _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
|
696 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
697 _GL_CXXALIASWARN (puts); |
11971 | 698 #endif |
699 | |
12041
73e9ab6e2c90
remove: new module, for mingw and Solaris 9 bugs
Eric Blake <ebb9@byu.net>
parents:
11972
diff
changeset
|
700 #if @GNULIB_REMOVE@ |
73e9ab6e2c90
remove: new module, for mingw and Solaris 9 bugs
Eric Blake <ebb9@byu.net>
parents:
11972
diff
changeset
|
701 # if @REPLACE_REMOVE@ |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
702 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
703 # undef remove |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
704 # define remove rpl_remove |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
705 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
706 _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
|
707 _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
|
708 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
709 _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
|
710 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
711 _GL_CXXALIASWARN (remove); |
12041
73e9ab6e2c90
remove: new module, for mingw and Solaris 9 bugs
Eric Blake <ebb9@byu.net>
parents:
11972
diff
changeset
|
712 #elif defined GNULIB_POSIXCHECK |
73e9ab6e2c90
remove: new module, for mingw and Solaris 9 bugs
Eric Blake <ebb9@byu.net>
parents:
11972
diff
changeset
|
713 # undef remove |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
714 /* Assume remove is always declared. */ |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
715 _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
|
716 "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
|
717 #endif |
73e9ab6e2c90
remove: new module, for mingw and Solaris 9 bugs
Eric Blake <ebb9@byu.net>
parents:
11972
diff
changeset
|
718 |
11972 | 719 #if @GNULIB_RENAME@ |
720 # if @REPLACE_RENAME@ | |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
721 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
722 # undef rename |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
723 # define rename rpl_rename |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
724 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
725 _GL_FUNCDECL_RPL (rename, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
726 (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
|
727 _GL_ARG_NONNULL ((1, 2))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
728 _GL_CXXALIAS_RPL (rename, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
729 (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
|
730 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
731 _GL_CXXALIAS_SYS (rename, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
732 (const char *old_filename, const char *new_filename)); |
11972 | 733 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
734 _GL_CXXALIASWARN (rename); |
11972 | 735 #elif defined GNULIB_POSIXCHECK |
736 # undef rename | |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
737 /* Assume rename is always declared. */ |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
738 _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
|
739 "use gnulib module rename for more portability"); |
11972 | 740 #endif |
741 | |
12099 | 742 #if @GNULIB_RENAMEAT@ |
12100 | 743 # if @REPLACE_RENAMEAT@ |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
744 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
745 # undef renameat |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
746 # define renameat rpl_renameat |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
747 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
748 _GL_FUNCDECL_RPL (renameat, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
749 (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
|
750 _GL_ARG_NONNULL ((2, 4))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
751 _GL_CXXALIAS_RPL (renameat, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
752 (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
|
753 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
754 # if !@HAVE_RENAMEAT@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
755 _GL_FUNCDECL_SYS (renameat, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
756 (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
|
757 _GL_ARG_NONNULL ((2, 4))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
758 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
759 _GL_CXXALIAS_SYS (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)); |
12100 | 761 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
762 _GL_CXXALIASWARN (renameat); |
12099 | 763 #elif defined GNULIB_POSIXCHECK |
764 # undef renameat | |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
765 # if HAVE_RAW_DECL_RENAMEAT |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
766 _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
|
767 "use gnulib module renameat for portability"); |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
768 # endif |
12099 | 769 #endif |
770 | |
11971 | 771 #if @GNULIB_SNPRINTF@ |
772 # if @REPLACE_SNPRINTF@ | |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
773 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
774 # define snprintf rpl_snprintf |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
775 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
776 _GL_FUNCDECL_RPL (snprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
777 (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
|
778 __attribute__ ((__format__ (__printf__, 3, 4))) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
779 _GL_ARG_NONNULL ((3))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
780 _GL_CXXALIAS_RPL (snprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
781 (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
|
782 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
783 # if !@HAVE_DECL_SNPRINTF@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
784 _GL_FUNCDECL_SYS (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 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
789 _GL_CXXALIAS_SYS (snprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
790 (char *str, size_t size, const char *format, ...)); |
11971 | 791 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
792 _GL_CXXALIASWARN (snprintf); |
11971 | 793 #elif defined GNULIB_POSIXCHECK |
794 # undef snprintf | |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
795 # if HAVE_RAW_DECL_SNPRINTF |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
796 _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
|
797 "use gnulib module snprintf for portability"); |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
798 # endif |
11971 | 799 #endif |
800 | |
12724 | 801 /* Some people would argue that sprintf should be handled like gets |
802 (for example, OpenBSD issues a link warning for both functions), | |
803 since both can cause security holes due to buffer overruns. | |
804 However, we believe that sprintf can be used safely, and is more | |
805 efficient than snprintf in those safe cases; and as proof of our | |
806 belief, we use sprintf in several gnulib modules. So this header | |
807 intentionally avoids adding a warning to sprintf except when | |
808 GNULIB_POSIXCHECK is defined. */ | |
809 | |
11971 | 810 #if @GNULIB_SPRINTF_POSIX@ |
811 # if @REPLACE_SPRINTF@ | |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
812 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
813 # define sprintf rpl_sprintf |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
814 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
815 _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
|
816 __attribute__ ((__format__ (__printf__, 2, 3))) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
817 _GL_ARG_NONNULL ((1, 2))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
818 _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
|
819 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
820 _GL_CXXALIAS_SYS (sprintf, int, (char *str, const char *format, ...)); |
11971 | 821 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
822 _GL_CXXALIASWARN (sprintf); |
11971 | 823 #elif defined GNULIB_POSIXCHECK |
824 # undef sprintf | |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
825 /* Assume sprintf is always declared. */ |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
826 _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
|
827 "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
|
828 "POSIX compliance"); |
11971 | 829 #endif |
830 | |
831 #if @GNULIB_VASPRINTF@ | |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
832 /* 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
|
833 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
|
834 *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
|
835 NUL. Upon memory allocation error, or some other error, return -1. */ |
11971 | 836 # if @REPLACE_VASPRINTF@ |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
837 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
838 # define asprintf rpl_asprintf |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
839 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
840 _GL_FUNCDECL_RPL (asprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
841 (char **result, const char *format, ...) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
842 __attribute__ ((__format__ (__printf__, 2, 3))) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
843 _GL_ARG_NONNULL ((1, 2))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
844 _GL_CXXALIAS_RPL (asprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
845 (char **result, const char *format, ...)); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
846 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
847 # if !@HAVE_VASPRINTF@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
848 _GL_FUNCDECL_SYS (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 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
853 _GL_CXXALIAS_SYS (asprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
854 (char **result, const char *format, ...)); |
11971 | 855 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
856 _GL_CXXALIASWARN (asprintf); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
857 # if @REPLACE_VASPRINTF@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
858 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
859 # define vasprintf rpl_vasprintf |
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_FUNCDECL_RPL (vasprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
862 (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
|
863 __attribute__ ((__format__ (__printf__, 2, 0))) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
864 _GL_ARG_NONNULL ((1, 2))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
865 _GL_CXXALIAS_RPL (vasprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
866 (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
|
867 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
868 # if !@HAVE_VASPRINTF@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
869 _GL_FUNCDECL_SYS (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 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
874 _GL_CXXALIAS_SYS (vasprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
875 (char **result, const char *format, va_list args)); |
11971 | 876 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
877 _GL_CXXALIASWARN (vasprintf); |
11971 | 878 #endif |
879 | |
880 #if @GNULIB_VDPRINTF@ | |
881 # if @REPLACE_VDPRINTF@ | |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
882 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
883 # define vdprintf rpl_vdprintf |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
884 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
885 _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
|
886 __attribute__ ((__format__ (__printf__, 2, 0))) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
887 _GL_ARG_NONNULL ((2))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
888 _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
|
889 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
890 # if !@HAVE_VDPRINTF@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
891 _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
|
892 __attribute__ ((__format__ (__printf__, 2, 0))) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
893 _GL_ARG_NONNULL ((2))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
894 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
895 _GL_CXXALIAS_SYS (vdprintf, int, (int fd, const char *format, va_list args)); |
11971 | 896 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
897 _GL_CXXALIASWARN (vdprintf); |
11971 | 898 #elif defined GNULIB_POSIXCHECK |
899 # undef vdprintf | |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
900 # if HAVE_RAW_DECL_VDPRINTF |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
901 _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
|
902 "use gnulib module vdprintf for portability"); |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
903 # endif |
11971 | 904 #endif |
905 | |
12879
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
906 #if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@ |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
907 # if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \ |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
908 || (@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
|
909 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
910 # define vfprintf rpl_vfprintf |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
911 # endif |
12879
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
912 # define GNULIB_overrides_vfprintf 1 |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
913 _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
|
914 __attribute__ ((__format__ (__printf__, 2, 0))) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
915 _GL_ARG_NONNULL ((1, 2))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
916 _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
|
917 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
918 _GL_CXXALIAS_SYS (vfprintf, int, (FILE *fp, const char *format, va_list args)); |
11971 | 919 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
920 _GL_CXXALIASWARN (vfprintf); |
12879
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
921 #endif |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
922 #if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
923 # if !GNULIB_overrides_vfprintf |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
924 # undef vfprintf |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
925 # endif |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
926 /* Assume vfprintf is always declared. */ |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
927 _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
|
928 "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
|
929 "POSIX compliance"); |
11971 | 930 #endif |
931 | |
12879
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
932 #if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@ |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
933 # if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \ |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
934 || (@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
|
935 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
936 # define vprintf rpl_vprintf |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
937 # endif |
12879
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
938 # define GNULIB_overrides_vprintf 1 |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
939 _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
|
940 __attribute__ ((__format__ (__printf__, 1, 0))) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
941 _GL_ARG_NONNULL ((1))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
942 _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
|
943 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
944 _GL_CXXALIAS_SYS (vprintf, int, (const char *format, va_list args)); |
11971 | 945 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
946 _GL_CXXALIASWARN (vprintf); |
12879
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
947 #endif |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
948 #if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
949 # if !GNULIB_overrides_vprintf |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
950 # undef vprintf |
037f6bf7ec72
Improve *printf warning condition.
Bruno Haible <bruno@clisp.org>
parents:
12878
diff
changeset
|
951 # endif |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
952 /* Assume vprintf is always declared. */ |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
953 _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
|
954 "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
|
955 "POSIX compliance"); |
11971 | 956 #endif |
957 | |
958 #if @GNULIB_VSNPRINTF@ | |
959 # if @REPLACE_VSNPRINTF@ | |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
960 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
961 # define vsnprintf rpl_vsnprintf |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
962 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
963 _GL_FUNCDECL_RPL (vsnprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
964 (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
|
965 __attribute__ ((__format__ (__printf__, 3, 0))) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
966 _GL_ARG_NONNULL ((3))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
967 _GL_CXXALIAS_RPL (vsnprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
968 (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
|
969 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
970 # if !@HAVE_DECL_VSNPRINTF@ |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
971 _GL_FUNCDECL_SYS (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 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
976 _GL_CXXALIAS_SYS (vsnprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
977 (char *str, size_t size, const char *format, va_list args)); |
11971 | 978 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
979 _GL_CXXALIASWARN (vsnprintf); |
11971 | 980 #elif defined GNULIB_POSIXCHECK |
981 # undef vsnprintf | |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
982 # if HAVE_RAW_DECL_VSNPRINTF |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
983 _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
|
984 "use gnulib module vsnprintf for portability"); |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
985 # endif |
11971 | 986 #endif |
987 | |
988 #if @GNULIB_VSPRINTF_POSIX@ | |
989 # if @REPLACE_VSPRINTF@ | |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
990 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
991 # define vsprintf rpl_vsprintf |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
992 # endif |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
993 _GL_FUNCDECL_RPL (vsprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
994 (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
|
995 __attribute__ ((__format__ (__printf__, 2, 0))) |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
996 _GL_ARG_NONNULL ((1, 2))); |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
997 _GL_CXXALIAS_RPL (vsprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
998 (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
|
999 # else |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
1000 _GL_CXXALIAS_SYS (vsprintf, int, |
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
1001 (char *str, const char *format, va_list args)); |
11971 | 1002 # endif |
12940
4c61fd24cafa
stdio: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12885
diff
changeset
|
1003 _GL_CXXALIASWARN (vsprintf); |
11971 | 1004 #elif defined GNULIB_POSIXCHECK |
1005 # undef vsprintf | |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
1006 /* Assume vsprintf is always declared. */ |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12762
diff
changeset
|
1007 _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
|
1008 "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
|
1009 "POSIX compliance"); |
11971 | 1010 #endif |
1011 | |
9262 | 1012 |
1013 #endif /* _GL_STDIO_H */ | |
1014 #endif /* _GL_STDIO_H */ | |
1015 #endif |