summaryrefslogtreecommitdiffstats
path: root/gl/stdio.in.h
diff options
context:
space:
mode:
authorLorenz <12514511+RincewindsHat@users.noreply.github.com>2023-03-27 10:34:19 (GMT)
committerGitHub <noreply@github.com>2023-03-27 10:34:19 (GMT)
commitbbc97d57f7f9e0a49fea78c02861c444fe95d46a (patch)
treec8956bbbe9b73e37d261735699a82cccaacea0db /gl/stdio.in.h
parent917dba07fded8ef04967183a4c0443b5cce2db82 (diff)
parent482aa6c7fe86d7a899e4888d14149f1ccd5401fd (diff)
downloadmonitoring-plugins-bbc97d57f7f9e0a49fea78c02861c444fe95d46a.tar.gz
Merge branch 'master' into dev/check_ssh-patches
Diffstat (limited to 'gl/stdio.in.h')
-rw-r--r--gl/stdio.in.h715
1 files changed, 541 insertions, 174 deletions
diff --git a/gl/stdio.in.h b/gl/stdio.in.h
index 06cbad0..59cbea3 100644
--- a/gl/stdio.in.h
+++ b/gl/stdio.in.h
@@ -1,19 +1,19 @@
1/* A GNU-like <stdio.h>. 1/* A GNU-like <stdio.h>.
2 2
3 Copyright (C) 2004, 2007-2013 Free Software Foundation, Inc. 3 Copyright (C) 2004, 2007-2023 Free Software Foundation, Inc.
4 4
5 This program is free software; you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU Lesser General Public License as
7 the Free Software Foundation; either version 3, or (at your option) 7 published by the Free Software Foundation; either version 2.1 of the
8 any later version. 8 License, or (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU Lesser General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU Lesser General Public License
16 along with this program; if not, see <http://www.gnu.org/licenses/>. */ 16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17 17
18#if __GNUC__ >= 3 18#if __GNUC__ >= 3
19@PRAGMA_SYSTEM_HEADER@ 19@PRAGMA_SYSTEM_HEADER@
@@ -56,36 +56,103 @@
56 May also define off_t to a 64-bit type on native Windows. */ 56 May also define off_t to a 64-bit type on native Windows. */
57#include <sys/types.h> 57#include <sys/types.h>
58 58
59/* Solaris 10 and NetBSD 7.0 declare renameat in <unistd.h>, not in <stdio.h>. */
60/* But in any case avoid namespace pollution on glibc systems. */
61#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && (defined __sun || defined __NetBSD__) \
62 && ! defined __GLIBC__
63# include <unistd.h>
64#endif
65
66/* Android 4.3 declares renameat in <sys/stat.h>, not in <stdio.h>. */
67/* But in any case avoid namespace pollution on glibc systems. */
68#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \
69 && ! defined __GLIBC__
70# include <sys/stat.h>
71#endif
72
73/* MSVC declares 'perror' in <stdlib.h>, not in <stdio.h>. We must include
74 it before we #define perror rpl_perror. */
75/* But in any case avoid namespace pollution on glibc systems. */
76#if (@GNULIB_PERROR@ || defined GNULIB_POSIXCHECK) \
77 && (defined _WIN32 && ! defined __CYGWIN__) \
78 && ! defined __GLIBC__
79# include <stdlib.h>
80#endif
81
82/* MSVC declares 'remove' in <io.h>, not in <stdio.h>. We must include
83 it before we #define remove rpl_remove. */
84/* MSVC declares 'rename' in <io.h>, not in <stdio.h>. We must include
85 it before we #define rename rpl_rename. */
86/* But in any case avoid namespace pollution on glibc systems. */
87#if (@GNULIB_REMOVE@ || @GNULIB_RENAME@ || defined GNULIB_POSIXCHECK) \
88 && (defined _WIN32 && ! defined __CYGWIN__) \
89 && ! defined __GLIBC__
90# include <io.h>
91#endif
92
93
94/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
95 that can be freed by passing them as the Ith argument to the
96 function F. */
97#ifndef _GL_ATTRIBUTE_DEALLOC
98# if __GNUC__ >= 11
99# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
100# else
101# define _GL_ATTRIBUTE_DEALLOC(f, i)
102# endif
103#endif
104
59/* The __attribute__ feature is available in gcc versions 2.5 and later. 105/* The __attribute__ feature is available in gcc versions 2.5 and later.
60 The __-protected variants of the attributes 'format' and 'printf' are 106 The __-protected variants of the attributes 'format' and 'printf' are
61 accepted by gcc versions 2.6.4 (effectively 2.7) and later. 107 accepted by gcc versions 2.6.4 (effectively 2.7) and later.
62 We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because 108 We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because
63 gnulib and libintl do '#define printf __printf__' when they override 109 gnulib and libintl do '#define printf __printf__' when they override
64 the 'printf' function. */ 110 the 'printf' function. */
65#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) 111#ifndef _GL_ATTRIBUTE_FORMAT
66# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) 112# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) || defined __clang__
113# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
114# else
115# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
116# endif
117#endif
118
119/* An __attribute__ __format__ specifier for a function that takes a format
120 string and arguments, where the format string directives are the ones
121 standardized by ISO C99 and POSIX.
122 _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD */
123/* __gnu_printf__ is supported in GCC >= 4.4. */
124#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
125# define _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD __gnu_printf__
67#else 126#else
68# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */ 127# define _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD __printf__
69#endif 128#endif
70 129
71/* _GL_ATTRIBUTE_FORMAT_PRINTF 130/* An __attribute__ __format__ specifier for a function that takes a format
131 string and arguments, where the format string directives are the ones of the
132 system printf(), rather than the ones standardized by ISO C99 and POSIX.
133 _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM */
134/* On mingw, Gnulib sets __USE_MINGW_ANSI_STDIO in order to get closer to
135 the standards. The macro GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU indicates
136 whether this change is effective. On older mingw, it is not. */
137#if GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU
138# define _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD
139#else
140# define _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM __printf__
141#endif
142
143/* _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD
72 indicates to GCC that the function takes a format string and arguments, 144 indicates to GCC that the function takes a format string and arguments,
73 where the format string directives are the ones standardized by ISO C99 145 where the format string directives are the ones standardized by ISO C99
74 and POSIX. */ 146 and POSIX. */
75#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) 147#define _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD(formatstring_parameter, first_argument) \
76# define _GL_ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \ 148 _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, formatstring_parameter, first_argument))
77 _GL_ATTRIBUTE_FORMAT ((__gnu_printf__, formatstring_parameter, first_argument))
78#else
79# define _GL_ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \
80 _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument))
81#endif
82 149
83/* _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_PRINTF, 150/* _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD,
84 except that it indicates to GCC that the supported format string directives 151 except that it indicates to GCC that the supported format string directives
85 are the ones of the system printf(), rather than the ones standardized by 152 are the ones of the system printf(), rather than the ones standardized by
86 ISO C99 and POSIX. */ 153 ISO C99 and POSIX. */
87#define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \ 154#define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \
88 _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument)) 155 _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM, formatstring_parameter, first_argument))
89 156
90/* _GL_ATTRIBUTE_FORMAT_SCANF 157/* _GL_ATTRIBUTE_FORMAT_SCANF
91 indicates to GCC that the function takes a format string and arguments, 158 indicates to GCC that the function takes a format string and arguments,
@@ -106,14 +173,6 @@
106#define _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM(formatstring_parameter, first_argument) \ 173#define _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM(formatstring_parameter, first_argument) \
107 _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument)) 174 _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument))
108 175
109/* Solaris 10 declares renameat in <unistd.h>, not in <stdio.h>. */
110/* But in any case avoid namespace pollution on glibc systems. */
111#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __sun \
112 && ! defined __GLIBC__
113# include <unistd.h>
114#endif
115
116
117/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 176/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
118 177
119/* The definition of _GL_ARG_NONNULL is copied here. */ 178/* The definition of _GL_ARG_NONNULL is copied here. */
@@ -124,23 +183,32 @@
124#define _GL_STDIO_STRINGIZE(token) #token 183#define _GL_STDIO_STRINGIZE(token) #token
125#define _GL_STDIO_MACROEXPAND_AND_STRINGIZE(token) _GL_STDIO_STRINGIZE(token) 184#define _GL_STDIO_MACROEXPAND_AND_STRINGIZE(token) _GL_STDIO_STRINGIZE(token)
126 185
186/* When also using extern inline, suppress the use of static inline in
187 standard headers of problematic Apple configurations, as Libc at
188 least through Libc-825.26 (2013-04-09) mishandles it; see, e.g.,
189 <https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html>.
190 Perhaps Apple will fix this some day. */
191#if (defined _GL_EXTERN_INLINE_IN_USE && defined __APPLE__ \
192 && defined __GNUC__ && defined __STDC__)
193# undef putc_unlocked
194#endif
127 195
128#if @GNULIB_DPRINTF@ 196#if @GNULIB_DPRINTF@
129# if @REPLACE_DPRINTF@ 197# if @REPLACE_DPRINTF@
130# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 198# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
131# define dprintf rpl_dprintf 199# define dprintf rpl_dprintf
132# endif 200# endif
133_GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *format, ...) 201_GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *restrict format, ...)
134 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) 202 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
135 _GL_ARG_NONNULL ((2))); 203 _GL_ARG_NONNULL ((2)));
136_GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *format, ...)); 204_GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *restrict format, ...));
137# else 205# else
138# if !@HAVE_DPRINTF@ 206# if !@HAVE_DPRINTF@
139_GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *format, ...) 207_GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *restrict format, ...)
140 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) 208 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
141 _GL_ARG_NONNULL ((2))); 209 _GL_ARG_NONNULL ((2)));
142# endif 210# endif
143_GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *format, ...)); 211_GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *restrict format, ...));
144# endif 212# endif
145_GL_CXXALIASWARN (dprintf); 213_GL_CXXALIASWARN (dprintf);
146#elif defined GNULIB_POSIXCHECK 214#elif defined GNULIB_POSIXCHECK
@@ -162,7 +230,9 @@ _GL_CXXALIAS_RPL (fclose, int, (FILE *stream));
162# else 230# else
163_GL_CXXALIAS_SYS (fclose, int, (FILE *stream)); 231_GL_CXXALIAS_SYS (fclose, int, (FILE *stream));
164# endif 232# endif
233# if __GLIBC__ >= 2
165_GL_CXXALIASWARN (fclose); 234_GL_CXXALIASWARN (fclose);
235# endif
166#elif defined GNULIB_POSIXCHECK 236#elif defined GNULIB_POSIXCHECK
167# undef fclose 237# undef fclose
168/* Assume fclose is always declared. */ 238/* Assume fclose is always declared. */
@@ -170,24 +240,84 @@ _GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - "
170 "use gnulib module fclose for portable POSIX compliance"); 240 "use gnulib module fclose for portable POSIX compliance");
171#endif 241#endif
172 242
243#if @GNULIB_MDA_FCLOSEALL@
244/* On native Windows, map 'fcloseall' to '_fcloseall', so that -loldnames is
245 not required. In C++ with GNULIB_NAMESPACE, avoid differences between
246 platforms by defining GNULIB_NAMESPACE::fcloseall on all platforms that have
247 it. */
248# if defined _WIN32 && !defined __CYGWIN__
249# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
250# undef fcloseall
251# define fcloseall _fcloseall
252# endif
253_GL_CXXALIAS_MDA (fcloseall, int, (void));
254# else
255# if @HAVE_DECL_FCLOSEALL@
256# if defined __FreeBSD__ || defined __DragonFly__
257_GL_CXXALIAS_SYS (fcloseall, void, (void));
258# else
259_GL_CXXALIAS_SYS (fcloseall, int, (void));
260# endif
261# endif
262# endif
263# if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_FCLOSEALL@
264_GL_CXXALIASWARN (fcloseall);
265# endif
266#endif
267
173#if @GNULIB_FDOPEN@ 268#if @GNULIB_FDOPEN@
174# if @REPLACE_FDOPEN@ 269# if @REPLACE_FDOPEN@
175# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 270# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
176# undef fdopen 271# undef fdopen
177# define fdopen rpl_fdopen 272# define fdopen rpl_fdopen
178# endif 273# endif
179_GL_FUNCDECL_RPL (fdopen, FILE *, (int fd, const char *mode) 274_GL_FUNCDECL_RPL (fdopen, FILE *,
180 _GL_ARG_NONNULL ((2))); 275 (int fd, const char *mode)
276 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1));
181_GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode)); 277_GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode));
278# elif defined _WIN32 && !defined __CYGWIN__
279# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
280# undef fdopen
281# define fdopen _fdopen
282# endif
283_GL_CXXALIAS_MDA (fdopen, FILE *, (int fd, const char *mode));
182# else 284# else
285# if __GNUC__ >= 11
286/* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose. */
287_GL_FUNCDECL_SYS (fdopen, FILE *,
288 (int fd, const char *mode)
289 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1));
290# endif
183_GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode)); 291_GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode));
184# endif 292# endif
185_GL_CXXALIASWARN (fdopen); 293_GL_CXXALIASWARN (fdopen);
186#elif defined GNULIB_POSIXCHECK 294#else
187# undef fdopen 295# if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined fdopen
296/* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose. */
297_GL_FUNCDECL_SYS (fdopen, FILE *,
298 (int fd, const char *mode)
299 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1));
300# endif
301# if defined GNULIB_POSIXCHECK
302# undef fdopen
188/* Assume fdopen is always declared. */ 303/* Assume fdopen is always declared. */
189_GL_WARN_ON_USE (fdopen, "fdopen on native Windows platforms is not POSIX compliant - " 304_GL_WARN_ON_USE (fdopen, "fdopen on native Windows platforms is not POSIX compliant - "
190 "use gnulib module fdopen for portability"); 305 "use gnulib module fdopen for portability");
306# elif @GNULIB_MDA_FDOPEN@
307/* On native Windows, map 'fdopen' to '_fdopen', so that -loldnames is not
308 required. In C++ with GNULIB_NAMESPACE, avoid differences between
309 platforms by defining GNULIB_NAMESPACE::fdopen always. */
310# if defined _WIN32 && !defined __CYGWIN__
311# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
312# undef fdopen
313# define fdopen _fdopen
314# endif
315_GL_CXXALIAS_MDA (fdopen, FILE *, (int fd, const char *mode));
316# else
317_GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode));
318# endif
319_GL_CXXALIASWARN (fdopen);
320# endif
191#endif 321#endif
192 322
193#if @GNULIB_FFLUSH@ 323#if @GNULIB_FFLUSH@
@@ -206,7 +336,9 @@ _GL_CXXALIAS_RPL (fflush, int, (FILE *gl_stream));
206# else 336# else
207_GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream)); 337_GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream));
208# endif 338# endif
339# if __GLIBC__ >= 2
209_GL_CXXALIASWARN (fflush); 340_GL_CXXALIASWARN (fflush);
341# endif
210#elif defined GNULIB_POSIXCHECK 342#elif defined GNULIB_POSIXCHECK
211# undef fflush 343# undef fflush
212/* Assume fflush is always declared. */ 344/* Assume fflush is always declared. */
@@ -225,7 +357,9 @@ _GL_CXXALIAS_RPL (fgetc, int, (FILE *stream));
225# else 357# else
226_GL_CXXALIAS_SYS (fgetc, int, (FILE *stream)); 358_GL_CXXALIAS_SYS (fgetc, int, (FILE *stream));
227# endif 359# endif
360# if __GLIBC__ >= 2
228_GL_CXXALIASWARN (fgetc); 361_GL_CXXALIASWARN (fgetc);
362# endif
229#endif 363#endif
230 364
231#if @GNULIB_FGETS@ 365#if @GNULIB_FGETS@
@@ -234,33 +368,74 @@ _GL_CXXALIASWARN (fgetc);
234# undef fgets 368# undef fgets
235# define fgets rpl_fgets 369# define fgets rpl_fgets
236# endif 370# endif
237_GL_FUNCDECL_RPL (fgets, char *, (char *s, int n, FILE *stream) 371_GL_FUNCDECL_RPL (fgets, char *,
238 _GL_ARG_NONNULL ((1, 3))); 372 (char *restrict s, int n, FILE *restrict stream)
239_GL_CXXALIAS_RPL (fgets, char *, (char *s, int n, FILE *stream)); 373 _GL_ARG_NONNULL ((1, 3)));
374_GL_CXXALIAS_RPL (fgets, char *,
375 (char *restrict s, int n, FILE *restrict stream));
240# else 376# else
241_GL_CXXALIAS_SYS (fgets, char *, (char *s, int n, FILE *stream)); 377_GL_CXXALIAS_SYS (fgets, char *,
378 (char *restrict s, int n, FILE *restrict stream));
242# endif 379# endif
380# if __GLIBC__ >= 2
243_GL_CXXALIASWARN (fgets); 381_GL_CXXALIASWARN (fgets);
382# endif
383#endif
384
385#if @GNULIB_MDA_FILENO@
386/* On native Windows, map 'fileno' to '_fileno', so that -loldnames is not
387 required. In C++ with GNULIB_NAMESPACE, avoid differences between
388 platforms by defining GNULIB_NAMESPACE::fileno always. */
389# if defined _WIN32 && !defined __CYGWIN__
390# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
391# undef fileno
392# define fileno _fileno
393# endif
394_GL_CXXALIAS_MDA (fileno, int, (FILE *restrict stream));
395# else
396_GL_CXXALIAS_SYS (fileno, int, (FILE *restrict stream));
397# endif
398_GL_CXXALIASWARN (fileno);
244#endif 399#endif
245 400
246#if @GNULIB_FOPEN@ 401#if @GNULIB_FOPEN@
247# if @REPLACE_FOPEN@ 402# if (@GNULIB_FOPEN@ && @REPLACE_FOPEN@) \
403 || (@GNULIB_FOPEN_GNU@ && @REPLACE_FOPEN_FOR_FOPEN_GNU@)
248# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 404# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
249# undef fopen 405# undef fopen
250# define fopen rpl_fopen 406# define fopen rpl_fopen
251# endif 407# endif
252_GL_FUNCDECL_RPL (fopen, FILE *, (const char *filename, const char *mode) 408_GL_FUNCDECL_RPL (fopen, FILE *,
253 _GL_ARG_NONNULL ((1, 2))); 409 (const char *restrict filename, const char *restrict mode)
254_GL_CXXALIAS_RPL (fopen, FILE *, (const char *filename, const char *mode)); 410 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1));
411_GL_CXXALIAS_RPL (fopen, FILE *,
412 (const char *restrict filename, const char *restrict mode));
255# else 413# else
256_GL_CXXALIAS_SYS (fopen, FILE *, (const char *filename, const char *mode)); 414# if __GNUC__ >= 11
415/* For -Wmismatched-dealloc: Associate fopen with fclose or rpl_fclose. */
416_GL_FUNCDECL_SYS (fopen, FILE *,
417 (const char *restrict filename, const char *restrict mode)
418 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1));
419# endif
420_GL_CXXALIAS_SYS (fopen, FILE *,
421 (const char *restrict filename, const char *restrict mode));
257# endif 422# endif
423# if __GLIBC__ >= 2
258_GL_CXXALIASWARN (fopen); 424_GL_CXXALIASWARN (fopen);
259#elif defined GNULIB_POSIXCHECK 425# endif
260# undef fopen 426#else
427# if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined fopen
428/* For -Wmismatched-dealloc: Associate fopen with fclose or rpl_fclose. */
429_GL_FUNCDECL_SYS (fopen, FILE *,
430 (const char *restrict filename, const char *restrict mode)
431 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1));
432# endif
433# if defined GNULIB_POSIXCHECK
434# undef fopen
261/* Assume fopen is always declared. */ 435/* Assume fopen is always declared. */
262_GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX compliant - " 436_GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX compliant - "
263 "use gnulib module fopen for portability"); 437 "use gnulib module fopen for portability");
438# endif
264#endif 439#endif
265 440
266#if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@ 441#if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@
@@ -271,19 +446,25 @@ _GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX complian
271# endif 446# endif
272# define GNULIB_overrides_fprintf 1 447# define GNULIB_overrides_fprintf 1
273# if @GNULIB_FPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ 448# if @GNULIB_FPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
274_GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...) 449_GL_FUNCDECL_RPL (fprintf, int,
275 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) 450 (FILE *restrict fp, const char *restrict format, ...)
276 _GL_ARG_NONNULL ((1, 2))); 451 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
452 _GL_ARG_NONNULL ((1, 2)));
277# else 453# else
278_GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...) 454_GL_FUNCDECL_RPL (fprintf, int,
279 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3) 455 (FILE *restrict fp, const char *restrict format, ...)
280 _GL_ARG_NONNULL ((1, 2))); 456 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3)
457 _GL_ARG_NONNULL ((1, 2)));
281# endif 458# endif
282_GL_CXXALIAS_RPL (fprintf, int, (FILE *fp, const char *format, ...)); 459_GL_CXXALIAS_RPL (fprintf, int,
460 (FILE *restrict fp, const char *restrict format, ...));
283# else 461# else
284_GL_CXXALIAS_SYS (fprintf, int, (FILE *fp, const char *format, ...)); 462_GL_CXXALIAS_SYS (fprintf, int,
463 (FILE *restrict fp, const char *restrict format, ...));
285# endif 464# endif
465# if __GLIBC__ >= 2
286_GL_CXXALIASWARN (fprintf); 466_GL_CXXALIASWARN (fprintf);
467# endif
287#endif 468#endif
288#if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK 469#if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
289# if !GNULIB_overrides_fprintf 470# if !GNULIB_overrides_fprintf
@@ -334,7 +515,9 @@ _GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream));
334# else 515# else
335_GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream)); 516_GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream));
336# endif 517# endif
518# if __GLIBC__ >= 2
337_GL_CXXALIASWARN (fputc); 519_GL_CXXALIASWARN (fputc);
520# endif
338#endif 521#endif
339 522
340#if @GNULIB_FPUTS@ 523#if @GNULIB_FPUTS@
@@ -343,13 +526,18 @@ _GL_CXXALIASWARN (fputc);
343# undef fputs 526# undef fputs
344# define fputs rpl_fputs 527# define fputs rpl_fputs
345# endif 528# endif
346_GL_FUNCDECL_RPL (fputs, int, (const char *string, FILE *stream) 529_GL_FUNCDECL_RPL (fputs, int,
347 _GL_ARG_NONNULL ((1, 2))); 530 (const char *restrict string, FILE *restrict stream)
348_GL_CXXALIAS_RPL (fputs, int, (const char *string, FILE *stream)); 531 _GL_ARG_NONNULL ((1, 2)));
532_GL_CXXALIAS_RPL (fputs, int,
533 (const char *restrict string, FILE *restrict stream));
349# else 534# else
350_GL_CXXALIAS_SYS (fputs, int, (const char *string, FILE *stream)); 535_GL_CXXALIAS_SYS (fputs, int,
536 (const char *restrict string, FILE *restrict stream));
351# endif 537# endif
538# if __GLIBC__ >= 2
352_GL_CXXALIASWARN (fputs); 539_GL_CXXALIASWARN (fputs);
540# endif
353#endif 541#endif
354 542
355#if @GNULIB_FREAD@ 543#if @GNULIB_FREAD@
@@ -358,13 +546,21 @@ _GL_CXXALIASWARN (fputs);
358# undef fread 546# undef fread
359# define fread rpl_fread 547# define fread rpl_fread
360# endif 548# endif
361_GL_FUNCDECL_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream) 549_GL_FUNCDECL_RPL (fread, size_t,
362 _GL_ARG_NONNULL ((4))); 550 (void *restrict ptr, size_t s, size_t n,
363_GL_CXXALIAS_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream)); 551 FILE *restrict stream)
552 _GL_ARG_NONNULL ((4)));
553_GL_CXXALIAS_RPL (fread, size_t,
554 (void *restrict ptr, size_t s, size_t n,
555 FILE *restrict stream));
364# else 556# else
365_GL_CXXALIAS_SYS (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream)); 557_GL_CXXALIAS_SYS (fread, size_t,
558 (void *restrict ptr, size_t s, size_t n,
559 FILE *restrict stream));
366# endif 560# endif
561# if __GLIBC__ >= 2
367_GL_CXXALIASWARN (fread); 562_GL_CXXALIASWARN (fread);
563# endif
368#endif 564#endif
369 565
370#if @GNULIB_FREOPEN@ 566#if @GNULIB_FREOPEN@
@@ -374,15 +570,20 @@ _GL_CXXALIASWARN (fread);
374# define freopen rpl_freopen 570# define freopen rpl_freopen
375# endif 571# endif
376_GL_FUNCDECL_RPL (freopen, FILE *, 572_GL_FUNCDECL_RPL (freopen, FILE *,
377 (const char *filename, const char *mode, FILE *stream) 573 (const char *restrict filename, const char *restrict mode,
574 FILE *restrict stream)
378 _GL_ARG_NONNULL ((2, 3))); 575 _GL_ARG_NONNULL ((2, 3)));
379_GL_CXXALIAS_RPL (freopen, FILE *, 576_GL_CXXALIAS_RPL (freopen, FILE *,
380 (const char *filename, const char *mode, FILE *stream)); 577 (const char *restrict filename, const char *restrict mode,
578 FILE *restrict stream));
381# else 579# else
382_GL_CXXALIAS_SYS (freopen, FILE *, 580_GL_CXXALIAS_SYS (freopen, FILE *,
383 (const char *filename, const char *mode, FILE *stream)); 581 (const char *restrict filename, const char *restrict mode,
582 FILE *restrict stream));
384# endif 583# endif
584# if __GLIBC__ >= 2
385_GL_CXXALIASWARN (freopen); 585_GL_CXXALIASWARN (freopen);
586# endif
386#elif defined GNULIB_POSIXCHECK 587#elif defined GNULIB_POSIXCHECK
387# undef freopen 588# undef freopen
388/* Assume freopen is always declared. */ 589/* Assume freopen is always declared. */
@@ -397,14 +598,19 @@ _GL_WARN_ON_USE (freopen,
397# undef fscanf 598# undef fscanf
398# define fscanf rpl_fscanf 599# define fscanf rpl_fscanf
399# endif 600# endif
400_GL_FUNCDECL_RPL (fscanf, int, (FILE *stream, const char *format, ...) 601_GL_FUNCDECL_RPL (fscanf, int,
401 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3) 602 (FILE *restrict stream, const char *restrict format, ...)
402 _GL_ARG_NONNULL ((1, 2))); 603 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3)
403_GL_CXXALIAS_RPL (fscanf, int, (FILE *stream, const char *format, ...)); 604 _GL_ARG_NONNULL ((1, 2)));
605_GL_CXXALIAS_RPL (fscanf, int,
606 (FILE *restrict stream, const char *restrict format, ...));
404# else 607# else
405_GL_CXXALIAS_SYS (fscanf, int, (FILE *stream, const char *format, ...)); 608_GL_CXXALIAS_SYS (fscanf, int,
609 (FILE *restrict stream, const char *restrict format, ...));
406# endif 610# endif
611# if __GLIBC__ >= 2
407_GL_CXXALIASWARN (fscanf); 612_GL_CXXALIASWARN (fscanf);
613# endif
408#endif 614#endif
409 615
410 616
@@ -455,7 +661,9 @@ _GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence));
455# else 661# else
456_GL_CXXALIAS_SYS (fseek, int, (FILE *fp, long offset, int whence)); 662_GL_CXXALIAS_SYS (fseek, int, (FILE *fp, long offset, int whence));
457# endif 663# endif
664# if __GLIBC__ >= 2
458_GL_CXXALIASWARN (fseek); 665_GL_CXXALIASWARN (fseek);
666# endif
459#endif 667#endif
460 668
461#if @GNULIB_FSEEKO@ 669#if @GNULIB_FSEEKO@
@@ -518,7 +726,9 @@ _GL_CXXALIAS_RPL (ftell, long, (FILE *fp));
518# else 726# else
519_GL_CXXALIAS_SYS (ftell, long, (FILE *fp)); 727_GL_CXXALIAS_SYS (ftell, long, (FILE *fp));
520# endif 728# endif
729# if __GLIBC__ >= 2
521_GL_CXXALIASWARN (ftell); 730_GL_CXXALIASWARN (ftell);
731# endif
522#endif 732#endif
523 733
524#if @GNULIB_FTELLO@ 734#if @GNULIB_FTELLO@
@@ -567,16 +777,19 @@ _GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB "
567# define fwrite rpl_fwrite 777# define fwrite rpl_fwrite
568# endif 778# endif
569_GL_FUNCDECL_RPL (fwrite, size_t, 779_GL_FUNCDECL_RPL (fwrite, size_t,
570 (const void *ptr, size_t s, size_t n, FILE *stream) 780 (const void *restrict ptr, size_t s, size_t n,
781 FILE *restrict stream)
571 _GL_ARG_NONNULL ((1, 4))); 782 _GL_ARG_NONNULL ((1, 4)));
572_GL_CXXALIAS_RPL (fwrite, size_t, 783_GL_CXXALIAS_RPL (fwrite, size_t,
573 (const void *ptr, size_t s, size_t n, FILE *stream)); 784 (const void *restrict ptr, size_t s, size_t n,
785 FILE *restrict stream));
574# else 786# else
575_GL_CXXALIAS_SYS (fwrite, size_t, 787_GL_CXXALIAS_SYS (fwrite, size_t,
576 (const void *ptr, size_t s, size_t n, FILE *stream)); 788 (const void *restrict ptr, size_t s, size_t n,
789 FILE *restrict stream));
577 790
578/* Work around bug 11959 when fortifying glibc 2.4 through 2.15 791/* Work around bug 11959 when fortifying glibc 2.4 through 2.15
579 <http://sources.redhat.com/bugzilla/show_bug.cgi?id=11959>, 792 <https://sourceware.org/bugzilla/show_bug.cgi?id=11959>,
580 which sometimes causes an unwanted diagnostic for fwrite calls. 793 which sometimes causes an unwanted diagnostic for fwrite calls.
581 This affects only function declaration attributes under certain 794 This affects only function declaration attributes under certain
582 versions of gcc and clang, and is not needed for C++. */ 795 versions of gcc and clang, and is not needed for C++. */
@@ -598,7 +811,9 @@ extern size_t __REDIRECT (rpl_fwrite_unlocked,
598# define fwrite_unlocked rpl_fwrite_unlocked 811# define fwrite_unlocked rpl_fwrite_unlocked
599# endif 812# endif
600# endif 813# endif
814# if __GLIBC__ >= 2
601_GL_CXXALIASWARN (fwrite); 815_GL_CXXALIASWARN (fwrite);
816# endif
602#endif 817#endif
603 818
604#if @GNULIB_GETC@ 819#if @GNULIB_GETC@
@@ -612,7 +827,9 @@ _GL_CXXALIAS_RPL_1 (getc, rpl_fgetc, int, (FILE *stream));
612# else 827# else
613_GL_CXXALIAS_SYS (getc, int, (FILE *stream)); 828_GL_CXXALIAS_SYS (getc, int, (FILE *stream));
614# endif 829# endif
830# if __GLIBC__ >= 2
615_GL_CXXALIASWARN (getc); 831_GL_CXXALIASWARN (getc);
832# endif
616#endif 833#endif
617 834
618#if @GNULIB_GETCHAR@ 835#if @GNULIB_GETCHAR@
@@ -626,7 +843,9 @@ _GL_CXXALIAS_RPL (getchar, int, (void));
626# else 843# else
627_GL_CXXALIAS_SYS (getchar, int, (void)); 844_GL_CXXALIAS_SYS (getchar, int, (void));
628# endif 845# endif
846# if __GLIBC__ >= 2
629_GL_CXXALIASWARN (getchar); 847_GL_CXXALIASWARN (getchar);
848# endif
630#endif 849#endif
631 850
632#if @GNULIB_GETDELIM@ 851#if @GNULIB_GETDELIM@
@@ -642,22 +861,26 @@ _GL_CXXALIASWARN (getchar);
642# define getdelim rpl_getdelim 861# define getdelim rpl_getdelim
643# endif 862# endif
644_GL_FUNCDECL_RPL (getdelim, ssize_t, 863_GL_FUNCDECL_RPL (getdelim, ssize_t,
645 (char **lineptr, size_t *linesize, int delimiter, 864 (char **restrict lineptr, size_t *restrict linesize,
646 FILE *stream) 865 int delimiter,
866 FILE *restrict stream)
647 _GL_ARG_NONNULL ((1, 2, 4))); 867 _GL_ARG_NONNULL ((1, 2, 4)));
648_GL_CXXALIAS_RPL (getdelim, ssize_t, 868_GL_CXXALIAS_RPL (getdelim, ssize_t,
649 (char **lineptr, size_t *linesize, int delimiter, 869 (char **restrict lineptr, size_t *restrict linesize,
650 FILE *stream)); 870 int delimiter,
871 FILE *restrict stream));
651# else 872# else
652# if !@HAVE_DECL_GETDELIM@ 873# if !@HAVE_DECL_GETDELIM@
653_GL_FUNCDECL_SYS (getdelim, ssize_t, 874_GL_FUNCDECL_SYS (getdelim, ssize_t,
654 (char **lineptr, size_t *linesize, int delimiter, 875 (char **restrict lineptr, size_t *restrict linesize,
655 FILE *stream) 876 int delimiter,
877 FILE *restrict stream)
656 _GL_ARG_NONNULL ((1, 2, 4))); 878 _GL_ARG_NONNULL ((1, 2, 4)));
657# endif 879# endif
658_GL_CXXALIAS_SYS (getdelim, ssize_t, 880_GL_CXXALIAS_SYS (getdelim, ssize_t,
659 (char **lineptr, size_t *linesize, int delimiter, 881 (char **restrict lineptr, size_t *restrict linesize,
660 FILE *stream)); 882 int delimiter,
883 FILE *restrict stream));
661# endif 884# endif
662_GL_CXXALIASWARN (getdelim); 885_GL_CXXALIASWARN (getdelim);
663#elif defined GNULIB_POSIXCHECK 886#elif defined GNULIB_POSIXCHECK
@@ -681,18 +904,22 @@ _GL_WARN_ON_USE (getdelim, "getdelim is unportable - "
681# define getline rpl_getline 904# define getline rpl_getline
682# endif 905# endif
683_GL_FUNCDECL_RPL (getline, ssize_t, 906_GL_FUNCDECL_RPL (getline, ssize_t,
684 (char **lineptr, size_t *linesize, FILE *stream) 907 (char **restrict lineptr, size_t *restrict linesize,
908 FILE *restrict stream)
685 _GL_ARG_NONNULL ((1, 2, 3))); 909 _GL_ARG_NONNULL ((1, 2, 3)));
686_GL_CXXALIAS_RPL (getline, ssize_t, 910_GL_CXXALIAS_RPL (getline, ssize_t,
687 (char **lineptr, size_t *linesize, FILE *stream)); 911 (char **restrict lineptr, size_t *restrict linesize,
912 FILE *restrict stream));
688# else 913# else
689# if !@HAVE_DECL_GETLINE@ 914# if !@HAVE_DECL_GETLINE@
690_GL_FUNCDECL_SYS (getline, ssize_t, 915_GL_FUNCDECL_SYS (getline, ssize_t,
691 (char **lineptr, size_t *linesize, FILE *stream) 916 (char **restrict lineptr, size_t *restrict linesize,
917 FILE *restrict stream)
692 _GL_ARG_NONNULL ((1, 2, 3))); 918 _GL_ARG_NONNULL ((1, 2, 3)));
693# endif 919# endif
694_GL_CXXALIAS_SYS (getline, ssize_t, 920_GL_CXXALIAS_SYS (getline, ssize_t,
695 (char **lineptr, size_t *linesize, FILE *stream)); 921 (char **restrict lineptr, size_t *restrict linesize,
922 FILE *restrict stream));
696# endif 923# endif
697# if @HAVE_DECL_GETLINE@ 924# if @HAVE_DECL_GETLINE@
698_GL_CXXALIASWARN (getline); 925_GL_CXXALIASWARN (getline);
@@ -709,10 +936,25 @@ _GL_WARN_ON_USE (getline, "getline is unportable - "
709 so any use of gets warrants an unconditional warning; besides, C11 936 so any use of gets warrants an unconditional warning; besides, C11
710 removed it. */ 937 removed it. */
711#undef gets 938#undef gets
712#if HAVE_RAW_DECL_GETS 939#if HAVE_RAW_DECL_GETS && !defined __cplusplus
713_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); 940_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
714#endif 941#endif
715 942
943#if @GNULIB_MDA_GETW@
944/* On native Windows, map 'getw' to '_getw', so that -loldnames is not
945 required. In C++ with GNULIB_NAMESPACE, avoid differences between
946 platforms by defining GNULIB_NAMESPACE::getw always. */
947# if defined _WIN32 && !defined __CYGWIN__
948# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
949# undef getw
950# define getw _getw
951# endif
952_GL_CXXALIAS_MDA (getw, int, (FILE *restrict stream));
953# else
954_GL_CXXALIAS_SYS (getw, int, (FILE *restrict stream));
955# endif
956_GL_CXXALIASWARN (getw);
957#endif
716 958
717#if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@ 959#if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
718struct obstack; 960struct obstack;
@@ -727,7 +969,7 @@ struct obstack;
727# endif 969# endif
728_GL_FUNCDECL_RPL (obstack_printf, int, 970_GL_FUNCDECL_RPL (obstack_printf, int,
729 (struct obstack *obs, const char *format, ...) 971 (struct obstack *obs, const char *format, ...)
730 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) 972 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
731 _GL_ARG_NONNULL ((1, 2))); 973 _GL_ARG_NONNULL ((1, 2)));
732_GL_CXXALIAS_RPL (obstack_printf, int, 974_GL_CXXALIAS_RPL (obstack_printf, int,
733 (struct obstack *obs, const char *format, ...)); 975 (struct obstack *obs, const char *format, ...));
@@ -735,7 +977,7 @@ _GL_CXXALIAS_RPL (obstack_printf, int,
735# if !@HAVE_DECL_OBSTACK_PRINTF@ 977# if !@HAVE_DECL_OBSTACK_PRINTF@
736_GL_FUNCDECL_SYS (obstack_printf, int, 978_GL_FUNCDECL_SYS (obstack_printf, int,
737 (struct obstack *obs, const char *format, ...) 979 (struct obstack *obs, const char *format, ...)
738 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) 980 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
739 _GL_ARG_NONNULL ((1, 2))); 981 _GL_ARG_NONNULL ((1, 2)));
740# endif 982# endif
741_GL_CXXALIAS_SYS (obstack_printf, int, 983_GL_CXXALIAS_SYS (obstack_printf, int,
@@ -748,7 +990,7 @@ _GL_CXXALIASWARN (obstack_printf);
748# endif 990# endif
749_GL_FUNCDECL_RPL (obstack_vprintf, int, 991_GL_FUNCDECL_RPL (obstack_vprintf, int,
750 (struct obstack *obs, const char *format, va_list args) 992 (struct obstack *obs, const char *format, va_list args)
751 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) 993 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
752 _GL_ARG_NONNULL ((1, 2))); 994 _GL_ARG_NONNULL ((1, 2)));
753_GL_CXXALIAS_RPL (obstack_vprintf, int, 995_GL_CXXALIAS_RPL (obstack_vprintf, int,
754 (struct obstack *obs, const char *format, va_list args)); 996 (struct obstack *obs, const char *format, va_list args));
@@ -756,7 +998,7 @@ _GL_CXXALIAS_RPL (obstack_vprintf, int,
756# if !@HAVE_DECL_OBSTACK_PRINTF@ 998# if !@HAVE_DECL_OBSTACK_PRINTF@
757_GL_FUNCDECL_SYS (obstack_vprintf, int, 999_GL_FUNCDECL_SYS (obstack_vprintf, int,
758 (struct obstack *obs, const char *format, va_list args) 1000 (struct obstack *obs, const char *format, va_list args)
759 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) 1001 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
760 _GL_ARG_NONNULL ((1, 2))); 1002 _GL_ARG_NONNULL ((1, 2)));
761# endif 1003# endif
762_GL_CXXALIAS_SYS (obstack_vprintf, int, 1004_GL_CXXALIAS_SYS (obstack_vprintf, int,
@@ -792,7 +1034,9 @@ _GL_CXXALIAS_RPL (perror, void, (const char *string));
792# else 1034# else
793_GL_CXXALIAS_SYS (perror, void, (const char *string)); 1035_GL_CXXALIAS_SYS (perror, void, (const char *string));
794# endif 1036# endif
1037# if __GLIBC__ >= 2
795_GL_CXXALIASWARN (perror); 1038_GL_CXXALIASWARN (perror);
1039# endif
796#elif defined GNULIB_POSIXCHECK 1040#elif defined GNULIB_POSIXCHECK
797# undef perror 1041# undef perror
798/* Assume perror is always declared. */ 1042/* Assume perror is always declared. */
@@ -806,43 +1050,53 @@ _GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - "
806# undef popen 1050# undef popen
807# define popen rpl_popen 1051# define popen rpl_popen
808# endif 1052# endif
809_GL_FUNCDECL_RPL (popen, FILE *, (const char *cmd, const char *mode) 1053_GL_FUNCDECL_RPL (popen, FILE *,
810 _GL_ARG_NONNULL ((1, 2))); 1054 (const char *cmd, const char *mode)
1055 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1));
811_GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode)); 1056_GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode));
812# else 1057# else
813# if !@HAVE_POPEN@ 1058# if !@HAVE_POPEN@ || __GNUC__ >= 11
814_GL_FUNCDECL_SYS (popen, FILE *, (const char *cmd, const char *mode) 1059_GL_FUNCDECL_SYS (popen, FILE *,
815 _GL_ARG_NONNULL ((1, 2))); 1060 (const char *cmd, const char *mode)
1061 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1));
816# endif 1062# endif
817_GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode)); 1063_GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode));
818# endif 1064# endif
819_GL_CXXALIASWARN (popen); 1065_GL_CXXALIASWARN (popen);
820#elif defined GNULIB_POSIXCHECK 1066#else
821# undef popen 1067# if @GNULIB_PCLOSE@ && __GNUC__ >= 11 && !defined popen
822# if HAVE_RAW_DECL_POPEN 1068/* For -Wmismatched-dealloc: Associate popen with pclose or rpl_pclose. */
1069_GL_FUNCDECL_SYS (popen, FILE *,
1070 (const char *cmd, const char *mode)
1071 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1));
1072# endif
1073# if defined GNULIB_POSIXCHECK
1074# undef popen
1075# if HAVE_RAW_DECL_POPEN
823_GL_WARN_ON_USE (popen, "popen is buggy on some platforms - " 1076_GL_WARN_ON_USE (popen, "popen is buggy on some platforms - "
824 "use gnulib module popen or pipe for more portability"); 1077 "use gnulib module popen or pipe for more portability");
1078# endif
825# endif 1079# endif
826#endif 1080#endif
827 1081
828#if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@ 1082#if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@
829# if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \ 1083# if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \
830 || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) 1084 || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
831# if defined __GNUC__ 1085# if defined __GNUC__ || defined __clang__
832# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1086# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
833/* Don't break __attribute__((format(printf,M,N))). */ 1087/* Don't break __attribute__((format(printf,M,N))). */
834# define printf __printf__ 1088# define printf __printf__
835# endif 1089# endif
836# if @GNULIB_PRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ 1090# if @GNULIB_PRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
837_GL_FUNCDECL_RPL_1 (__printf__, int, 1091_GL_FUNCDECL_RPL_1 (__printf__, int,
838 (const char *format, ...) 1092 (const char *restrict format, ...)
839 __asm__ (@ASM_SYMBOL_PREFIX@ 1093 __asm__ (@ASM_SYMBOL_PREFIX@
840 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)) 1094 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf))
841 _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2) 1095 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2)
842 _GL_ARG_NONNULL ((1))); 1096 _GL_ARG_NONNULL ((1)));
843# else 1097# else
844_GL_FUNCDECL_RPL_1 (__printf__, int, 1098_GL_FUNCDECL_RPL_1 (__printf__, int,
845 (const char *format, ...) 1099 (const char *restrict format, ...)
846 __asm__ (@ASM_SYMBOL_PREFIX@ 1100 __asm__ (@ASM_SYMBOL_PREFIX@
847 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)) 1101 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf))
848 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2) 1102 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2)
@@ -854,16 +1108,18 @@ _GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...));
854# define printf rpl_printf 1108# define printf rpl_printf
855# endif 1109# endif
856_GL_FUNCDECL_RPL (printf, int, 1110_GL_FUNCDECL_RPL (printf, int,
857 (const char *format, ...) 1111 (const char *restrict format, ...)
858 _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2) 1112 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2)
859 _GL_ARG_NONNULL ((1))); 1113 _GL_ARG_NONNULL ((1)));
860_GL_CXXALIAS_RPL (printf, int, (const char *format, ...)); 1114_GL_CXXALIAS_RPL (printf, int, (const char *restrict format, ...));
861# endif 1115# endif
862# define GNULIB_overrides_printf 1 1116# define GNULIB_overrides_printf 1
863# else 1117# else
864_GL_CXXALIAS_SYS (printf, int, (const char *format, ...)); 1118_GL_CXXALIAS_SYS (printf, int, (const char *restrict format, ...));
865# endif 1119# endif
1120# if __GLIBC__ >= 2
866_GL_CXXALIASWARN (printf); 1121_GL_CXXALIASWARN (printf);
1122# endif
867#endif 1123#endif
868#if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK 1124#if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK
869# if !GNULIB_overrides_printf 1125# if !GNULIB_overrides_printf
@@ -886,7 +1142,9 @@ _GL_CXXALIAS_RPL_1 (putc, rpl_fputc, int, (int c, FILE *stream));
886# else 1142# else
887_GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream)); 1143_GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream));
888# endif 1144# endif
1145# if __GLIBC__ >= 2
889_GL_CXXALIASWARN (putc); 1146_GL_CXXALIASWARN (putc);
1147# endif
890#endif 1148#endif
891 1149
892#if @GNULIB_PUTCHAR@ 1150#if @GNULIB_PUTCHAR@
@@ -900,7 +1158,9 @@ _GL_CXXALIAS_RPL (putchar, int, (int c));
900# else 1158# else
901_GL_CXXALIAS_SYS (putchar, int, (int c)); 1159_GL_CXXALIAS_SYS (putchar, int, (int c));
902# endif 1160# endif
1161# if __GLIBC__ >= 2
903_GL_CXXALIASWARN (putchar); 1162_GL_CXXALIASWARN (putchar);
1163# endif
904#endif 1164#endif
905 1165
906#if @GNULIB_PUTS@ 1166#if @GNULIB_PUTS@
@@ -914,7 +1174,25 @@ _GL_CXXALIAS_RPL (puts, int, (const char *string));
914# else 1174# else
915_GL_CXXALIAS_SYS (puts, int, (const char *string)); 1175_GL_CXXALIAS_SYS (puts, int, (const char *string));
916# endif 1176# endif
1177# if __GLIBC__ >= 2
917_GL_CXXALIASWARN (puts); 1178_GL_CXXALIASWARN (puts);
1179# endif
1180#endif
1181
1182#if @GNULIB_MDA_PUTW@
1183/* On native Windows, map 'putw' to '_putw', so that -loldnames is not
1184 required. In C++ with GNULIB_NAMESPACE, avoid differences between
1185 platforms by defining GNULIB_NAMESPACE::putw always. */
1186# if defined _WIN32 && !defined __CYGWIN__
1187# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1188# undef putw
1189# define putw _putw
1190# endif
1191_GL_CXXALIAS_MDA (putw, int, (int w, FILE *restrict stream));
1192# else
1193_GL_CXXALIAS_SYS (putw, int, (int w, FILE *restrict stream));
1194# endif
1195_GL_CXXALIASWARN (putw);
918#endif 1196#endif
919 1197
920#if @GNULIB_REMOVE@ 1198#if @GNULIB_REMOVE@
@@ -928,7 +1206,9 @@ _GL_CXXALIAS_RPL (remove, int, (const char *name));
928# else 1206# else
929_GL_CXXALIAS_SYS (remove, int, (const char *name)); 1207_GL_CXXALIAS_SYS (remove, int, (const char *name));
930# endif 1208# endif
1209# if __GLIBC__ >= 2
931_GL_CXXALIASWARN (remove); 1210_GL_CXXALIASWARN (remove);
1211# endif
932#elif defined GNULIB_POSIXCHECK 1212#elif defined GNULIB_POSIXCHECK
933# undef remove 1213# undef remove
934/* Assume remove is always declared. */ 1214/* Assume remove is always declared. */
@@ -951,7 +1231,9 @@ _GL_CXXALIAS_RPL (rename, int,
951_GL_CXXALIAS_SYS (rename, int, 1231_GL_CXXALIAS_SYS (rename, int,
952 (const char *old_filename, const char *new_filename)); 1232 (const char *old_filename, const char *new_filename));
953# endif 1233# endif
1234# if __GLIBC__ >= 2
954_GL_CXXALIASWARN (rename); 1235_GL_CXXALIASWARN (rename);
1236# endif
955#elif defined GNULIB_POSIXCHECK 1237#elif defined GNULIB_POSIXCHECK
956# undef rename 1238# undef rename
957/* Assume rename is always declared. */ 1239/* Assume rename is always declared. */
@@ -990,33 +1272,35 @@ _GL_WARN_ON_USE (renameat, "renameat is not portable - "
990 1272
991#if @GNULIB_SCANF@ 1273#if @GNULIB_SCANF@
992# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ 1274# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
993# if defined __GNUC__ 1275# if defined __GNUC__ || defined __clang__
994# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1276# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
995# undef scanf 1277# undef scanf
996/* Don't break __attribute__((format(scanf,M,N))). */ 1278/* Don't break __attribute__((format(scanf,M,N))). */
997# define scanf __scanf__ 1279# define scanf __scanf__
998# endif 1280# endif
999_GL_FUNCDECL_RPL_1 (__scanf__, int, 1281_GL_FUNCDECL_RPL_1 (__scanf__, int,
1000 (const char *format, ...) 1282 (const char *restrict format, ...)
1001 __asm__ (@ASM_SYMBOL_PREFIX@ 1283 __asm__ (@ASM_SYMBOL_PREFIX@
1002 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf)) 1284 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf))
1003 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2) 1285 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
1004 _GL_ARG_NONNULL ((1))); 1286 _GL_ARG_NONNULL ((1)));
1005_GL_CXXALIAS_RPL_1 (scanf, __scanf__, int, (const char *format, ...)); 1287_GL_CXXALIAS_RPL_1 (scanf, __scanf__, int, (const char *restrict format, ...));
1006# else 1288# else
1007# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1289# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1008# undef scanf 1290# undef scanf
1009# define scanf rpl_scanf 1291# define scanf rpl_scanf
1010# endif 1292# endif
1011_GL_FUNCDECL_RPL (scanf, int, (const char *format, ...) 1293_GL_FUNCDECL_RPL (scanf, int, (const char *restrict format, ...)
1012 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2) 1294 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
1013 _GL_ARG_NONNULL ((1))); 1295 _GL_ARG_NONNULL ((1)));
1014_GL_CXXALIAS_RPL (scanf, int, (const char *format, ...)); 1296_GL_CXXALIAS_RPL (scanf, int, (const char *restrict format, ...));
1015# endif 1297# endif
1016# else 1298# else
1017_GL_CXXALIAS_SYS (scanf, int, (const char *format, ...)); 1299_GL_CXXALIAS_SYS (scanf, int, (const char *restrict format, ...));
1018# endif 1300# endif
1301# if __GLIBC__ >= 2
1019_GL_CXXALIASWARN (scanf); 1302_GL_CXXALIASWARN (scanf);
1303# endif
1020#endif 1304#endif
1021 1305
1022#if @GNULIB_SNPRINTF@ 1306#if @GNULIB_SNPRINTF@
@@ -1024,23 +1308,30 @@ _GL_CXXALIASWARN (scanf);
1024# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1308# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1025# define snprintf rpl_snprintf 1309# define snprintf rpl_snprintf
1026# endif 1310# endif
1311# define GNULIB_overrides_snprintf 1
1027_GL_FUNCDECL_RPL (snprintf, int, 1312_GL_FUNCDECL_RPL (snprintf, int,
1028 (char *str, size_t size, const char *format, ...) 1313 (char *restrict str, size_t size,
1029 _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4) 1314 const char *restrict format, ...)
1315 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4)
1030 _GL_ARG_NONNULL ((3))); 1316 _GL_ARG_NONNULL ((3)));
1031_GL_CXXALIAS_RPL (snprintf, int, 1317_GL_CXXALIAS_RPL (snprintf, int,
1032 (char *str, size_t size, const char *format, ...)); 1318 (char *restrict str, size_t size,
1319 const char *restrict format, ...));
1033# else 1320# else
1034# if !@HAVE_DECL_SNPRINTF@ 1321# if !@HAVE_DECL_SNPRINTF@
1035_GL_FUNCDECL_SYS (snprintf, int, 1322_GL_FUNCDECL_SYS (snprintf, int,
1036 (char *str, size_t size, const char *format, ...) 1323 (char *restrict str, size_t size,
1037 _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4) 1324 const char *restrict format, ...)
1325 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4)
1038 _GL_ARG_NONNULL ((3))); 1326 _GL_ARG_NONNULL ((3)));
1039# endif 1327# endif
1040_GL_CXXALIAS_SYS (snprintf, int, 1328_GL_CXXALIAS_SYS (snprintf, int,
1041 (char *str, size_t size, const char *format, ...)); 1329 (char *restrict str, size_t size,
1330 const char *restrict format, ...));
1042# endif 1331# endif
1332# if __GLIBC__ >= 2
1043_GL_CXXALIASWARN (snprintf); 1333_GL_CXXALIASWARN (snprintf);
1334# endif
1044#elif defined GNULIB_POSIXCHECK 1335#elif defined GNULIB_POSIXCHECK
1045# undef snprintf 1336# undef snprintf
1046# if HAVE_RAW_DECL_SNPRINTF 1337# if HAVE_RAW_DECL_SNPRINTF
@@ -1063,14 +1354,20 @@ _GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
1063# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1354# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1064# define sprintf rpl_sprintf 1355# define sprintf rpl_sprintf
1065# endif 1356# endif
1066_GL_FUNCDECL_RPL (sprintf, int, (char *str, const char *format, ...) 1357# define GNULIB_overrides_sprintf 1
1067 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) 1358_GL_FUNCDECL_RPL (sprintf, int,
1068 _GL_ARG_NONNULL ((1, 2))); 1359 (char *restrict str, const char *restrict format, ...)
1069_GL_CXXALIAS_RPL (sprintf, int, (char *str, const char *format, ...)); 1360 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
1361 _GL_ARG_NONNULL ((1, 2)));
1362_GL_CXXALIAS_RPL (sprintf, int,
1363 (char *restrict str, const char *restrict format, ...));
1070# else 1364# else
1071_GL_CXXALIAS_SYS (sprintf, int, (char *str, const char *format, ...)); 1365_GL_CXXALIAS_SYS (sprintf, int,
1366 (char *restrict str, const char *restrict format, ...));
1072# endif 1367# endif
1368# if __GLIBC__ >= 2
1073_GL_CXXALIASWARN (sprintf); 1369_GL_CXXALIASWARN (sprintf);
1370# endif
1074#elif defined GNULIB_POSIXCHECK 1371#elif defined GNULIB_POSIXCHECK
1075# undef sprintf 1372# undef sprintf
1076/* Assume sprintf is always declared. */ 1373/* Assume sprintf is always declared. */
@@ -1079,22 +1376,53 @@ _GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - "
1079 "POSIX compliance"); 1376 "POSIX compliance");
1080#endif 1377#endif
1081 1378
1379#if @GNULIB_MDA_TEMPNAM@
1380/* On native Windows, map 'tempnam' to '_tempnam', so that -loldnames is not
1381 required. In C++ with GNULIB_NAMESPACE, avoid differences between
1382 platforms by defining GNULIB_NAMESPACE::tempnam always. */
1383# if defined _WIN32 && !defined __CYGWIN__
1384# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1385# undef tempnam
1386# define tempnam _tempnam
1387# endif
1388_GL_CXXALIAS_MDA (tempnam, char *, (const char *dir, const char *prefix));
1389# else
1390_GL_CXXALIAS_SYS (tempnam, char *, (const char *dir, const char *prefix));
1391# endif
1392_GL_CXXALIASWARN (tempnam);
1393#endif
1394
1082#if @GNULIB_TMPFILE@ 1395#if @GNULIB_TMPFILE@
1083# if @REPLACE_TMPFILE@ 1396# if @REPLACE_TMPFILE@
1084# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1397# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1085# define tmpfile rpl_tmpfile 1398# define tmpfile rpl_tmpfile
1086# endif 1399# endif
1087_GL_FUNCDECL_RPL (tmpfile, FILE *, (void)); 1400_GL_FUNCDECL_RPL (tmpfile, FILE *, (void)
1401 _GL_ATTRIBUTE_DEALLOC (fclose, 1));
1088_GL_CXXALIAS_RPL (tmpfile, FILE *, (void)); 1402_GL_CXXALIAS_RPL (tmpfile, FILE *, (void));
1089# else 1403# else
1404# if __GNUC__ >= 11
1405/* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose. */
1406_GL_FUNCDECL_SYS (tmpfile, FILE *, (void)
1407 _GL_ATTRIBUTE_DEALLOC (fclose, 1));
1408# endif
1090_GL_CXXALIAS_SYS (tmpfile, FILE *, (void)); 1409_GL_CXXALIAS_SYS (tmpfile, FILE *, (void));
1091# endif 1410# endif
1411# if __GLIBC__ >= 2
1092_GL_CXXALIASWARN (tmpfile); 1412_GL_CXXALIASWARN (tmpfile);
1093#elif defined GNULIB_POSIXCHECK 1413# endif
1094# undef tmpfile 1414#else
1095# if HAVE_RAW_DECL_TMPFILE 1415# if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined tmpfile
1416/* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose. */
1417_GL_FUNCDECL_SYS (tmpfile, FILE *, (void)
1418 _GL_ATTRIBUTE_DEALLOC (fclose, 1));
1419# endif
1420# if defined GNULIB_POSIXCHECK
1421# undef tmpfile
1422# if HAVE_RAW_DECL_TMPFILE
1096_GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - " 1423_GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - "
1097 "use gnulib module tmpfile for portability"); 1424 "use gnulib module tmpfile for portability");
1425# endif
1098# endif 1426# endif
1099#endif 1427#endif
1100 1428
@@ -1107,9 +1435,10 @@ _GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - "
1107# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1435# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1108# define asprintf rpl_asprintf 1436# define asprintf rpl_asprintf
1109# endif 1437# endif
1438# define GNULIB_overrides_asprintf
1110_GL_FUNCDECL_RPL (asprintf, int, 1439_GL_FUNCDECL_RPL (asprintf, int,
1111 (char **result, const char *format, ...) 1440 (char **result, const char *format, ...)
1112 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) 1441 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
1113 _GL_ARG_NONNULL ((1, 2))); 1442 _GL_ARG_NONNULL ((1, 2)));
1114_GL_CXXALIAS_RPL (asprintf, int, 1443_GL_CXXALIAS_RPL (asprintf, int,
1115 (char **result, const char *format, ...)); 1444 (char **result, const char *format, ...));
@@ -1117,7 +1446,7 @@ _GL_CXXALIAS_RPL (asprintf, int,
1117# if !@HAVE_VASPRINTF@ 1446# if !@HAVE_VASPRINTF@
1118_GL_FUNCDECL_SYS (asprintf, int, 1447_GL_FUNCDECL_SYS (asprintf, int,
1119 (char **result, const char *format, ...) 1448 (char **result, const char *format, ...)
1120 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) 1449 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
1121 _GL_ARG_NONNULL ((1, 2))); 1450 _GL_ARG_NONNULL ((1, 2)));
1122# endif 1451# endif
1123_GL_CXXALIAS_SYS (asprintf, int, 1452_GL_CXXALIAS_SYS (asprintf, int,
@@ -1128,9 +1457,10 @@ _GL_CXXALIASWARN (asprintf);
1128# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1457# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1129# define vasprintf rpl_vasprintf 1458# define vasprintf rpl_vasprintf
1130# endif 1459# endif
1460# define GNULIB_overrides_vasprintf 1
1131_GL_FUNCDECL_RPL (vasprintf, int, 1461_GL_FUNCDECL_RPL (vasprintf, int,
1132 (char **result, const char *format, va_list args) 1462 (char **result, const char *format, va_list args)
1133 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) 1463 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1134 _GL_ARG_NONNULL ((1, 2))); 1464 _GL_ARG_NONNULL ((1, 2)));
1135_GL_CXXALIAS_RPL (vasprintf, int, 1465_GL_CXXALIAS_RPL (vasprintf, int,
1136 (char **result, const char *format, va_list args)); 1466 (char **result, const char *format, va_list args));
@@ -1138,7 +1468,7 @@ _GL_CXXALIAS_RPL (vasprintf, int,
1138# if !@HAVE_VASPRINTF@ 1468# if !@HAVE_VASPRINTF@
1139_GL_FUNCDECL_SYS (vasprintf, int, 1469_GL_FUNCDECL_SYS (vasprintf, int,
1140 (char **result, const char *format, va_list args) 1470 (char **result, const char *format, va_list args)
1141 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) 1471 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1142 _GL_ARG_NONNULL ((1, 2))); 1472 _GL_ARG_NONNULL ((1, 2)));
1143# endif 1473# endif
1144_GL_CXXALIAS_SYS (vasprintf, int, 1474_GL_CXXALIAS_SYS (vasprintf, int,
@@ -1152,22 +1482,27 @@ _GL_CXXALIASWARN (vasprintf);
1152# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1482# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1153# define vdprintf rpl_vdprintf 1483# define vdprintf rpl_vdprintf
1154# endif 1484# endif
1155_GL_FUNCDECL_RPL (vdprintf, int, (int fd, const char *format, va_list args) 1485_GL_FUNCDECL_RPL (vdprintf, int,
1156 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) 1486 (int fd, const char *restrict format, va_list args)
1157 _GL_ARG_NONNULL ((2))); 1487 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1158_GL_CXXALIAS_RPL (vdprintf, int, (int fd, const char *format, va_list args)); 1488 _GL_ARG_NONNULL ((2)));
1489_GL_CXXALIAS_RPL (vdprintf, int,
1490 (int fd, const char *restrict format, va_list args));
1159# else 1491# else
1160# if !@HAVE_VDPRINTF@ 1492# if !@HAVE_VDPRINTF@
1161_GL_FUNCDECL_SYS (vdprintf, int, (int fd, const char *format, va_list args) 1493_GL_FUNCDECL_SYS (vdprintf, int,
1162 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) 1494 (int fd, const char *restrict format, va_list args)
1163 _GL_ARG_NONNULL ((2))); 1495 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1496 _GL_ARG_NONNULL ((2)));
1164# endif 1497# endif
1165/* Need to cast, because on Solaris, the third parameter will likely be 1498/* Need to cast, because on Solaris, the third parameter will likely be
1166 __va_list args. */ 1499 __va_list args. */
1167_GL_CXXALIAS_SYS_CAST (vdprintf, int, 1500_GL_CXXALIAS_SYS_CAST (vdprintf, int,
1168 (int fd, const char *format, va_list args)); 1501 (int fd, const char *restrict format, va_list args));
1169# endif 1502# endif
1503# if __GLIBC__ >= 2
1170_GL_CXXALIASWARN (vdprintf); 1504_GL_CXXALIASWARN (vdprintf);
1505# endif
1171#elif defined GNULIB_POSIXCHECK 1506#elif defined GNULIB_POSIXCHECK
1172# undef vdprintf 1507# undef vdprintf
1173# if HAVE_RAW_DECL_VDPRINTF 1508# if HAVE_RAW_DECL_VDPRINTF
@@ -1184,23 +1519,32 @@ _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - "
1184# endif 1519# endif
1185# define GNULIB_overrides_vfprintf 1 1520# define GNULIB_overrides_vfprintf 1
1186# if @GNULIB_VFPRINTF_POSIX@ 1521# if @GNULIB_VFPRINTF_POSIX@
1187_GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args) 1522_GL_FUNCDECL_RPL (vfprintf, int,
1188 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) 1523 (FILE *restrict fp,
1189 _GL_ARG_NONNULL ((1, 2))); 1524 const char *restrict format, va_list args)
1525 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1526 _GL_ARG_NONNULL ((1, 2)));
1190# else 1527# else
1191_GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args) 1528_GL_FUNCDECL_RPL (vfprintf, int,
1192 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0) 1529 (FILE *restrict fp,
1193 _GL_ARG_NONNULL ((1, 2))); 1530 const char *restrict format, va_list args)
1531 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0)
1532 _GL_ARG_NONNULL ((1, 2)));
1194# endif 1533# endif
1195_GL_CXXALIAS_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args)); 1534_GL_CXXALIAS_RPL (vfprintf, int,
1535 (FILE *restrict fp,
1536 const char *restrict format, va_list args));
1196# else 1537# else
1197/* Need to cast, because on Solaris, the third parameter is 1538/* Need to cast, because on Solaris, the third parameter is
1198 __va_list args 1539 __va_list args
1199 and GCC's fixincludes did not change this to __gnuc_va_list. */ 1540 and GCC's fixincludes did not change this to __gnuc_va_list. */
1200_GL_CXXALIAS_SYS_CAST (vfprintf, int, 1541_GL_CXXALIAS_SYS_CAST (vfprintf, int,
1201 (FILE *fp, const char *format, va_list args)); 1542 (FILE *restrict fp,
1543 const char *restrict format, va_list args));
1202# endif 1544# endif
1545# if __GLIBC__ >= 2
1203_GL_CXXALIASWARN (vfprintf); 1546_GL_CXXALIASWARN (vfprintf);
1547# endif
1204#endif 1548#endif
1205#if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK 1549#if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
1206# if !GNULIB_overrides_vfprintf 1550# if !GNULIB_overrides_vfprintf
@@ -1219,16 +1563,21 @@ _GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - "
1219# define vfscanf rpl_vfscanf 1563# define vfscanf rpl_vfscanf
1220# endif 1564# endif
1221_GL_FUNCDECL_RPL (vfscanf, int, 1565_GL_FUNCDECL_RPL (vfscanf, int,
1222 (FILE *stream, const char *format, va_list args) 1566 (FILE *restrict stream,
1567 const char *restrict format, va_list args)
1223 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0) 1568 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0)
1224 _GL_ARG_NONNULL ((1, 2))); 1569 _GL_ARG_NONNULL ((1, 2)));
1225_GL_CXXALIAS_RPL (vfscanf, int, 1570_GL_CXXALIAS_RPL (vfscanf, int,
1226 (FILE *stream, const char *format, va_list args)); 1571 (FILE *restrict stream,
1572 const char *restrict format, va_list args));
1227# else 1573# else
1228_GL_CXXALIAS_SYS (vfscanf, int, 1574_GL_CXXALIAS_SYS (vfscanf, int,
1229 (FILE *stream, const char *format, va_list args)); 1575 (FILE *restrict stream,
1576 const char *restrict format, va_list args));
1230# endif 1577# endif
1578# if __GLIBC__ >= 2
1231_GL_CXXALIASWARN (vfscanf); 1579_GL_CXXALIASWARN (vfscanf);
1580# endif
1232#endif 1581#endif
1233 1582
1234#if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@ 1583#if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@
@@ -1239,22 +1588,25 @@ _GL_CXXALIASWARN (vfscanf);
1239# endif 1588# endif
1240# define GNULIB_overrides_vprintf 1 1589# define GNULIB_overrides_vprintf 1
1241# if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ 1590# if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
1242_GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args) 1591_GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args)
1243 _GL_ATTRIBUTE_FORMAT_PRINTF (1, 0) 1592 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 0)
1244 _GL_ARG_NONNULL ((1))); 1593 _GL_ARG_NONNULL ((1)));
1245# else 1594# else
1246_GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args) 1595_GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args)
1247 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0) 1596 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0)
1248 _GL_ARG_NONNULL ((1))); 1597 _GL_ARG_NONNULL ((1)));
1249# endif 1598# endif
1250_GL_CXXALIAS_RPL (vprintf, int, (const char *format, va_list args)); 1599_GL_CXXALIAS_RPL (vprintf, int, (const char *restrict format, va_list args));
1251# else 1600# else
1252/* Need to cast, because on Solaris, the second parameter is 1601/* Need to cast, because on Solaris, the second parameter is
1253 __va_list args 1602 __va_list args
1254 and GCC's fixincludes did not change this to __gnuc_va_list. */ 1603 and GCC's fixincludes did not change this to __gnuc_va_list. */
1255_GL_CXXALIAS_SYS_CAST (vprintf, int, (const char *format, va_list args)); 1604_GL_CXXALIAS_SYS_CAST (vprintf, int,
1605 (const char *restrict format, va_list args));
1256# endif 1606# endif
1607# if __GLIBC__ >= 2
1257_GL_CXXALIASWARN (vprintf); 1608_GL_CXXALIASWARN (vprintf);
1609# endif
1258#endif 1610#endif
1259#if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK 1611#if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
1260# if !GNULIB_overrides_vprintf 1612# if !GNULIB_overrides_vprintf
@@ -1272,14 +1624,16 @@ _GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - "
1272# undef vscanf 1624# undef vscanf
1273# define vscanf rpl_vscanf 1625# define vscanf rpl_vscanf
1274# endif 1626# endif
1275_GL_FUNCDECL_RPL (vscanf, int, (const char *format, va_list args) 1627_GL_FUNCDECL_RPL (vscanf, int, (const char *restrict format, va_list args)
1276 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 0) 1628 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 0)
1277 _GL_ARG_NONNULL ((1))); 1629 _GL_ARG_NONNULL ((1)));
1278_GL_CXXALIAS_RPL (vscanf, int, (const char *format, va_list args)); 1630_GL_CXXALIAS_RPL (vscanf, int, (const char *restrict format, va_list args));
1279# else 1631# else
1280_GL_CXXALIAS_SYS (vscanf, int, (const char *format, va_list args)); 1632_GL_CXXALIAS_SYS (vscanf, int, (const char *restrict format, va_list args));
1281# endif 1633# endif
1634# if __GLIBC__ >= 2
1282_GL_CXXALIASWARN (vscanf); 1635_GL_CXXALIASWARN (vscanf);
1636# endif
1283#endif 1637#endif
1284 1638
1285#if @GNULIB_VSNPRINTF@ 1639#if @GNULIB_VSNPRINTF@
@@ -1287,23 +1641,30 @@ _GL_CXXALIASWARN (vscanf);
1287# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1641# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1288# define vsnprintf rpl_vsnprintf 1642# define vsnprintf rpl_vsnprintf
1289# endif 1643# endif
1644# define GNULIB_overrides_vsnprintf 1
1290_GL_FUNCDECL_RPL (vsnprintf, int, 1645_GL_FUNCDECL_RPL (vsnprintf, int,
1291 (char *str, size_t size, const char *format, va_list args) 1646 (char *restrict str, size_t size,
1292 _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0) 1647 const char *restrict format, va_list args)
1648 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0)
1293 _GL_ARG_NONNULL ((3))); 1649 _GL_ARG_NONNULL ((3)));
1294_GL_CXXALIAS_RPL (vsnprintf, int, 1650_GL_CXXALIAS_RPL (vsnprintf, int,
1295 (char *str, size_t size, const char *format, va_list args)); 1651 (char *restrict str, size_t size,
1652 const char *restrict format, va_list args));
1296# else 1653# else
1297# if !@HAVE_DECL_VSNPRINTF@ 1654# if !@HAVE_DECL_VSNPRINTF@
1298_GL_FUNCDECL_SYS (vsnprintf, int, 1655_GL_FUNCDECL_SYS (vsnprintf, int,
1299 (char *str, size_t size, const char *format, va_list args) 1656 (char *restrict str, size_t size,
1300 _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0) 1657 const char *restrict format, va_list args)
1658 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0)
1301 _GL_ARG_NONNULL ((3))); 1659 _GL_ARG_NONNULL ((3)));
1302# endif 1660# endif
1303_GL_CXXALIAS_SYS (vsnprintf, int, 1661_GL_CXXALIAS_SYS (vsnprintf, int,
1304 (char *str, size_t size, const char *format, va_list args)); 1662 (char *restrict str, size_t size,
1663 const char *restrict format, va_list args));
1305# endif 1664# endif
1665# if __GLIBC__ >= 2
1306_GL_CXXALIASWARN (vsnprintf); 1666_GL_CXXALIASWARN (vsnprintf);
1667# endif
1307#elif defined GNULIB_POSIXCHECK 1668#elif defined GNULIB_POSIXCHECK
1308# undef vsnprintf 1669# undef vsnprintf
1309# if HAVE_RAW_DECL_VSNPRINTF 1670# if HAVE_RAW_DECL_VSNPRINTF
@@ -1317,20 +1678,26 @@ _GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - "
1317# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1678# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1318# define vsprintf rpl_vsprintf 1679# define vsprintf rpl_vsprintf
1319# endif 1680# endif
1681# define GNULIB_overrides_vsprintf 1
1320_GL_FUNCDECL_RPL (vsprintf, int, 1682_GL_FUNCDECL_RPL (vsprintf, int,
1321 (char *str, const char *format, va_list args) 1683 (char *restrict str,
1322 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) 1684 const char *restrict format, va_list args)
1685 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1323 _GL_ARG_NONNULL ((1, 2))); 1686 _GL_ARG_NONNULL ((1, 2)));
1324_GL_CXXALIAS_RPL (vsprintf, int, 1687_GL_CXXALIAS_RPL (vsprintf, int,
1325 (char *str, const char *format, va_list args)); 1688 (char *restrict str,
1689 const char *restrict format, va_list args));
1326# else 1690# else
1327/* Need to cast, because on Solaris, the third parameter is 1691/* Need to cast, because on Solaris, the third parameter is
1328 __va_list args 1692 __va_list args
1329 and GCC's fixincludes did not change this to __gnuc_va_list. */ 1693 and GCC's fixincludes did not change this to __gnuc_va_list. */
1330_GL_CXXALIAS_SYS_CAST (vsprintf, int, 1694_GL_CXXALIAS_SYS_CAST (vsprintf, int,
1331 (char *str, const char *format, va_list args)); 1695 (char *restrict str,
1696 const char *restrict format, va_list args));
1332# endif 1697# endif
1698# if __GLIBC__ >= 2
1333_GL_CXXALIASWARN (vsprintf); 1699_GL_CXXALIASWARN (vsprintf);
1700# endif
1334#elif defined GNULIB_POSIXCHECK 1701#elif defined GNULIB_POSIXCHECK
1335# undef vsprintf 1702# undef vsprintf
1336/* Assume vsprintf is always declared. */ 1703/* Assume vsprintf is always declared. */