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