aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPo Lu2024-09-05 08:41:11 +0800
committerPo Lu2024-09-05 08:45:18 +0800
commit1a13c5e63e1eb8fcf15c53ae4ed0caca8b928a3b (patch)
treea40610febdebe7a02acf3981b7f966b323c0d1c3 /lib
parenta13eef1fae00411bc03165933870de73d10551af (diff)
downloademacs-1a13c5e63e1eb8fcf15c53ae4ed0caca8b928a3b.tar.gz
emacs-1a13c5e63e1eb8fcf15c53ae4ed0caca8b928a3b.zip
; Update from Gnulib
* configure.ac: * src/conf_post.h: Remove workarounds now rendered redundant by Gnulib.
Diffstat (limited to 'lib')
-rw-r--r--lib/_Noreturn.h2
-rw-r--r--lib/acl.h14
-rw-r--r--lib/attribute.h49
-rw-r--r--lib/c++defs.h39
-rw-r--r--lib/cdefs.h4
-rw-r--r--lib/diffseq.h10
-rw-r--r--lib/dirent.in.h45
-rw-r--r--lib/errno.in.h9
-rw-r--r--lib/fcntl.in.h8
-rw-r--r--lib/file-has-acl.c6
-rw-r--r--lib/gnulib.mk.in29
-rw-r--r--lib/intprops-internal.h4
-rw-r--r--lib/inttypes.in.h8
-rw-r--r--lib/libc-config.h5
-rw-r--r--lib/md5-stream.c7
-rw-r--r--lib/mini-gmp-gnulib.c4
-rw-r--r--lib/sig2str.c4
-rw-r--r--lib/sig2str.h21
-rw-r--r--lib/signal.in.h53
-rw-r--r--lib/stddef.in.h4
-rw-r--r--lib/stdio.in.h290
-rw-r--r--lib/stdlib.in.h337
-rw-r--r--lib/strftime.c2
-rw-r--r--lib/strftime.h18
-rw-r--r--lib/string.in.h126
-rw-r--r--lib/sys_random.in.h11
-rw-r--r--lib/sys_select.in.h6
-rw-r--r--lib/sys_stat.in.h90
-rw-r--r--lib/sys_time.in.h4
-rw-r--r--lib/time.in.h87
-rw-r--r--lib/time_rz.c57
-rw-r--r--lib/unistd.in.h289
-rw-r--r--lib/verify.h9
-rw-r--r--lib/warn-on-use.h8
-rw-r--r--lib/xalloc-oversized.h3
35 files changed, 982 insertions, 680 deletions
diff --git a/lib/_Noreturn.h b/lib/_Noreturn.h
index 7326bd47733..9806f2b1a09 100644
--- a/lib/_Noreturn.h
+++ b/lib/_Noreturn.h
@@ -34,7 +34,7 @@
34# elif ((!defined __cplusplus || defined __clang__) \ 34# elif ((!defined __cplusplus || defined __clang__) \
35 && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \ 35 && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
36 || (!defined __STRICT_ANSI__ \ 36 || (!defined __STRICT_ANSI__ \
37 && (4 < __GNUC__ + (7 <= __GNUC_MINOR__) \ 37 && (4 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __clang__ \
38 || (defined __apple_build_version__ \ 38 || (defined __apple_build_version__ \
39 ? 6000000 <= __apple_build_version__ \ 39 ? 6000000 <= __apple_build_version__ \
40 : 3 < __clang_major__ + (5 <= __clang_minor__)))))) 40 : 3 < __clang_major__ + (5 <= __clang_minor__))))))
diff --git a/lib/acl.h b/lib/acl.h
index 0bf78a654d2..475231c2db7 100644
--- a/lib/acl.h
+++ b/lib/acl.h
@@ -20,7 +20,7 @@
20#ifndef _GL_ACL_H 20#ifndef _GL_ACL_H
21#define _GL_ACL_H 1 21#define _GL_ACL_H 1
22 22
23/* This file uses _GL_ATTRIBUTE_CONST. */ 23/* This file uses _GL_ATTRIBUTE_CONST, _GL_ATTRIBUTE_DEPRECATED. */
24#if !_GL_CONFIG_H_INCLUDED 24#if !_GL_CONFIG_H_INCLUDED
25 #error "Please include config.h first." 25 #error "Please include config.h first."
26#endif 26#endif
@@ -35,10 +35,18 @@ extern "C" {
35 35
36bool acl_errno_valid (int) _GL_ATTRIBUTE_CONST; 36bool acl_errno_valid (int) _GL_ATTRIBUTE_CONST;
37int file_has_acl (char const *, struct stat const *); 37int file_has_acl (char const *, struct stat const *);
38
38int qset_acl (char const *, int, mode_t); 39int qset_acl (char const *, int, mode_t);
39int set_acl (char const *, int, mode_t); 40int xset_acl (char const *, int, mode_t);
41/* Old name of xset_acl. */
42_GL_ATTRIBUTE_DEPRECATED int set_acl (char const *, int, mode_t);
43
40int qcopy_acl (char const *, int, char const *, int, mode_t); 44int qcopy_acl (char const *, int, char const *, int, mode_t);
41int copy_acl (char const *, int, char const *, int, mode_t); 45int xcopy_acl (char const *, int, char const *, int, mode_t);
46/* Old name of xcopy_acl. */
47_GL_ATTRIBUTE_DEPRECATED int copy_acl (char const *, int, char const *, int,
48 mode_t);
49
42int chmod_or_fchmod (char const *, int, mode_t); 50int chmod_or_fchmod (char const *, int, mode_t);
43 51
44 52
diff --git a/lib/attribute.h b/lib/attribute.h
index 604965a6d18..186faa55265 100644
--- a/lib/attribute.h
+++ b/lib/attribute.h
@@ -20,12 +20,49 @@
20/* Provide public ATTRIBUTE_* names for the private _GL_ATTRIBUTE_* 20/* Provide public ATTRIBUTE_* names for the private _GL_ATTRIBUTE_*
21 macros used within Gnulib. */ 21 macros used within Gnulib. */
22 22
23/* These attributes can be placed in two ways: 23/* The placement of these attributes depends on the kind of declaration
24 - At the start of a declaration (i.e. even before storage-class 24 and, in some cases, also on the programming language (C vs. C++).
25 specifiers!); then they apply to all entities that are declared 25
26 by the declaration. 26 In function declarations and function definitions:
27 - Immediately after the name of an entity being declared by the 27
28 declaration; then they apply to that entity only. */ 28 * ATTRIBUTE_NOTHROW must come after the parameter list.
29
30 * The macros
31 ATTRIBUTE_CONST
32 ATTRIBUTE_PURE
33 DEPRECATED
34 MAYBE_UNUSED
35 NODISCARD
36 REPRODUCIBLE
37 UNSEQUENCED
38 must come before the return type, and more precisely:
39 - In a function declaration/definition without a storage-class
40 specifier: at the beginning of the declaration/definition.
41 - In a function declaration/definition with a storage-class
42 specifier:
43 - In C: before the storage-class specifier.
44 - In C++: between the storage-class specifier and the return type.
45
46 * The other macros can be placed
47 - Either
48 - In a function declaration/definition without a storage-class
49 specifier: at the beginning of the declaration/definition.
50 - In a function declaration/definition with a storage-class
51 specifier: between the storage-class specifier and the return
52 type.
53 - Or after the parameter list,
54 ∙ but after ATTRIBUTE_NOTHROW if present.
55
56 In other declarations, such as variable declarations:
57
58 * Either
59 - In C: before the storage-class specifier.
60 - In C++: between the storage-class specifier and the return type.
61 Then they apply to all entities that are declared by the declaration.
62
63 * Or immediately after the name of an entity being declared by the
64 declaration. Then they apply to that entity only.
65 */
29 66
30#ifndef _GL_ATTRIBUTE_H 67#ifndef _GL_ATTRIBUTE_H
31#define _GL_ATTRIBUTE_H 68#define _GL_ATTRIBUTE_H
diff --git a/lib/c++defs.h b/lib/c++defs.h
index eb66967b09b..7082af3fc28 100644
--- a/lib/c++defs.h
+++ b/lib/c++defs.h
@@ -93,11 +93,22 @@
93# define _GL_EXTERN_C extern 93# define _GL_EXTERN_C extern
94#endif 94#endif
95 95
96/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); 96/* _GL_EXTERN_C_FUNC declaration;
97 performs the declaration of a function with C linkage. */
98#if defined __cplusplus
99# define _GL_EXTERN_C_FUNC extern "C"
100#else
101/* In C mode, omit the 'extern' keyword, because attributes in bracket syntax
102 are not allowed between 'extern' and the return type (see gnulib-common.m4).
103 */
104# define _GL_EXTERN_C_FUNC
105#endif
106
107/* _GL_FUNCDECL_RPL (func, rettype, parameters[, attributes]);
97 declares a replacement function, named rpl_func, with the given prototype, 108 declares a replacement function, named rpl_func, with the given prototype,
98 consisting of return type, parameters, and attributes. 109 consisting of return type, parameters, and attributes.
99 Example: 110 Example:
100 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) 111 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...),
101 _GL_ARG_NONNULL ((1))); 112 _GL_ARG_NONNULL ((1)));
102 113
103 Note: Attributes, such as _GL_ATTRIBUTE_DEPRECATED, are supported in front 114 Note: Attributes, such as _GL_ATTRIBUTE_DEPRECATED, are supported in front
@@ -105,21 +116,27 @@
105 because 116 because
106 [[...]] extern "C" <declaration>; 117 [[...]] extern "C" <declaration>;
107 is invalid syntax in C++.) 118 is invalid syntax in C++.)
119
120 Note: The attribute _GL_ATTRIBUTE_NOTHROW, if needed, must be placed outside
121 of the _GL_FUNCDECL_RPL invocation, at the end of the declaration.
108 */ 122 */
109#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ 123#define _GL_FUNCDECL_RPL(func,rettype,parameters,...) \
110 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) 124 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters, __VA_ARGS__)
111#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ 125#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters,...) \
112 _GL_EXTERN_C rettype rpl_func parameters_and_attributes 126 _GL_EXTERN_C_FUNC __VA_ARGS__ rettype rpl_func parameters
113 127
114/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); 128/* _GL_FUNCDECL_SYS (func, rettype, parameters[, attributes]);
115 declares the system function, named func, with the given prototype, 129 declares the system function, named func, with the given prototype,
116 consisting of return type, parameters, and attributes. 130 consisting of return type, parameters, and attributes.
117 Example: 131 Example:
118 _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) 132 _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...),
119 _GL_ARG_NONNULL ((1))); 133 _GL_ARG_NONNULL ((1)));
134
135 Note: The attribute _GL_ATTRIBUTE_NOTHROW, if needed, must be placed outside
136 of the _GL_FUNCDECL_SYS invocation, at the end of the declaration.
120 */ 137 */
121#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ 138#define _GL_FUNCDECL_SYS(func,rettype,parameters,...) \
122 _GL_EXTERN_C rettype func parameters_and_attributes 139 _GL_EXTERN_C_FUNC __VA_ARGS__ rettype func parameters
123 140
124/* _GL_CXXALIAS_RPL (func, rettype, parameters); 141/* _GL_CXXALIAS_RPL (func, rettype, parameters);
125 declares a C++ alias called GNULIB_NAMESPACE::func 142 declares a C++ alias called GNULIB_NAMESPACE::func
@@ -297,7 +314,7 @@
297 _GL_WARN_ON_USE (func, \ 314 _GL_WARN_ON_USE (func, \
298 "The symbol ::" #func " refers to the system function. " \ 315 "The symbol ::" #func " refers to the system function. " \
299 "Use " #namespace "::" #func " instead.") 316 "Use " #namespace "::" #func " instead.")
300# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 317# elif (__GNUC__ >= 3 || defined __clang__) && GNULIB_STRICT_CHECKING
301# define _GL_CXXALIASWARN_2(func,namespace) \ 318# define _GL_CXXALIASWARN_2(func,namespace) \
302 extern __typeof__ (func) func 319 extern __typeof__ (func) func
303# else 320# else
diff --git a/lib/cdefs.h b/lib/cdefs.h
index 02fcabce722..9c49eeb413e 100644
--- a/lib/cdefs.h
+++ b/lib/cdefs.h
@@ -83,7 +83,7 @@
83# define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct 83# define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct
84# define __NTHNL(fct) __attribute__ ((__nothrow__)) fct 84# define __NTHNL(fct) __attribute__ ((__nothrow__)) fct
85# else 85# else
86# if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major >= 4) 86# if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major__ >= 4)
87# if __cplusplus >= 201103L 87# if __cplusplus >= 201103L
88# define __THROW noexcept (true) 88# define __THROW noexcept (true)
89# else 89# else
@@ -497,7 +497,7 @@
497# endif 497# endif
498#endif 498#endif
499 499
500/* ISO C99 also allows declaring arrays as non-overlapping. The syntax is 500/* ISO C99 also allows to declare arrays as non-overlapping. The syntax is
501 array_name[restrict] 501 array_name[restrict]
502 GCC 3.1 and clang support this. 502 GCC 3.1 and clang support this.
503 This syntax is not usable in C++ mode. */ 503 This syntax is not usable in C++ mode. */
diff --git a/lib/diffseq.h b/lib/diffseq.h
index 0c5bc9cbc6d..c9369e44100 100644
--- a/lib/diffseq.h
+++ b/lib/diffseq.h
@@ -93,10 +93,14 @@
93#endif 93#endif
94 94
95/* Suppress gcc's "...may be used before initialized" warnings, 95/* Suppress gcc's "...may be used before initialized" warnings,
96 generated by GCC versions up to at least GCC 13.2. */ 96 generated by GCC versions up to at least GCC 14.2.
97#if __GNUC__ + (__GNUC_MINOR__ >= 7) > 4 97 Likewise for gcc -fanalyzer's "use of uninitialized value" warnings. */
98#if _GL_GNUC_PREREQ (4, 7)
98# pragma GCC diagnostic push 99# pragma GCC diagnostic push
99# pragma GCC diagnostic ignored "-Wmaybe-uninitialized" 100# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
101# if _GL_GNUC_PREREQ (13, 0)
102# pragma GCC diagnostic ignored "-Wanalyzer-use-of-uninitialized-value"
103# endif
100#endif 104#endif
101 105
102/* 106/*
@@ -554,7 +558,7 @@ compareseq (OFFSET xoff, OFFSET xlim, OFFSET yoff, OFFSET ylim,
554 #undef XREF_YREF_EQUAL 558 #undef XREF_YREF_EQUAL
555} 559}
556 560
557#if __GNUC__ + (__GNUC_MINOR__ >= 7) > 4 561#if _GL_GNUC_PREREQ (4, 7)
558# pragma GCC diagnostic pop 562# pragma GCC diagnostic pop
559#endif 563#endif
560 564
diff --git a/lib/dirent.in.h b/lib/dirent.in.h
index f05b880077f..7ba8fc64d89 100644
--- a/lib/dirent.in.h
+++ b/lib/dirent.in.h
@@ -78,7 +78,7 @@ typedef struct gl_directory DIR;
78 that can be freed by passing them as the Ith argument to the 78 that can be freed by passing them as the Ith argument to the
79 function F. */ 79 function F. */
80#ifndef _GL_ATTRIBUTE_DEALLOC 80#ifndef _GL_ATTRIBUTE_DEALLOC
81# if __GNUC__ >= 11 81# if __GNUC__ >= 11 && !defined __clang__
82# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) 82# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
83# else 83# else
84# define _GL_ATTRIBUTE_DEALLOC(f, i) 84# define _GL_ATTRIBUTE_DEALLOC(f, i)
@@ -122,11 +122,11 @@ typedef struct gl_directory DIR;
122# define closedir rpl_closedir 122# define closedir rpl_closedir
123# define GNULIB_defined_closedir 1 123# define GNULIB_defined_closedir 1
124# endif 124# endif
125_GL_FUNCDECL_RPL (closedir, int, (DIR *dirp) _GL_ARG_NONNULL ((1))); 125_GL_FUNCDECL_RPL (closedir, int, (DIR *dirp), _GL_ARG_NONNULL ((1)));
126_GL_CXXALIAS_RPL (closedir, int, (DIR *dirp)); 126_GL_CXXALIAS_RPL (closedir, int, (DIR *dirp));
127# else 127# else
128# if !@HAVE_CLOSEDIR@ 128# if !@HAVE_CLOSEDIR@
129_GL_FUNCDECL_SYS (closedir, int, (DIR *dirp) _GL_ARG_NONNULL ((1))); 129_GL_FUNCDECL_SYS (closedir, int, (DIR *dirp), _GL_ARG_NONNULL ((1)));
130# endif 130# endif
131_GL_CXXALIAS_SYS (closedir, int, (DIR *dirp)); 131_GL_CXXALIAS_SYS (closedir, int, (DIR *dirp));
132# endif 132# endif
@@ -147,14 +147,14 @@ _GL_WARN_ON_USE (closedir, "closedir is not portable - "
147# define GNULIB_defined_opendir 1 147# define GNULIB_defined_opendir 1
148# endif 148# endif
149_GL_FUNCDECL_RPL (opendir, DIR *, 149_GL_FUNCDECL_RPL (opendir, DIR *,
150 (const char *dir_name) 150 (const char *dir_name),
151 _GL_ARG_NONNULL ((1)) 151 _GL_ARG_NONNULL ((1))
152 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1)); 152 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1));
153_GL_CXXALIAS_RPL (opendir, DIR *, (const char *dir_name)); 153_GL_CXXALIAS_RPL (opendir, DIR *, (const char *dir_name));
154# else 154# else
155# if !@HAVE_OPENDIR@ || __GNUC__ >= 11 155# if !@HAVE_OPENDIR@ || (__GNUC__ >= 11 && !defined __clang__)
156_GL_FUNCDECL_SYS (opendir, DIR *, 156_GL_FUNCDECL_SYS (opendir, DIR *,
157 (const char *dir_name) 157 (const char *dir_name),
158 _GL_ARG_NONNULL ((1)) 158 _GL_ARG_NONNULL ((1))
159 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1)); 159 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1));
160# endif 160# endif
@@ -162,11 +162,12 @@ _GL_CXXALIAS_SYS (opendir, DIR *, (const char *dir_name));
162# endif 162# endif
163_GL_CXXALIASWARN (opendir); 163_GL_CXXALIASWARN (opendir);
164#else 164#else
165# if @GNULIB_CLOSEDIR@ && !GNULIB_defined_DIR && __GNUC__ >= 11 && !defined opendir 165# if @GNULIB_CLOSEDIR@ && !GNULIB_defined_DIR \
166 && (__GNUC__ >= 11 && !defined __clang__) && !defined opendir
166/* For -Wmismatched-dealloc: Associate opendir with closedir or 167/* For -Wmismatched-dealloc: Associate opendir with closedir or
167 rpl_closedir. */ 168 rpl_closedir. */
168_GL_FUNCDECL_SYS (opendir, DIR *, 169_GL_FUNCDECL_SYS (opendir, DIR *,
169 (const char *dir_name) 170 (const char *dir_name),
170 _GL_ARG_NONNULL ((1)) 171 _GL_ARG_NONNULL ((1))
171 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1)); 172 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1));
172# endif 173# endif
@@ -185,11 +186,11 @@ _GL_WARN_ON_USE (opendir, "opendir is not portable - "
185# undef readdir 186# undef readdir
186# define readdir rpl_readdir 187# define readdir rpl_readdir
187# endif 188# endif
188_GL_FUNCDECL_RPL (readdir, struct dirent *, (DIR *dirp) _GL_ARG_NONNULL ((1))); 189_GL_FUNCDECL_RPL (readdir, struct dirent *, (DIR *dirp), _GL_ARG_NONNULL ((1)));
189_GL_CXXALIAS_RPL (readdir, struct dirent *, (DIR *dirp)); 190_GL_CXXALIAS_RPL (readdir, struct dirent *, (DIR *dirp));
190# else 191# else
191# if !@HAVE_READDIR@ 192# if !@HAVE_READDIR@
192_GL_FUNCDECL_SYS (readdir, struct dirent *, (DIR *dirp) _GL_ARG_NONNULL ((1))); 193_GL_FUNCDECL_SYS (readdir, struct dirent *, (DIR *dirp), _GL_ARG_NONNULL ((1)));
193# endif 194# endif
194_GL_CXXALIAS_SYS (readdir, struct dirent *, (DIR *dirp)); 195_GL_CXXALIAS_SYS (readdir, struct dirent *, (DIR *dirp));
195# endif 196# endif
@@ -208,11 +209,11 @@ _GL_WARN_ON_USE (readdir, "readdir is not portable - "
208# undef rewinddir 209# undef rewinddir
209# define rewinddir rpl_rewinddir 210# define rewinddir rpl_rewinddir
210# endif 211# endif
211_GL_FUNCDECL_RPL (rewinddir, void, (DIR *dirp) _GL_ARG_NONNULL ((1))); 212_GL_FUNCDECL_RPL (rewinddir, void, (DIR *dirp), _GL_ARG_NONNULL ((1)));
212_GL_CXXALIAS_RPL (rewinddir, void, (DIR *dirp)); 213_GL_CXXALIAS_RPL (rewinddir, void, (DIR *dirp));
213# else 214# else
214# if !@HAVE_REWINDDIR@ 215# if !@HAVE_REWINDDIR@
215_GL_FUNCDECL_SYS (rewinddir, void, (DIR *dirp) _GL_ARG_NONNULL ((1))); 216_GL_FUNCDECL_SYS (rewinddir, void, (DIR *dirp), _GL_ARG_NONNULL ((1)));
216# endif 217# endif
217_GL_CXXALIAS_SYS (rewinddir, void, (DIR *dirp)); 218_GL_CXXALIAS_SYS (rewinddir, void, (DIR *dirp));
218# endif 219# endif
@@ -234,7 +235,7 @@ _GL_WARN_ON_USE (rewinddir, "rewinddir is not portable - "
234# undef dirfd 235# undef dirfd
235# define dirfd rpl_dirfd 236# define dirfd rpl_dirfd
236# endif 237# endif
237_GL_FUNCDECL_RPL (dirfd, int, (DIR *) _GL_ARG_NONNULL ((1))); 238_GL_FUNCDECL_RPL (dirfd, int, (DIR *), _GL_ARG_NONNULL ((1)));
238_GL_CXXALIAS_RPL (dirfd, int, (DIR *)); 239_GL_CXXALIAS_RPL (dirfd, int, (DIR *));
239 240
240# else 241# else
@@ -245,7 +246,7 @@ static inline int (dirfd) (DIR *dp) { return dirfd (dp); }
245# undef dirfd 246# undef dirfd
246# endif 247# endif
247# if !(@HAVE_DECL_DIRFD@ || defined dirfd) 248# if !(@HAVE_DECL_DIRFD@ || defined dirfd)
248_GL_FUNCDECL_SYS (dirfd, int, (DIR *) _GL_ARG_NONNULL ((1))); 249_GL_FUNCDECL_SYS (dirfd, int, (DIR *), _GL_ARG_NONNULL ((1)));
249# endif 250# endif
250_GL_CXXALIAS_SYS (dirfd, int, (DIR *)); 251_GL_CXXALIAS_SYS (dirfd, int, (DIR *));
251# endif 252# endif
@@ -270,24 +271,26 @@ _GL_WARN_ON_USE (dirfd, "dirfd is unportable - "
270# define fdopendir rpl_fdopendir 271# define fdopendir rpl_fdopendir
271# endif 272# endif
272_GL_FUNCDECL_RPL (fdopendir, DIR *, 273_GL_FUNCDECL_RPL (fdopendir, DIR *,
273 (int fd) 274 (int fd),
274 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1)); 275 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1));
275_GL_CXXALIAS_RPL (fdopendir, DIR *, (int fd)); 276_GL_CXXALIAS_RPL (fdopendir, DIR *, (int fd));
276# else 277# else
277# if !@HAVE_FDOPENDIR@ || !@HAVE_DECL_FDOPENDIR@ || __GNUC__ >= 11 278# if !@HAVE_FDOPENDIR@ || !@HAVE_DECL_FDOPENDIR@ \
279 || (__GNUC__ >= 11 && !defined __clang__)
278_GL_FUNCDECL_SYS (fdopendir, DIR *, 280_GL_FUNCDECL_SYS (fdopendir, DIR *,
279 (int fd) 281 (int fd),
280 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1)); 282 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1));
281# endif 283# endif
282_GL_CXXALIAS_SYS (fdopendir, DIR *, (int fd)); 284_GL_CXXALIAS_SYS (fdopendir, DIR *, (int fd));
283# endif 285# endif
284_GL_CXXALIASWARN (fdopendir); 286_GL_CXXALIASWARN (fdopendir);
285#else 287#else
286# if @GNULIB_CLOSEDIR@ && __GNUC__ >= 11 && !defined fdopendir 288# if @GNULIB_CLOSEDIR@ \
289 && (__GNUC__ >= 11 && !defined __clang__) && !defined fdopendir
287/* For -Wmismatched-dealloc: Associate fdopendir with closedir or 290/* For -Wmismatched-dealloc: Associate fdopendir with closedir or
288 rpl_closedir. */ 291 rpl_closedir. */
289_GL_FUNCDECL_SYS (fdopendir, DIR *, 292_GL_FUNCDECL_SYS (fdopendir, DIR *,
290 (int fd) 293 (int fd),
291 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1)); 294 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1));
292# endif 295# endif
293# if defined GNULIB_POSIXCHECK 296# if defined GNULIB_POSIXCHECK
@@ -308,7 +311,7 @@ _GL_WARN_ON_USE (fdopendir, "fdopendir is unportable - "
308_GL_FUNCDECL_SYS (scandir, int, 311_GL_FUNCDECL_SYS (scandir, int,
309 (const char *dir, struct dirent ***namelist, 312 (const char *dir, struct dirent ***namelist,
310 int (*filter) (const struct dirent *), 313 int (*filter) (const struct dirent *),
311 int (*cmp) (const struct dirent **, const struct dirent **)) 314 int (*cmp) (const struct dirent **, const struct dirent **)),
312 _GL_ARG_NONNULL ((1, 2, 4))); 315 _GL_ARG_NONNULL ((1, 2, 4)));
313# endif 316# endif
314/* Need to cast, because on glibc systems, the fourth parameter is 317/* Need to cast, because on glibc systems, the fourth parameter is
@@ -330,7 +333,7 @@ _GL_WARN_ON_USE (scandir, "scandir is unportable - "
330/* Compare two 'struct dirent' entries alphabetically. */ 333/* Compare two 'struct dirent' entries alphabetically. */
331# if !@HAVE_ALPHASORT@ 334# if !@HAVE_ALPHASORT@
332_GL_FUNCDECL_SYS (alphasort, int, 335_GL_FUNCDECL_SYS (alphasort, int,
333 (const struct dirent **, const struct dirent **) 336 (const struct dirent **, const struct dirent **),
334 _GL_ATTRIBUTE_PURE 337 _GL_ATTRIBUTE_PURE
335 _GL_ARG_NONNULL ((1, 2))); 338 _GL_ARG_NONNULL ((1, 2)));
336# endif 339# endif
diff --git a/lib/errno.in.h b/lib/errno.in.h
index aa658e62708..18eb8a0c582 100644
--- a/lib/errno.in.h
+++ b/lib/errno.in.h
@@ -133,7 +133,7 @@
133 133
134/* These are intentionally the same values as the WSA* error numbers, defined 134/* These are intentionally the same values as the WSA* error numbers, defined
135 in <winsock2.h>. */ 135 in <winsock2.h>. */
136# define ESOCKTNOSUPPORT 10044 /* not required by POSIX */ 136# define ESOCKTNOSUPPORT 10044
137# define EPFNOSUPPORT 10046 /* not required by POSIX */ 137# define EPFNOSUPPORT 10046 /* not required by POSIX */
138# define ESHUTDOWN 10058 /* not required by POSIX */ 138# define ESHUTDOWN 10058 /* not required by POSIX */
139# define ETOOMANYREFS 10059 /* not required by POSIX */ 139# define ETOOMANYREFS 10059 /* not required by POSIX */
@@ -270,10 +270,17 @@
270# define GNULIB_defined_ENOTRECOVERABLE 1 270# define GNULIB_defined_ENOTRECOVERABLE 1
271# endif 271# endif
272 272
273/* On LynxOS, the macro EILSEQ is not defined. */
273# ifndef EILSEQ 274# ifndef EILSEQ
274# define EILSEQ 2015 275# define EILSEQ 2015
275# define GNULIB_defined_EILSEQ 1 276# define GNULIB_defined_EILSEQ 1
276# endif 277# endif
277 278
279/* On Haiku, the macro ESOCKTNOSUPPORT is not defined. */
280# ifndef ESOCKTNOSUPPORT
281# define ESOCKTNOSUPPORT 2016
282# define GNULIB_defined_ESOCKTNOSUPPORT 1
283# endif
284
278#endif /* _@GUARD_PREFIX@_ERRNO_H */ 285#endif /* _@GUARD_PREFIX@_ERRNO_H */
279#endif /* _@GUARD_PREFIX@_ERRNO_H */ 286#endif /* _@GUARD_PREFIX@_ERRNO_H */
diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h
index 1465ce594d7..8b8274295a5 100644
--- a/lib/fcntl.in.h
+++ b/lib/fcntl.in.h
@@ -100,7 +100,7 @@
100# undef creat 100# undef creat
101# define creat rpl_creat 101# define creat rpl_creat
102# endif 102# endif
103_GL_FUNCDECL_RPL (creat, int, (const char *filename, mode_t mode) 103_GL_FUNCDECL_RPL (creat, int, (const char *filename, mode_t mode),
104 _GL_ARG_NONNULL ((1))); 104 _GL_ARG_NONNULL ((1)));
105_GL_CXXALIAS_RPL (creat, int, (const char *filename, mode_t mode)); 105_GL_CXXALIAS_RPL (creat, int, (const char *filename, mode_t mode));
106# elif defined _WIN32 && !defined __CYGWIN__ 106# elif defined _WIN32 && !defined __CYGWIN__
@@ -170,7 +170,7 @@ _GL_WARN_ON_USE (fcntl, "fcntl is not always POSIX compliant - "
170# undef open 170# undef open
171# define open rpl_open 171# define open rpl_open
172# endif 172# endif
173_GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) 173_GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...),
174 _GL_ARG_NONNULL ((1))); 174 _GL_ARG_NONNULL ((1)));
175_GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); 175_GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
176# elif defined _WIN32 && !defined __CYGWIN__ 176# elif defined _WIN32 && !defined __CYGWIN__
@@ -217,14 +217,14 @@ _GL_CXXALIASWARN (open);
217# define openat rpl_openat 217# define openat rpl_openat
218# endif 218# endif
219_GL_FUNCDECL_RPL (openat, int, 219_GL_FUNCDECL_RPL (openat, int,
220 (int fd, char const *file, int flags, /* mode_t mode */ ...) 220 (int fd, char const *file, int flags, /* mode_t mode */ ...),
221 _GL_ARG_NONNULL ((2))); 221 _GL_ARG_NONNULL ((2)));
222_GL_CXXALIAS_RPL (openat, int, 222_GL_CXXALIAS_RPL (openat, int,
223 (int fd, char const *file, int flags, /* mode_t mode */ ...)); 223 (int fd, char const *file, int flags, /* mode_t mode */ ...));
224# else 224# else
225# if !@HAVE_OPENAT@ 225# if !@HAVE_OPENAT@
226_GL_FUNCDECL_SYS (openat, int, 226_GL_FUNCDECL_SYS (openat, int,
227 (int fd, char const *file, int flags, /* mode_t mode */ ...) 227 (int fd, char const *file, int flags, /* mode_t mode */ ...),
228 _GL_ARG_NONNULL ((2))); 228 _GL_ARG_NONNULL ((2)));
229# endif 229# endif
230_GL_CXXALIAS_SYS (openat, int, 230_GL_CXXALIAS_SYS (openat, int,
diff --git a/lib/file-has-acl.c b/lib/file-has-acl.c
index 898fb030d1d..06759a4948c 100644
--- a/lib/file-has-acl.c
+++ b/lib/file-has-acl.c
@@ -17,14 +17,14 @@
17 17
18 Written by Paul Eggert, Andreas Grünbacher, and Bruno Haible. */ 18 Written by Paul Eggert, Andreas Grünbacher, and Bruno Haible. */
19 19
20#include <config.h>
21
20/* Without this pragma, gcc 4.7.0 20120126 may suggest that the 22/* Without this pragma, gcc 4.7.0 20120126 may suggest that the
21 file_has_acl function might be candidate for attribute 'const' */ 23 file_has_acl function might be candidate for attribute 'const' */
22#if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__ 24#if _GL_GNUC_PREREQ (4, 6)
23# pragma GCC diagnostic ignored "-Wsuggest-attribute=const" 25# pragma GCC diagnostic ignored "-Wsuggest-attribute=const"
24#endif 26#endif
25 27
26#include <config.h>
27
28#include "acl.h" 28#include "acl.h"
29 29
30#include "acl-internal.h" 30#include "acl-internal.h"
diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in
index cebde64d117..5e541d9af1f 100644
--- a/lib/gnulib.mk.in
+++ b/lib/gnulib.mk.in
@@ -47,6 +47,7 @@
47# --avoid=iswdigit \ 47# --avoid=iswdigit \
48# --avoid=iswxdigit \ 48# --avoid=iswxdigit \
49# --avoid=langinfo \ 49# --avoid=langinfo \
50# --avoid=libgmp-mpq \
50# --avoid=localename-unsafe-limited \ 51# --avoid=localename-unsafe-limited \
51# --avoid=lock \ 52# --avoid=lock \
52# --avoid=mbrtowc \ 53# --avoid=mbrtowc \
@@ -226,6 +227,7 @@ CAIRO_XCB_CFLAGS = @CAIRO_XCB_CFLAGS@
226CAIRO_XCB_LIBS = @CAIRO_XCB_LIBS@ 227CAIRO_XCB_LIBS = @CAIRO_XCB_LIBS@
227CAIRO_XLIB_CFLAGS = @CAIRO_XLIB_CFLAGS@ 228CAIRO_XLIB_CFLAGS = @CAIRO_XLIB_CFLAGS@
228CAIRO_XLIB_LIBS = @CAIRO_XLIB_LIBS@ 229CAIRO_XLIB_LIBS = @CAIRO_XLIB_LIBS@
230CAN_PRINT_STACK_TRACE = @CAN_PRINT_STACK_TRACE@
229CC = @CC@ 231CC = @CC@
230CFLAGS = @CFLAGS@ 232CFLAGS = @CFLAGS@
231CFLAGS_SOUND = @CFLAGS_SOUND@ 233CFLAGS_SOUND = @CFLAGS_SOUND@
@@ -597,6 +599,7 @@ GL_GNULIB_SECURE_GETENV = @GL_GNULIB_SECURE_GETENV@
597GL_GNULIB_SELECT = @GL_GNULIB_SELECT@ 599GL_GNULIB_SELECT = @GL_GNULIB_SELECT@
598GL_GNULIB_SETENV = @GL_GNULIB_SETENV@ 600GL_GNULIB_SETENV = @GL_GNULIB_SETENV@
599GL_GNULIB_SETHOSTNAME = @GL_GNULIB_SETHOSTNAME@ 601GL_GNULIB_SETHOSTNAME = @GL_GNULIB_SETHOSTNAME@
602GL_GNULIB_SIG2STR = @GL_GNULIB_SIG2STR@
600GL_GNULIB_SIGABBREV_NP = @GL_GNULIB_SIGABBREV_NP@ 603GL_GNULIB_SIGABBREV_NP = @GL_GNULIB_SIGABBREV_NP@
601GL_GNULIB_SIGACTION = @GL_GNULIB_SIGACTION@ 604GL_GNULIB_SIGACTION = @GL_GNULIB_SIGACTION@
602GL_GNULIB_SIGDESCR_NP = @GL_GNULIB_SIGDESCR_NP@ 605GL_GNULIB_SIGDESCR_NP = @GL_GNULIB_SIGDESCR_NP@
@@ -606,6 +609,7 @@ GL_GNULIB_SLEEP = @GL_GNULIB_SLEEP@
606GL_GNULIB_SNPRINTF = @GL_GNULIB_SNPRINTF@ 609GL_GNULIB_SNPRINTF = @GL_GNULIB_SNPRINTF@
607GL_GNULIB_SNZPRINTF = @GL_GNULIB_SNZPRINTF@ 610GL_GNULIB_SNZPRINTF = @GL_GNULIB_SNZPRINTF@
608GL_GNULIB_SPRINTF_POSIX = @GL_GNULIB_SPRINTF_POSIX@ 611GL_GNULIB_SPRINTF_POSIX = @GL_GNULIB_SPRINTF_POSIX@
612GL_GNULIB_STACK_TRACE = @GL_GNULIB_STACK_TRACE@
609GL_GNULIB_STAT = @GL_GNULIB_STAT@ 613GL_GNULIB_STAT = @GL_GNULIB_STAT@
610GL_GNULIB_STDIO_H_NONBLOCKING = @GL_GNULIB_STDIO_H_NONBLOCKING@ 614GL_GNULIB_STDIO_H_NONBLOCKING = @GL_GNULIB_STDIO_H_NONBLOCKING@
611GL_GNULIB_STDIO_H_SIGPIPE = @GL_GNULIB_STDIO_H_SIGPIPE@ 615GL_GNULIB_STDIO_H_SIGPIPE = @GL_GNULIB_STDIO_H_SIGPIPE@
@@ -886,6 +890,7 @@ HAVE_SECURE_GETENV = @HAVE_SECURE_GETENV@
886HAVE_SETENV = @HAVE_SETENV@ 890HAVE_SETENV = @HAVE_SETENV@
887HAVE_SETHOSTNAME = @HAVE_SETHOSTNAME@ 891HAVE_SETHOSTNAME = @HAVE_SETHOSTNAME@
888HAVE_SETSTATE = @HAVE_SETSTATE@ 892HAVE_SETSTATE = @HAVE_SETSTATE@
893HAVE_SIG2STR = @HAVE_SIG2STR@
889HAVE_SIGABBREV_NP = @HAVE_SIGABBREV_NP@ 894HAVE_SIGABBREV_NP = @HAVE_SIGABBREV_NP@
890HAVE_SIGACTION = @HAVE_SIGACTION@ 895HAVE_SIGACTION = @HAVE_SIGACTION@
891HAVE_SIGDESCR_NP = @HAVE_SIGDESCR_NP@ 896HAVE_SIGDESCR_NP = @HAVE_SIGDESCR_NP@
@@ -900,6 +905,7 @@ HAVE_SPAWN_H = @HAVE_SPAWN_H@
900HAVE_STDINT_H = @HAVE_STDINT_H@ 905HAVE_STDINT_H = @HAVE_STDINT_H@
901HAVE_STPCPY = @HAVE_STPCPY@ 906HAVE_STPCPY = @HAVE_STPCPY@
902HAVE_STPNCPY = @HAVE_STPNCPY@ 907HAVE_STPNCPY = @HAVE_STPNCPY@
908HAVE_STR2SIG = @HAVE_STR2SIG@
903HAVE_STRCASESTR = @HAVE_STRCASESTR@ 909HAVE_STRCASESTR = @HAVE_STRCASESTR@
904HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ 910HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
905HAVE_STRERRORNAME_NP = @HAVE_STRERRORNAME_NP@ 911HAVE_STRERRORNAME_NP = @HAVE_STRERRORNAME_NP@
@@ -933,6 +939,7 @@ HAVE_TIMESPEC_GET = @HAVE_TIMESPEC_GET@
933HAVE_TIMESPEC_GETRES = @HAVE_TIMESPEC_GETRES@ 939HAVE_TIMESPEC_GETRES = @HAVE_TIMESPEC_GETRES@
934HAVE_TIMEZONE_T = @HAVE_TIMEZONE_T@ 940HAVE_TIMEZONE_T = @HAVE_TIMEZONE_T@
935HAVE_TYPE_VOLATILE_SIG_ATOMIC_T = @HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@ 941HAVE_TYPE_VOLATILE_SIG_ATOMIC_T = @HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@
942HAVE_TZALLOC = @HAVE_TZALLOC@
936HAVE_UNISTD_H = @HAVE_UNISTD_H@ 943HAVE_UNISTD_H = @HAVE_UNISTD_H@
937HAVE_UNLINKAT = @HAVE_UNLINKAT@ 944HAVE_UNLINKAT = @HAVE_UNLINKAT@
938HAVE_UNLOCKPT = @HAVE_UNLOCKPT@ 945HAVE_UNLOCKPT = @HAVE_UNLOCKPT@
@@ -1057,6 +1064,7 @@ NDK_BUILD_MODULES = @NDK_BUILD_MODULES@
1057NDK_BUILD_NASM = @NDK_BUILD_NASM@ 1064NDK_BUILD_NASM = @NDK_BUILD_NASM@
1058NDK_BUILD_READELF = @NDK_BUILD_READELF@ 1065NDK_BUILD_READELF = @NDK_BUILD_READELF@
1059NDK_BUILD_SDK = @NDK_BUILD_SDK@ 1066NDK_BUILD_SDK = @NDK_BUILD_SDK@
1067NDK_BUILD_SO_LDFLAGS = @NDK_BUILD_SO_LDFLAGS@
1060NEXT_ASSERT_H = @NEXT_ASSERT_H@ 1068NEXT_ASSERT_H = @NEXT_ASSERT_H@
1061NEXT_AS_FIRST_DIRECTIVE_ASSERT_H = @NEXT_AS_FIRST_DIRECTIVE_ASSERT_H@ 1069NEXT_AS_FIRST_DIRECTIVE_ASSERT_H = @NEXT_AS_FIRST_DIRECTIVE_ASSERT_H@
1062NEXT_AS_FIRST_DIRECTIVE_DIRENT_H = @NEXT_AS_FIRST_DIRECTIVE_DIRENT_H@ 1070NEXT_AS_FIRST_DIRECTIVE_DIRENT_H = @NEXT_AS_FIRST_DIRECTIVE_DIRENT_H@
@@ -1218,6 +1226,7 @@ REPLACE_LINK = @REPLACE_LINK@
1218REPLACE_LINKAT = @REPLACE_LINKAT@ 1226REPLACE_LINKAT = @REPLACE_LINKAT@
1219REPLACE_LOCALTIME = @REPLACE_LOCALTIME@ 1227REPLACE_LOCALTIME = @REPLACE_LOCALTIME@
1220REPLACE_LOCALTIME_R = @REPLACE_LOCALTIME_R@ 1228REPLACE_LOCALTIME_R = @REPLACE_LOCALTIME_R@
1229REPLACE_LOCALTIME_RZ = @REPLACE_LOCALTIME_RZ@
1221REPLACE_LSEEK = @REPLACE_LSEEK@ 1230REPLACE_LSEEK = @REPLACE_LSEEK@
1222REPLACE_LSTAT = @REPLACE_LSTAT@ 1231REPLACE_LSTAT = @REPLACE_LSTAT@
1223REPLACE_MALLOC_FOR_MALLOC_GNU = @REPLACE_MALLOC_FOR_MALLOC_GNU@ 1232REPLACE_MALLOC_FOR_MALLOC_GNU = @REPLACE_MALLOC_FOR_MALLOC_GNU@
@@ -1238,6 +1247,7 @@ REPLACE_MKOSTEMP = @REPLACE_MKOSTEMP@
1238REPLACE_MKOSTEMPS = @REPLACE_MKOSTEMPS@ 1247REPLACE_MKOSTEMPS = @REPLACE_MKOSTEMPS@
1239REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ 1248REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
1240REPLACE_MKTIME = @REPLACE_MKTIME@ 1249REPLACE_MKTIME = @REPLACE_MKTIME@
1250REPLACE_MKTIME_Z = @REPLACE_MKTIME_Z@
1241REPLACE_NANOSLEEP = @REPLACE_NANOSLEEP@ 1251REPLACE_NANOSLEEP = @REPLACE_NANOSLEEP@
1242REPLACE_NULL = @REPLACE_NULL@ 1252REPLACE_NULL = @REPLACE_NULL@
1243REPLACE_OBSTACK_PRINTF = @REPLACE_OBSTACK_PRINTF@ 1253REPLACE_OBSTACK_PRINTF = @REPLACE_OBSTACK_PRINTF@
@@ -2592,8 +2602,8 @@ EXTRA_DIST += cdefs.h libc-config.h
2592endif 2602endif
2593## end gnulib module libc-config 2603## end gnulib module libc-config
2594 2604
2595## begin gnulib module libgmp 2605## begin gnulib module libgmp-mpz
2596ifeq (,$(OMIT_GNULIB_MODULE_libgmp)) 2606ifeq (,$(OMIT_GNULIB_MODULE_libgmp-mpz))
2597 2607
2598BUILT_SOURCES += $(GMP_H) 2608BUILT_SOURCES += $(GMP_H)
2599 2609
@@ -2602,6 +2612,9 @@ ifneq (,$(GL_GENERATE_MINI_GMP_H_CONDITION))
2602# Build gmp.h as a wrapper for mini-gmp.h when using mini-gmp. 2612# Build gmp.h as a wrapper for mini-gmp.h when using mini-gmp.
2603gmp.h: $(top_builddir)/config.status 2613gmp.h: $(top_builddir)/config.status
2604 echo '#include "mini-gmp.h"' > $@-t 2614 echo '#include "mini-gmp.h"' > $@-t
2615 echo '#if GNULIB_LIBGMP_MPQ' >> $@-t
2616 echo '# include "mini-mpq.h"' >> $@-t
2617 echo '#endif' >> $@-t
2605 mv $@-t $@ 2618 mv $@-t $@
2606endif 2619endif
2607ifneq (,$(GL_GENERATE_GMP_GMP_H_CONDITION)) 2620ifneq (,$(GL_GENERATE_GMP_GMP_H_CONDITION))
@@ -2625,7 +2638,7 @@ EXTRA_DIST += mini-gmp.c mini-gmp.h
2625EXTRA_libgnu_a_SOURCES += mini-gmp.c 2638EXTRA_libgnu_a_SOURCES += mini-gmp.c
2626 2639
2627endif 2640endif
2628## end gnulib module libgmp 2641## end gnulib module libgmp-mpz
2629 2642
2630## begin gnulib module limits-h 2643## begin gnulib module limits-h
2631ifeq (,$(OMIT_GNULIB_MODULE_limits-h)) 2644ifeq (,$(OMIT_GNULIB_MODULE_limits-h))
@@ -3001,15 +3014,18 @@ signal.h: signal.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
3001 -e 's|@''NEXT_SIGNAL_H''@|$(NEXT_SIGNAL_H)|g' \ 3014 -e 's|@''NEXT_SIGNAL_H''@|$(NEXT_SIGNAL_H)|g' \
3002 -e 's/@''GNULIB_PTHREAD_SIGMASK''@/$(GL_GNULIB_PTHREAD_SIGMASK)/g' \ 3015 -e 's/@''GNULIB_PTHREAD_SIGMASK''@/$(GL_GNULIB_PTHREAD_SIGMASK)/g' \
3003 -e 's/@''GNULIB_RAISE''@/$(GL_GNULIB_RAISE)/g' \ 3016 -e 's/@''GNULIB_RAISE''@/$(GL_GNULIB_RAISE)/g' \
3017 -e 's/@''GNULIB_SIG2STR''@/$(GL_GNULIB_SIG2STR)/g' \
3004 -e 's/@''GNULIB_SIGNAL_H_SIGPIPE''@/$(GL_GNULIB_SIGNAL_H_SIGPIPE)/g' \ 3018 -e 's/@''GNULIB_SIGNAL_H_SIGPIPE''@/$(GL_GNULIB_SIGNAL_H_SIGPIPE)/g' \
3005 -e 's/@''GNULIB_SIGPROCMASK''@/$(GL_GNULIB_SIGPROCMASK)/g' \ 3019 -e 's/@''GNULIB_SIGPROCMASK''@/$(GL_GNULIB_SIGPROCMASK)/g' \
3006 -e 's/@''GNULIB_SIGACTION''@/$(GL_GNULIB_SIGACTION)/g' \ 3020 -e 's/@''GNULIB_SIGACTION''@/$(GL_GNULIB_SIGACTION)/g' \
3007 -e 's|@''HAVE_POSIX_SIGNALBLOCKING''@|$(HAVE_POSIX_SIGNALBLOCKING)|g' \ 3021 -e 's|@''HAVE_POSIX_SIGNALBLOCKING''@|$(HAVE_POSIX_SIGNALBLOCKING)|g' \
3008 -e 's|@''HAVE_PTHREAD_SIGMASK''@|$(HAVE_PTHREAD_SIGMASK)|g' \ 3022 -e 's|@''HAVE_PTHREAD_SIGMASK''@|$(HAVE_PTHREAD_SIGMASK)|g' \
3009 -e 's|@''HAVE_RAISE''@|$(HAVE_RAISE)|g' \ 3023 -e 's|@''HAVE_RAISE''@|$(HAVE_RAISE)|g' \
3024 -e 's|@''HAVE_SIG2STR''@|$(HAVE_SIG2STR)|g' \
3010 -e 's|@''HAVE_SIGSET_T''@|$(HAVE_SIGSET_T)|g' \ 3025 -e 's|@''HAVE_SIGSET_T''@|$(HAVE_SIGSET_T)|g' \
3011 -e 's|@''HAVE_SIGINFO_T''@|$(HAVE_SIGINFO_T)|g' \ 3026 -e 's|@''HAVE_SIGINFO_T''@|$(HAVE_SIGINFO_T)|g' \
3012 -e 's|@''HAVE_SIGACTION''@|$(HAVE_SIGACTION)|g' \ 3027 -e 's|@''HAVE_SIGACTION''@|$(HAVE_SIGACTION)|g' \
3028 -e 's|@''HAVE_STR2SIG''@|$(HAVE_STR2SIG)|g' \
3013 -e 's|@''HAVE_STRUCT_SIGACTION_SA_SIGACTION''@|$(HAVE_STRUCT_SIGACTION_SA_SIGACTION)|g' \ 3029 -e 's|@''HAVE_STRUCT_SIGACTION_SA_SIGACTION''@|$(HAVE_STRUCT_SIGACTION_SA_SIGACTION)|g' \
3014 -e 's|@''HAVE_TYPE_VOLATILE_SIG_ATOMIC_T''@|$(HAVE_TYPE_VOLATILE_SIG_ATOMIC_T)|g' \ 3030 -e 's|@''HAVE_TYPE_VOLATILE_SIG_ATOMIC_T''@|$(HAVE_TYPE_VOLATILE_SIG_ATOMIC_T)|g' \
3015 -e 's|@''HAVE_SIGHANDLER_T''@|$(HAVE_SIGHANDLER_T)|g' \ 3031 -e 's|@''HAVE_SIGHANDLER_T''@|$(HAVE_SIGHANDLER_T)|g' \
@@ -3491,6 +3507,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
3491 -e 's/@''GNULIB_RPMATCH''@/$(GL_GNULIB_RPMATCH)/g' \ 3507 -e 's/@''GNULIB_RPMATCH''@/$(GL_GNULIB_RPMATCH)/g' \
3492 -e 's/@''GNULIB_SECURE_GETENV''@/$(GL_GNULIB_SECURE_GETENV)/g' \ 3508 -e 's/@''GNULIB_SECURE_GETENV''@/$(GL_GNULIB_SECURE_GETENV)/g' \
3493 -e 's/@''GNULIB_SETENV''@/$(GL_GNULIB_SETENV)/g' \ 3509 -e 's/@''GNULIB_SETENV''@/$(GL_GNULIB_SETENV)/g' \
3510 -e 's/@''GNULIB_STACK_TRACE''@/$(GL_GNULIB_STACK_TRACE)/g' \
3494 -e 's/@''GNULIB_STRTOD''@/$(GL_GNULIB_STRTOD)/g' \ 3511 -e 's/@''GNULIB_STRTOD''@/$(GL_GNULIB_STRTOD)/g' \
3495 -e 's/@''GNULIB_STRTOF''@/$(GL_GNULIB_STRTOF)/g' \ 3512 -e 's/@''GNULIB_STRTOF''@/$(GL_GNULIB_STRTOF)/g' \
3496 -e 's/@''GNULIB_STRTOL''@/$(GL_GNULIB_STRTOL)/g' \ 3513 -e 's/@''GNULIB_STRTOL''@/$(GL_GNULIB_STRTOL)/g' \
@@ -3600,6 +3617,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
3600 -e 's|@''REPLACE_STRTOULL''@|$(REPLACE_STRTOULL)|g' \ 3617 -e 's|@''REPLACE_STRTOULL''@|$(REPLACE_STRTOULL)|g' \
3601 -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \ 3618 -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \
3602 -e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \ 3619 -e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \
3620 -e 's|@''CAN_PRINT_STACK_TRACE''@|$(CAN_PRINT_STACK_TRACE)|g' \
3603 -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ 3621 -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
3604 -e '/definition of _Noreturn/r $(_NORETURN_H)' \ 3622 -e '/definition of _Noreturn/r $(_NORETURN_H)' \
3605 -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ 3623 -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
@@ -3960,6 +3978,7 @@ sys/time.h: sys_time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU
3960 $(srcdir)/sys_time.in.h > $@-t 3978 $(srcdir)/sys_time.in.h > $@-t
3961 $(AM_V_at)mv $@-t $@ 3979 $(AM_V_at)mv $@-t $@
3962MOSTLYCLEANFILES += sys/time.h sys/time.h-t 3980MOSTLYCLEANFILES += sys/time.h sys/time.h-t
3981MOSTLYCLEANDIRS += sys
3963 3982
3964EXTRA_DIST += sys_time.in.h 3983EXTRA_DIST += sys_time.in.h
3965 3984
@@ -3987,6 +4006,7 @@ sys/types.h: sys_types.in.h $(top_builddir)/config.status
3987 $(srcdir)/sys_types.in.h > $@-t 4006 $(srcdir)/sys_types.in.h > $@-t
3988 $(AM_V_at)mv $@-t $@ 4007 $(AM_V_at)mv $@-t $@
3989MOSTLYCLEANFILES += sys/types.h sys/types.h-t 4008MOSTLYCLEANFILES += sys/types.h sys/types.h-t
4009MOSTLYCLEANDIRS += sys
3990 4010
3991EXTRA_DIST += sys_types.in.h 4011EXTRA_DIST += sys_types.in.h
3992 4012
@@ -4039,11 +4059,14 @@ time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
4039 -e 's|@''HAVE_TIMESPEC_GET''@|$(HAVE_TIMESPEC_GET)|g' \ 4059 -e 's|@''HAVE_TIMESPEC_GET''@|$(HAVE_TIMESPEC_GET)|g' \
4040 -e 's|@''HAVE_TIMESPEC_GETRES''@|$(HAVE_TIMESPEC_GETRES)|g' \ 4060 -e 's|@''HAVE_TIMESPEC_GETRES''@|$(HAVE_TIMESPEC_GETRES)|g' \
4041 -e 's|@''HAVE_TIMEZONE_T''@|$(HAVE_TIMEZONE_T)|g' \ 4061 -e 's|@''HAVE_TIMEZONE_T''@|$(HAVE_TIMEZONE_T)|g' \
4062 -e 's|@''HAVE_TZALLOC''@|$(HAVE_TZALLOC)|g' \
4042 -e 's|@''REPLACE_CTIME''@|$(REPLACE_CTIME)|g' \ 4063 -e 's|@''REPLACE_CTIME''@|$(REPLACE_CTIME)|g' \
4043 -e 's|@''REPLACE_GMTIME''@|$(REPLACE_GMTIME)|g' \ 4064 -e 's|@''REPLACE_GMTIME''@|$(REPLACE_GMTIME)|g' \
4044 -e 's|@''REPLACE_LOCALTIME''@|$(REPLACE_LOCALTIME)|g' \ 4065 -e 's|@''REPLACE_LOCALTIME''@|$(REPLACE_LOCALTIME)|g' \
4045 -e 's|@''REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \ 4066 -e 's|@''REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \
4067 -e 's|@''REPLACE_LOCALTIME_RZ''@|$(REPLACE_LOCALTIME_RZ)|g' \
4046 -e 's|@''REPLACE_MKTIME''@|$(REPLACE_MKTIME)|g' \ 4068 -e 's|@''REPLACE_MKTIME''@|$(REPLACE_MKTIME)|g' \
4069 -e 's|@''REPLACE_MKTIME_Z''@|$(REPLACE_MKTIME_Z)|g' \
4047 -e 's|@''REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \ 4070 -e 's|@''REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \
4048 -e 's|@''REPLACE_STRFTIME''@|$(REPLACE_STRFTIME)|g' \ 4071 -e 's|@''REPLACE_STRFTIME''@|$(REPLACE_STRFTIME)|g' \
4049 -e 's|@''REPLACE_TIME''@|$(REPLACE_TIME)|g' \ 4072 -e 's|@''REPLACE_TIME''@|$(REPLACE_TIME)|g' \
diff --git a/lib/intprops-internal.h b/lib/intprops-internal.h
index 443024c6657..c8cc0e20194 100644
--- a/lib/intprops-internal.h
+++ b/lib/intprops-internal.h
@@ -21,7 +21,7 @@
21#include <limits.h> 21#include <limits.h>
22 22
23/* Pacify GCC 13.2 in some calls to _GL_EXPR_SIGNED. */ 23/* Pacify GCC 13.2 in some calls to _GL_EXPR_SIGNED. */
24#if defined __GNUC__ && 4 < __GNUC__ + (3 <= __GNUC_MINOR__) 24#if 4 < __GNUC__ + (3 <= __GNUC_MINOR__) && !defined __clang__
25# pragma GCC diagnostic ignored "-Wtype-limits" 25# pragma GCC diagnostic ignored "-Wtype-limits"
26#endif 26#endif
27 27
@@ -163,7 +163,7 @@
163#if _GL_HAS_BUILTIN_MUL_OVERFLOW 163#if _GL_HAS_BUILTIN_MUL_OVERFLOW
164# if ((9 < __GNUC__ + (3 <= __GNUC_MINOR__) \ 164# if ((9 < __GNUC__ + (3 <= __GNUC_MINOR__) \
165 || (__GNUC__ == 8 && 4 <= __GNUC_MINOR__)) \ 165 || (__GNUC__ == 8 && 4 <= __GNUC_MINOR__)) \
166 && !defined __EDG__) 166 && !defined __clang__ && !defined __EDG__)
167# define _GL_INT_MULTIPLY_WRAPV(a, b, r) __builtin_mul_overflow (a, b, r) 167# define _GL_INT_MULTIPLY_WRAPV(a, b, r) __builtin_mul_overflow (a, b, r)
168# else 168# else
169 /* Work around GCC bug 91450. */ 169 /* Work around GCC bug 91450. */
diff --git a/lib/inttypes.in.h b/lib/inttypes.in.h
index b9ab8a4b424..e9c80f3dca5 100644
--- a/lib/inttypes.in.h
+++ b/lib/inttypes.in.h
@@ -970,7 +970,7 @@ _GL_WARN_ON_USE (imaxdiv, "imaxdiv is unportable - "
970# define strtoimax rpl_strtoimax 970# define strtoimax rpl_strtoimax
971# endif 971# endif
972_GL_FUNCDECL_RPL (strtoimax, intmax_t, 972_GL_FUNCDECL_RPL (strtoimax, intmax_t,
973 (const char *restrict, char **restrict, int) 973 (const char *restrict, char **restrict, int),
974 _GL_ARG_NONNULL ((1))); 974 _GL_ARG_NONNULL ((1)));
975_GL_CXXALIAS_RPL (strtoimax, intmax_t, 975_GL_CXXALIAS_RPL (strtoimax, intmax_t,
976 (const char *restrict, char **restrict, int)); 976 (const char *restrict, char **restrict, int));
@@ -978,7 +978,7 @@ _GL_CXXALIAS_RPL (strtoimax, intmax_t,
978# if !@HAVE_DECL_STRTOIMAX@ 978# if !@HAVE_DECL_STRTOIMAX@
979# undef strtoimax 979# undef strtoimax
980_GL_FUNCDECL_SYS (strtoimax, intmax_t, 980_GL_FUNCDECL_SYS (strtoimax, intmax_t,
981 (const char *restrict, char **restrict, int) 981 (const char *restrict, char **restrict, int),
982 _GL_ARG_NONNULL ((1))); 982 _GL_ARG_NONNULL ((1)));
983# endif 983# endif
984_GL_CXXALIAS_SYS (strtoimax, intmax_t, 984_GL_CXXALIAS_SYS (strtoimax, intmax_t,
@@ -1000,7 +1000,7 @@ _GL_WARN_ON_USE (strtoimax, "strtoimax is unportable - "
1000# define strtoumax rpl_strtoumax 1000# define strtoumax rpl_strtoumax
1001# endif 1001# endif
1002_GL_FUNCDECL_RPL (strtoumax, uintmax_t, 1002_GL_FUNCDECL_RPL (strtoumax, uintmax_t,
1003 (const char *restrict, char **restrict, int) 1003 (const char *restrict, char **restrict, int),
1004 _GL_ARG_NONNULL ((1))); 1004 _GL_ARG_NONNULL ((1)));
1005_GL_CXXALIAS_RPL (strtoumax, uintmax_t, 1005_GL_CXXALIAS_RPL (strtoumax, uintmax_t,
1006 (const char *restrict, char **restrict, int)); 1006 (const char *restrict, char **restrict, int));
@@ -1008,7 +1008,7 @@ _GL_CXXALIAS_RPL (strtoumax, uintmax_t,
1008# if !@HAVE_DECL_STRTOUMAX@ 1008# if !@HAVE_DECL_STRTOUMAX@
1009# undef strtoumax 1009# undef strtoumax
1010_GL_FUNCDECL_SYS (strtoumax, uintmax_t, 1010_GL_FUNCDECL_SYS (strtoumax, uintmax_t,
1011 (const char *restrict, char **restrict, int) 1011 (const char *restrict, char **restrict, int),
1012 _GL_ARG_NONNULL ((1))); 1012 _GL_ARG_NONNULL ((1)));
1013# endif 1013# endif
1014_GL_CXXALIAS_SYS (strtoumax, uintmax_t, 1014_GL_CXXALIAS_SYS (strtoumax, uintmax_t,
diff --git a/lib/libc-config.h b/lib/libc-config.h
index 70114608fb1..33bdb73660c 100644
--- a/lib/libc-config.h
+++ b/lib/libc-config.h
@@ -48,6 +48,11 @@
48 48
49/* From glibc <features.h>. */ 49/* From glibc <features.h>. */
50 50
51#if defined __clang__
52 /* clang really only groks GNU C 4.2, regardless of its value of __GNUC__. */
53# undef __GNUC_PREREQ
54# define __GNUC_PREREQ(maj, min) ((maj) < 4 + ((min) <= 2))
55#endif
51#ifndef __GNUC_PREREQ 56#ifndef __GNUC_PREREQ
52# if defined __GNUC__ && defined __GNUC_MINOR__ 57# if defined __GNUC__ && defined __GNUC_MINOR__
53# define __GNUC_PREREQ(maj, min) ((maj) < __GNUC__ + ((min) <= __GNUC_MINOR__)) 58# define __GNUC_PREREQ(maj, min) ((maj) < __GNUC__ + ((min) <= __GNUC_MINOR__))
diff --git a/lib/md5-stream.c b/lib/md5-stream.c
index c82f18145e0..fdd2bd8b4bf 100644
--- a/lib/md5-stream.c
+++ b/lib/md5-stream.c
@@ -132,10 +132,3 @@ process_partial_block:
132 free (buffer); 132 free (buffer);
133 return 0; 133 return 0;
134} 134}
135
136/*
137 * Hey Emacs!
138 * Local Variables:
139 * coding: utf-8
140 * End:
141 */
diff --git a/lib/mini-gmp-gnulib.c b/lib/mini-gmp-gnulib.c
index 6e02d3cefb6..764323f8f78 100644
--- a/lib/mini-gmp-gnulib.c
+++ b/lib/mini-gmp-gnulib.c
@@ -31,11 +31,11 @@
31#include "mini-gmp.h" 31#include "mini-gmp.h"
32 32
33/* Pacify GCC -Wsuggest-attribute=const, pure, malloc. */ 33/* Pacify GCC -Wsuggest-attribute=const, pure, malloc. */
34#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) 34#if _GL_GNUC_PREREQ (4, 6)
35# pragma GCC diagnostic ignored "-Wsuggest-attribute=const" 35# pragma GCC diagnostic ignored "-Wsuggest-attribute=const"
36# pragma GCC diagnostic ignored "-Wsuggest-attribute=pure" 36# pragma GCC diagnostic ignored "-Wsuggest-attribute=pure"
37#endif 37#endif
38#if 8 <= __GNUC__ 38#if _GL_GNUC_PREREQ (8, 0)
39# pragma GCC diagnostic ignored "-Wsuggest-attribute=malloc" 39# pragma GCC diagnostic ignored "-Wsuggest-attribute=malloc"
40#endif 40#endif
41 41
diff --git a/lib/sig2str.c b/lib/sig2str.c
index c6b91e38498..2dad2cd5a3c 100644
--- a/lib/sig2str.c
+++ b/lib/sig2str.c
@@ -19,8 +19,10 @@
19 19
20#include <config.h> 20#include <config.h>
21 21
22#include <limits.h> 22/* Specification. */
23#include <signal.h> 23#include <signal.h>
24
25#include <limits.h>
24#include <stdlib.h> 26#include <stdlib.h>
25#include <stdio.h> 27#include <stdio.h>
26#include <string.h> 28#include <string.h>
diff --git a/lib/sig2str.h b/lib/sig2str.h
index 391da4b1d1c..1abdb140e5a 100644
--- a/lib/sig2str.h
+++ b/lib/sig2str.h
@@ -19,27 +19,6 @@
19 19
20#include <signal.h> 20#include <signal.h>
21 21
22/* Don't override system declarations of SIG2STR_MAX, sig2str, str2sig. */
23#ifndef SIG2STR_MAX
24
25# include "intprops.h"
26
27/* Size of a buffer needed to hold a signal name like "HUP". */
28# define SIG2STR_MAX (sizeof "SIGRTMAX" + INT_STRLEN_BOUND (int) - 1)
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34int sig2str (int, char *);
35int str2sig (char const *, int *);
36
37#ifdef __cplusplus
38}
39#endif
40
41#endif
42
43/* An upper bound on signal numbers allowed by the system. */ 22/* An upper bound on signal numbers allowed by the system. */
44 23
45#if defined _sys_nsig 24#if defined _sys_nsig
diff --git a/lib/signal.in.h b/lib/signal.in.h
index 107226e3dcf..a0effa21ba1 100644
--- a/lib/signal.in.h
+++ b/lib/signal.in.h
@@ -139,6 +139,47 @@ typedef void (*sighandler_t) (int);
139#endif 139#endif
140 140
141 141
142/* Maximum size of a signal name returned by sig2str(), including the
143 terminating NUL byte. */
144#ifndef SIG2STR_MAX
145/* The longest one: "RTMAX", then "+" or "-", then up to 10 digits, then NUL.
146 Add + 2 as a reserve for the future. */
147# define SIG2STR_MAX (5 + 1 + 10 + 1 + 2)
148#endif
149
150#if @GNULIB_SIG2STR@
151# if !@HAVE_SIG2STR@
152_GL_FUNCDECL_SYS (sig2str, int, (int signo, char *str));
153# endif
154_GL_CXXALIAS_SYS (sig2str, int, (int signo, char *str));
155# if __GLIBC__ >= 2
156_GL_CXXALIASWARN (sig2str);
157# endif
158#elif defined GNULIB_POSIXCHECK
159# undef sig2str
160# if HAVE_RAW_DECL_SIG2STR
161_GL_WARN_ON_USE (sig2str, "sig2str is not portable - "
162 "use gnulib module sig2str for portability");
163# endif
164#endif
165
166#if @GNULIB_SIG2STR@
167# if !@HAVE_STR2SIG@
168_GL_FUNCDECL_SYS (str2sig, int, (char const *str, int *signo_p));
169# endif
170_GL_CXXALIAS_SYS (str2sig, int, (char const *str, int *signo_p));
171# if __GLIBC__ >= 2
172_GL_CXXALIASWARN (str2sig);
173# endif
174#elif defined GNULIB_POSIXCHECK
175# undef str2sig
176# if HAVE_RAW_DECL_STR2SIG
177_GL_WARN_ON_USE (str2sig, "str2sig is not portable - "
178 "use gnulib module sig2str for portability");
179# endif
180#endif
181
182
142#if @GNULIB_PTHREAD_SIGMASK@ 183#if @GNULIB_PTHREAD_SIGMASK@
143# if @REPLACE_PTHREAD_SIGMASK@ 184# if @REPLACE_PTHREAD_SIGMASK@
144# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 185# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -243,7 +284,7 @@ typedef int verify_NSIG_constraint[NSIG <= 32 ? 1 : -1];
243# undef sigismember 284# undef sigismember
244# endif 285# endif
245# else 286# else
246_GL_FUNCDECL_SYS (sigismember, int, (const sigset_t *set, int sig) 287_GL_FUNCDECL_SYS (sigismember, int, (const sigset_t *set, int sig),
247 _GL_ARG_NONNULL ((1))); 288 _GL_ARG_NONNULL ((1)));
248# endif 289# endif
249_GL_CXXALIAS_SYS (sigismember, int, (const sigset_t *set, int sig)); 290_GL_CXXALIAS_SYS (sigismember, int, (const sigset_t *set, int sig));
@@ -256,7 +297,7 @@ _GL_CXXALIASWARN (sigismember);
256# undef sigemptyset 297# undef sigemptyset
257# endif 298# endif
258# else 299# else
259_GL_FUNCDECL_SYS (sigemptyset, int, (sigset_t *set) _GL_ARG_NONNULL ((1))); 300_GL_FUNCDECL_SYS (sigemptyset, int, (sigset_t *set), _GL_ARG_NONNULL ((1)));
260# endif 301# endif
261_GL_CXXALIAS_SYS (sigemptyset, int, (sigset_t *set)); 302_GL_CXXALIAS_SYS (sigemptyset, int, (sigset_t *set));
262_GL_CXXALIASWARN (sigemptyset); 303_GL_CXXALIASWARN (sigemptyset);
@@ -268,7 +309,7 @@ _GL_CXXALIASWARN (sigemptyset);
268# undef sigaddset 309# undef sigaddset
269# endif 310# endif
270# else 311# else
271_GL_FUNCDECL_SYS (sigaddset, int, (sigset_t *set, int sig) 312_GL_FUNCDECL_SYS (sigaddset, int, (sigset_t *set, int sig),
272 _GL_ARG_NONNULL ((1))); 313 _GL_ARG_NONNULL ((1)));
273# endif 314# endif
274_GL_CXXALIAS_SYS (sigaddset, int, (sigset_t *set, int sig)); 315_GL_CXXALIAS_SYS (sigaddset, int, (sigset_t *set, int sig));
@@ -281,7 +322,7 @@ _GL_CXXALIASWARN (sigaddset);
281# undef sigdelset 322# undef sigdelset
282# endif 323# endif
283# else 324# else
284_GL_FUNCDECL_SYS (sigdelset, int, (sigset_t *set, int sig) 325_GL_FUNCDECL_SYS (sigdelset, int, (sigset_t *set, int sig),
285 _GL_ARG_NONNULL ((1))); 326 _GL_ARG_NONNULL ((1)));
286# endif 327# endif
287_GL_CXXALIAS_SYS (sigdelset, int, (sigset_t *set, int sig)); 328_GL_CXXALIAS_SYS (sigdelset, int, (sigset_t *set, int sig));
@@ -294,14 +335,14 @@ _GL_CXXALIASWARN (sigdelset);
294# undef sigfillset 335# undef sigfillset
295# endif 336# endif
296# else 337# else
297_GL_FUNCDECL_SYS (sigfillset, int, (sigset_t *set) _GL_ARG_NONNULL ((1))); 338_GL_FUNCDECL_SYS (sigfillset, int, (sigset_t *set), _GL_ARG_NONNULL ((1)));
298# endif 339# endif
299_GL_CXXALIAS_SYS (sigfillset, int, (sigset_t *set)); 340_GL_CXXALIAS_SYS (sigfillset, int, (sigset_t *set));
300_GL_CXXALIASWARN (sigfillset); 341_GL_CXXALIASWARN (sigfillset);
301 342
302/* Return the set of those blocked signals that are pending. */ 343/* Return the set of those blocked signals that are pending. */
303# if !@HAVE_POSIX_SIGNALBLOCKING@ 344# if !@HAVE_POSIX_SIGNALBLOCKING@
304_GL_FUNCDECL_SYS (sigpending, int, (sigset_t *set) _GL_ARG_NONNULL ((1))); 345_GL_FUNCDECL_SYS (sigpending, int, (sigset_t *set), _GL_ARG_NONNULL ((1)));
305# endif 346# endif
306_GL_CXXALIAS_SYS (sigpending, int, (sigset_t *set)); 347_GL_CXXALIAS_SYS (sigpending, int, (sigset_t *set));
307_GL_CXXALIASWARN (sigpending); 348_GL_CXXALIASWARN (sigpending);
diff --git a/lib/stddef.in.h b/lib/stddef.in.h
index 0abc4497043..e39268c60c9 100644
--- a/lib/stddef.in.h
+++ b/lib/stddef.in.h
@@ -131,7 +131,7 @@ typedef long max_align_t;
131 */ 131 */
132#ifndef _GL_ATTRIBUTE_NOTHROW 132#ifndef _GL_ATTRIBUTE_NOTHROW
133# if defined __cplusplus 133# if defined __cplusplus
134# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4 134# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4
135# if __cplusplus >= 201103L 135# if __cplusplus >= 201103L
136# define _GL_ATTRIBUTE_NOTHROW noexcept (true) 136# define _GL_ATTRIBUTE_NOTHROW noexcept (true)
137# else 137# else
@@ -194,7 +194,7 @@ typedef union
194# ifndef _GL_HAS_BUILTIN_UNREACHABLE 194# ifndef _GL_HAS_BUILTIN_UNREACHABLE
195# if defined __clang_major__ && __clang_major__ < 5 195# if defined __clang_major__ && __clang_major__ < 5
196# define _GL_HAS_BUILTIN_UNREACHABLE 0 196# define _GL_HAS_BUILTIN_UNREACHABLE 0
197# elif 4 < __GNUC__ + (5 <= __GNUC_MINOR__) 197# elif 4 < __GNUC__ + (5 <= __GNUC_MINOR__) && !defined __clang__
198# define _GL_HAS_BUILTIN_UNREACHABLE 1 198# define _GL_HAS_BUILTIN_UNREACHABLE 1
199# elif defined __has_builtin 199# elif defined __has_builtin
200# define _GL_HAS_BUILTIN_UNREACHABLE __has_builtin (__builtin_unreachable) 200# define _GL_HAS_BUILTIN_UNREACHABLE __has_builtin (__builtin_unreachable)
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index 38572382d46..36fd6a72ceb 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -64,8 +64,8 @@
64#define _@GUARD_PREFIX@_STDIO_H 64#define _@GUARD_PREFIX@_STDIO_H
65 65
66/* This file uses _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_FORMAT, 66/* This file uses _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_FORMAT,
67 _GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_NOTHROW, GNULIB_POSIXCHECK, 67 _GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOTHROW,
68 HAVE_RAW_DECL_*. */ 68 GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
69#if !_GL_CONFIG_H_INCLUDED 69#if !_GL_CONFIG_H_INCLUDED
70 #error "Please include config.h first." 70 #error "Please include config.h first."
71#endif 71#endif
@@ -120,7 +120,7 @@
120 that can be freed by passing them as the Ith argument to the 120 that can be freed by passing them as the Ith argument to the
121 function F. */ 121 function F. */
122#ifndef _GL_ATTRIBUTE_DEALLOC 122#ifndef _GL_ATTRIBUTE_DEALLOC
123# if __GNUC__ >= 11 123# if __GNUC__ >= 11 && !defined __clang__
124# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) 124# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
125# else 125# else
126# define _GL_ATTRIBUTE_DEALLOC(f, i) 126# define _GL_ATTRIBUTE_DEALLOC(f, i)
@@ -155,7 +155,7 @@
155 */ 155 */
156#ifndef _GL_ATTRIBUTE_NOTHROW 156#ifndef _GL_ATTRIBUTE_NOTHROW
157# if defined __cplusplus 157# if defined __cplusplus
158# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4 158# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4
159# if __cplusplus >= 201103L 159# if __cplusplus >= 201103L
160# define _GL_ATTRIBUTE_NOTHROW noexcept (true) 160# define _GL_ATTRIBUTE_NOTHROW noexcept (true)
161# else 161# else
@@ -178,7 +178,7 @@
178 standardized by ISO C99 and POSIX. 178 standardized by ISO C99 and POSIX.
179 _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD */ 179 _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD */
180/* __gnu_printf__ is supported in GCC >= 4.4. */ 180/* __gnu_printf__ is supported in GCC >= 4.4. */
181#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) 181#if (__GNUC__ + (__GNUC_MINOR__ >= 4) > 4) && !defined __clang__
182# define _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD __gnu_printf__ 182# define _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD __gnu_printf__
183#else 183#else
184# define _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD __printf__ 184# define _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD __printf__
@@ -289,7 +289,7 @@
289 directives nor widths, the only possible failure codes are ENOMEM 289 directives nor widths, the only possible failure codes are ENOMEM
290 and the possible failure codes from write(), excluding EINTR. */ 290 and the possible failure codes from write(), excluding EINTR. */
291_GL_FUNCDECL_SYS (dzprintf, off64_t, 291_GL_FUNCDECL_SYS (dzprintf, off64_t,
292 (int fd, const char *restrict format, ...) 292 (int fd, const char *restrict format, ...),
293 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) 293 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
294 _GL_ARG_NONNULL ((2))); 294 _GL_ARG_NONNULL ((2)));
295_GL_CXXALIAS_SYS (dzprintf, off64_t, 295_GL_CXXALIAS_SYS (dzprintf, off64_t,
@@ -304,13 +304,13 @@ _GL_CXXALIAS_SYS (dzprintf, off64_t,
304# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 304# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
305# define dprintf rpl_dprintf 305# define dprintf rpl_dprintf
306# endif 306# endif
307_GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *restrict format, ...) 307_GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *restrict format, ...),
308 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) 308 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
309 _GL_ARG_NONNULL ((2))); 309 _GL_ARG_NONNULL ((2)));
310_GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *restrict format, ...)); 310_GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *restrict format, ...));
311# else 311# else
312# if !@HAVE_DPRINTF@ 312# if !@HAVE_DPRINTF@
313_GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *restrict format, ...) 313_GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *restrict format, ...),
314 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) 314 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
315 _GL_ARG_NONNULL ((2))); 315 _GL_ARG_NONNULL ((2)));
316# endif 316# endif
@@ -333,7 +333,7 @@ _GL_WARN_ON_USE (dprintf, "dprintf is unportable - "
333# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 333# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
334# define fclose rpl_fclose 334# define fclose rpl_fclose
335# endif 335# endif
336_GL_FUNCDECL_RPL (fclose, int, (FILE *stream) _GL_ARG_NONNULL ((1))); 336_GL_FUNCDECL_RPL (fclose, int, (FILE *stream), _GL_ARG_NONNULL ((1)));
337_GL_CXXALIAS_RPL (fclose, int, (FILE *stream)); 337_GL_CXXALIAS_RPL (fclose, int, (FILE *stream));
338# else 338# else
339_GL_CXXALIAS_SYS (fclose, int, (FILE *stream)); 339_GL_CXXALIAS_SYS (fclose, int, (FILE *stream));
@@ -380,9 +380,10 @@ _GL_CXXALIASWARN (fcloseall);
380# define fdopen rpl_fdopen 380# define fdopen rpl_fdopen
381# endif 381# endif
382_GL_FUNCDECL_RPL (fdopen, FILE *, 382_GL_FUNCDECL_RPL (fdopen, FILE *,
383 (int fd, const char *mode) 383 (int fd, const char *mode),
384 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1) 384 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)
385 _GL_ATTRIBUTE_MALLOC); 385 _GL_ATTRIBUTE_MALLOC
386 _GL_ATTRIBUTE_NODISCARD);
386_GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode)); 387_GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode));
387# elif defined _WIN32 && !defined __CYGWIN__ 388# elif defined _WIN32 && !defined __CYGWIN__
388# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 389# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -391,36 +392,38 @@ _GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode));
391# endif 392# endif
392_GL_CXXALIAS_MDA (fdopen, FILE *, (int fd, const char *mode)); 393_GL_CXXALIAS_MDA (fdopen, FILE *, (int fd, const char *mode));
393# else 394# else
394# if __GNUC__ >= 11 395# if __GNUC__ >= 11 && !defined __clang__
395/* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose. */ 396/* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose. */
396# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 397# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
397_GL_FUNCDECL_SYS (fdopen, FILE *, 398_GL_FUNCDECL_SYS (fdopen, FILE *,
398 (int fd, const char *mode) 399 (int fd, const char *mode),
399 _GL_ATTRIBUTE_NOTHROW
400 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1) 400 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)
401 _GL_ATTRIBUTE_MALLOC); 401 _GL_ATTRIBUTE_MALLOC
402 _GL_ATTRIBUTE_NODISCARD)
403 _GL_ATTRIBUTE_NOTHROW;
402# else 404# else
403_GL_FUNCDECL_SYS (fdopen, FILE *, 405_GL_FUNCDECL_SYS (fdopen, FILE *,
404 (int fd, const char *mode) 406 (int fd, const char *mode),
405 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1) 407 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)
406 _GL_ATTRIBUTE_MALLOC); 408 _GL_ATTRIBUTE_MALLOC
409 _GL_ATTRIBUTE_NODISCARD);
407# endif 410# endif
408# endif 411# endif
409_GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode)); 412_GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode));
410# endif 413# endif
411_GL_CXXALIASWARN (fdopen); 414_GL_CXXALIASWARN (fdopen);
412#else 415#else
413# if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined fdopen 416# if @GNULIB_FCLOSE@ && (__GNUC__ >= 11 && !defined __clang__) && !defined fdopen
414/* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose. */ 417/* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose. */
415# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 418# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
416_GL_FUNCDECL_SYS (fdopen, FILE *, 419_GL_FUNCDECL_SYS (fdopen, FILE *,
417 (int fd, const char *mode) 420 (int fd, const char *mode),
418 _GL_ATTRIBUTE_NOTHROW
419 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1) 421 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)
420 _GL_ATTRIBUTE_MALLOC); 422 _GL_ATTRIBUTE_MALLOC)
423 _GL_ATTRIBUTE_NOTHROW;
421# else 424# else
422_GL_FUNCDECL_SYS (fdopen, FILE *, 425_GL_FUNCDECL_SYS (fdopen, FILE *,
423 (int fd, const char *mode) 426 (int fd, const char *mode),
424 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1) 427 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)
425 _GL_ATTRIBUTE_MALLOC); 428 _GL_ATTRIBUTE_MALLOC);
426# endif 429# endif
@@ -479,7 +482,7 @@ _GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - "
479# undef fgetc 482# undef fgetc
480# define fgetc rpl_fgetc 483# define fgetc rpl_fgetc
481# endif 484# endif
482_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1))); 485_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream), _GL_ARG_NONNULL ((1)));
483_GL_CXXALIAS_RPL (fgetc, int, (FILE *stream)); 486_GL_CXXALIAS_RPL (fgetc, int, (FILE *stream));
484# else 487# else
485_GL_CXXALIAS_SYS (fgetc, int, (FILE *stream)); 488_GL_CXXALIAS_SYS (fgetc, int, (FILE *stream));
@@ -496,8 +499,8 @@ _GL_CXXALIASWARN (fgetc);
496# define fgets rpl_fgets 499# define fgets rpl_fgets
497# endif 500# endif
498_GL_FUNCDECL_RPL (fgets, char *, 501_GL_FUNCDECL_RPL (fgets, char *,
499 (char *restrict s, int n, FILE *restrict stream) 502 (char *restrict s, int n, FILE *restrict stream),
500 _GL_ARG_NONNULL ((1, 3))); 503 _GL_ARG_NONNULL ((1, 3)) _GL_ATTRIBUTE_NODISCARD);
501_GL_CXXALIAS_RPL (fgets, char *, 504_GL_CXXALIAS_RPL (fgets, char *,
502 (char *restrict s, int n, FILE *restrict stream)); 505 (char *restrict s, int n, FILE *restrict stream));
503# else 506# else
@@ -533,17 +536,18 @@ _GL_CXXALIASWARN (fileno);
533# define fopen rpl_fopen 536# define fopen rpl_fopen
534# endif 537# endif
535_GL_FUNCDECL_RPL (fopen, FILE *, 538_GL_FUNCDECL_RPL (fopen, FILE *,
536 (const char *restrict filename, const char *restrict mode) 539 (const char *restrict filename, const char *restrict mode),
537 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1) 540 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)
538 _GL_ATTRIBUTE_MALLOC); 541 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_NODISCARD);
539_GL_CXXALIAS_RPL (fopen, FILE *, 542_GL_CXXALIAS_RPL (fopen, FILE *,
540 (const char *restrict filename, const char *restrict mode)); 543 (const char *restrict filename, const char *restrict mode));
541# else 544# else
542# if __GNUC__ >= 11 545# if __GNUC__ >= 11 && !defined __clang__
543/* For -Wmismatched-dealloc: Associate fopen with fclose or rpl_fclose. */ 546/* For -Wmismatched-dealloc: Associate fopen with fclose or rpl_fclose. */
544_GL_FUNCDECL_SYS (fopen, FILE *, 547_GL_FUNCDECL_SYS (fopen, FILE *,
545 (const char *restrict filename, const char *restrict mode) 548 (const char *restrict filename, const char *restrict mode),
546 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); 549 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)
550 _GL_ATTRIBUTE_NODISCARD);
547# endif 551# endif
548_GL_CXXALIAS_SYS (fopen, FILE *, 552_GL_CXXALIAS_SYS (fopen, FILE *,
549 (const char *restrict filename, const char *restrict mode)); 553 (const char *restrict filename, const char *restrict mode));
@@ -552,10 +556,10 @@ _GL_CXXALIAS_SYS (fopen, FILE *,
552_GL_CXXALIASWARN (fopen); 556_GL_CXXALIASWARN (fopen);
553# endif 557# endif
554#else 558#else
555# if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined fopen 559# if @GNULIB_FCLOSE@ && (__GNUC__ >= 11 && !defined __clang__) && !defined fopen
556/* For -Wmismatched-dealloc: Associate fopen with fclose or rpl_fclose. */ 560/* For -Wmismatched-dealloc: Associate fopen with fclose or rpl_fclose. */
557_GL_FUNCDECL_SYS (fopen, FILE *, 561_GL_FUNCDECL_SYS (fopen, FILE *,
558 (const char *restrict filename, const char *restrict mode) 562 (const char *restrict filename, const char *restrict mode),
559 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); 563 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1));
560# endif 564# endif
561# if defined GNULIB_POSIXCHECK 565# if defined GNULIB_POSIXCHECK
@@ -575,7 +579,7 @@ _GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX complian
575 directives nor widths, the only possible failure causes are ENOMEM 579 directives nor widths, the only possible failure causes are ENOMEM
576 and the possible failure causes from fwrite(). */ 580 and the possible failure causes from fwrite(). */
577_GL_FUNCDECL_SYS (fzprintf, off64_t, 581_GL_FUNCDECL_SYS (fzprintf, off64_t,
578 (FILE *restrict fp, const char *restrict format, ...) 582 (FILE *restrict fp, const char *restrict format, ...),
579 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) 583 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
580 _GL_ARG_NONNULL ((1, 2))); 584 _GL_ARG_NONNULL ((1, 2)));
581_GL_CXXALIAS_SYS (fzprintf, off64_t, 585_GL_CXXALIAS_SYS (fzprintf, off64_t,
@@ -594,12 +598,12 @@ _GL_CXXALIAS_SYS (fzprintf, off64_t,
594# define GNULIB_overrides_fprintf 1 598# define GNULIB_overrides_fprintf 1
595# if @GNULIB_FPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ 599# if @GNULIB_FPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
596_GL_FUNCDECL_RPL (fprintf, int, 600_GL_FUNCDECL_RPL (fprintf, int,
597 (FILE *restrict fp, const char *restrict format, ...) 601 (FILE *restrict fp, const char *restrict format, ...),
598 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) 602 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
599 _GL_ARG_NONNULL ((1, 2))); 603 _GL_ARG_NONNULL ((1, 2)));
600# else 604# else
601_GL_FUNCDECL_RPL (fprintf, int, 605_GL_FUNCDECL_RPL (fprintf, int,
602 (FILE *restrict fp, const char *restrict format, ...) 606 (FILE *restrict fp, const char *restrict format, ...),
603 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3) 607 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3)
604 _GL_ARG_NONNULL ((1, 2))); 608 _GL_ARG_NONNULL ((1, 2)));
605# endif 609# endif
@@ -634,15 +638,17 @@ _GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX compliant - "
634# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 638# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
635# define fpurge rpl_fpurge 639# define fpurge rpl_fpurge
636# endif 640# endif
637_GL_FUNCDECL_RPL (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1))); 641_GL_FUNCDECL_RPL (fpurge, int, (FILE *gl_stream), _GL_ARG_NONNULL ((1)));
638_GL_CXXALIAS_RPL (fpurge, int, (FILE *gl_stream)); 642_GL_CXXALIAS_RPL (fpurge, int, (FILE *gl_stream));
639# else 643# else
640# if !@HAVE_DECL_FPURGE@ 644# if !@HAVE_DECL_FPURGE@
641_GL_FUNCDECL_SYS (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1))); 645_GL_FUNCDECL_SYS (fpurge, int, (FILE *gl_stream), _GL_ARG_NONNULL ((1)));
642# endif 646# endif
643_GL_CXXALIAS_SYS (fpurge, int, (FILE *gl_stream)); 647_GL_CXXALIAS_SYS (fpurge, int, (FILE *gl_stream));
644# endif 648# endif
649# if __GLIBC__ >= 2
645_GL_CXXALIASWARN (fpurge); 650_GL_CXXALIASWARN (fpurge);
651# endif
646#elif defined GNULIB_POSIXCHECK 652#elif defined GNULIB_POSIXCHECK
647# undef fpurge 653# undef fpurge
648# if HAVE_RAW_DECL_FPURGE 654# if HAVE_RAW_DECL_FPURGE
@@ -657,7 +663,7 @@ _GL_WARN_ON_USE (fpurge, "fpurge is not always present - "
657# undef fputc 663# undef fputc
658# define fputc rpl_fputc 664# define fputc rpl_fputc
659# endif 665# endif
660_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2))); 666_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream), _GL_ARG_NONNULL ((2)));
661_GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream)); 667_GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream));
662# else 668# else
663_GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream)); 669_GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream));
@@ -674,7 +680,7 @@ _GL_CXXALIASWARN (fputc);
674# define fputs rpl_fputs 680# define fputs rpl_fputs
675# endif 681# endif
676_GL_FUNCDECL_RPL (fputs, int, 682_GL_FUNCDECL_RPL (fputs, int,
677 (const char *restrict string, FILE *restrict stream) 683 (const char *restrict string, FILE *restrict stream),
678 _GL_ARG_NONNULL ((1, 2))); 684 _GL_ARG_NONNULL ((1, 2)));
679_GL_CXXALIAS_RPL (fputs, int, 685_GL_CXXALIAS_RPL (fputs, int,
680 (const char *restrict string, FILE *restrict stream)); 686 (const char *restrict string, FILE *restrict stream));
@@ -695,8 +701,8 @@ _GL_CXXALIASWARN (fputs);
695# endif 701# endif
696_GL_FUNCDECL_RPL (fread, size_t, 702_GL_FUNCDECL_RPL (fread, size_t,
697 (void *restrict ptr, size_t s, size_t n, 703 (void *restrict ptr, size_t s, size_t n,
698 FILE *restrict stream) 704 FILE *restrict stream),
699 _GL_ARG_NONNULL ((4))); 705 _GL_ARG_NONNULL ((4)) _GL_ATTRIBUTE_NODISCARD);
700_GL_CXXALIAS_RPL (fread, size_t, 706_GL_CXXALIAS_RPL (fread, size_t,
701 (void *restrict ptr, size_t s, size_t n, 707 (void *restrict ptr, size_t s, size_t n,
702 FILE *restrict stream)); 708 FILE *restrict stream));
@@ -718,8 +724,8 @@ _GL_CXXALIASWARN (fread);
718# endif 724# endif
719_GL_FUNCDECL_RPL (freopen, FILE *, 725_GL_FUNCDECL_RPL (freopen, FILE *,
720 (const char *restrict filename, const char *restrict mode, 726 (const char *restrict filename, const char *restrict mode,
721 FILE *restrict stream) 727 FILE *restrict stream),
722 _GL_ARG_NONNULL ((2, 3))); 728 _GL_ARG_NONNULL ((2, 3)) _GL_ATTRIBUTE_NODISCARD);
723_GL_CXXALIAS_RPL (freopen, FILE *, 729_GL_CXXALIAS_RPL (freopen, FILE *,
724 (const char *restrict filename, const char *restrict mode, 730 (const char *restrict filename, const char *restrict mode,
725 FILE *restrict stream)); 731 FILE *restrict stream));
@@ -746,9 +752,9 @@ _GL_WARN_ON_USE (freopen,
746# define fscanf rpl_fscanf 752# define fscanf rpl_fscanf
747# endif 753# endif
748_GL_FUNCDECL_RPL (fscanf, int, 754_GL_FUNCDECL_RPL (fscanf, int,
749 (FILE *restrict stream, const char *restrict format, ...) 755 (FILE *restrict stream, const char *restrict format, ...),
750 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3) 756 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3)
751 _GL_ARG_NONNULL ((1, 2))); 757 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
752_GL_CXXALIAS_RPL (fscanf, int, 758_GL_CXXALIAS_RPL (fscanf, int,
753 (FILE *restrict stream, const char *restrict format, ...)); 759 (FILE *restrict stream, const char *restrict format, ...));
754# else 760# else
@@ -802,7 +808,7 @@ _GL_CXXALIASWARN (fscanf);
802# undef fseek 808# undef fseek
803# define fseek rpl_fseek 809# define fseek rpl_fseek
804# endif 810# endif
805_GL_FUNCDECL_RPL (fseek, int, (FILE *fp, long offset, int whence) 811_GL_FUNCDECL_RPL (fseek, int, (FILE *fp, long offset, int whence),
806 _GL_ARG_NONNULL ((1))); 812 _GL_ARG_NONNULL ((1)));
807_GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence)); 813_GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence));
808# else 814# else
@@ -825,12 +831,12 @@ _GL_CXXALIASWARN (fseek);
825# undef fseeko 831# undef fseeko
826# define fseeko rpl_fseeko 832# define fseeko rpl_fseeko
827# endif 833# endif
828_GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence) 834_GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence),
829 _GL_ARG_NONNULL ((1))); 835 _GL_ARG_NONNULL ((1)));
830_GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence)); 836_GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence));
831# else 837# else
832# if ! @HAVE_DECL_FSEEKO@ 838# if ! @HAVE_DECL_FSEEKO@
833_GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence) 839_GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence),
834 _GL_ARG_NONNULL ((1))); 840 _GL_ARG_NONNULL ((1)));
835# endif 841# endif
836_GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)); 842_GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence));
@@ -868,7 +874,8 @@ _GL_WARN_ON_USE (fseek, "fseek cannot handle files larger than 4 GB "
868# undef ftell 874# undef ftell
869# define ftell rpl_ftell 875# define ftell rpl_ftell
870# endif 876# endif
871_GL_FUNCDECL_RPL (ftell, long, (FILE *fp) _GL_ARG_NONNULL ((1))); 877_GL_FUNCDECL_RPL (ftell, long, (FILE *fp),
878 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
872_GL_CXXALIAS_RPL (ftell, long, (FILE *fp)); 879_GL_CXXALIAS_RPL (ftell, long, (FILE *fp));
873# else 880# else
874_GL_CXXALIAS_SYS (ftell, long, (FILE *fp)); 881_GL_CXXALIAS_SYS (ftell, long, (FILE *fp));
@@ -888,11 +895,13 @@ _GL_CXXALIASWARN (ftell);
888# undef ftello 895# undef ftello
889# define ftello rpl_ftello 896# define ftello rpl_ftello
890# endif 897# endif
891_GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1))); 898_GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp),
899 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
892_GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp)); 900_GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp));
893# else 901# else
894# if ! @HAVE_DECL_FTELLO@ 902# if ! @HAVE_DECL_FTELLO@
895_GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1))); 903_GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp),
904 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
896# endif 905# endif
897_GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp)); 906_GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp));
898# endif 907# endif
@@ -925,7 +934,7 @@ _GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB "
925# endif 934# endif
926_GL_FUNCDECL_RPL (fwrite, size_t, 935_GL_FUNCDECL_RPL (fwrite, size_t,
927 (const void *restrict ptr, size_t s, size_t n, 936 (const void *restrict ptr, size_t s, size_t n,
928 FILE *restrict stream) 937 FILE *restrict stream),
929 _GL_ARG_NONNULL ((1, 4))); 938 _GL_ARG_NONNULL ((1, 4)));
930_GL_CXXALIAS_RPL (fwrite, size_t, 939_GL_CXXALIAS_RPL (fwrite, size_t,
931 (const void *restrict ptr, size_t s, size_t n, 940 (const void *restrict ptr, size_t s, size_t n,
@@ -940,9 +949,9 @@ _GL_CXXALIAS_SYS (fwrite, size_t,
940 which sometimes causes an unwanted diagnostic for fwrite calls. 949 which sometimes causes an unwanted diagnostic for fwrite calls.
941 This affects only function declaration attributes under certain 950 This affects only function declaration attributes under certain
942 versions of gcc and clang, and is not needed for C++. */ 951 versions of gcc and clang, and is not needed for C++. */
943# if (0 < __USE_FORTIFY_LEVEL \ 952# if (0 < __USE_FORTIFY_LEVEL \
944 && __GLIBC__ == 2 && 4 <= __GLIBC_MINOR__ && __GLIBC_MINOR__ <= 15 \ 953 && __GLIBC__ == 2 && 4 <= __GLIBC_MINOR__ && __GLIBC_MINOR__ <= 15 \
945 && 3 < __GNUC__ + (4 <= __GNUC_MINOR__) \ 954 && (3 < __GNUC__ + (4 <= __GNUC_MINOR__) || defined __clang__) \
946 && !defined __cplusplus) 955 && !defined __cplusplus)
947# undef fwrite 956# undef fwrite
948# undef fwrite_unlocked 957# undef fwrite_unlocked
@@ -969,7 +978,7 @@ _GL_CXXALIASWARN (fwrite);
969# undef getc 978# undef getc
970# define getc rpl_fgetc 979# define getc rpl_fgetc
971# endif 980# endif
972_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1))); 981_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream), _GL_ARG_NONNULL ((1)));
973_GL_CXXALIAS_RPL_1 (getc, rpl_fgetc, int, (FILE *stream)); 982_GL_CXXALIAS_RPL_1 (getc, rpl_fgetc, int, (FILE *stream));
974# else 983# else
975_GL_CXXALIAS_SYS (getc, int, (FILE *stream)); 984_GL_CXXALIAS_SYS (getc, int, (FILE *stream));
@@ -1010,8 +1019,8 @@ _GL_CXXALIASWARN (getchar);
1010_GL_FUNCDECL_RPL (getdelim, ssize_t, 1019_GL_FUNCDECL_RPL (getdelim, ssize_t,
1011 (char **restrict lineptr, size_t *restrict linesize, 1020 (char **restrict lineptr, size_t *restrict linesize,
1012 int delimiter, 1021 int delimiter,
1013 FILE *restrict stream) 1022 FILE *restrict stream),
1014 _GL_ARG_NONNULL ((1, 2, 4))); 1023 _GL_ARG_NONNULL ((1, 2, 4)) _GL_ATTRIBUTE_NODISCARD);
1015_GL_CXXALIAS_RPL (getdelim, ssize_t, 1024_GL_CXXALIAS_RPL (getdelim, ssize_t,
1016 (char **restrict lineptr, size_t *restrict linesize, 1025 (char **restrict lineptr, size_t *restrict linesize,
1017 int delimiter, 1026 int delimiter,
@@ -1021,8 +1030,8 @@ _GL_CXXALIAS_RPL (getdelim, ssize_t,
1021_GL_FUNCDECL_SYS (getdelim, ssize_t, 1030_GL_FUNCDECL_SYS (getdelim, ssize_t,
1022 (char **restrict lineptr, size_t *restrict linesize, 1031 (char **restrict lineptr, size_t *restrict linesize,
1023 int delimiter, 1032 int delimiter,
1024 FILE *restrict stream) 1033 FILE *restrict stream),
1025 _GL_ARG_NONNULL ((1, 2, 4))); 1034 _GL_ARG_NONNULL ((1, 2, 4)) _GL_ATTRIBUTE_NODISCARD);
1026# endif 1035# endif
1027_GL_CXXALIAS_SYS (getdelim, ssize_t, 1036_GL_CXXALIAS_SYS (getdelim, ssize_t,
1028 (char **restrict lineptr, size_t *restrict linesize, 1037 (char **restrict lineptr, size_t *restrict linesize,
@@ -1054,8 +1063,8 @@ _GL_WARN_ON_USE (getdelim, "getdelim is unportable - "
1054# endif 1063# endif
1055_GL_FUNCDECL_RPL (getline, ssize_t, 1064_GL_FUNCDECL_RPL (getline, ssize_t,
1056 (char **restrict lineptr, size_t *restrict linesize, 1065 (char **restrict lineptr, size_t *restrict linesize,
1057 FILE *restrict stream) 1066 FILE *restrict stream),
1058 _GL_ARG_NONNULL ((1, 2, 3))); 1067 _GL_ARG_NONNULL ((1, 2, 3)) _GL_ATTRIBUTE_NODISCARD);
1059_GL_CXXALIAS_RPL (getline, ssize_t, 1068_GL_CXXALIAS_RPL (getline, ssize_t,
1060 (char **restrict lineptr, size_t *restrict linesize, 1069 (char **restrict lineptr, size_t *restrict linesize,
1061 FILE *restrict stream)); 1070 FILE *restrict stream));
@@ -1063,8 +1072,8 @@ _GL_CXXALIAS_RPL (getline, ssize_t,
1063# if !@HAVE_DECL_GETLINE@ 1072# if !@HAVE_DECL_GETLINE@
1064_GL_FUNCDECL_SYS (getline, ssize_t, 1073_GL_FUNCDECL_SYS (getline, ssize_t,
1065 (char **restrict lineptr, size_t *restrict linesize, 1074 (char **restrict lineptr, size_t *restrict linesize,
1066 FILE *restrict stream) 1075 FILE *restrict stream),
1067 _GL_ARG_NONNULL ((1, 2, 3))); 1076 _GL_ARG_NONNULL ((1, 2, 3)) _GL_ATTRIBUTE_NODISCARD);
1068# endif 1077# endif
1069_GL_CXXALIAS_SYS (getline, ssize_t, 1078_GL_CXXALIAS_SYS (getline, ssize_t,
1070 (char **restrict lineptr, size_t *restrict linesize, 1079 (char **restrict lineptr, size_t *restrict linesize,
@@ -1126,13 +1135,13 @@ struct obstack;
1126 directives nor widths, the only possible failure code is through 1135 directives nor widths, the only possible failure code is through
1127 obstack_alloc_failed_handler. */ 1136 obstack_alloc_failed_handler. */
1128_GL_FUNCDECL_SYS (obstack_zprintf, ptrdiff_t, 1137_GL_FUNCDECL_SYS (obstack_zprintf, ptrdiff_t,
1129 (struct obstack *obs, const char *format, ...) 1138 (struct obstack *obs, const char *format, ...),
1130 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) 1139 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
1131 _GL_ARG_NONNULL ((1, 2))); 1140 _GL_ARG_NONNULL ((1, 2)));
1132_GL_CXXALIAS_SYS (obstack_zprintf, ptrdiff_t, 1141_GL_CXXALIAS_SYS (obstack_zprintf, ptrdiff_t,
1133 (struct obstack *obs, const char *format, ...)); 1142 (struct obstack *obs, const char *format, ...));
1134_GL_FUNCDECL_SYS (obstack_vzprintf, ptrdiff_t, 1143_GL_FUNCDECL_SYS (obstack_vzprintf, ptrdiff_t,
1135 (struct obstack *obs, const char *format, va_list args) 1144 (struct obstack *obs, const char *format, va_list args),
1136 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) 1145 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1137 _GL_ARG_NONNULL ((1, 2))); 1146 _GL_ARG_NONNULL ((1, 2)));
1138_GL_CXXALIAS_SYS (obstack_vzprintf, ptrdiff_t, 1147_GL_CXXALIAS_SYS (obstack_vzprintf, ptrdiff_t,
@@ -1151,7 +1160,7 @@ struct obstack;
1151# define obstack_printf rpl_obstack_printf 1160# define obstack_printf rpl_obstack_printf
1152# endif 1161# endif
1153_GL_FUNCDECL_RPL (obstack_printf, int, 1162_GL_FUNCDECL_RPL (obstack_printf, int,
1154 (struct obstack *obs, const char *format, ...) 1163 (struct obstack *obs, const char *format, ...),
1155 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) 1164 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
1156 _GL_ARG_NONNULL ((1, 2))); 1165 _GL_ARG_NONNULL ((1, 2)));
1157_GL_CXXALIAS_RPL (obstack_printf, int, 1166_GL_CXXALIAS_RPL (obstack_printf, int,
@@ -1159,7 +1168,7 @@ _GL_CXXALIAS_RPL (obstack_printf, int,
1159# else 1168# else
1160# if !@HAVE_DECL_OBSTACK_PRINTF@ 1169# if !@HAVE_DECL_OBSTACK_PRINTF@
1161_GL_FUNCDECL_SYS (obstack_printf, int, 1170_GL_FUNCDECL_SYS (obstack_printf, int,
1162 (struct obstack *obs, const char *format, ...) 1171 (struct obstack *obs, const char *format, ...),
1163 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) 1172 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
1164 _GL_ARG_NONNULL ((1, 2))); 1173 _GL_ARG_NONNULL ((1, 2)));
1165# endif 1174# endif
@@ -1172,7 +1181,7 @@ _GL_CXXALIASWARN (obstack_printf);
1172# define obstack_vprintf rpl_obstack_vprintf 1181# define obstack_vprintf rpl_obstack_vprintf
1173# endif 1182# endif
1174_GL_FUNCDECL_RPL (obstack_vprintf, int, 1183_GL_FUNCDECL_RPL (obstack_vprintf, int,
1175 (struct obstack *obs, const char *format, va_list args) 1184 (struct obstack *obs, const char *format, va_list args),
1176 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) 1185 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1177 _GL_ARG_NONNULL ((1, 2))); 1186 _GL_ARG_NONNULL ((1, 2)));
1178_GL_CXXALIAS_RPL (obstack_vprintf, int, 1187_GL_CXXALIAS_RPL (obstack_vprintf, int,
@@ -1180,7 +1189,7 @@ _GL_CXXALIAS_RPL (obstack_vprintf, int,
1180# else 1189# else
1181# if !@HAVE_DECL_OBSTACK_PRINTF@ 1190# if !@HAVE_DECL_OBSTACK_PRINTF@
1182_GL_FUNCDECL_SYS (obstack_vprintf, int, 1191_GL_FUNCDECL_SYS (obstack_vprintf, int,
1183 (struct obstack *obs, const char *format, va_list args) 1192 (struct obstack *obs, const char *format, va_list args),
1184 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) 1193 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1185 _GL_ARG_NONNULL ((1, 2))); 1194 _GL_ARG_NONNULL ((1, 2)));
1186# endif 1195# endif
@@ -1192,7 +1201,7 @@ _GL_CXXALIASWARN (obstack_vprintf);
1192 1201
1193#if @GNULIB_PCLOSE@ 1202#if @GNULIB_PCLOSE@
1194# if !@HAVE_PCLOSE@ 1203# if !@HAVE_PCLOSE@
1195_GL_FUNCDECL_SYS (pclose, int, (FILE *stream) _GL_ARG_NONNULL ((1))); 1204_GL_FUNCDECL_SYS (pclose, int, (FILE *stream), _GL_ARG_NONNULL ((1)));
1196# endif 1205# endif
1197_GL_CXXALIAS_SYS (pclose, int, (FILE *stream)); 1206_GL_CXXALIAS_SYS (pclose, int, (FILE *stream));
1198_GL_CXXALIASWARN (pclose); 1207_GL_CXXALIASWARN (pclose);
@@ -1234,25 +1243,26 @@ _GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - "
1234# define popen rpl_popen 1243# define popen rpl_popen
1235# endif 1244# endif
1236_GL_FUNCDECL_RPL (popen, FILE *, 1245_GL_FUNCDECL_RPL (popen, FILE *,
1237 (const char *cmd, const char *mode) 1246 (const char *cmd, const char *mode),
1238 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1) 1247 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1)
1239 _GL_ATTRIBUTE_MALLOC); 1248 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_NODISCARD);
1240_GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode)); 1249_GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode));
1241# else 1250# else
1242# if !@HAVE_POPEN@ || __GNUC__ >= 11 1251# if !@HAVE_POPEN@ || (__GNUC__ >= 11 && !defined __clang__)
1243_GL_FUNCDECL_SYS (popen, FILE *, 1252_GL_FUNCDECL_SYS (popen, FILE *,
1244 (const char *cmd, const char *mode) 1253 (const char *cmd, const char *mode),
1245 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1) 1254 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1)
1246 _GL_ATTRIBUTE_MALLOC); 1255 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_NODISCARD);
1247# endif 1256# endif
1248_GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode)); 1257_GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode));
1249# endif 1258# endif
1250_GL_CXXALIASWARN (popen); 1259_GL_CXXALIASWARN (popen);
1251#else 1260#else
1252# if @GNULIB_PCLOSE@ && __GNUC__ >= 11 && !defined popen 1261# if @GNULIB_PCLOSE@ \
1262 && (__GNUC__ >= 11 && !defined __clang__) && !defined popen
1253/* For -Wmismatched-dealloc: Associate popen with pclose or rpl_pclose. */ 1263/* For -Wmismatched-dealloc: Associate popen with pclose or rpl_pclose. */
1254_GL_FUNCDECL_SYS (popen, FILE *, 1264_GL_FUNCDECL_SYS (popen, FILE *,
1255 (const char *cmd, const char *mode) 1265 (const char *cmd, const char *mode),
1256 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1) 1266 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1)
1257 _GL_ATTRIBUTE_MALLOC); 1267 _GL_ATTRIBUTE_MALLOC);
1258# endif 1268# endif
@@ -1273,7 +1283,7 @@ _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - "
1273 Therefore, if the format string is valid and does not use %ls/%lc 1283 Therefore, if the format string is valid and does not use %ls/%lc
1274 directives nor widths, the only possible failure causes are ENOMEM 1284 directives nor widths, the only possible failure causes are ENOMEM
1275 and the possible failure causes from fwrite(). */ 1285 and the possible failure causes from fwrite(). */
1276_GL_FUNCDECL_SYS (zprintf, off64_t, (const char *restrict format, ...) 1286_GL_FUNCDECL_SYS (zprintf, off64_t, (const char *restrict format, ...),
1277 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2) 1287 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2)
1278 _GL_ARG_NONNULL ((1))); 1288 _GL_ARG_NONNULL ((1)));
1279_GL_CXXALIAS_SYS (zprintf, off64_t, (const char *restrict format, ...)); 1289_GL_CXXALIAS_SYS (zprintf, off64_t, (const char *restrict format, ...));
@@ -1294,14 +1304,14 @@ _GL_CXXALIAS_SYS (zprintf, off64_t, (const char *restrict format, ...));
1294_GL_FUNCDECL_RPL_1 (__printf__, int, 1304_GL_FUNCDECL_RPL_1 (__printf__, int,
1295 (const char *restrict format, ...) 1305 (const char *restrict format, ...)
1296 __asm__ (@ASM_SYMBOL_PREFIX@ 1306 __asm__ (@ASM_SYMBOL_PREFIX@
1297 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)) 1307 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)),
1298 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2) 1308 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2)
1299 _GL_ARG_NONNULL ((1))); 1309 _GL_ARG_NONNULL ((1)));
1300# else 1310# else
1301_GL_FUNCDECL_RPL_1 (__printf__, int, 1311_GL_FUNCDECL_RPL_1 (__printf__, int,
1302 (const char *restrict format, ...) 1312 (const char *restrict format, ...)
1303 __asm__ (@ASM_SYMBOL_PREFIX@ 1313 __asm__ (@ASM_SYMBOL_PREFIX@
1304 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)) 1314 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)),
1305 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2) 1315 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2)
1306 _GL_ARG_NONNULL ((1))); 1316 _GL_ARG_NONNULL ((1)));
1307# endif 1317# endif
@@ -1311,7 +1321,7 @@ _GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...));
1311# define printf rpl_printf 1321# define printf rpl_printf
1312# endif 1322# endif
1313_GL_FUNCDECL_RPL (printf, int, 1323_GL_FUNCDECL_RPL (printf, int,
1314 (const char *restrict format, ...) 1324 (const char *restrict format, ...),
1315 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2) 1325 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2)
1316 _GL_ARG_NONNULL ((1))); 1326 _GL_ARG_NONNULL ((1)));
1317_GL_CXXALIAS_RPL (printf, int, (const char *restrict format, ...)); 1327_GL_CXXALIAS_RPL (printf, int, (const char *restrict format, ...));
@@ -1340,7 +1350,7 @@ _GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - "
1340# undef putc 1350# undef putc
1341# define putc rpl_fputc 1351# define putc rpl_fputc
1342# endif 1352# endif
1343_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2))); 1353_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream), _GL_ARG_NONNULL ((2)));
1344_GL_CXXALIAS_RPL_1 (putc, rpl_fputc, int, (int c, FILE *stream)); 1354_GL_CXXALIAS_RPL_1 (putc, rpl_fputc, int, (int c, FILE *stream));
1345# else 1355# else
1346_GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream)); 1356_GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream));
@@ -1372,7 +1382,7 @@ _GL_CXXALIASWARN (putchar);
1372# undef puts 1382# undef puts
1373# define puts rpl_puts 1383# define puts rpl_puts
1374# endif 1384# endif
1375_GL_FUNCDECL_RPL (puts, int, (const char *string) _GL_ARG_NONNULL ((1))); 1385_GL_FUNCDECL_RPL (puts, int, (const char *string), _GL_ARG_NONNULL ((1)));
1376_GL_CXXALIAS_RPL (puts, int, (const char *string)); 1386_GL_CXXALIAS_RPL (puts, int, (const char *string));
1377# else 1387# else
1378_GL_CXXALIAS_SYS (puts, int, (const char *string)); 1388_GL_CXXALIAS_SYS (puts, int, (const char *string));
@@ -1412,7 +1422,7 @@ _GL_CXXALIASWARN (putw);
1412# undef remove 1422# undef remove
1413# define remove rpl_remove 1423# define remove rpl_remove
1414# endif 1424# endif
1415_GL_FUNCDECL_RPL (remove, int, (const char *name) _GL_ARG_NONNULL ((1))); 1425_GL_FUNCDECL_RPL (remove, int, (const char *name), _GL_ARG_NONNULL ((1)));
1416_GL_CXXALIAS_RPL (remove, int, (const char *name)); 1426_GL_CXXALIAS_RPL (remove, int, (const char *name));
1417# else 1427# else
1418_GL_CXXALIAS_SYS (remove, int, (const char *name)); 1428_GL_CXXALIAS_SYS (remove, int, (const char *name));
@@ -1434,7 +1444,7 @@ _GL_WARN_ON_USE (remove, "remove cannot handle directories on some platforms - "
1434# define rename rpl_rename 1444# define rename rpl_rename
1435# endif 1445# endif
1436_GL_FUNCDECL_RPL (rename, int, 1446_GL_FUNCDECL_RPL (rename, int,
1437 (const char *old_filename, const char *new_filename) 1447 (const char *old_filename, const char *new_filename),
1438 _GL_ARG_NONNULL ((1, 2))); 1448 _GL_ARG_NONNULL ((1, 2)));
1439_GL_CXXALIAS_RPL (rename, int, 1449_GL_CXXALIAS_RPL (rename, int,
1440 (const char *old_filename, const char *new_filename)); 1450 (const char *old_filename, const char *new_filename));
@@ -1459,14 +1469,14 @@ _GL_WARN_ON_USE (rename, "rename is buggy on some platforms - "
1459# define renameat rpl_renameat 1469# define renameat rpl_renameat
1460# endif 1470# endif
1461_GL_FUNCDECL_RPL (renameat, int, 1471_GL_FUNCDECL_RPL (renameat, int,
1462 (int fd1, char const *file1, int fd2, char const *file2) 1472 (int fd1, char const *file1, int fd2, char const *file2),
1463 _GL_ARG_NONNULL ((2, 4))); 1473 _GL_ARG_NONNULL ((2, 4)));
1464_GL_CXXALIAS_RPL (renameat, int, 1474_GL_CXXALIAS_RPL (renameat, int,
1465 (int fd1, char const *file1, int fd2, char const *file2)); 1475 (int fd1, char const *file1, int fd2, char const *file2));
1466# else 1476# else
1467# if !@HAVE_RENAMEAT@ 1477# if !@HAVE_RENAMEAT@
1468_GL_FUNCDECL_SYS (renameat, int, 1478_GL_FUNCDECL_SYS (renameat, int,
1469 (int fd1, char const *file1, int fd2, char const *file2) 1479 (int fd1, char const *file1, int fd2, char const *file2),
1470 _GL_ARG_NONNULL ((2, 4))); 1480 _GL_ARG_NONNULL ((2, 4)));
1471# endif 1481# endif
1472_GL_CXXALIAS_SYS (renameat, int, 1482_GL_CXXALIAS_SYS (renameat, int,
@@ -1492,18 +1502,18 @@ _GL_WARN_ON_USE (renameat, "renameat is not portable - "
1492_GL_FUNCDECL_RPL_1 (__scanf__, int, 1502_GL_FUNCDECL_RPL_1 (__scanf__, int,
1493 (const char *restrict format, ...) 1503 (const char *restrict format, ...)
1494 __asm__ (@ASM_SYMBOL_PREFIX@ 1504 __asm__ (@ASM_SYMBOL_PREFIX@
1495 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf)) 1505 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf)),
1496 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2) 1506 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
1497 _GL_ARG_NONNULL ((1))); 1507 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1498_GL_CXXALIAS_RPL_1 (scanf, __scanf__, int, (const char *restrict format, ...)); 1508_GL_CXXALIAS_RPL_1 (scanf, __scanf__, int, (const char *restrict format, ...));
1499# else 1509# else
1500# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1510# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1501# undef scanf 1511# undef scanf
1502# define scanf rpl_scanf 1512# define scanf rpl_scanf
1503# endif 1513# endif
1504_GL_FUNCDECL_RPL (scanf, int, (const char *restrict format, ...) 1514_GL_FUNCDECL_RPL (scanf, int, (const char *restrict format, ...),
1505 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2) 1515 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
1506 _GL_ARG_NONNULL ((1))); 1516 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1507_GL_CXXALIAS_RPL (scanf, int, (const char *restrict format, ...)); 1517_GL_CXXALIAS_RPL (scanf, int, (const char *restrict format, ...));
1508# endif 1518# endif
1509# else 1519# else
@@ -1525,7 +1535,7 @@ _GL_CXXALIASWARN (scanf);
1525 directives nor widths, the only possible failure code is ENOMEM. */ 1535 directives nor widths, the only possible failure code is ENOMEM. */
1526_GL_FUNCDECL_SYS (snzprintf, ptrdiff_t, 1536_GL_FUNCDECL_SYS (snzprintf, ptrdiff_t,
1527 (char *restrict str, size_t size, 1537 (char *restrict str, size_t size,
1528 const char *restrict format, ...) 1538 const char *restrict format, ...),
1529 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4) 1539 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4)
1530 _GL_ARG_NONNULL ((3))); 1540 _GL_ARG_NONNULL ((3)));
1531_GL_CXXALIAS_SYS (snzprintf, ptrdiff_t, 1541_GL_CXXALIAS_SYS (snzprintf, ptrdiff_t,
@@ -1546,7 +1556,7 @@ _GL_CXXALIAS_SYS (snzprintf, ptrdiff_t,
1546# define GNULIB_overrides_snprintf 1 1556# define GNULIB_overrides_snprintf 1
1547_GL_FUNCDECL_RPL (snprintf, int, 1557_GL_FUNCDECL_RPL (snprintf, int,
1548 (char *restrict str, size_t size, 1558 (char *restrict str, size_t size,
1549 const char *restrict format, ...) 1559 const char *restrict format, ...),
1550 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4) 1560 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4)
1551 _GL_ARG_NONNULL ((3))); 1561 _GL_ARG_NONNULL ((3)));
1552_GL_CXXALIAS_RPL (snprintf, int, 1562_GL_CXXALIAS_RPL (snprintf, int,
@@ -1556,7 +1566,7 @@ _GL_CXXALIAS_RPL (snprintf, int,
1556# if !@HAVE_DECL_SNPRINTF@ 1566# if !@HAVE_DECL_SNPRINTF@
1557_GL_FUNCDECL_SYS (snprintf, int, 1567_GL_FUNCDECL_SYS (snprintf, int,
1558 (char *restrict str, size_t size, 1568 (char *restrict str, size_t size,
1559 const char *restrict format, ...) 1569 const char *restrict format, ...),
1560 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4) 1570 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4)
1561 _GL_ARG_NONNULL ((3))); 1571 _GL_ARG_NONNULL ((3)));
1562# endif 1572# endif
@@ -1584,7 +1594,7 @@ _GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
1584 directives nor widths, the only possible failure code is ENOMEM. */ 1594 directives nor widths, the only possible failure code is ENOMEM. */
1585_GL_FUNCDECL_SYS (szprintf, ptrdiff_t, 1595_GL_FUNCDECL_SYS (szprintf, ptrdiff_t,
1586 (char *restrict str, 1596 (char *restrict str,
1587 const char *restrict format, ...) 1597 const char *restrict format, ...),
1588 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) 1598 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
1589 _GL_ARG_NONNULL ((1, 2))); 1599 _GL_ARG_NONNULL ((1, 2)));
1590_GL_CXXALIAS_SYS (szprintf, ptrdiff_t, 1600_GL_CXXALIAS_SYS (szprintf, ptrdiff_t,
@@ -1611,7 +1621,7 @@ _GL_CXXALIAS_SYS (szprintf, ptrdiff_t,
1611# endif 1621# endif
1612# define GNULIB_overrides_sprintf 1 1622# define GNULIB_overrides_sprintf 1
1613_GL_FUNCDECL_RPL (sprintf, int, 1623_GL_FUNCDECL_RPL (sprintf, int,
1614 (char *restrict str, const char *restrict format, ...) 1624 (char *restrict str, const char *restrict format, ...),
1615 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) 1625 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
1616 _GL_ARG_NONNULL ((1, 2))); 1626 _GL_ARG_NONNULL ((1, 2)));
1617_GL_CXXALIAS_RPL (sprintf, int, 1627_GL_CXXALIAS_RPL (sprintf, int,
@@ -1652,16 +1662,18 @@ _GL_CXXALIASWARN (tempnam);
1652# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1662# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1653# define tmpfile rpl_tmpfile 1663# define tmpfile rpl_tmpfile
1654# endif 1664# endif
1655_GL_FUNCDECL_RPL (tmpfile, FILE *, (void) 1665_GL_FUNCDECL_RPL (tmpfile, FILE *, (void),
1656 _GL_ATTRIBUTE_DEALLOC (fclose, 1) 1666 _GL_ATTRIBUTE_DEALLOC (fclose, 1)
1657 _GL_ATTRIBUTE_MALLOC); 1667 _GL_ATTRIBUTE_MALLOC
1668 _GL_ATTRIBUTE_NODISCARD);
1658_GL_CXXALIAS_RPL (tmpfile, FILE *, (void)); 1669_GL_CXXALIAS_RPL (tmpfile, FILE *, (void));
1659# else 1670# else
1660# if __GNUC__ >= 11 1671# if __GNUC__ >= 11 && !defined __clang__
1661/* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose. */ 1672/* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose. */
1662_GL_FUNCDECL_SYS (tmpfile, FILE *, (void) 1673_GL_FUNCDECL_SYS (tmpfile, FILE *, (void),
1663 _GL_ATTRIBUTE_DEALLOC (fclose, 1) 1674 _GL_ATTRIBUTE_DEALLOC (fclose, 1)
1664 _GL_ATTRIBUTE_MALLOC); 1675 _GL_ATTRIBUTE_MALLOC
1676 _GL_ATTRIBUTE_NODISCARD);
1665# endif 1677# endif
1666_GL_CXXALIAS_SYS (tmpfile, FILE *, (void)); 1678_GL_CXXALIAS_SYS (tmpfile, FILE *, (void));
1667# endif 1679# endif
@@ -1669,9 +1681,10 @@ _GL_CXXALIAS_SYS (tmpfile, FILE *, (void));
1669_GL_CXXALIASWARN (tmpfile); 1681_GL_CXXALIASWARN (tmpfile);
1670# endif 1682# endif
1671#else 1683#else
1672# if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined tmpfile 1684# if @GNULIB_FCLOSE@ \
1685 && (__GNUC__ >= 11 && !defined __clang__) && !defined tmpfile
1673/* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose. */ 1686/* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose. */
1674_GL_FUNCDECL_SYS (tmpfile, FILE *, (void) 1687_GL_FUNCDECL_SYS (tmpfile, FILE *, (void),
1675 _GL_ATTRIBUTE_DEALLOC (fclose, 1) 1688 _GL_ATTRIBUTE_DEALLOC (fclose, 1)
1676 _GL_ATTRIBUTE_MALLOC); 1689 _GL_ATTRIBUTE_MALLOC);
1677# endif 1690# endif
@@ -1694,15 +1707,17 @@ _GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - "
1694 Therefore, if the format string is valid and does not use %ls/%lc 1707 Therefore, if the format string is valid and does not use %ls/%lc
1695 directives nor widths, the only possible failure code is ENOMEM. */ 1708 directives nor widths, the only possible failure code is ENOMEM. */
1696_GL_FUNCDECL_SYS (aszprintf, ptrdiff_t, 1709_GL_FUNCDECL_SYS (aszprintf, ptrdiff_t,
1697 (char **result, const char *format, ...) 1710 (char **result, const char *format, ...),
1698 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) 1711 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
1699 _GL_ARG_NONNULL ((1, 2))); 1712 _GL_ARG_NONNULL ((1, 2))
1713 _GL_ATTRIBUTE_NODISCARD);
1700_GL_CXXALIAS_SYS (aszprintf, ptrdiff_t, 1714_GL_CXXALIAS_SYS (aszprintf, ptrdiff_t,
1701 (char **result, const char *format, ...)); 1715 (char **result, const char *format, ...));
1702_GL_FUNCDECL_SYS (vaszprintf, ptrdiff_t, 1716_GL_FUNCDECL_SYS (vaszprintf, ptrdiff_t,
1703 (char **result, const char *format, va_list args) 1717 (char **result, const char *format, va_list args),
1704 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) 1718 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1705 _GL_ARG_NONNULL ((1, 2))); 1719 _GL_ARG_NONNULL ((1, 2))
1720 _GL_ATTRIBUTE_NODISCARD);
1706_GL_CXXALIAS_SYS (vaszprintf, ptrdiff_t, 1721_GL_CXXALIAS_SYS (vaszprintf, ptrdiff_t,
1707 (char **result, const char *format, va_list args)); 1722 (char **result, const char *format, va_list args));
1708#endif 1723#endif
@@ -1718,17 +1733,19 @@ _GL_CXXALIAS_SYS (vaszprintf, ptrdiff_t,
1718# endif 1733# endif
1719# define GNULIB_overrides_asprintf 1734# define GNULIB_overrides_asprintf
1720_GL_FUNCDECL_RPL (asprintf, int, 1735_GL_FUNCDECL_RPL (asprintf, int,
1721 (char **result, const char *format, ...) 1736 (char **result, const char *format, ...),
1722 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) 1737 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
1723 _GL_ARG_NONNULL ((1, 2))); 1738 _GL_ARG_NONNULL ((1, 2))
1739 _GL_ATTRIBUTE_NODISCARD);
1724_GL_CXXALIAS_RPL (asprintf, int, 1740_GL_CXXALIAS_RPL (asprintf, int,
1725 (char **result, const char *format, ...)); 1741 (char **result, const char *format, ...));
1726# else 1742# else
1727# if !@HAVE_VASPRINTF@ 1743# if !@HAVE_VASPRINTF@
1728_GL_FUNCDECL_SYS (asprintf, int, 1744_GL_FUNCDECL_SYS (asprintf, int,
1729 (char **result, const char *format, ...) 1745 (char **result, const char *format, ...),
1730 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) 1746 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
1731 _GL_ARG_NONNULL ((1, 2))); 1747 _GL_ARG_NONNULL ((1, 2))
1748 _GL_ATTRIBUTE_NODISCARD);
1732# endif 1749# endif
1733_GL_CXXALIAS_SYS (asprintf, int, 1750_GL_CXXALIAS_SYS (asprintf, int,
1734 (char **result, const char *format, ...)); 1751 (char **result, const char *format, ...));
@@ -1740,17 +1757,19 @@ _GL_CXXALIASWARN (asprintf);
1740# endif 1757# endif
1741# define GNULIB_overrides_vasprintf 1 1758# define GNULIB_overrides_vasprintf 1
1742_GL_FUNCDECL_RPL (vasprintf, int, 1759_GL_FUNCDECL_RPL (vasprintf, int,
1743 (char **result, const char *format, va_list args) 1760 (char **result, const char *format, va_list args),
1744 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) 1761 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1745 _GL_ARG_NONNULL ((1, 2))); 1762 _GL_ARG_NONNULL ((1, 2))
1763 _GL_ATTRIBUTE_NODISCARD);
1746_GL_CXXALIAS_RPL (vasprintf, int, 1764_GL_CXXALIAS_RPL (vasprintf, int,
1747 (char **result, const char *format, va_list args)); 1765 (char **result, const char *format, va_list args));
1748# else 1766# else
1749# if !@HAVE_VASPRINTF@ 1767# if !@HAVE_VASPRINTF@
1750_GL_FUNCDECL_SYS (vasprintf, int, 1768_GL_FUNCDECL_SYS (vasprintf, int,
1751 (char **result, const char *format, va_list args) 1769 (char **result, const char *format, va_list args),
1752 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) 1770 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1753 _GL_ARG_NONNULL ((1, 2))); 1771 _GL_ARG_NONNULL ((1, 2))
1772 _GL_ATTRIBUTE_NODISCARD);
1754# endif 1773# endif
1755_GL_CXXALIAS_SYS (vasprintf, int, 1774_GL_CXXALIAS_SYS (vasprintf, int,
1756 (char **result, const char *format, va_list args)); 1775 (char **result, const char *format, va_list args));
@@ -1767,7 +1786,7 @@ _GL_CXXALIASWARN (vasprintf);
1767 directives nor widths, the only possible failure codes are ENOMEM 1786 directives nor widths, the only possible failure codes are ENOMEM
1768 and the possible failure codes from write(), excluding EINTR. */ 1787 and the possible failure codes from write(), excluding EINTR. */
1769_GL_FUNCDECL_SYS (vdzprintf, off64_t, 1788_GL_FUNCDECL_SYS (vdzprintf, off64_t,
1770 (int fd, const char *restrict format, va_list args) 1789 (int fd, const char *restrict format, va_list args),
1771 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) 1790 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1772 _GL_ARG_NONNULL ((2))); 1791 _GL_ARG_NONNULL ((2)));
1773_GL_CXXALIAS_SYS (vdzprintf, off64_t, 1792_GL_CXXALIAS_SYS (vdzprintf, off64_t,
@@ -1783,7 +1802,7 @@ _GL_CXXALIAS_SYS (vdzprintf, off64_t,
1783# define vdprintf rpl_vdprintf 1802# define vdprintf rpl_vdprintf
1784# endif 1803# endif
1785_GL_FUNCDECL_RPL (vdprintf, int, 1804_GL_FUNCDECL_RPL (vdprintf, int,
1786 (int fd, const char *restrict format, va_list args) 1805 (int fd, const char *restrict format, va_list args),
1787 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) 1806 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1788 _GL_ARG_NONNULL ((2))); 1807 _GL_ARG_NONNULL ((2)));
1789_GL_CXXALIAS_RPL (vdprintf, int, 1808_GL_CXXALIAS_RPL (vdprintf, int,
@@ -1791,7 +1810,7 @@ _GL_CXXALIAS_RPL (vdprintf, int,
1791# else 1810# else
1792# if !@HAVE_VDPRINTF@ 1811# if !@HAVE_VDPRINTF@
1793_GL_FUNCDECL_SYS (vdprintf, int, 1812_GL_FUNCDECL_SYS (vdprintf, int,
1794 (int fd, const char *restrict format, va_list args) 1813 (int fd, const char *restrict format, va_list args),
1795 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) 1814 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1796 _GL_ARG_NONNULL ((2))); 1815 _GL_ARG_NONNULL ((2)));
1797# endif 1816# endif
@@ -1821,7 +1840,7 @@ _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - "
1821 and the possible failure causes from fwrite(). */ 1840 and the possible failure causes from fwrite(). */
1822_GL_FUNCDECL_SYS (vfzprintf, off64_t, 1841_GL_FUNCDECL_SYS (vfzprintf, off64_t,
1823 (FILE *restrict fp, 1842 (FILE *restrict fp,
1824 const char *restrict format, va_list args) 1843 const char *restrict format, va_list args),
1825 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) 1844 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1826 _GL_ARG_NONNULL ((1, 2))); 1845 _GL_ARG_NONNULL ((1, 2)));
1827_GL_CXXALIAS_SYS (vfzprintf, off64_t, 1846_GL_CXXALIAS_SYS (vfzprintf, off64_t,
@@ -1842,13 +1861,13 @@ _GL_CXXALIAS_SYS (vfzprintf, off64_t,
1842# if @GNULIB_VFPRINTF_POSIX@ 1861# if @GNULIB_VFPRINTF_POSIX@
1843_GL_FUNCDECL_RPL (vfprintf, int, 1862_GL_FUNCDECL_RPL (vfprintf, int,
1844 (FILE *restrict fp, 1863 (FILE *restrict fp,
1845 const char *restrict format, va_list args) 1864 const char *restrict format, va_list args),
1846 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) 1865 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1847 _GL_ARG_NONNULL ((1, 2))); 1866 _GL_ARG_NONNULL ((1, 2)));
1848# else 1867# else
1849_GL_FUNCDECL_RPL (vfprintf, int, 1868_GL_FUNCDECL_RPL (vfprintf, int,
1850 (FILE *restrict fp, 1869 (FILE *restrict fp,
1851 const char *restrict format, va_list args) 1870 const char *restrict format, va_list args),
1852 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0) 1871 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0)
1853 _GL_ARG_NONNULL ((1, 2))); 1872 _GL_ARG_NONNULL ((1, 2)));
1854# endif 1873# endif
@@ -1885,9 +1904,9 @@ _GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - "
1885# endif 1904# endif
1886_GL_FUNCDECL_RPL (vfscanf, int, 1905_GL_FUNCDECL_RPL (vfscanf, int,
1887 (FILE *restrict stream, 1906 (FILE *restrict stream,
1888 const char *restrict format, va_list args) 1907 const char *restrict format, va_list args),
1889 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0) 1908 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0)
1890 _GL_ARG_NONNULL ((1, 2))); 1909 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
1891_GL_CXXALIAS_RPL (vfscanf, int, 1910_GL_CXXALIAS_RPL (vfscanf, int,
1892 (FILE *restrict stream, 1911 (FILE *restrict stream,
1893 const char *restrict format, va_list args)); 1912 const char *restrict format, va_list args));
@@ -1909,9 +1928,10 @@ _GL_CXXALIASWARN (vfscanf);
1909 Therefore, if the format string is valid and does not use %ls/%lc 1928 Therefore, if the format string is valid and does not use %ls/%lc
1910 directives nor widths, the only possible failure causes are ENOMEM 1929 directives nor widths, the only possible failure causes are ENOMEM
1911 and the possible failure causes from fwrite(). */ 1930 and the possible failure causes from fwrite(). */
1912_GL_FUNCDECL_SYS (vzprintf, off64_t, (const char *restrict format, va_list args) 1931_GL_FUNCDECL_SYS (vzprintf, off64_t,
1913 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 0) 1932 (const char *restrict format, va_list args),
1914 _GL_ARG_NONNULL ((1))); 1933 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 0)
1934 _GL_ARG_NONNULL ((1)));
1915_GL_CXXALIAS_SYS (vzprintf, off64_t, 1935_GL_CXXALIAS_SYS (vzprintf, off64_t,
1916 (const char *restrict format, va_list args)); 1936 (const char *restrict format, va_list args));
1917#endif 1937#endif
@@ -1927,11 +1947,11 @@ _GL_CXXALIAS_SYS (vzprintf, off64_t,
1927# endif 1947# endif
1928# define GNULIB_overrides_vprintf 1 1948# define GNULIB_overrides_vprintf 1
1929# if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ 1949# if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
1930_GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args) 1950_GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args),
1931 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 0) 1951 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 0)
1932 _GL_ARG_NONNULL ((1))); 1952 _GL_ARG_NONNULL ((1)));
1933# else 1953# else
1934_GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args) 1954_GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args),
1935 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0) 1955 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0)
1936 _GL_ARG_NONNULL ((1))); 1956 _GL_ARG_NONNULL ((1)));
1937# endif 1957# endif
@@ -1963,9 +1983,9 @@ _GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - "
1963# undef vscanf 1983# undef vscanf
1964# define vscanf rpl_vscanf 1984# define vscanf rpl_vscanf
1965# endif 1985# endif
1966_GL_FUNCDECL_RPL (vscanf, int, (const char *restrict format, va_list args) 1986_GL_FUNCDECL_RPL (vscanf, int, (const char *restrict format, va_list args),
1967 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 0) 1987 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 0)
1968 _GL_ARG_NONNULL ((1))); 1988 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1969_GL_CXXALIAS_RPL (vscanf, int, (const char *restrict format, va_list args)); 1989_GL_CXXALIAS_RPL (vscanf, int, (const char *restrict format, va_list args));
1970# else 1990# else
1971_GL_CXXALIAS_SYS (vscanf, int, (const char *restrict format, va_list args)); 1991_GL_CXXALIAS_SYS (vscanf, int, (const char *restrict format, va_list args));
@@ -1986,7 +2006,7 @@ _GL_CXXALIASWARN (vscanf);
1986 directives nor widths, the only possible failure code is ENOMEM. */ 2006 directives nor widths, the only possible failure code is ENOMEM. */
1987_GL_FUNCDECL_SYS (vsnzprintf, ptrdiff_t, 2007_GL_FUNCDECL_SYS (vsnzprintf, ptrdiff_t,
1988 (char *restrict str, size_t size, 2008 (char *restrict str, size_t size,
1989 const char *restrict format, va_list args) 2009 const char *restrict format, va_list args),
1990 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0) 2010 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0)
1991 _GL_ARG_NONNULL ((3))); 2011 _GL_ARG_NONNULL ((3)));
1992_GL_CXXALIAS_SYS (vsnzprintf, ptrdiff_t, 2012_GL_CXXALIAS_SYS (vsnzprintf, ptrdiff_t,
@@ -2007,7 +2027,7 @@ _GL_CXXALIAS_SYS (vsnzprintf, ptrdiff_t,
2007# define GNULIB_overrides_vsnprintf 1 2027# define GNULIB_overrides_vsnprintf 1
2008_GL_FUNCDECL_RPL (vsnprintf, int, 2028_GL_FUNCDECL_RPL (vsnprintf, int,
2009 (char *restrict str, size_t size, 2029 (char *restrict str, size_t size,
2010 const char *restrict format, va_list args) 2030 const char *restrict format, va_list args),
2011 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0) 2031 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0)
2012 _GL_ARG_NONNULL ((3))); 2032 _GL_ARG_NONNULL ((3)));
2013_GL_CXXALIAS_RPL (vsnprintf, int, 2033_GL_CXXALIAS_RPL (vsnprintf, int,
@@ -2017,7 +2037,7 @@ _GL_CXXALIAS_RPL (vsnprintf, int,
2017# if !@HAVE_DECL_VSNPRINTF@ 2037# if !@HAVE_DECL_VSNPRINTF@
2018_GL_FUNCDECL_SYS (vsnprintf, int, 2038_GL_FUNCDECL_SYS (vsnprintf, int,
2019 (char *restrict str, size_t size, 2039 (char *restrict str, size_t size,
2020 const char *restrict format, va_list args) 2040 const char *restrict format, va_list args),
2021 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0) 2041 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0)
2022 _GL_ARG_NONNULL ((3))); 2042 _GL_ARG_NONNULL ((3)));
2023# endif 2043# endif
@@ -2045,7 +2065,7 @@ _GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - "
2045 directives nor widths, the only possible failure code is ENOMEM. */ 2065 directives nor widths, the only possible failure code is ENOMEM. */
2046_GL_FUNCDECL_SYS (vszprintf, ptrdiff_t, 2066_GL_FUNCDECL_SYS (vszprintf, ptrdiff_t,
2047 (char *restrict str, 2067 (char *restrict str,
2048 const char *restrict format, va_list args) 2068 const char *restrict format, va_list args),
2049 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) 2069 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
2050 _GL_ARG_NONNULL ((1, 2))); 2070 _GL_ARG_NONNULL ((1, 2)));
2051_GL_CXXALIAS_SYS (vszprintf, ptrdiff_t, 2071_GL_CXXALIAS_SYS (vszprintf, ptrdiff_t,
@@ -2064,7 +2084,7 @@ _GL_CXXALIAS_SYS (vszprintf, ptrdiff_t,
2064# define GNULIB_overrides_vsprintf 1 2084# define GNULIB_overrides_vsprintf 1
2065_GL_FUNCDECL_RPL (vsprintf, int, 2085_GL_FUNCDECL_RPL (vsprintf, int,
2066 (char *restrict str, 2086 (char *restrict str,
2067 const char *restrict format, va_list args) 2087 const char *restrict format, va_list args),
2068 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) 2088 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
2069 _GL_ARG_NONNULL ((1, 2))); 2089 _GL_ARG_NONNULL ((1, 2)));
2070_GL_CXXALIAS_RPL (vsprintf, int, 2090_GL_CXXALIAS_RPL (vsprintf, int,
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index e42368eef27..1ec96c8b249 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -51,8 +51,8 @@
51#define _@GUARD_PREFIX@_STDLIB_H 51#define _@GUARD_PREFIX@_STDLIB_H
52 52
53/* This file uses _Noreturn, _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_MALLOC, 53/* This file uses _Noreturn, _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_MALLOC,
54 _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PURE, GNULIB_POSIXCHECK, 54 _GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PURE,
55 HAVE_RAW_DECL_*. */ 55 GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
56#if !_GL_CONFIG_H_INCLUDED 56#if !_GL_CONFIG_H_INCLUDED
57 #error "Please include config.h first." 57 #error "Please include config.h first."
58#endif 58#endif
@@ -132,7 +132,7 @@ struct random_data
132 that can be freed by passing them as the Ith argument to the 132 that can be freed by passing them as the Ith argument to the
133 function F. */ 133 function F. */
134#ifndef _GL_ATTRIBUTE_DEALLOC 134#ifndef _GL_ATTRIBUTE_DEALLOC
135# if __GNUC__ >= 11 135# if __GNUC__ >= 11 && !defined __clang__
136# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) 136# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
137# else 137# else
138# define _GL_ATTRIBUTE_DEALLOC(f, i) 138# define _GL_ATTRIBUTE_DEALLOC(f, i)
@@ -161,7 +161,7 @@ struct random_data
161 */ 161 */
162#ifndef _GL_ATTRIBUTE_NOTHROW 162#ifndef _GL_ATTRIBUTE_NOTHROW
163# if defined __cplusplus 163# if defined __cplusplus
164# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4 164# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4
165# if __cplusplus >= 201103L 165# if __cplusplus >= 201103L
166# define _GL_ATTRIBUTE_NOTHROW noexcept (true) 166# define _GL_ATTRIBUTE_NOTHROW noexcept (true)
167# else 167# else
@@ -241,6 +241,9 @@ _GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
241 241
242 242
243#if @GNULIB_ABORT_DEBUG@ 243#if @GNULIB_ABORT_DEBUG@
244/* Terminates the current process with signal SIGABRT.
245 Note: While the original abort() function is safe to call in signal handlers,
246 the overridden abort() function is not. */
244# if @REPLACE_ABORT@ 247# if @REPLACE_ABORT@
245# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 248# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
246# undef abort 249# undef abort
@@ -255,14 +258,6 @@ _GL_CXXALIAS_SYS (abort, void, (void));
255_GL_CXXALIASWARN (abort); 258_GL_CXXALIASWARN (abort);
256# endif 259# endif
257#endif 260#endif
258#if @GNULIB_ABORT_DEBUG@ && @REPLACE_ABORT@
259_GL_EXTERN_C void _gl_pre_abort (void);
260#else
261# if !GNULIB_defined_gl_pre_abort
262# define _gl_pre_abort() /* nothing */
263# define GNULIB_defined_gl_pre_abort 1
264# endif
265#endif
266 261
267 262
268#if @GNULIB_FREE_POSIX@ 263#if @GNULIB_FREE_POSIX@
@@ -272,7 +267,7 @@ _GL_EXTERN_C void _gl_pre_abort (void);
272# define free rpl_free 267# define free rpl_free
273# endif 268# endif
274# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) 269# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
275_GL_FUNCDECL_RPL (free, void, (void *ptr) _GL_ATTRIBUTE_NOTHROW); 270_GL_FUNCDECL_RPL (free, void, (void *ptr)) _GL_ATTRIBUTE_NOTHROW;
276# else 271# else
277_GL_FUNCDECL_RPL (free, void, (void *ptr)); 272_GL_FUNCDECL_RPL (free, void, (void *ptr));
278# endif 273# endif
@@ -299,22 +294,25 @@ _GL_WARN_ON_USE (free, "free is not future POSIX compliant everywhere - "
299# define aligned_alloc rpl_aligned_alloc 294# define aligned_alloc rpl_aligned_alloc
300# endif 295# endif
301_GL_FUNCDECL_RPL (aligned_alloc, void *, 296_GL_FUNCDECL_RPL (aligned_alloc, void *,
302 (size_t alignment, size_t size) 297 (size_t alignment, size_t size),
303 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 298 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
299 _GL_ATTRIBUTE_NODISCARD);
304_GL_CXXALIAS_RPL (aligned_alloc, void *, (size_t alignment, size_t size)); 300_GL_CXXALIAS_RPL (aligned_alloc, void *, (size_t alignment, size_t size));
305# else 301# else
306# if @HAVE_ALIGNED_ALLOC@ 302# if @HAVE_ALIGNED_ALLOC@
307# if __GNUC__ >= 11 303# if __GNUC__ >= 11 && !defined __clang__
308/* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */ 304/* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */
309# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2 305# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2
310_GL_FUNCDECL_SYS (aligned_alloc, void *, 306_GL_FUNCDECL_SYS (aligned_alloc, void *,
311 (size_t alignment, size_t size) 307 (size_t alignment, size_t size),
312 _GL_ATTRIBUTE_NOTHROW 308 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
313 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 309 _GL_ATTRIBUTE_NODISCARD)
310 _GL_ATTRIBUTE_NOTHROW;
314# else 311# else
315_GL_FUNCDECL_SYS (aligned_alloc, void *, 312_GL_FUNCDECL_SYS (aligned_alloc, void *,
316 (size_t alignment, size_t size) 313 (size_t alignment, size_t size),
317 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 314 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
315 _GL_ATTRIBUTE_NODISCARD);
318# endif 316# endif
319# endif 317# endif
320_GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size)); 318_GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size));
@@ -324,16 +322,17 @@ _GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size));
324_GL_CXXALIASWARN (aligned_alloc); 322_GL_CXXALIASWARN (aligned_alloc);
325# endif 323# endif
326#else 324#else
327# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined aligned_alloc 325# if @GNULIB_FREE_POSIX@ \
326 && (__GNUC__ >= 11 && !defined __clang__) && !defined aligned_alloc
328/* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */ 327/* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */
329# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2 328# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2
330_GL_FUNCDECL_SYS (aligned_alloc, void *, 329_GL_FUNCDECL_SYS (aligned_alloc, void *,
331 (size_t alignment, size_t size) 330 (size_t alignment, size_t size),
332 _GL_ATTRIBUTE_NOTHROW 331 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
333 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 332 _GL_ATTRIBUTE_NOTHROW;
334# else 333# else
335_GL_FUNCDECL_SYS (aligned_alloc, void *, 334_GL_FUNCDECL_SYS (aligned_alloc, void *,
336 (size_t alignment, size_t size) 335 (size_t alignment, size_t size),
337 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 336 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
338# endif 337# endif
339# endif 338# endif
@@ -350,9 +349,10 @@ _GL_WARN_ON_USE (aligned_alloc, "aligned_alloc is not portable - "
350/* Parse a signed decimal integer. 349/* Parse a signed decimal integer.
351 Returns the value of the integer. Errors are not detected. */ 350 Returns the value of the integer. Errors are not detected. */
352# if !@HAVE_ATOLL@ 351# if !@HAVE_ATOLL@
353_GL_FUNCDECL_SYS (atoll, long long, (const char *string) 352_GL_FUNCDECL_SYS (atoll, long long,
354 _GL_ATTRIBUTE_PURE 353 (const char *string),
355 _GL_ARG_NONNULL ((1))); 354 _GL_ATTRIBUTE_PURE
355 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
356# endif 356# endif
357_GL_CXXALIAS_SYS (atoll, long long, (const char *string)); 357_GL_CXXALIAS_SYS (atoll, long long, (const char *string));
358_GL_CXXALIASWARN (atoll); 358_GL_CXXALIASWARN (atoll);
@@ -372,21 +372,24 @@ _GL_WARN_ON_USE (atoll, "atoll is unportable - "
372# define calloc rpl_calloc 372# define calloc rpl_calloc
373# endif 373# endif
374_GL_FUNCDECL_RPL (calloc, void *, 374_GL_FUNCDECL_RPL (calloc, void *,
375 (size_t nmemb, size_t size) 375 (size_t nmemb, size_t size),
376 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 376 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
377 _GL_ATTRIBUTE_NODISCARD);
377_GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size)); 378_GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size));
378# else 379# else
379# if __GNUC__ >= 11 380# if __GNUC__ >= 11 && !defined __clang__
380/* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */ 381/* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */
381# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 382# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
382_GL_FUNCDECL_SYS (calloc, void *, 383_GL_FUNCDECL_SYS (calloc, void *,
383 (size_t nmemb, size_t size) 384 (size_t nmemb, size_t size),
384 _GL_ATTRIBUTE_NOTHROW 385 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
385 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 386 _GL_ATTRIBUTE_NODISCARD)
387 _GL_ATTRIBUTE_NOTHROW;
386# else 388# else
387_GL_FUNCDECL_SYS (calloc, void *, 389_GL_FUNCDECL_SYS (calloc, void *,
388 (size_t nmemb, size_t size) 390 (size_t nmemb, size_t size),
389 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 391 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
392 _GL_ATTRIBUTE_NODISCARD);
390# endif 393# endif
391# endif 394# endif
392_GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size)); 395_GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
@@ -395,16 +398,17 @@ _GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
395_GL_CXXALIASWARN (calloc); 398_GL_CXXALIASWARN (calloc);
396# endif 399# endif
397#else 400#else
398# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined calloc 401# if @GNULIB_FREE_POSIX@ \
402 && (__GNUC__ >= 11 && !defined __clang__) && !defined calloc
399/* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */ 403/* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */
400# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 404# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
401_GL_FUNCDECL_SYS (calloc, void *, 405_GL_FUNCDECL_SYS (calloc, void *,
402 (size_t nmemb, size_t size) 406 (size_t nmemb, size_t size),
403 _GL_ATTRIBUTE_NOTHROW 407 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
404 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 408 _GL_ATTRIBUTE_NOTHROW;
405# else 409# else
406_GL_FUNCDECL_SYS (calloc, void *, 410_GL_FUNCDECL_SYS (calloc, void *,
407 (size_t nmemb, size_t size) 411 (size_t nmemb, size_t size),
408 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 412 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
409# endif 413# endif
410# endif 414# endif
@@ -422,23 +426,26 @@ _GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - "
422# define canonicalize_file_name rpl_canonicalize_file_name 426# define canonicalize_file_name rpl_canonicalize_file_name
423# endif 427# endif
424_GL_FUNCDECL_RPL (canonicalize_file_name, char *, 428_GL_FUNCDECL_RPL (canonicalize_file_name, char *,
425 (const char *name) 429 (const char *name),
426 _GL_ARG_NONNULL ((1)) 430 _GL_ARG_NONNULL ((1))
427 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 431 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
432 _GL_ATTRIBUTE_NODISCARD);
428_GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name)); 433_GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name));
429# else 434# else
430# if !@HAVE_CANONICALIZE_FILE_NAME@ || __GNUC__ >= 11 435# if !@HAVE_CANONICALIZE_FILE_NAME@ || (__GNUC__ >= 11 && !defined __clang__)
431# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 436# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
432_GL_FUNCDECL_SYS (canonicalize_file_name, char *, 437_GL_FUNCDECL_SYS (canonicalize_file_name, char *,
433 (const char *name) 438 (const char *name),
434 _GL_ATTRIBUTE_NOTHROW
435 _GL_ARG_NONNULL ((1)) 439 _GL_ARG_NONNULL ((1))
436 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 440 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
441 _GL_ATTRIBUTE_NODISCARD)
442 _GL_ATTRIBUTE_NOTHROW;
437# else 443# else
438_GL_FUNCDECL_SYS (canonicalize_file_name, char *, 444_GL_FUNCDECL_SYS (canonicalize_file_name, char *,
439 (const char *name) 445 (const char *name),
440 _GL_ARG_NONNULL ((1)) 446 _GL_ARG_NONNULL ((1))
441 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 447 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
448 _GL_ATTRIBUTE_NODISCARD);
442# endif 449# endif
443# endif 450# endif
444_GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name)); 451_GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
@@ -449,18 +456,19 @@ _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
449# endif 456# endif
450_GL_CXXALIASWARN (canonicalize_file_name); 457_GL_CXXALIASWARN (canonicalize_file_name);
451#else 458#else
452# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined canonicalize_file_name 459# if @GNULIB_FREE_POSIX@ \
460 && (__GNUC__ >= 11 && !defined __clang__) && !defined canonicalize_file_name
453/* For -Wmismatched-dealloc: Associate canonicalize_file_name with free or 461/* For -Wmismatched-dealloc: Associate canonicalize_file_name with free or
454 rpl_free. */ 462 rpl_free. */
455# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 463# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
456_GL_FUNCDECL_SYS (canonicalize_file_name, char *, 464_GL_FUNCDECL_SYS (canonicalize_file_name, char *,
457 (const char *name) 465 (const char *name),
458 _GL_ATTRIBUTE_NOTHROW
459 _GL_ARG_NONNULL ((1)) 466 _GL_ARG_NONNULL ((1))
460 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 467 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
468 _GL_ATTRIBUTE_NOTHROW;
461# else 469# else
462_GL_FUNCDECL_SYS (canonicalize_file_name, char *, 470_GL_FUNCDECL_SYS (canonicalize_file_name, char *,
463 (const char *name) 471 (const char *name),
464 _GL_ARG_NONNULL ((1)) 472 _GL_ARG_NONNULL ((1))
465 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 473 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
466# endif 474# endif
@@ -552,12 +560,12 @@ _GL_CXXALIASWARN (gcvt);
552# undef getloadavg 560# undef getloadavg
553# define getloadavg rpl_getloadavg 561# define getloadavg rpl_getloadavg
554# endif 562# endif
555_GL_FUNCDECL_RPL (getloadavg, int, (double loadavg[], int nelem) 563_GL_FUNCDECL_RPL (getloadavg, int, (double loadavg[], int nelem),
556 _GL_ARG_NONNULL ((1))); 564 _GL_ARG_NONNULL ((1)));
557_GL_CXXALIAS_RPL (getloadavg, int, (double loadavg[], int nelem)); 565_GL_CXXALIAS_RPL (getloadavg, int, (double loadavg[], int nelem));
558# else 566# else
559# if !@HAVE_DECL_GETLOADAVG@ 567# if !@HAVE_DECL_GETLOADAVG@
560_GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem) 568_GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem),
561 _GL_ARG_NONNULL ((1))); 569 _GL_ARG_NONNULL ((1)));
562# endif 570# endif
563_GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem)); 571_GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem));
@@ -582,7 +590,7 @@ _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
582# define getprogname rpl_getprogname 590# define getprogname rpl_getprogname
583# endif 591# endif
584# if @HAVE_DECL_PROGRAM_INVOCATION_NAME@ 592# if @HAVE_DECL_PROGRAM_INVOCATION_NAME@
585_GL_FUNCDECL_RPL (getprogname, const char *, (void) _GL_ATTRIBUTE_PURE); 593_GL_FUNCDECL_RPL (getprogname, const char *, (void), _GL_ATTRIBUTE_PURE);
586# else 594# else
587_GL_FUNCDECL_RPL (getprogname, const char *, (void)); 595_GL_FUNCDECL_RPL (getprogname, const char *, (void));
588# endif 596# endif
@@ -590,7 +598,7 @@ _GL_CXXALIAS_RPL (getprogname, const char *, (void));
590# else 598# else
591# if !@HAVE_GETPROGNAME@ 599# if !@HAVE_GETPROGNAME@
592# if @HAVE_DECL_PROGRAM_INVOCATION_NAME@ 600# if @HAVE_DECL_PROGRAM_INVOCATION_NAME@
593_GL_FUNCDECL_SYS (getprogname, const char *, (void) _GL_ATTRIBUTE_PURE); 601_GL_FUNCDECL_SYS (getprogname, const char *, (void), _GL_ATTRIBUTE_PURE);
594# else 602# else
595_GL_FUNCDECL_SYS (getprogname, const char *, (void)); 603_GL_FUNCDECL_SYS (getprogname, const char *, (void));
596# endif 604# endif
@@ -626,15 +634,15 @@ _GL_WARN_ON_USE (getprogname, "getprogname is unportable - "
626# define getsubopt rpl_getsubopt 634# define getsubopt rpl_getsubopt
627# endif 635# endif
628_GL_FUNCDECL_RPL (getsubopt, int, 636_GL_FUNCDECL_RPL (getsubopt, int,
629 (char **optionp, char *const *tokens, char **valuep) 637 (char **optionp, char *const *tokens, char **valuep),
630 _GL_ARG_NONNULL ((1, 2, 3))); 638 _GL_ARG_NONNULL ((1, 2, 3)) _GL_ATTRIBUTE_NODISCARD);
631_GL_CXXALIAS_RPL (getsubopt, int, 639_GL_CXXALIAS_RPL (getsubopt, int,
632 (char **optionp, char *const *tokens, char **valuep)); 640 (char **optionp, char *const *tokens, char **valuep));
633# else 641# else
634# if !@HAVE_GETSUBOPT@ 642# if !@HAVE_GETSUBOPT@
635_GL_FUNCDECL_SYS (getsubopt, int, 643_GL_FUNCDECL_SYS (getsubopt, int,
636 (char **optionp, char *const *tokens, char **valuep) 644 (char **optionp, char *const *tokens, char **valuep),
637 _GL_ARG_NONNULL ((1, 2, 3))); 645 _GL_ARG_NONNULL ((1, 2, 3)) _GL_ATTRIBUTE_NODISCARD);
638# endif 646# endif
639_GL_CXXALIAS_SYS (getsubopt, int, 647_GL_CXXALIAS_SYS (getsubopt, int,
640 (char **optionp, char *const *tokens, char **valuep)); 648 (char **optionp, char *const *tokens, char **valuep));
@@ -679,21 +687,24 @@ _GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
679# define malloc rpl_malloc 687# define malloc rpl_malloc
680# endif 688# endif
681_GL_FUNCDECL_RPL (malloc, void *, 689_GL_FUNCDECL_RPL (malloc, void *,
682 (size_t size) 690 (size_t size),
683 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 691 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
692 _GL_ATTRIBUTE_NODISCARD);
684_GL_CXXALIAS_RPL (malloc, void *, (size_t size)); 693_GL_CXXALIAS_RPL (malloc, void *, (size_t size));
685# else 694# else
686# if __GNUC__ >= 11 695# if __GNUC__ >= 11 && !defined __clang__
687/* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */ 696/* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */
688# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 697# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
689_GL_FUNCDECL_SYS (malloc, void *, 698_GL_FUNCDECL_SYS (malloc, void *,
690 (size_t size) 699 (size_t size),
691 _GL_ATTRIBUTE_NOTHROW 700 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
692 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 701 _GL_ATTRIBUTE_NODISCARD)
702 _GL_ATTRIBUTE_NOTHROW;
693# else 703# else
694_GL_FUNCDECL_SYS (malloc, void *, 704_GL_FUNCDECL_SYS (malloc, void *,
695 (size_t size) 705 (size_t size),
696 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 706 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
707 _GL_ATTRIBUTE_NODISCARD);
697# endif 708# endif
698# endif 709# endif
699_GL_CXXALIAS_SYS (malloc, void *, (size_t size)); 710_GL_CXXALIAS_SYS (malloc, void *, (size_t size));
@@ -702,16 +713,17 @@ _GL_CXXALIAS_SYS (malloc, void *, (size_t size));
702_GL_CXXALIASWARN (malloc); 713_GL_CXXALIASWARN (malloc);
703# endif 714# endif
704#else 715#else
705# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined malloc 716# if @GNULIB_FREE_POSIX@ \
717 && (__GNUC__ >= 11 && !defined __clang__) && !defined malloc
706/* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */ 718/* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */
707# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 719# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
708_GL_FUNCDECL_SYS (malloc, void *, 720_GL_FUNCDECL_SYS (malloc, void *,
709 (size_t size) 721 (size_t size),
710 _GL_ATTRIBUTE_NOTHROW 722 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
711 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 723 _GL_ATTRIBUTE_NOTHROW;
712# else 724# else
713_GL_FUNCDECL_SYS (malloc, void *, 725_GL_FUNCDECL_SYS (malloc, void *,
714 (size_t size) 726 (size_t size),
715 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 727 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
716# endif 728# endif
717# endif 729# endif
@@ -747,7 +759,7 @@ int gl_MB_CUR_MAX (void)
747# endif 759# endif
748_GL_FUNCDECL_RPL (mbstowcs, size_t, 760_GL_FUNCDECL_RPL (mbstowcs, size_t,
749 (wchar_t *restrict dest, const char *restrict src, 761 (wchar_t *restrict dest, const char *restrict src,
750 size_t len) 762 size_t len),
751 _GL_ARG_NONNULL ((2))); 763 _GL_ARG_NONNULL ((2)));
752_GL_CXXALIAS_RPL (mbstowcs, size_t, 764_GL_CXXALIAS_RPL (mbstowcs, size_t,
753 (wchar_t *restrict dest, const char *restrict src, 765 (wchar_t *restrict dest, const char *restrict src,
@@ -805,7 +817,9 @@ _GL_WARN_ON_USE (mbtowc, "mbtowc is not portable - "
805 Returns TEMPLATE, or a null pointer if it cannot get a unique name. 817 Returns TEMPLATE, or a null pointer if it cannot get a unique name.
806 The directory is created mode 700. */ 818 The directory is created mode 700. */
807# if !@HAVE_MKDTEMP@ 819# if !@HAVE_MKDTEMP@
808_GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1))); 820_GL_FUNCDECL_SYS (mkdtemp, char *,
821 (char * /*template*/),
822 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
809# endif 823# endif
810_GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/)); 824_GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/));
811_GL_CXXALIASWARN (mkdtemp); 825_GL_CXXALIASWARN (mkdtemp);
@@ -835,13 +849,13 @@ _GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
835# undef mkostemp 849# undef mkostemp
836# define mkostemp rpl_mkostemp 850# define mkostemp rpl_mkostemp
837# endif 851# endif
838_GL_FUNCDECL_RPL (mkostemp, int, (char * /*template*/, int /*flags*/) 852_GL_FUNCDECL_RPL (mkostemp, int, (char * /*template*/, int /*flags*/),
839 _GL_ARG_NONNULL ((1))); 853 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
840_GL_CXXALIAS_RPL (mkostemp, int, (char * /*template*/, int /*flags*/)); 854_GL_CXXALIAS_RPL (mkostemp, int, (char * /*template*/, int /*flags*/));
841# else 855# else
842# if !@HAVE_MKOSTEMP@ 856# if !@HAVE_MKOSTEMP@
843_GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/) 857_GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/),
844 _GL_ARG_NONNULL ((1))); 858 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
845# endif 859# endif
846_GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)); 860_GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/));
847# endif 861# endif
@@ -876,15 +890,15 @@ _GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
876# define mkostemps rpl_mkostemps 890# define mkostemps rpl_mkostemps
877# endif 891# endif
878_GL_FUNCDECL_RPL (mkostemps, int, 892_GL_FUNCDECL_RPL (mkostemps, int,
879 (char * /*template*/, int /*suffixlen*/, int /*flags*/) 893 (char * /*template*/, int /*suffixlen*/, int /*flags*/),
880 _GL_ARG_NONNULL ((1))); 894 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
881_GL_CXXALIAS_RPL (mkostemps, int, 895_GL_CXXALIAS_RPL (mkostemps, int,
882 (char * /*template*/, int /*suffixlen*/, int /*flags*/)); 896 (char * /*template*/, int /*suffixlen*/, int /*flags*/));
883# else 897# else
884# if !@HAVE_MKOSTEMPS@ 898# if !@HAVE_MKOSTEMPS@
885_GL_FUNCDECL_SYS (mkostemps, int, 899_GL_FUNCDECL_SYS (mkostemps, int,
886 (char * /*template*/, int /*suffixlen*/, int /*flags*/) 900 (char * /*template*/, int /*suffixlen*/, int /*flags*/),
887 _GL_ARG_NONNULL ((1))); 901 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
888# endif 902# endif
889_GL_CXXALIAS_SYS (mkostemps, int, 903_GL_CXXALIAS_SYS (mkostemps, int,
890 (char * /*template*/, int /*suffixlen*/, int /*flags*/)); 904 (char * /*template*/, int /*suffixlen*/, int /*flags*/));
@@ -914,11 +928,13 @@ _GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
914# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 928# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
915# define mkstemp rpl_mkstemp 929# define mkstemp rpl_mkstemp
916# endif 930# endif
917_GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); 931_GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/),
932 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
918_GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/)); 933_GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/));
919# else 934# else
920# if ! @HAVE_MKSTEMP@ 935# if ! @HAVE_MKSTEMP@
921_GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); 936_GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/),
937 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
922# endif 938# endif
923_GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/)); 939_GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/));
924# endif 940# endif
@@ -943,8 +959,8 @@ _GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
943 Returns the open file descriptor if successful, otherwise -1 and errno 959 Returns the open file descriptor if successful, otherwise -1 and errno
944 set. */ 960 set. */
945# if !@HAVE_MKSTEMPS@ 961# if !@HAVE_MKSTEMPS@
946_GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/) 962_GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/),
947 _GL_ARG_NONNULL ((1))); 963 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
948# endif 964# endif
949_GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)); 965_GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/));
950_GL_CXXALIASWARN (mkstemps); 966_GL_CXXALIASWARN (mkstemps);
@@ -980,8 +996,8 @@ _GL_CXXALIASWARN (mktemp);
980# define posix_memalign rpl_posix_memalign 996# define posix_memalign rpl_posix_memalign
981# endif 997# endif
982_GL_FUNCDECL_RPL (posix_memalign, int, 998_GL_FUNCDECL_RPL (posix_memalign, int,
983 (void **memptr, size_t alignment, size_t size) 999 (void **memptr, size_t alignment, size_t size),
984 _GL_ARG_NONNULL ((1))); 1000 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
985_GL_CXXALIAS_RPL (posix_memalign, int, 1001_GL_CXXALIAS_RPL (posix_memalign, int,
986 (void **memptr, size_t alignment, size_t size)); 1002 (void **memptr, size_t alignment, size_t size));
987# else 1003# else
@@ -1009,11 +1025,11 @@ _GL_WARN_ON_USE (posix_memalign, "posix_memalign is not portable - "
1009# undef posix_openpt 1025# undef posix_openpt
1010# define posix_openpt rpl_posix_openpt 1026# define posix_openpt rpl_posix_openpt
1011# endif 1027# endif
1012_GL_FUNCDECL_RPL (posix_openpt, int, (int flags)); 1028_GL_FUNCDECL_RPL (posix_openpt, int, (int flags), _GL_ATTRIBUTE_NODISCARD);
1013_GL_CXXALIAS_RPL (posix_openpt, int, (int flags)); 1029_GL_CXXALIAS_RPL (posix_openpt, int, (int flags));
1014# else 1030# else
1015# if !@HAVE_POSIX_OPENPT@ 1031# if !@HAVE_POSIX_OPENPT@
1016_GL_FUNCDECL_SYS (posix_openpt, int, (int flags)); 1032_GL_FUNCDECL_SYS (posix_openpt, int, (int flags), _GL_ATTRIBUTE_NODISCARD);
1017# endif 1033# endif
1018_GL_CXXALIAS_SYS (posix_openpt, int, (int flags)); 1034_GL_CXXALIAS_SYS (posix_openpt, int, (int flags));
1019# endif 1035# endif
@@ -1036,11 +1052,11 @@ _GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - "
1036# undef ptsname 1052# undef ptsname
1037# define ptsname rpl_ptsname 1053# define ptsname rpl_ptsname
1038# endif 1054# endif
1039_GL_FUNCDECL_RPL (ptsname, char *, (int fd)); 1055_GL_FUNCDECL_RPL (ptsname, char *, (int fd), _GL_ATTRIBUTE_NODISCARD);
1040_GL_CXXALIAS_RPL (ptsname, char *, (int fd)); 1056_GL_CXXALIAS_RPL (ptsname, char *, (int fd));
1041# else 1057# else
1042# if !@HAVE_PTSNAME@ 1058# if !@HAVE_PTSNAME@
1043_GL_FUNCDECL_SYS (ptsname, char *, (int fd)); 1059_GL_FUNCDECL_SYS (ptsname, char *, (int fd), _GL_ATTRIBUTE_NODISCARD);
1044# endif 1060# endif
1045_GL_CXXALIAS_SYS (ptsname, char *, (int fd)); 1061_GL_CXXALIAS_SYS (ptsname, char *, (int fd));
1046# endif 1062# endif
@@ -1088,7 +1104,7 @@ _GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - "
1088# undef putenv 1104# undef putenv
1089# define putenv rpl_putenv 1105# define putenv rpl_putenv
1090# endif 1106# endif
1091_GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1))); 1107_GL_FUNCDECL_RPL (putenv, int, (char *string), _GL_ARG_NONNULL ((1)));
1092_GL_CXXALIAS_RPL (putenv, int, (char *string)); 1108_GL_CXXALIAS_RPL (putenv, int, (char *string));
1093# elif defined _WIN32 && !defined __CYGWIN__ 1109# elif defined _WIN32 && !defined __CYGWIN__
1094# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1110# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1147,7 +1163,8 @@ typedef int (*_gl_qsort_r_compar_fn) (void const *, void const *, void *);
1147# endif 1163# endif
1148_GL_FUNCDECL_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size, 1164_GL_FUNCDECL_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
1149 _gl_qsort_r_compar_fn compare, 1165 _gl_qsort_r_compar_fn compare,
1150 void *arg) _GL_ARG_NONNULL ((1, 4))); 1166 void *arg),
1167 _GL_ARG_NONNULL ((1, 4)));
1151_GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size, 1168_GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
1152 _gl_qsort_r_compar_fn compare, 1169 _gl_qsort_r_compar_fn compare,
1153 void *arg)); 1170 void *arg));
@@ -1155,7 +1172,8 @@ _GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
1155# if !@HAVE_QSORT_R@ 1172# if !@HAVE_QSORT_R@
1156_GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size, 1173_GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
1157 _gl_qsort_r_compar_fn compare, 1174 _gl_qsort_r_compar_fn compare,
1158 void *arg) _GL_ARG_NONNULL ((1, 4))); 1175 void *arg),
1176 _GL_ARG_NONNULL ((1, 4)));
1159# endif 1177# endif
1160_GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size, 1178_GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
1161 _gl_qsort_r_compar_fn compare, 1179 _gl_qsort_r_compar_fn compare,
@@ -1258,14 +1276,14 @@ _GL_WARN_ON_USE (srandom, "srandom is unportable - "
1258# define initstate rpl_initstate 1276# define initstate rpl_initstate
1259# endif 1277# endif
1260_GL_FUNCDECL_RPL (initstate, char *, 1278_GL_FUNCDECL_RPL (initstate, char *,
1261 (unsigned int seed, char *buf, size_t buf_size) 1279 (unsigned int seed, char *buf, size_t buf_size),
1262 _GL_ARG_NONNULL ((2))); 1280 _GL_ARG_NONNULL ((2)));
1263_GL_CXXALIAS_RPL (initstate, char *, 1281_GL_CXXALIAS_RPL (initstate, char *,
1264 (unsigned int seed, char *buf, size_t buf_size)); 1282 (unsigned int seed, char *buf, size_t buf_size));
1265# else 1283# else
1266# if !@HAVE_INITSTATE@ || !@HAVE_DECL_INITSTATE@ 1284# if !@HAVE_INITSTATE@ || !@HAVE_DECL_INITSTATE@
1267_GL_FUNCDECL_SYS (initstate, char *, 1285_GL_FUNCDECL_SYS (initstate, char *,
1268 (unsigned int seed, char *buf, size_t buf_size) 1286 (unsigned int seed, char *buf, size_t buf_size),
1269 _GL_ARG_NONNULL ((2))); 1287 _GL_ARG_NONNULL ((2)));
1270# endif 1288# endif
1271/* Need to cast, because on FreeBSD, the first parameter is 1289/* Need to cast, because on FreeBSD, the first parameter is
@@ -1290,11 +1308,11 @@ _GL_WARN_ON_USE (initstate, "initstate is unportable - "
1290# undef setstate 1308# undef setstate
1291# define setstate rpl_setstate 1309# define setstate rpl_setstate
1292# endif 1310# endif
1293_GL_FUNCDECL_RPL (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); 1311_GL_FUNCDECL_RPL (setstate, char *, (char *arg_state), _GL_ARG_NONNULL ((1)));
1294_GL_CXXALIAS_RPL (setstate, char *, (char *arg_state)); 1312_GL_CXXALIAS_RPL (setstate, char *, (char *arg_state));
1295# else 1313# else
1296# if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@ 1314# if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@
1297_GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); 1315_GL_FUNCDECL_SYS (setstate, char *, (char *arg_state), _GL_ARG_NONNULL ((1)));
1298# endif 1316# endif
1299/* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter 1317/* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter
1300 is const char *arg_state. */ 1318 is const char *arg_state. */
@@ -1318,12 +1336,12 @@ _GL_WARN_ON_USE (setstate, "setstate is unportable - "
1318# undef random_r 1336# undef random_r
1319# define random_r rpl_random_r 1337# define random_r rpl_random_r
1320# endif 1338# endif
1321_GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result) 1339_GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result),
1322 _GL_ARG_NONNULL ((1, 2))); 1340 _GL_ARG_NONNULL ((1, 2)));
1323_GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result)); 1341_GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result));
1324# else 1342# else
1325# if !@HAVE_RANDOM_R@ 1343# if !@HAVE_RANDOM_R@
1326_GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result) 1344_GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result),
1327 _GL_ARG_NONNULL ((1, 2))); 1345 _GL_ARG_NONNULL ((1, 2)));
1328# endif 1346# endif
1329_GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result)); 1347_GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
@@ -1344,14 +1362,14 @@ _GL_WARN_ON_USE (random_r, "random_r is unportable - "
1344# define srandom_r rpl_srandom_r 1362# define srandom_r rpl_srandom_r
1345# endif 1363# endif
1346_GL_FUNCDECL_RPL (srandom_r, int, 1364_GL_FUNCDECL_RPL (srandom_r, int,
1347 (unsigned int seed, struct random_data *rand_state) 1365 (unsigned int seed, struct random_data *rand_state),
1348 _GL_ARG_NONNULL ((2))); 1366 _GL_ARG_NONNULL ((2)));
1349_GL_CXXALIAS_RPL (srandom_r, int, 1367_GL_CXXALIAS_RPL (srandom_r, int,
1350 (unsigned int seed, struct random_data *rand_state)); 1368 (unsigned int seed, struct random_data *rand_state));
1351# else 1369# else
1352# if !@HAVE_RANDOM_R@ 1370# if !@HAVE_RANDOM_R@
1353_GL_FUNCDECL_SYS (srandom_r, int, 1371_GL_FUNCDECL_SYS (srandom_r, int,
1354 (unsigned int seed, struct random_data *rand_state) 1372 (unsigned int seed, struct random_data *rand_state),
1355 _GL_ARG_NONNULL ((2))); 1373 _GL_ARG_NONNULL ((2)));
1356# endif 1374# endif
1357_GL_CXXALIAS_SYS (srandom_r, int, 1375_GL_CXXALIAS_SYS (srandom_r, int,
@@ -1374,7 +1392,7 @@ _GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
1374# endif 1392# endif
1375_GL_FUNCDECL_RPL (initstate_r, int, 1393_GL_FUNCDECL_RPL (initstate_r, int,
1376 (unsigned int seed, char *buf, size_t buf_size, 1394 (unsigned int seed, char *buf, size_t buf_size,
1377 struct random_data *rand_state) 1395 struct random_data *rand_state),
1378 _GL_ARG_NONNULL ((2, 4))); 1396 _GL_ARG_NONNULL ((2, 4)));
1379_GL_CXXALIAS_RPL (initstate_r, int, 1397_GL_CXXALIAS_RPL (initstate_r, int,
1380 (unsigned int seed, char *buf, size_t buf_size, 1398 (unsigned int seed, char *buf, size_t buf_size,
@@ -1383,7 +1401,7 @@ _GL_CXXALIAS_RPL (initstate_r, int,
1383# if !@HAVE_RANDOM_R@ 1401# if !@HAVE_RANDOM_R@
1384_GL_FUNCDECL_SYS (initstate_r, int, 1402_GL_FUNCDECL_SYS (initstate_r, int,
1385 (unsigned int seed, char *buf, size_t buf_size, 1403 (unsigned int seed, char *buf, size_t buf_size,
1386 struct random_data *rand_state) 1404 struct random_data *rand_state),
1387 _GL_ARG_NONNULL ((2, 4))); 1405 _GL_ARG_NONNULL ((2, 4)));
1388# endif 1406# endif
1389/* Need to cast, because on Haiku, the third parameter is 1407/* Need to cast, because on Haiku, the third parameter is
@@ -1408,14 +1426,14 @@ _GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
1408# define setstate_r rpl_setstate_r 1426# define setstate_r rpl_setstate_r
1409# endif 1427# endif
1410_GL_FUNCDECL_RPL (setstate_r, int, 1428_GL_FUNCDECL_RPL (setstate_r, int,
1411 (char *arg_state, struct random_data *rand_state) 1429 (char *arg_state, struct random_data *rand_state),
1412 _GL_ARG_NONNULL ((1, 2))); 1430 _GL_ARG_NONNULL ((1, 2)));
1413_GL_CXXALIAS_RPL (setstate_r, int, 1431_GL_CXXALIAS_RPL (setstate_r, int,
1414 (char *arg_state, struct random_data *rand_state)); 1432 (char *arg_state, struct random_data *rand_state));
1415# else 1433# else
1416# if !@HAVE_RANDOM_R@ 1434# if !@HAVE_RANDOM_R@
1417_GL_FUNCDECL_SYS (setstate_r, int, 1435_GL_FUNCDECL_SYS (setstate_r, int,
1418 (char *arg_state, struct random_data *rand_state) 1436 (char *arg_state, struct random_data *rand_state),
1419 _GL_ARG_NONNULL ((1, 2))); 1437 _GL_ARG_NONNULL ((1, 2)));
1420# endif 1438# endif
1421/* Need to cast, because on Haiku, the first parameter is 1439/* Need to cast, because on Haiku, the first parameter is
@@ -1441,21 +1459,22 @@ _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
1441# undef realloc 1459# undef realloc
1442# define realloc rpl_realloc 1460# define realloc rpl_realloc
1443# endif 1461# endif
1444_GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size) 1462_GL_FUNCDECL_RPL (realloc, void *,
1445 _GL_ATTRIBUTE_DEALLOC_FREE); 1463 (void *ptr, size_t size),
1464 _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_NODISCARD);
1446_GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size)); 1465_GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
1447# else 1466# else
1448# if __GNUC__ >= 11 1467# if __GNUC__ >= 11 && !defined __clang__
1449/* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */ 1468/* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */
1450# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 1469# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
1451_GL_FUNCDECL_SYS (realloc, void *, 1470_GL_FUNCDECL_SYS (realloc, void *,
1452 (void *ptr, size_t size) 1471 (void *ptr, size_t size),
1453 _GL_ATTRIBUTE_NOTHROW 1472 _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_NODISCARD)
1454 _GL_ATTRIBUTE_DEALLOC_FREE); 1473 _GL_ATTRIBUTE_NOTHROW;
1455# else 1474# else
1456_GL_FUNCDECL_SYS (realloc, void *, 1475_GL_FUNCDECL_SYS (realloc, void *,
1457 (void *ptr, size_t size) 1476 (void *ptr, size_t size),
1458 _GL_ATTRIBUTE_DEALLOC_FREE); 1477 _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_NODISCARD);
1459# endif 1478# endif
1460# endif 1479# endif
1461_GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size)); 1480_GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
@@ -1464,16 +1483,17 @@ _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
1464_GL_CXXALIASWARN (realloc); 1483_GL_CXXALIASWARN (realloc);
1465# endif 1484# endif
1466#else 1485#else
1467# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined realloc 1486# if @GNULIB_FREE_POSIX@ \
1487 && (__GNUC__ >= 11 && !defined __clang__) && !defined realloc
1468/* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */ 1488/* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */
1469# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 1489# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
1470_GL_FUNCDECL_SYS (realloc, void *, 1490_GL_FUNCDECL_SYS (realloc, void *,
1471 (void *ptr, size_t size) 1491 (void *ptr, size_t size),
1472 _GL_ATTRIBUTE_NOTHROW 1492 _GL_ATTRIBUTE_DEALLOC_FREE)
1473 _GL_ATTRIBUTE_DEALLOC_FREE); 1493 _GL_ATTRIBUTE_NOTHROW;
1474# else 1494# else
1475_GL_FUNCDECL_SYS (realloc, void *, 1495_GL_FUNCDECL_SYS (realloc, void *,
1476 (void *ptr, size_t size) 1496 (void *ptr, size_t size),
1477 _GL_ATTRIBUTE_DEALLOC_FREE); 1497 _GL_ATTRIBUTE_DEALLOC_FREE);
1478# endif 1498# endif
1479# endif 1499# endif
@@ -1493,13 +1513,15 @@ _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
1493# define reallocarray rpl_reallocarray 1513# define reallocarray rpl_reallocarray
1494# endif 1514# endif
1495_GL_FUNCDECL_RPL (reallocarray, void *, 1515_GL_FUNCDECL_RPL (reallocarray, void *,
1496 (void *ptr, size_t nmemb, size_t size)); 1516 (void *ptr, size_t nmemb, size_t size),
1517 _GL_ATTRIBUTE_NODISCARD);
1497_GL_CXXALIAS_RPL (reallocarray, void *, 1518_GL_CXXALIAS_RPL (reallocarray, void *,
1498 (void *ptr, size_t nmemb, size_t size)); 1519 (void *ptr, size_t nmemb, size_t size));
1499# else 1520# else
1500# if ! @HAVE_REALLOCARRAY@ 1521# if ! @HAVE_REALLOCARRAY@
1501_GL_FUNCDECL_SYS (reallocarray, void *, 1522_GL_FUNCDECL_SYS (reallocarray, void *,
1502 (void *ptr, size_t nmemb, size_t size)); 1523 (void *ptr, size_t nmemb, size_t size),
1524 _GL_ATTRIBUTE_NODISCARD);
1503# endif 1525# endif
1504_GL_CXXALIAS_SYS (reallocarray, void *, 1526_GL_CXXALIAS_SYS (reallocarray, void *,
1505 (void *ptr, size_t nmemb, size_t size)); 1527 (void *ptr, size_t nmemb, size_t size));
@@ -1521,15 +1543,15 @@ _GL_WARN_ON_USE (reallocarray, "reallocarray is not portable - "
1521# define realpath rpl_realpath 1543# define realpath rpl_realpath
1522# endif 1544# endif
1523_GL_FUNCDECL_RPL (realpath, char *, 1545_GL_FUNCDECL_RPL (realpath, char *,
1524 (const char *restrict name, char *restrict resolved) 1546 (const char *restrict name, char *restrict resolved),
1525 _GL_ARG_NONNULL ((1))); 1547 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1526_GL_CXXALIAS_RPL (realpath, char *, 1548_GL_CXXALIAS_RPL (realpath, char *,
1527 (const char *restrict name, char *restrict resolved)); 1549 (const char *restrict name, char *restrict resolved));
1528# else 1550# else
1529# if !@HAVE_REALPATH@ 1551# if !@HAVE_REALPATH@
1530_GL_FUNCDECL_SYS (realpath, char *, 1552_GL_FUNCDECL_SYS (realpath, char *,
1531 (const char *restrict name, char *restrict resolved) 1553 (const char *restrict name, char *restrict resolved),
1532 _GL_ARG_NONNULL ((1))); 1554 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1533# endif 1555# endif
1534_GL_CXXALIAS_SYS (realpath, char *, 1556_GL_CXXALIAS_SYS (realpath, char *,
1535 (const char *restrict name, char *restrict resolved)); 1557 (const char *restrict name, char *restrict resolved));
@@ -1547,7 +1569,8 @@ _GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module "
1547/* Test a user response to a question. 1569/* Test a user response to a question.
1548 Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */ 1570 Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */
1549# if !@HAVE_RPMATCH@ 1571# if !@HAVE_RPMATCH@
1550_GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1))); 1572_GL_FUNCDECL_SYS (rpmatch, int, (const char *response),
1573 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1551# endif 1574# endif
1552_GL_CXXALIAS_SYS (rpmatch, int, (const char *response)); 1575_GL_CXXALIAS_SYS (rpmatch, int, (const char *response));
1553_GL_CXXALIASWARN (rpmatch); 1576_GL_CXXALIASWARN (rpmatch);
@@ -1563,7 +1586,8 @@ _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
1563/* Look up NAME in the environment, returning 0 in insecure situations. */ 1586/* Look up NAME in the environment, returning 0 in insecure situations. */
1564# if !@HAVE_SECURE_GETENV@ 1587# if !@HAVE_SECURE_GETENV@
1565_GL_FUNCDECL_SYS (secure_getenv, char *, 1588_GL_FUNCDECL_SYS (secure_getenv, char *,
1566 (char const *name) _GL_ARG_NONNULL ((1))); 1589 (char const *name),
1590 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1567# endif 1591# endif
1568_GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name)); 1592_GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name));
1569_GL_CXXALIASWARN (secure_getenv); 1593_GL_CXXALIASWARN (secure_getenv);
@@ -1584,14 +1608,14 @@ _GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - "
1584# define setenv rpl_setenv 1608# define setenv rpl_setenv
1585# endif 1609# endif
1586_GL_FUNCDECL_RPL (setenv, int, 1610_GL_FUNCDECL_RPL (setenv, int,
1587 (const char *name, const char *value, int replace) 1611 (const char *name, const char *value, int replace),
1588 _GL_ARG_NONNULL ((1))); 1612 _GL_ARG_NONNULL ((1)));
1589_GL_CXXALIAS_RPL (setenv, int, 1613_GL_CXXALIAS_RPL (setenv, int,
1590 (const char *name, const char *value, int replace)); 1614 (const char *name, const char *value, int replace));
1591# else 1615# else
1592# if !@HAVE_DECL_SETENV@ 1616# if !@HAVE_DECL_SETENV@
1593_GL_FUNCDECL_SYS (setenv, int, 1617_GL_FUNCDECL_SYS (setenv, int,
1594 (const char *name, const char *value, int replace) 1618 (const char *name, const char *value, int replace),
1595 _GL_ARG_NONNULL ((1))); 1619 _GL_ARG_NONNULL ((1)));
1596# endif 1620# endif
1597_GL_CXXALIAS_SYS (setenv, int, 1621_GL_CXXALIAS_SYS (setenv, int,
@@ -1608,6 +1632,19 @@ _GL_WARN_ON_USE (setenv, "setenv is unportable - "
1608# endif 1632# endif
1609#endif 1633#endif
1610 1634
1635#if @GNULIB_STACK_TRACE@
1636/* Prints a stack trace of the current thread to standard error,
1637 if possible. */
1638# if @CAN_PRINT_STACK_TRACE@
1639_GL_EXTERN_C void print_stack_trace (void);
1640# else
1641# if !GNULIB_defined_print_stack_trace
1642# define print_stack_trace() /* nothing */
1643# define GNULIB_defined_print_stack_trace 1
1644# endif
1645# endif
1646#endif
1647
1611#if @GNULIB_STRTOD@ 1648#if @GNULIB_STRTOD@
1612 /* Parse a double from STRING, updating ENDP if appropriate. */ 1649 /* Parse a double from STRING, updating ENDP if appropriate. */
1613# if @REPLACE_STRTOD@ 1650# if @REPLACE_STRTOD@
@@ -1616,14 +1653,14 @@ _GL_WARN_ON_USE (setenv, "setenv is unportable - "
1616# endif 1653# endif
1617# define GNULIB_defined_strtod_function 1 1654# define GNULIB_defined_strtod_function 1
1618_GL_FUNCDECL_RPL (strtod, double, 1655_GL_FUNCDECL_RPL (strtod, double,
1619 (const char *restrict str, char **restrict endp) 1656 (const char *restrict str, char **restrict endp),
1620 _GL_ARG_NONNULL ((1))); 1657 _GL_ARG_NONNULL ((1)));
1621_GL_CXXALIAS_RPL (strtod, double, 1658_GL_CXXALIAS_RPL (strtod, double,
1622 (const char *restrict str, char **restrict endp)); 1659 (const char *restrict str, char **restrict endp));
1623# else 1660# else
1624# if !@HAVE_STRTOD@ 1661# if !@HAVE_STRTOD@
1625_GL_FUNCDECL_SYS (strtod, double, 1662_GL_FUNCDECL_SYS (strtod, double,
1626 (const char *restrict str, char **restrict endp) 1663 (const char *restrict str, char **restrict endp),
1627 _GL_ARG_NONNULL ((1))); 1664 _GL_ARG_NONNULL ((1)));
1628# endif 1665# endif
1629_GL_CXXALIAS_SYS (strtod, double, 1666_GL_CXXALIAS_SYS (strtod, double,
@@ -1648,14 +1685,14 @@ _GL_WARN_ON_USE (strtod, "strtod is unportable - "
1648# endif 1685# endif
1649# define GNULIB_defined_strtof_function 1 1686# define GNULIB_defined_strtof_function 1
1650_GL_FUNCDECL_RPL (strtof, float, 1687_GL_FUNCDECL_RPL (strtof, float,
1651 (const char *restrict str, char **restrict endp) 1688 (const char *restrict str, char **restrict endp),
1652 _GL_ARG_NONNULL ((1))); 1689 _GL_ARG_NONNULL ((1)));
1653_GL_CXXALIAS_RPL (strtof, float, 1690_GL_CXXALIAS_RPL (strtof, float,
1654 (const char *restrict str, char **restrict endp)); 1691 (const char *restrict str, char **restrict endp));
1655# else 1692# else
1656# if !@HAVE_STRTOF@ 1693# if !@HAVE_STRTOF@
1657_GL_FUNCDECL_SYS (strtof, float, 1694_GL_FUNCDECL_SYS (strtof, float,
1658 (const char *restrict str, char **restrict endp) 1695 (const char *restrict str, char **restrict endp),
1659 _GL_ARG_NONNULL ((1))); 1696 _GL_ARG_NONNULL ((1)));
1660# endif 1697# endif
1661_GL_CXXALIAS_SYS (strtof, float, 1698_GL_CXXALIAS_SYS (strtof, float,
@@ -1680,14 +1717,14 @@ _GL_WARN_ON_USE (strtof, "strtof is unportable - "
1680# endif 1717# endif
1681# define GNULIB_defined_strtold_function 1 1718# define GNULIB_defined_strtold_function 1
1682_GL_FUNCDECL_RPL (strtold, long double, 1719_GL_FUNCDECL_RPL (strtold, long double,
1683 (const char *restrict str, char **restrict endp) 1720 (const char *restrict str, char **restrict endp),
1684 _GL_ARG_NONNULL ((1))); 1721 _GL_ARG_NONNULL ((1)));
1685_GL_CXXALIAS_RPL (strtold, long double, 1722_GL_CXXALIAS_RPL (strtold, long double,
1686 (const char *restrict str, char **restrict endp)); 1723 (const char *restrict str, char **restrict endp));
1687# else 1724# else
1688# if !@HAVE_STRTOLD@ 1725# if !@HAVE_STRTOLD@
1689_GL_FUNCDECL_SYS (strtold, long double, 1726_GL_FUNCDECL_SYS (strtold, long double,
1690 (const char *restrict str, char **restrict endp) 1727 (const char *restrict str, char **restrict endp),
1691 _GL_ARG_NONNULL ((1))); 1728 _GL_ARG_NONNULL ((1)));
1692# endif 1729# endif
1693_GL_CXXALIAS_SYS (strtold, long double, 1730_GL_CXXALIAS_SYS (strtold, long double,
@@ -1718,7 +1755,7 @@ _GL_WARN_ON_USE (strtold, "strtold is unportable - "
1718# define GNULIB_defined_strtol_function 1 1755# define GNULIB_defined_strtol_function 1
1719_GL_FUNCDECL_RPL (strtol, long, 1756_GL_FUNCDECL_RPL (strtol, long,
1720 (const char *restrict string, char **restrict endptr, 1757 (const char *restrict string, char **restrict endptr,
1721 int base) 1758 int base),
1722 _GL_ARG_NONNULL ((1))); 1759 _GL_ARG_NONNULL ((1)));
1723_GL_CXXALIAS_RPL (strtol, long, 1760_GL_CXXALIAS_RPL (strtol, long,
1724 (const char *restrict string, char **restrict endptr, 1761 (const char *restrict string, char **restrict endptr,
@@ -1727,7 +1764,7 @@ _GL_CXXALIAS_RPL (strtol, long,
1727# if !@HAVE_STRTOL@ 1764# if !@HAVE_STRTOL@
1728_GL_FUNCDECL_SYS (strtol, long, 1765_GL_FUNCDECL_SYS (strtol, long,
1729 (const char *restrict string, char **restrict endptr, 1766 (const char *restrict string, char **restrict endptr,
1730 int base) 1767 int base),
1731 _GL_ARG_NONNULL ((1))); 1768 _GL_ARG_NONNULL ((1)));
1732# endif 1769# endif
1733_GL_CXXALIAS_SYS (strtol, long, 1770_GL_CXXALIAS_SYS (strtol, long,
@@ -1761,7 +1798,7 @@ _GL_WARN_ON_USE (strtol, "strtol is unportable - "
1761# define GNULIB_defined_strtoll_function 1 1798# define GNULIB_defined_strtoll_function 1
1762_GL_FUNCDECL_RPL (strtoll, long long, 1799_GL_FUNCDECL_RPL (strtoll, long long,
1763 (const char *restrict string, char **restrict endptr, 1800 (const char *restrict string, char **restrict endptr,
1764 int base) 1801 int base),
1765 _GL_ARG_NONNULL ((1))); 1802 _GL_ARG_NONNULL ((1)));
1766_GL_CXXALIAS_RPL (strtoll, long long, 1803_GL_CXXALIAS_RPL (strtoll, long long,
1767 (const char *restrict string, char **restrict endptr, 1804 (const char *restrict string, char **restrict endptr,
@@ -1770,7 +1807,7 @@ _GL_CXXALIAS_RPL (strtoll, long long,
1770# if !@HAVE_STRTOLL@ 1807# if !@HAVE_STRTOLL@
1771_GL_FUNCDECL_SYS (strtoll, long long, 1808_GL_FUNCDECL_SYS (strtoll, long long,
1772 (const char *restrict string, char **restrict endptr, 1809 (const char *restrict string, char **restrict endptr,
1773 int base) 1810 int base),
1774 _GL_ARG_NONNULL ((1))); 1811 _GL_ARG_NONNULL ((1)));
1775# endif 1812# endif
1776_GL_CXXALIAS_SYS (strtoll, long long, 1813_GL_CXXALIAS_SYS (strtoll, long long,
@@ -1801,7 +1838,7 @@ _GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
1801# define GNULIB_defined_strtoul_function 1 1838# define GNULIB_defined_strtoul_function 1
1802_GL_FUNCDECL_RPL (strtoul, unsigned long, 1839_GL_FUNCDECL_RPL (strtoul, unsigned long,
1803 (const char *restrict string, char **restrict endptr, 1840 (const char *restrict string, char **restrict endptr,
1804 int base) 1841 int base),
1805 _GL_ARG_NONNULL ((1))); 1842 _GL_ARG_NONNULL ((1)));
1806_GL_CXXALIAS_RPL (strtoul, unsigned long, 1843_GL_CXXALIAS_RPL (strtoul, unsigned long,
1807 (const char *restrict string, char **restrict endptr, 1844 (const char *restrict string, char **restrict endptr,
@@ -1810,7 +1847,7 @@ _GL_CXXALIAS_RPL (strtoul, unsigned long,
1810# if !@HAVE_STRTOUL@ 1847# if !@HAVE_STRTOUL@
1811_GL_FUNCDECL_SYS (strtoul, unsigned long, 1848_GL_FUNCDECL_SYS (strtoul, unsigned long,
1812 (const char *restrict string, char **restrict endptr, 1849 (const char *restrict string, char **restrict endptr,
1813 int base) 1850 int base),
1814 _GL_ARG_NONNULL ((1))); 1851 _GL_ARG_NONNULL ((1)));
1815# endif 1852# endif
1816_GL_CXXALIAS_SYS (strtoul, unsigned long, 1853_GL_CXXALIAS_SYS (strtoul, unsigned long,
@@ -1844,7 +1881,7 @@ _GL_WARN_ON_USE (strtoul, "strtoul is unportable - "
1844# define GNULIB_defined_strtoull_function 1 1881# define GNULIB_defined_strtoull_function 1
1845_GL_FUNCDECL_RPL (strtoull, unsigned long long, 1882_GL_FUNCDECL_RPL (strtoull, unsigned long long,
1846 (const char *restrict string, char **restrict endptr, 1883 (const char *restrict string, char **restrict endptr,
1847 int base) 1884 int base),
1848 _GL_ARG_NONNULL ((1))); 1885 _GL_ARG_NONNULL ((1)));
1849_GL_CXXALIAS_RPL (strtoull, unsigned long long, 1886_GL_CXXALIAS_RPL (strtoull, unsigned long long,
1850 (const char *restrict string, char **restrict endptr, 1887 (const char *restrict string, char **restrict endptr,
@@ -1853,7 +1890,7 @@ _GL_CXXALIAS_RPL (strtoull, unsigned long long,
1853# if !@HAVE_STRTOULL@ 1890# if !@HAVE_STRTOULL@
1854_GL_FUNCDECL_SYS (strtoull, unsigned long long, 1891_GL_FUNCDECL_SYS (strtoull, unsigned long long,
1855 (const char *restrict string, char **restrict endptr, 1892 (const char *restrict string, char **restrict endptr,
1856 int base) 1893 int base),
1857 _GL_ARG_NONNULL ((1))); 1894 _GL_ARG_NONNULL ((1)));
1858# endif 1895# endif
1859_GL_CXXALIAS_SYS (strtoull, unsigned long long, 1896_GL_CXXALIAS_SYS (strtoull, unsigned long long,
@@ -1892,11 +1929,11 @@ _GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
1892# undef unsetenv 1929# undef unsetenv
1893# define unsetenv rpl_unsetenv 1930# define unsetenv rpl_unsetenv
1894# endif 1931# endif
1895_GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); 1932_GL_FUNCDECL_RPL (unsetenv, int, (const char *name), _GL_ARG_NONNULL ((1)));
1896_GL_CXXALIAS_RPL (unsetenv, int, (const char *name)); 1933_GL_CXXALIAS_RPL (unsetenv, int, (const char *name));
1897# else 1934# else
1898# if !@HAVE_DECL_UNSETENV@ 1935# if !@HAVE_DECL_UNSETENV@
1899_GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); 1936_GL_FUNCDECL_SYS (unsetenv, int, (const char *name), _GL_ARG_NONNULL ((1)));
1900# endif 1937# endif
1901_GL_CXXALIAS_SYS (unsetenv, int, (const char *name)); 1938_GL_CXXALIAS_SYS (unsetenv, int, (const char *name));
1902# endif 1939# endif
diff --git a/lib/strftime.c b/lib/strftime.c
index 9b1b27a1fc8..4ddbec04269 100644
--- a/lib/strftime.c
+++ b/lib/strftime.c
@@ -321,7 +321,7 @@ enum pad_style
321 maximum object size 9223372036854775807", caused by insufficient data flow 321 maximum object size 9223372036854775807", caused by insufficient data flow
322 analysis and value propagation of the 'width_add' expansion when GCC is not 322 analysis and value propagation of the 'width_add' expansion when GCC is not
323 optimizing. Cf. <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88443>. */ 323 optimizing. Cf. <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88443>. */
324#if __GNUC__ >= 7 && !__OPTIMIZE__ 324#if _GL_GNUC_PREREQ (7, 0) && !__OPTIMIZE__
325# pragma GCC diagnostic ignored "-Wstringop-overflow" 325# pragma GCC diagnostic ignored "-Wstringop-overflow"
326#endif 326#endif
327 327
diff --git a/lib/strftime.h b/lib/strftime.h
index 8ce62cdb6d7..3179874af97 100644
--- a/lib/strftime.h
+++ b/lib/strftime.h
@@ -21,11 +21,11 @@
21extern "C" { 21extern "C" {
22#endif 22#endif
23 23
24/* Formats the broken-down time *__TP, with additional __NS nanoseconds, 24/* Format the broken-down time *__TP, with additional __NS nanoseconds,
25 into the buffer __S of size __MAXSIZE, according to the rules of the 25 into the buffer __S of size __MAXSIZE, according to the rules of the
26 LC_TIME category of the current locale. 26 LC_TIME category of the current locale.
27 27
28 Uses the time zone __TZ. 28 Use the time zone __TZ.
29 If *__TP represents local time, __TZ should be set to 29 If *__TP represents local time, __TZ should be set to
30 tzalloc (getenv ("TZ")). 30 tzalloc (getenv ("TZ")).
31 If *__TP represents universal time (a.k.a. GMT), __TZ should be set to 31 If *__TP represents universal time (a.k.a. GMT), __TZ should be set to
@@ -60,15 +60,11 @@ extern "C" {
60 time zone: %z %Z 60 time zone: %z %Z
61 nanosecond %N 61 nanosecond %N
62 62
63 Stores the result, as a string with a trailing NUL character, at the 63 Store the result, as a string with a trailing NUL character, at the
64 beginning of the array __S[0..__MAXSIZE-1], if it fits, and returns 64 beginning of the array __S[0..__MAXSIZE-1] and return the length of
65 the length of that string, not counting the trailing NUL. In this case, 65 that string, not counting the trailing NUL, and without changing errno.
66 errno is preserved if the return value is 0. 66 If unsuccessful, possibly change the array __S, set errno, and return 0;
67 If it does not fit, this function sets errno to ERANGE and returns 0. 67 errno == ERANGE means the string didn't fit.
68 Upon other errors, this function sets errno and returns 0 as well.
69
70 Note: The errno behavior is in draft POSIX 202x plus some requested
71 changes to POSIX.
72 68
73 This function is like strftime, but with two more arguments: 69 This function is like strftime, but with two more arguments:
74 * __TZ instead of the local timezone information, 70 * __TZ instead of the local timezone information,
diff --git a/lib/string.in.h b/lib/string.in.h
index 44ec2e7ecdb..a588e7e2c26 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -79,7 +79,7 @@
79 that can be freed by passing them as the Ith argument to the 79 that can be freed by passing them as the Ith argument to the
80 function F. */ 80 function F. */
81#ifndef _GL_ATTRIBUTE_DEALLOC 81#ifndef _GL_ATTRIBUTE_DEALLOC
82# if __GNUC__ >= 11 82# if __GNUC__ >= 11 && !defined __clang__
83# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) 83# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
84# else 84# else
85# define _GL_ATTRIBUTE_DEALLOC(f, i) 85# define _GL_ATTRIBUTE_DEALLOC(f, i)
@@ -115,7 +115,7 @@
115 */ 115 */
116#ifndef _GL_ATTRIBUTE_NOTHROW 116#ifndef _GL_ATTRIBUTE_NOTHROW
117# if defined __cplusplus 117# if defined __cplusplus
118# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4 118# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4
119# if __cplusplus >= 201103L 119# if __cplusplus >= 201103L
120# define _GL_ATTRIBUTE_NOTHROW noexcept (true) 120# define _GL_ATTRIBUTE_NOTHROW noexcept (true)
121# else 121# else
@@ -198,7 +198,7 @@ _GL_EXTERN_C void free (void *);
198#if @GNULIB_EXPLICIT_BZERO@ 198#if @GNULIB_EXPLICIT_BZERO@
199# if ! @HAVE_EXPLICIT_BZERO@ 199# if ! @HAVE_EXPLICIT_BZERO@
200_GL_FUNCDECL_SYS (explicit_bzero, void, 200_GL_FUNCDECL_SYS (explicit_bzero, void,
201 (void *__dest, size_t __n) _GL_ARG_NONNULL ((1))); 201 (void *__dest, size_t __n), _GL_ARG_NONNULL ((1)));
202# endif 202# endif
203_GL_CXXALIAS_SYS (explicit_bzero, void, (void *__dest, size_t __n)); 203_GL_CXXALIAS_SYS (explicit_bzero, void, (void *__dest, size_t __n));
204_GL_CXXALIASWARN (explicit_bzero); 204_GL_CXXALIASWARN (explicit_bzero);
@@ -274,7 +274,7 @@ _GL_CXXALIASWARN (memccpy);
274# undef memchr 274# undef memchr
275# define memchr rpl_memchr 275# define memchr rpl_memchr
276# endif 276# endif
277_GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n) 277_GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n),
278 _GL_ATTRIBUTE_PURE 278 _GL_ATTRIBUTE_PURE
279 _GL_ARG_NONNULL ((1))); 279 _GL_ARG_NONNULL ((1)));
280_GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n)); 280_GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n));
@@ -313,7 +313,7 @@ _GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - "
313# endif 313# endif
314_GL_FUNCDECL_RPL (memmem, void *, 314_GL_FUNCDECL_RPL (memmem, void *,
315 (void const *__haystack, size_t __haystack_len, 315 (void const *__haystack, size_t __haystack_len,
316 void const *__needle, size_t __needle_len) 316 void const *__needle, size_t __needle_len),
317 _GL_ATTRIBUTE_PURE 317 _GL_ATTRIBUTE_PURE
318 _GL_ARG_NONNULL ((1, 3))); 318 _GL_ARG_NONNULL ((1, 3)));
319_GL_CXXALIAS_RPL (memmem, void *, 319_GL_CXXALIAS_RPL (memmem, void *,
@@ -323,7 +323,7 @@ _GL_CXXALIAS_RPL (memmem, void *,
323# if ! @HAVE_DECL_MEMMEM@ 323# if ! @HAVE_DECL_MEMMEM@
324_GL_FUNCDECL_SYS (memmem, void *, 324_GL_FUNCDECL_SYS (memmem, void *,
325 (void const *__haystack, size_t __haystack_len, 325 (void const *__haystack, size_t __haystack_len,
326 void const *__needle, size_t __needle_len) 326 void const *__needle, size_t __needle_len),
327 _GL_ATTRIBUTE_PURE 327 _GL_ATTRIBUTE_PURE
328 _GL_ARG_NONNULL ((1, 3))); 328 _GL_ARG_NONNULL ((1, 3)));
329# endif 329# endif
@@ -351,7 +351,7 @@ _GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - "
351# endif 351# endif
352_GL_FUNCDECL_RPL (mempcpy, void *, 352_GL_FUNCDECL_RPL (mempcpy, void *,
353 (void *restrict __dest, void const *restrict __src, 353 (void *restrict __dest, void const *restrict __src,
354 size_t __n) 354 size_t __n),
355 _GL_ARG_NONNULL ((1, 2))); 355 _GL_ARG_NONNULL ((1, 2)));
356_GL_CXXALIAS_RPL (mempcpy, void *, 356_GL_CXXALIAS_RPL (mempcpy, void *,
357 (void *restrict __dest, void const *restrict __src, 357 (void *restrict __dest, void const *restrict __src,
@@ -360,7 +360,7 @@ _GL_CXXALIAS_RPL (mempcpy, void *,
360# if !@HAVE_MEMPCPY@ 360# if !@HAVE_MEMPCPY@
361_GL_FUNCDECL_SYS (mempcpy, void *, 361_GL_FUNCDECL_SYS (mempcpy, void *,
362 (void *restrict __dest, void const *restrict __src, 362 (void *restrict __dest, void const *restrict __src,
363 size_t __n) 363 size_t __n),
364 _GL_ARG_NONNULL ((1, 2))); 364 _GL_ARG_NONNULL ((1, 2)));
365# endif 365# endif
366_GL_CXXALIAS_SYS (mempcpy, void *, 366_GL_CXXALIAS_SYS (mempcpy, void *,
@@ -381,7 +381,7 @@ _GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - "
381/* Search backwards through a block for a byte (specified as an int). */ 381/* Search backwards through a block for a byte (specified as an int). */
382#if @GNULIB_MEMRCHR@ 382#if @GNULIB_MEMRCHR@
383# if ! @HAVE_DECL_MEMRCHR@ 383# if ! @HAVE_DECL_MEMRCHR@
384_GL_FUNCDECL_SYS (memrchr, void *, (void const *, int, size_t) 384_GL_FUNCDECL_SYS (memrchr, void *, (void const *, int, size_t),
385 _GL_ATTRIBUTE_PURE 385 _GL_ATTRIBUTE_PURE
386 _GL_ARG_NONNULL ((1))); 386 _GL_ARG_NONNULL ((1)));
387# endif 387# endif
@@ -420,12 +420,12 @@ _GL_WARN_ON_USE (memrchr, "memrchr is unportable - "
420# define memset_explicit rpl_memset_explicit 420# define memset_explicit rpl_memset_explicit
421# endif 421# endif
422_GL_FUNCDECL_RPL (memset_explicit, void *, 422_GL_FUNCDECL_RPL (memset_explicit, void *,
423 (void *__dest, int __c, size_t __n) _GL_ARG_NONNULL ((1))); 423 (void *__dest, int __c, size_t __n), _GL_ARG_NONNULL ((1)));
424_GL_CXXALIAS_RPL (memset_explicit, void *, (void *__dest, int __c, size_t __n)); 424_GL_CXXALIAS_RPL (memset_explicit, void *, (void *__dest, int __c, size_t __n));
425# else 425# else
426# if !@HAVE_MEMSET_EXPLICIT@ 426# if !@HAVE_MEMSET_EXPLICIT@
427_GL_FUNCDECL_SYS (memset_explicit, void *, 427_GL_FUNCDECL_SYS (memset_explicit, void *,
428 (void *__dest, int __c, size_t __n) _GL_ARG_NONNULL ((1))); 428 (void *__dest, int __c, size_t __n), _GL_ARG_NONNULL ((1)));
429# endif 429# endif
430_GL_CXXALIAS_SYS (memset_explicit, void *, (void *__dest, int __c, size_t __n)); 430_GL_CXXALIAS_SYS (memset_explicit, void *, (void *__dest, int __c, size_t __n));
431# endif 431# endif
@@ -443,7 +443,7 @@ _GL_WARN_ON_USE (memset_explicit, "memset_explicit is unportable - "
443 occur within N bytes. */ 443 occur within N bytes. */
444#if @GNULIB_RAWMEMCHR@ 444#if @GNULIB_RAWMEMCHR@
445# if ! @HAVE_RAWMEMCHR@ 445# if ! @HAVE_RAWMEMCHR@
446_GL_FUNCDECL_SYS (rawmemchr, void *, (void const *__s, int __c_in) 446_GL_FUNCDECL_SYS (rawmemchr, void *, (void const *__s, int __c_in),
447 _GL_ATTRIBUTE_PURE 447 _GL_ATTRIBUTE_PURE
448 _GL_ARG_NONNULL ((1))); 448 _GL_ARG_NONNULL ((1)));
449# endif 449# endif
@@ -481,14 +481,14 @@ _GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - "
481# define stpcpy rpl_stpcpy 481# define stpcpy rpl_stpcpy
482# endif 482# endif
483_GL_FUNCDECL_RPL (stpcpy, char *, 483_GL_FUNCDECL_RPL (stpcpy, char *,
484 (char *restrict __dst, char const *restrict __src) 484 (char *restrict __dst, char const *restrict __src),
485 _GL_ARG_NONNULL ((1, 2))); 485 _GL_ARG_NONNULL ((1, 2)));
486_GL_CXXALIAS_RPL (stpcpy, char *, 486_GL_CXXALIAS_RPL (stpcpy, char *,
487 (char *restrict __dst, char const *restrict __src)); 487 (char *restrict __dst, char const *restrict __src));
488# else 488# else
489# if !@HAVE_STPCPY@ 489# if !@HAVE_STPCPY@
490_GL_FUNCDECL_SYS (stpcpy, char *, 490_GL_FUNCDECL_SYS (stpcpy, char *,
491 (char *restrict __dst, char const *restrict __src) 491 (char *restrict __dst, char const *restrict __src),
492 _GL_ARG_NONNULL ((1, 2))); 492 _GL_ARG_NONNULL ((1, 2)));
493# endif 493# endif
494_GL_CXXALIAS_SYS (stpcpy, char *, 494_GL_CXXALIAS_SYS (stpcpy, char *,
@@ -515,7 +515,7 @@ _GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - "
515# endif 515# endif
516_GL_FUNCDECL_RPL (stpncpy, char *, 516_GL_FUNCDECL_RPL (stpncpy, char *,
517 (char *restrict __dst, char const *restrict __src, 517 (char *restrict __dst, char const *restrict __src,
518 size_t __n) 518 size_t __n),
519 _GL_ARG_NONNULL ((1, 2))); 519 _GL_ARG_NONNULL ((1, 2)));
520_GL_CXXALIAS_RPL (stpncpy, char *, 520_GL_CXXALIAS_RPL (stpncpy, char *,
521 (char *restrict __dst, char const *restrict __src, 521 (char *restrict __dst, char const *restrict __src,
@@ -524,7 +524,7 @@ _GL_CXXALIAS_RPL (stpncpy, char *,
524# if ! @HAVE_STPNCPY@ 524# if ! @HAVE_STPNCPY@
525_GL_FUNCDECL_SYS (stpncpy, char *, 525_GL_FUNCDECL_SYS (stpncpy, char *,
526 (char *restrict __dst, char const *restrict __src, 526 (char *restrict __dst, char const *restrict __src,
527 size_t __n) 527 size_t __n),
528 _GL_ARG_NONNULL ((1, 2))); 528 _GL_ARG_NONNULL ((1, 2)));
529# endif 529# endif
530_GL_CXXALIAS_SYS (stpncpy, char *, 530_GL_CXXALIAS_SYS (stpncpy, char *,
@@ -560,14 +560,14 @@ _GL_WARN_ON_USE_CXX (strchr,
560# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 560# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
561# define strchrnul rpl_strchrnul 561# define strchrnul rpl_strchrnul
562# endif 562# endif
563_GL_FUNCDECL_RPL (strchrnul, char *, (const char *__s, int __c_in) 563_GL_FUNCDECL_RPL (strchrnul, char *, (const char *__s, int __c_in),
564 _GL_ATTRIBUTE_PURE 564 _GL_ATTRIBUTE_PURE
565 _GL_ARG_NONNULL ((1))); 565 _GL_ARG_NONNULL ((1)));
566_GL_CXXALIAS_RPL (strchrnul, char *, 566_GL_CXXALIAS_RPL (strchrnul, char *,
567 (const char *str, int ch)); 567 (const char *str, int ch));
568# else 568# else
569# if ! @HAVE_STRCHRNUL@ 569# if ! @HAVE_STRCHRNUL@
570_GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in) 570_GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in),
571 _GL_ATTRIBUTE_PURE 571 _GL_ATTRIBUTE_PURE
572 _GL_ARG_NONNULL ((1))); 572 _GL_ARG_NONNULL ((1)));
573# endif 573# endif
@@ -606,7 +606,7 @@ _GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - "
606# define strdup rpl_strdup 606# define strdup rpl_strdup
607# endif 607# endif
608_GL_FUNCDECL_RPL (strdup, char *, 608_GL_FUNCDECL_RPL (strdup, char *,
609 (char const *__s) 609 (char const *__s),
610 _GL_ARG_NONNULL ((1)) 610 _GL_ARG_NONNULL ((1))
611 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 611 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
612_GL_CXXALIAS_RPL (strdup, char *, (char const *__s)); 612_GL_CXXALIAS_RPL (strdup, char *, (char const *__s));
@@ -621,16 +621,17 @@ _GL_CXXALIAS_MDA (strdup, char *, (char const *__s));
621 /* strdup exists as a function and as a macro. Get rid of the macro. */ 621 /* strdup exists as a function and as a macro. Get rid of the macro. */
622# undef strdup 622# undef strdup
623# endif 623# endif
624# if (!@HAVE_DECL_STRDUP@ || __GNUC__ >= 11) && !defined strdup 624# if (!@HAVE_DECL_STRDUP@ || (__GNUC__ >= 11 && !defined __clang__)) \
625 && !defined strdup
625# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 626# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
626_GL_FUNCDECL_SYS (strdup, char *, 627_GL_FUNCDECL_SYS (strdup, char *,
627 (char const *__s) 628 (char const *__s),
628 _GL_ATTRIBUTE_NOTHROW
629 _GL_ARG_NONNULL ((1)) 629 _GL_ARG_NONNULL ((1))
630 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 630 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
631 _GL_ATTRIBUTE_NOTHROW;
631# else 632# else
632_GL_FUNCDECL_SYS (strdup, char *, 633_GL_FUNCDECL_SYS (strdup, char *,
633 (char const *__s) 634 (char const *__s),
634 _GL_ARG_NONNULL ((1)) 635 _GL_ARG_NONNULL ((1))
635 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 636 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
636# endif 637# endif
@@ -639,17 +640,17 @@ _GL_CXXALIAS_SYS (strdup, char *, (char const *__s));
639# endif 640# endif
640_GL_CXXALIASWARN (strdup); 641_GL_CXXALIASWARN (strdup);
641#else 642#else
642# if __GNUC__ >= 11 && !defined strdup 643# if (__GNUC__ >= 11 && !defined __clang__) && !defined strdup
643/* For -Wmismatched-dealloc: Associate strdup with free or rpl_free. */ 644/* For -Wmismatched-dealloc: Associate strdup with free or rpl_free. */
644# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 645# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
645_GL_FUNCDECL_SYS (strdup, char *, 646_GL_FUNCDECL_SYS (strdup, char *,
646 (char const *__s) 647 (char const *__s),
647 _GL_ATTRIBUTE_NOTHROW
648 _GL_ARG_NONNULL ((1)) 648 _GL_ARG_NONNULL ((1))
649 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 649 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
650 _GL_ATTRIBUTE_NOTHROW;
650# else 651# else
651_GL_FUNCDECL_SYS (strdup, char *, 652_GL_FUNCDECL_SYS (strdup, char *,
652 (char const *__s) 653 (char const *__s),
653 _GL_ARG_NONNULL ((1)) 654 _GL_ARG_NONNULL ((1))
654 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 655 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
655# endif 656# endif
@@ -688,7 +689,7 @@ _GL_CXXALIASWARN (strdup);
688# define strncat rpl_strncat 689# define strncat rpl_strncat
689# endif 690# endif
690_GL_FUNCDECL_RPL (strncat, char *, 691_GL_FUNCDECL_RPL (strncat, char *,
691 (char *restrict dest, const char *restrict src, size_t n) 692 (char *restrict dest, const char *restrict src, size_t n),
692 _GL_ARG_NONNULL ((1, 2))); 693 _GL_ARG_NONNULL ((1, 2)));
693_GL_CXXALIAS_RPL (strncat, char *, 694_GL_CXXALIAS_RPL (strncat, char *,
694 (char *restrict dest, const char *restrict src, size_t n)); 695 (char *restrict dest, const char *restrict src, size_t n));
@@ -715,21 +716,22 @@ _GL_WARN_ON_USE (strncat, "strncat is unportable - "
715# define strndup rpl_strndup 716# define strndup rpl_strndup
716# endif 717# endif
717_GL_FUNCDECL_RPL (strndup, char *, 718_GL_FUNCDECL_RPL (strndup, char *,
718 (char const *__s, size_t __n) 719 (char const *__s, size_t __n),
719 _GL_ARG_NONNULL ((1)) 720 _GL_ARG_NONNULL ((1))
720 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 721 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
721_GL_CXXALIAS_RPL (strndup, char *, (char const *__s, size_t __n)); 722_GL_CXXALIAS_RPL (strndup, char *, (char const *__s, size_t __n));
722# else 723# else
723# if !@HAVE_DECL_STRNDUP@ || (__GNUC__ >= 11 && !defined strndup) 724# if !@HAVE_DECL_STRNDUP@ \
725 || ((__GNUC__ >= 11 && !defined __clang__) && !defined strndup)
724# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 726# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
725_GL_FUNCDECL_SYS (strndup, char *, 727_GL_FUNCDECL_SYS (strndup, char *,
726 (char const *__s, size_t __n) 728 (char const *__s, size_t __n),
727 _GL_ATTRIBUTE_NOTHROW
728 _GL_ARG_NONNULL ((1)) 729 _GL_ARG_NONNULL ((1))
729 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 730 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
731 _GL_ATTRIBUTE_NOTHROW;
730# else 732# else
731_GL_FUNCDECL_SYS (strndup, char *, 733_GL_FUNCDECL_SYS (strndup, char *,
732 (char const *__s, size_t __n) 734 (char const *__s, size_t __n),
733 _GL_ARG_NONNULL ((1)) 735 _GL_ARG_NONNULL ((1))
734 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 736 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
735# endif 737# endif
@@ -738,17 +740,17 @@ _GL_CXXALIAS_SYS (strndup, char *, (char const *__s, size_t __n));
738# endif 740# endif
739_GL_CXXALIASWARN (strndup); 741_GL_CXXALIASWARN (strndup);
740#else 742#else
741# if __GNUC__ >= 11 && !defined strndup 743# if (__GNUC__ >= 11 && !defined __clang__) && !defined strndup
742/* For -Wmismatched-dealloc: Associate strndup with free or rpl_free. */ 744/* For -Wmismatched-dealloc: Associate strndup with free or rpl_free. */
743# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 745# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
744_GL_FUNCDECL_SYS (strndup, char *, 746_GL_FUNCDECL_SYS (strndup, char *,
745 (char const *__s, size_t __n) 747 (char const *__s, size_t __n),
746 _GL_ATTRIBUTE_NOTHROW
747 _GL_ARG_NONNULL ((1)) 748 _GL_ARG_NONNULL ((1))
748 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 749 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
750 _GL_ATTRIBUTE_NOTHROW;
749# else 751# else
750_GL_FUNCDECL_SYS (strndup, char *, 752_GL_FUNCDECL_SYS (strndup, char *,
751 (char const *__s, size_t __n) 753 (char const *__s, size_t __n),
752 _GL_ARG_NONNULL ((1)) 754 _GL_ARG_NONNULL ((1))
753 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 755 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
754# endif 756# endif
@@ -771,13 +773,13 @@ _GL_WARN_ON_USE (strndup, "strndup is unportable - "
771# undef strnlen 773# undef strnlen
772# define strnlen rpl_strnlen 774# define strnlen rpl_strnlen
773# endif 775# endif
774_GL_FUNCDECL_RPL (strnlen, size_t, (char const *__s, size_t __maxlen) 776_GL_FUNCDECL_RPL (strnlen, size_t, (char const *__s, size_t __maxlen),
775 _GL_ATTRIBUTE_PURE 777 _GL_ATTRIBUTE_PURE
776 _GL_ARG_NONNULL ((1))); 778 _GL_ARG_NONNULL ((1)));
777_GL_CXXALIAS_RPL (strnlen, size_t, (char const *__s, size_t __maxlen)); 779_GL_CXXALIAS_RPL (strnlen, size_t, (char const *__s, size_t __maxlen));
778# else 780# else
779# if ! @HAVE_DECL_STRNLEN@ 781# if ! @HAVE_DECL_STRNLEN@
780_GL_FUNCDECL_SYS (strnlen, size_t, (char const *__s, size_t __maxlen) 782_GL_FUNCDECL_SYS (strnlen, size_t, (char const *__s, size_t __maxlen),
781 _GL_ATTRIBUTE_PURE 783 _GL_ATTRIBUTE_PURE
782 _GL_ARG_NONNULL ((1))); 784 _GL_ARG_NONNULL ((1)));
783# endif 785# endif
@@ -807,7 +809,7 @@ _GL_WARN_ON_USE (strcspn, "strcspn cannot work correctly on character strings "
807/* Find the first occurrence in S of any character in ACCEPT. */ 809/* Find the first occurrence in S of any character in ACCEPT. */
808#if @GNULIB_STRPBRK@ 810#if @GNULIB_STRPBRK@
809# if ! @HAVE_STRPBRK@ 811# if ! @HAVE_STRPBRK@
810_GL_FUNCDECL_SYS (strpbrk, char *, (char const *__s, char const *__accept) 812_GL_FUNCDECL_SYS (strpbrk, char *, (char const *__s, char const *__accept),
811 _GL_ATTRIBUTE_PURE 813 _GL_ATTRIBUTE_PURE
812 _GL_ARG_NONNULL ((1, 2))); 814 _GL_ARG_NONNULL ((1, 2)));
813# endif 815# endif
@@ -892,7 +894,7 @@ _GL_WARN_ON_USE_CXX (strrchr,
892#if @GNULIB_STRSEP@ 894#if @GNULIB_STRSEP@
893# if ! @HAVE_STRSEP@ 895# if ! @HAVE_STRSEP@
894_GL_FUNCDECL_SYS (strsep, char *, 896_GL_FUNCDECL_SYS (strsep, char *,
895 (char **restrict __stringp, char const *restrict __delim) 897 (char **restrict __stringp, char const *restrict __delim),
896 _GL_ARG_NONNULL ((1, 2))); 898 _GL_ARG_NONNULL ((1, 2)));
897# endif 899# endif
898_GL_CXXALIAS_SYS (strsep, char *, 900_GL_CXXALIAS_SYS (strsep, char *,
@@ -917,7 +919,7 @@ _GL_WARN_ON_USE (strsep, "strsep is unportable - "
917# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 919# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
918# define strstr rpl_strstr 920# define strstr rpl_strstr
919# endif 921# endif
920_GL_FUNCDECL_RPL (strstr, char *, (const char *haystack, const char *needle) 922_GL_FUNCDECL_RPL (strstr, char *, (const char *haystack, const char *needle),
921 _GL_ATTRIBUTE_PURE 923 _GL_ATTRIBUTE_PURE
922 _GL_ARG_NONNULL ((1, 2))); 924 _GL_ARG_NONNULL ((1, 2)));
923_GL_CXXALIAS_RPL (strstr, char *, (const char *haystack, const char *needle)); 925_GL_CXXALIAS_RPL (strstr, char *, (const char *haystack, const char *needle));
@@ -963,7 +965,7 @@ _GL_WARN_ON_USE (strstr, "strstr is quadratic on many systems, and cannot "
963# define strcasestr rpl_strcasestr 965# define strcasestr rpl_strcasestr
964# endif 966# endif
965_GL_FUNCDECL_RPL (strcasestr, char *, 967_GL_FUNCDECL_RPL (strcasestr, char *,
966 (const char *haystack, const char *needle) 968 (const char *haystack, const char *needle),
967 _GL_ATTRIBUTE_PURE 969 _GL_ATTRIBUTE_PURE
968 _GL_ARG_NONNULL ((1, 2))); 970 _GL_ARG_NONNULL ((1, 2)));
969_GL_CXXALIAS_RPL (strcasestr, char *, 971_GL_CXXALIAS_RPL (strcasestr, char *,
@@ -971,7 +973,7 @@ _GL_CXXALIAS_RPL (strcasestr, char *,
971# else 973# else
972# if ! @HAVE_STRCASESTR@ 974# if ! @HAVE_STRCASESTR@
973_GL_FUNCDECL_SYS (strcasestr, char *, 975_GL_FUNCDECL_SYS (strcasestr, char *,
974 (const char *haystack, const char *needle) 976 (const char *haystack, const char *needle),
975 _GL_ATTRIBUTE_PURE 977 _GL_ATTRIBUTE_PURE
976 _GL_ARG_NONNULL ((1, 2))); 978 _GL_ARG_NONNULL ((1, 2)));
977# endif 979# endif
@@ -1038,7 +1040,7 @@ _GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character "
1038# endif 1040# endif
1039_GL_FUNCDECL_RPL (strtok_r, char *, 1041_GL_FUNCDECL_RPL (strtok_r, char *,
1040 (char *restrict s, char const *restrict delim, 1042 (char *restrict s, char const *restrict delim,
1041 char **restrict save_ptr) 1043 char **restrict save_ptr),
1042 _GL_ARG_NONNULL ((2, 3))); 1044 _GL_ARG_NONNULL ((2, 3)));
1043_GL_CXXALIAS_RPL (strtok_r, char *, 1045_GL_CXXALIAS_RPL (strtok_r, char *,
1044 (char *restrict s, char const *restrict delim, 1046 (char *restrict s, char const *restrict delim,
@@ -1050,7 +1052,7 @@ _GL_CXXALIAS_RPL (strtok_r, char *,
1050# if ! @HAVE_DECL_STRTOK_R@ 1052# if ! @HAVE_DECL_STRTOK_R@
1051_GL_FUNCDECL_SYS (strtok_r, char *, 1053_GL_FUNCDECL_SYS (strtok_r, char *,
1052 (char *restrict s, char const *restrict delim, 1054 (char *restrict s, char const *restrict delim,
1053 char **restrict save_ptr) 1055 char **restrict save_ptr),
1054 _GL_ARG_NONNULL ((2, 3))); 1056 _GL_ARG_NONNULL ((2, 3)));
1055# endif 1057# endif
1056_GL_CXXALIAS_SYS (strtok_r, char *, 1058_GL_CXXALIAS_SYS (strtok_r, char *,
@@ -1085,12 +1087,12 @@ _GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - "
1085# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1087# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1086# define mbslen rpl_mbslen 1088# define mbslen rpl_mbslen
1087# endif 1089# endif
1088_GL_FUNCDECL_RPL (mbslen, size_t, (const char *string) 1090_GL_FUNCDECL_RPL (mbslen, size_t, (const char *string),
1089 _GL_ATTRIBUTE_PURE 1091 _GL_ATTRIBUTE_PURE
1090 _GL_ARG_NONNULL ((1))); 1092 _GL_ARG_NONNULL ((1)));
1091_GL_CXXALIAS_RPL (mbslen, size_t, (const char *string)); 1093_GL_CXXALIAS_RPL (mbslen, size_t, (const char *string));
1092# else 1094# else
1093_GL_FUNCDECL_SYS (mbslen, size_t, (const char *string) 1095_GL_FUNCDECL_SYS (mbslen, size_t, (const char *string),
1094 _GL_ATTRIBUTE_PURE 1096 _GL_ATTRIBUTE_PURE
1095 _GL_ARG_NONNULL ((1))); 1097 _GL_ARG_NONNULL ((1)));
1096_GL_CXXALIAS_SYS (mbslen, size_t, (const char *string)); 1098_GL_CXXALIAS_SYS (mbslen, size_t, (const char *string));
@@ -1117,12 +1119,12 @@ _GL_EXTERN_C size_t mbsnlen (const char *string, size_t len)
1117# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1119# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1118# define mbschr rpl_mbschr /* avoid collision with HP-UX function */ 1120# define mbschr rpl_mbschr /* avoid collision with HP-UX function */
1119# endif 1121# endif
1120_GL_FUNCDECL_RPL (mbschr, char *, (const char *string, int c) 1122_GL_FUNCDECL_RPL (mbschr, char *, (const char *string, int c),
1121 _GL_ATTRIBUTE_PURE 1123 _GL_ATTRIBUTE_PURE
1122 _GL_ARG_NONNULL ((1))); 1124 _GL_ARG_NONNULL ((1)));
1123_GL_CXXALIAS_RPL (mbschr, char *, (const char *string, int c)); 1125_GL_CXXALIAS_RPL (mbschr, char *, (const char *string, int c));
1124# else 1126# else
1125_GL_FUNCDECL_SYS (mbschr, char *, (const char *string, int c) 1127_GL_FUNCDECL_SYS (mbschr, char *, (const char *string, int c),
1126 _GL_ATTRIBUTE_PURE 1128 _GL_ATTRIBUTE_PURE
1127 _GL_ARG_NONNULL ((1))); 1129 _GL_ARG_NONNULL ((1)));
1128_GL_CXXALIAS_SYS (mbschr, char *, (const char *string, int c)); 1130_GL_CXXALIAS_SYS (mbschr, char *, (const char *string, int c));
@@ -1139,12 +1141,12 @@ _GL_CXXALIASWARN (mbschr);
1139# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1141# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1140# define mbsrchr rpl_mbsrchr /* avoid collision with system function */ 1142# define mbsrchr rpl_mbsrchr /* avoid collision with system function */
1141# endif 1143# endif
1142_GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c) 1144_GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c),
1143 _GL_ATTRIBUTE_PURE 1145 _GL_ATTRIBUTE_PURE
1144 _GL_ARG_NONNULL ((1))); 1146 _GL_ARG_NONNULL ((1)));
1145_GL_CXXALIAS_RPL (mbsrchr, char *, (const char *string, int c)); 1147_GL_CXXALIAS_RPL (mbsrchr, char *, (const char *string, int c));
1146# else 1148# else
1147_GL_FUNCDECL_SYS (mbsrchr, char *, (const char *string, int c) 1149_GL_FUNCDECL_SYS (mbsrchr, char *, (const char *string, int c),
1148 _GL_ATTRIBUTE_PURE 1150 _GL_ATTRIBUTE_PURE
1149 _GL_ARG_NONNULL ((1))); 1151 _GL_ARG_NONNULL ((1)));
1150_GL_CXXALIAS_SYS (mbsrchr, char *, (const char *string, int c)); 1152_GL_CXXALIAS_SYS (mbsrchr, char *, (const char *string, int c));
@@ -1234,12 +1236,12 @@ _GL_EXTERN_C size_t mbscspn (const char *string, const char *accept)
1234# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1236# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1235# define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */ 1237# define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */
1236# endif 1238# endif
1237_GL_FUNCDECL_RPL (mbspbrk, char *, (const char *string, const char *accept) 1239_GL_FUNCDECL_RPL (mbspbrk, char *, (const char *string, const char *accept),
1238 _GL_ATTRIBUTE_PURE 1240 _GL_ATTRIBUTE_PURE
1239 _GL_ARG_NONNULL ((1, 2))); 1241 _GL_ARG_NONNULL ((1, 2)));
1240_GL_CXXALIAS_RPL (mbspbrk, char *, (const char *string, const char *accept)); 1242_GL_CXXALIAS_RPL (mbspbrk, char *, (const char *string, const char *accept));
1241# else 1243# else
1242_GL_FUNCDECL_SYS (mbspbrk, char *, (const char *string, const char *accept) 1244_GL_FUNCDECL_SYS (mbspbrk, char *, (const char *string, const char *accept),
1243 _GL_ATTRIBUTE_PURE 1245 _GL_ATTRIBUTE_PURE
1244 _GL_ARG_NONNULL ((1, 2))); 1246 _GL_ARG_NONNULL ((1, 2)));
1245_GL_CXXALIAS_SYS (mbspbrk, char *, (const char *string, const char *accept)); 1247_GL_CXXALIAS_SYS (mbspbrk, char *, (const char *string, const char *accept));
@@ -1329,12 +1331,12 @@ _GL_WARN_ON_USE (strerror, "strerror is unportable - "
1329# undef strerror_r 1331# undef strerror_r
1330# define strerror_r rpl_strerror_r 1332# define strerror_r rpl_strerror_r
1331# endif 1333# endif
1332_GL_FUNCDECL_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen) 1334_GL_FUNCDECL_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen),
1333 _GL_ARG_NONNULL ((2))); 1335 _GL_ARG_NONNULL ((2)));
1334_GL_CXXALIAS_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen)); 1336_GL_CXXALIAS_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen));
1335# else 1337# else
1336# if !@HAVE_DECL_STRERROR_R@ 1338# if !@HAVE_DECL_STRERROR_R@
1337_GL_FUNCDECL_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen) 1339_GL_FUNCDECL_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen),
1338 _GL_ARG_NONNULL ((2))); 1340 _GL_ARG_NONNULL ((2)));
1339# endif 1341# endif
1340_GL_CXXALIAS_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen)); 1342_GL_CXXALIAS_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen));
@@ -1433,13 +1435,13 @@ _GL_WARN_ON_USE (strsignal, "strsignal is unportable - "
1433# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1435# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1434# define strverscmp rpl_strverscmp 1436# define strverscmp rpl_strverscmp
1435# endif 1437# endif
1436_GL_FUNCDECL_RPL (strverscmp, int, (const char *, const char *) 1438_GL_FUNCDECL_RPL (strverscmp, int, (const char *, const char *),
1437 _GL_ATTRIBUTE_PURE 1439 _GL_ATTRIBUTE_PURE
1438 _GL_ARG_NONNULL ((1, 2))); 1440 _GL_ARG_NONNULL ((1, 2)));
1439_GL_CXXALIAS_RPL (strverscmp, int, (const char *, const char *)); 1441_GL_CXXALIAS_RPL (strverscmp, int, (const char *, const char *));
1440# else 1442# else
1441# if !@HAVE_STRVERSCMP@ 1443# if !@HAVE_STRVERSCMP@
1442_GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *) 1444_GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *),
1443 _GL_ATTRIBUTE_PURE 1445 _GL_ATTRIBUTE_PURE
1444 _GL_ARG_NONNULL ((1, 2))); 1446 _GL_ARG_NONNULL ((1, 2)));
1445# endif 1447# endif
diff --git a/lib/sys_random.in.h b/lib/sys_random.in.h
index 22f67b17635..279ce621309 100644
--- a/lib/sys_random.in.h
+++ b/lib/sys_random.in.h
@@ -45,7 +45,8 @@
45#ifndef _@GUARD_PREFIX@_SYS_RANDOM_H 45#ifndef _@GUARD_PREFIX@_SYS_RANDOM_H
46#define _@GUARD_PREFIX@_SYS_RANDOM_H 46#define _@GUARD_PREFIX@_SYS_RANDOM_H
47 47
48/* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */ 48/* This file uses _GL_ATTRIBUTE_NODISCARD, GNULIB_POSIXCHECK,
49 HAVE_RAW_DECL_*. */
49#if !_GL_CONFIG_H_INCLUDED 50#if !_GL_CONFIG_H_INCLUDED
50 #error "Please include config.h first." 51 #error "Please include config.h first."
51#endif 52#endif
@@ -76,15 +77,15 @@
76# define getrandom rpl_getrandom 77# define getrandom rpl_getrandom
77# endif 78# endif
78_GL_FUNCDECL_RPL (getrandom, ssize_t, 79_GL_FUNCDECL_RPL (getrandom, ssize_t,
79 (void *buffer, size_t length, unsigned int flags) 80 (void *buffer, size_t length, unsigned int flags),
80 _GL_ARG_NONNULL ((1))); 81 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
81_GL_CXXALIAS_RPL (getrandom, ssize_t, 82_GL_CXXALIAS_RPL (getrandom, ssize_t,
82 (void *buffer, size_t length, unsigned int flags)); 83 (void *buffer, size_t length, unsigned int flags));
83# else 84# else
84# if !@HAVE_GETRANDOM@ 85# if !@HAVE_GETRANDOM@
85_GL_FUNCDECL_SYS (getrandom, ssize_t, 86_GL_FUNCDECL_SYS (getrandom, ssize_t,
86 (void *buffer, size_t length, unsigned int flags) 87 (void *buffer, size_t length, unsigned int flags),
87 _GL_ARG_NONNULL ((1))); 88 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
88# endif 89# endif
89_GL_CXXALIAS_SYS (getrandom, ssize_t, 90_GL_CXXALIAS_SYS (getrandom, ssize_t,
90 (void *buffer, size_t length, unsigned int flags)); 91 (void *buffer, size_t length, unsigned int flags));
diff --git a/lib/sys_select.in.h b/lib/sys_select.in.h
index ddf25d1de4c..0d5ddd16783 100644
--- a/lib/sys_select.in.h
+++ b/lib/sys_select.in.h
@@ -332,8 +332,10 @@ _GL_CXXALIAS_SYS (select, int,
332_GL_CXXALIASWARN (select); 332_GL_CXXALIASWARN (select);
333# endif 333# endif
334#elif @HAVE_WINSOCK2_H@ 334#elif @HAVE_WINSOCK2_H@
335# undef select 335# if !GNULIB_SELECT
336# define select select_used_without_requesting_gnulib_module_select 336# undef select
337# define select select_used_without_requesting_gnulib_module_select
338# endif
337#elif defined GNULIB_POSIXCHECK 339#elif defined GNULIB_POSIXCHECK
338# undef select 340# undef select
339# if HAVE_RAW_DECL_SELECT 341# if HAVE_RAW_DECL_SELECT
diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h
index bf08f33536d..d2ecdb9da96 100644
--- a/lib/sys_stat.in.h
+++ b/lib/sys_stat.in.h
@@ -55,7 +55,8 @@
55#ifndef _@GUARD_PREFIX@_SYS_STAT_H 55#ifndef _@GUARD_PREFIX@_SYS_STAT_H
56#define _@GUARD_PREFIX@_SYS_STAT_H 56#define _@GUARD_PREFIX@_SYS_STAT_H
57 57
58/* This file uses _GL_ATTRIBUTE_NOTHROW, GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */ 58/* This file uses _GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOTHROW,
59 GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
59#if !_GL_CONFIG_H_INCLUDED 60#if !_GL_CONFIG_H_INCLUDED
60 #error "Please include config.h first." 61 #error "Please include config.h first."
61#endif 62#endif
@@ -65,7 +66,7 @@
65 */ 66 */
66#ifndef _GL_ATTRIBUTE_NOTHROW 67#ifndef _GL_ATTRIBUTE_NOTHROW
67# if defined __cplusplus 68# if defined __cplusplus
68# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4 69# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4
69# if __cplusplus >= 201103L 70# if __cplusplus >= 201103L
70# define _GL_ATTRIBUTE_NOTHROW noexcept (true) 71# define _GL_ATTRIBUTE_NOTHROW noexcept (true)
71# else 72# else
@@ -122,9 +123,11 @@
122# if @GNULIB_STAT@ 123# if @GNULIB_STAT@
123# define stat rpl_stat 124# define stat rpl_stat
124# else 125# else
125 /* Provoke a clear link error if stat() is used as a function and 126# if !GNULIB_STAT
126 module 'stat' is not in use. */ 127 /* Provoke a clear link error if stat() is used as a function and
127# define stat stat_used_without_requesting_gnulib_module_stat 128 module 'stat' is not in use. */
129# define stat stat_used_without_requesting_gnulib_module_stat
130# endif
128# endif 131# endif
129 132
130# if !GNULIB_defined_struct_stat 133# if !GNULIB_defined_struct_stat
@@ -433,7 +436,7 @@ struct stat
433# undef chmod 436# undef chmod
434# define chmod rpl_chmod 437# define chmod rpl_chmod
435# endif 438# endif
436_GL_FUNCDECL_RPL (chmod, int, (const char *filename, mode_t mode) 439_GL_FUNCDECL_RPL (chmod, int, (const char *filename, mode_t mode),
437 _GL_ARG_NONNULL ((1))); 440 _GL_ARG_NONNULL ((1)));
438_GL_CXXALIAS_RPL (chmod, int, (const char *filename, mode_t mode)); 441_GL_CXXALIAS_RPL (chmod, int, (const char *filename, mode_t mode));
439# elif defined _WIN32 && !defined __CYGWIN__ 442# elif defined _WIN32 && !defined __CYGWIN__
@@ -478,15 +481,15 @@ _GL_CXXALIASWARN (chmod);
478# define fchmodat rpl_fchmodat 481# define fchmodat rpl_fchmodat
479# endif 482# endif
480_GL_FUNCDECL_RPL (fchmodat, int, 483_GL_FUNCDECL_RPL (fchmodat, int,
481 (int fd, char const *file, mode_t mode, int flag) 484 (int fd, char const *file, mode_t mode, int flag),
482 _GL_ARG_NONNULL ((2))); 485 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
483_GL_CXXALIAS_RPL (fchmodat, int, 486_GL_CXXALIAS_RPL (fchmodat, int,
484 (int fd, char const *file, mode_t mode, int flag)); 487 (int fd, char const *file, mode_t mode, int flag));
485# else 488# else
486# if !@HAVE_FCHMODAT@ 489# if !@HAVE_FCHMODAT@
487_GL_FUNCDECL_SYS (fchmodat, int, 490_GL_FUNCDECL_SYS (fchmodat, int,
488 (int fd, char const *file, mode_t mode, int flag) 491 (int fd, char const *file, mode_t mode, int flag),
489 _GL_ARG_NONNULL ((2))); 492 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
490# endif 493# endif
491_GL_CXXALIAS_SYS (fchmodat, int, 494_GL_CXXALIAS_SYS (fchmodat, int,
492 (int fd, char const *file, mode_t mode, int flag)); 495 (int fd, char const *file, mode_t mode, int flag));
@@ -507,7 +510,8 @@ _GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - "
507# undef fstat 510# undef fstat
508# define fstat rpl_fstat 511# define fstat rpl_fstat
509# endif 512# endif
510_GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2))); 513_GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf),
514 _GL_ARG_NONNULL ((2)));
511_GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf)); 515_GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf));
512# else 516# else
513_GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf)); 517_GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
@@ -516,8 +520,10 @@ _GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
516_GL_CXXALIASWARN (fstat); 520_GL_CXXALIASWARN (fstat);
517# endif 521# endif
518#elif @GNULIB_OVERRIDES_STRUCT_STAT@ 522#elif @GNULIB_OVERRIDES_STRUCT_STAT@
519# undef fstat 523# if !GNULIB_FSTAT
520# define fstat fstat_used_without_requesting_gnulib_module_fstat 524# undef fstat
525# define fstat fstat_used_without_requesting_gnulib_module_fstat
526# endif
521#elif @WINDOWS_64_BIT_ST_SIZE@ 527#elif @WINDOWS_64_BIT_ST_SIZE@
522/* Above, we define stat to _stati64. */ 528/* Above, we define stat to _stati64. */
523# define fstat _fstati64 529# define fstat _fstati64
@@ -538,7 +544,7 @@ _GL_WARN_ON_USE (fstat, "fstat has portability problems - "
538# endif 544# endif
539_GL_FUNCDECL_RPL (fstatat, int, 545_GL_FUNCDECL_RPL (fstatat, int,
540 (int fd, char const *restrict name, struct stat *restrict st, 546 (int fd, char const *restrict name, struct stat *restrict st,
541 int flags) 547 int flags),
542 _GL_ARG_NONNULL ((2, 3))); 548 _GL_ARG_NONNULL ((2, 3)));
543_GL_CXXALIAS_RPL (fstatat, int, 549_GL_CXXALIAS_RPL (fstatat, int,
544 (int fd, char const *restrict name, struct stat *restrict st, 550 (int fd, char const *restrict name, struct stat *restrict st,
@@ -547,7 +553,7 @@ _GL_CXXALIAS_RPL (fstatat, int,
547# if !@HAVE_FSTATAT@ 553# if !@HAVE_FSTATAT@
548_GL_FUNCDECL_SYS (fstatat, int, 554_GL_FUNCDECL_SYS (fstatat, int,
549 (int fd, char const *restrict name, struct stat *restrict st, 555 (int fd, char const *restrict name, struct stat *restrict st,
550 int flags) 556 int flags),
551 _GL_ARG_NONNULL ((2, 3))); 557 _GL_ARG_NONNULL ((2, 3)));
552# endif 558# endif
553_GL_CXXALIAS_SYS (fstatat, int, 559_GL_CXXALIAS_SYS (fstatat, int,
@@ -556,8 +562,10 @@ _GL_CXXALIAS_SYS (fstatat, int,
556# endif 562# endif
557_GL_CXXALIASWARN (fstatat); 563_GL_CXXALIASWARN (fstatat);
558#elif @GNULIB_OVERRIDES_STRUCT_STAT@ 564#elif @GNULIB_OVERRIDES_STRUCT_STAT@
559# undef fstatat 565# if !GNULIB_FSTATAT
560# define fstatat fstatat_used_without_requesting_gnulib_module_fstatat 566# undef fstatat
567# define fstatat fstatat_used_without_requesting_gnulib_module_fstatat
568# endif
561#elif defined GNULIB_POSIXCHECK 569#elif defined GNULIB_POSIXCHECK
562# undef fstatat 570# undef fstatat
563# if HAVE_RAW_DECL_FSTATAT 571# if HAVE_RAW_DECL_FSTATAT
@@ -600,7 +608,7 @@ _GL_WARN_ON_USE (futimens, "futimens is not portable - "
600#if @GNULIB_GETUMASK@ 608#if @GNULIB_GETUMASK@
601# if !@HAVE_GETUMASK@ 609# if !@HAVE_GETUMASK@
602# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 610# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
603_GL_FUNCDECL_SYS (getumask, mode_t, (void) _GL_ATTRIBUTE_NOTHROW); 611_GL_FUNCDECL_SYS (getumask, mode_t, (void)) _GL_ATTRIBUTE_NOTHROW;
604# else 612# else
605_GL_FUNCDECL_SYS (getumask, mode_t, (void)); 613_GL_FUNCDECL_SYS (getumask, mode_t, (void));
606# endif 614# endif
@@ -622,7 +630,7 @@ _GL_WARN_ON_USE (getumask, "getumask is not portable - "
622/* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME 630/* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME
623 denotes a symbolic link. */ 631 denotes a symbolic link. */
624# if !@HAVE_LCHMOD@ || defined __hpux 632# if !@HAVE_LCHMOD@ || defined __hpux
625_GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode) 633_GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode),
626 _GL_ARG_NONNULL ((1))); 634 _GL_ARG_NONNULL ((1)));
627# endif 635# endif
628_GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode)); 636_GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode));
@@ -642,7 +650,7 @@ _GL_WARN_ON_USE (lchmod, "lchmod is unportable - "
642# undef mkdir 650# undef mkdir
643# define mkdir rpl_mkdir 651# define mkdir rpl_mkdir
644# endif 652# endif
645_GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode) 653_GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode),
646 _GL_ARG_NONNULL ((1))); 654 _GL_ARG_NONNULL ((1)));
647_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode)); 655_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
648# elif defined _WIN32 && !defined __CYGWIN__ 656# elif defined _WIN32 && !defined __CYGWIN__
@@ -667,12 +675,6 @@ _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
667_GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode)); 675_GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode));
668# endif 676# endif
669_GL_CXXALIASWARN (mkdir); 677_GL_CXXALIASWARN (mkdir);
670#elif defined GNULIB_POSIXCHECK
671# undef mkdir
672# if HAVE_RAW_DECL_MKDIR
673_GL_WARN_ON_USE (mkdir, "mkdir does not always support two parameters - "
674 "use gnulib module mkdir for portability");
675# endif
676#elif @GNULIB_MDA_MKDIR@ 678#elif @GNULIB_MDA_MKDIR@
677/* On native Windows, map 'mkdir' to '_mkdir', so that -loldnames is not 679/* On native Windows, map 'mkdir' to '_mkdir', so that -loldnames is not
678 required. In C++ with GNULIB_NAMESPACE, avoid differences between 680 required. In C++ with GNULIB_NAMESPACE, avoid differences between
@@ -695,12 +697,18 @@ _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
695_GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode)); 697_GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode));
696# endif 698# endif
697_GL_CXXALIASWARN (mkdir); 699_GL_CXXALIASWARN (mkdir);
700#elif defined GNULIB_POSIXCHECK
701# undef mkdir
702# if HAVE_RAW_DECL_MKDIR
703_GL_WARN_ON_USE (mkdir, "mkdir does not always support two parameters - "
704 "use gnulib module mkdir for portability");
705# endif
698#endif 706#endif
699 707
700 708
701#if @GNULIB_MKDIRAT@ 709#if @GNULIB_MKDIRAT@
702# if !@HAVE_MKDIRAT@ 710# if !@HAVE_MKDIRAT@
703_GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode) 711_GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode),
704 _GL_ARG_NONNULL ((2))); 712 _GL_ARG_NONNULL ((2)));
705# endif 713# endif
706_GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode)); 714_GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode));
@@ -720,12 +728,12 @@ _GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - "
720# undef mkfifo 728# undef mkfifo
721# define mkfifo rpl_mkfifo 729# define mkfifo rpl_mkfifo
722# endif 730# endif
723_GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode) 731_GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode),
724 _GL_ARG_NONNULL ((1))); 732 _GL_ARG_NONNULL ((1)));
725_GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode)); 733_GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode));
726# else 734# else
727# if !@HAVE_MKFIFO@ 735# if !@HAVE_MKFIFO@
728_GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode) 736_GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode),
729 _GL_ARG_NONNULL ((1))); 737 _GL_ARG_NONNULL ((1)));
730# endif 738# endif
731_GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode)); 739_GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode));
@@ -746,12 +754,12 @@ _GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - "
746# undef mkfifoat 754# undef mkfifoat
747# define mkfifoat rpl_mkfifoat 755# define mkfifoat rpl_mkfifoat
748# endif 756# endif
749_GL_FUNCDECL_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode) 757_GL_FUNCDECL_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode),
750 _GL_ARG_NONNULL ((2))); 758 _GL_ARG_NONNULL ((2)));
751_GL_CXXALIAS_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode)); 759_GL_CXXALIAS_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode));
752# else 760# else
753# if !@HAVE_MKFIFOAT@ 761# if !@HAVE_MKFIFOAT@
754_GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode) 762_GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode),
755 _GL_ARG_NONNULL ((2))); 763 _GL_ARG_NONNULL ((2)));
756# endif 764# endif
757_GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)); 765_GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode));
@@ -774,12 +782,12 @@ _GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - "
774# undef mknod 782# undef mknod
775# define mknod rpl_mknod 783# define mknod rpl_mknod
776# endif 784# endif
777_GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev) 785_GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev),
778 _GL_ARG_NONNULL ((1))); 786 _GL_ARG_NONNULL ((1)));
779_GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev)); 787_GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev));
780# else 788# else
781# if !@HAVE_MKNOD@ 789# if !@HAVE_MKNOD@
782_GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev) 790_GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev),
783 _GL_ARG_NONNULL ((1))); 791 _GL_ARG_NONNULL ((1)));
784# endif 792# endif
785/* Need to cast, because on OSF/1 5.1, the third parameter is '...'. */ 793/* Need to cast, because on OSF/1 5.1, the third parameter is '...'. */
@@ -802,14 +810,14 @@ _GL_WARN_ON_USE (mknod, "mknod is not portable - "
802# define mknodat rpl_mknodat 810# define mknodat rpl_mknodat
803# endif 811# endif
804_GL_FUNCDECL_RPL (mknodat, int, 812_GL_FUNCDECL_RPL (mknodat, int,
805 (int fd, char const *file, mode_t mode, dev_t dev) 813 (int fd, char const *file, mode_t mode, dev_t dev),
806 _GL_ARG_NONNULL ((2))); 814 _GL_ARG_NONNULL ((2)));
807_GL_CXXALIAS_RPL (mknodat, int, 815_GL_CXXALIAS_RPL (mknodat, int,
808 (int fd, char const *file, mode_t mode, dev_t dev)); 816 (int fd, char const *file, mode_t mode, dev_t dev));
809# else 817# else
810# if !@HAVE_MKNODAT@ 818# if !@HAVE_MKNODAT@
811_GL_FUNCDECL_SYS (mknodat, int, 819_GL_FUNCDECL_SYS (mknodat, int,
812 (int fd, char const *file, mode_t mode, dev_t dev) 820 (int fd, char const *file, mode_t mode, dev_t dev),
813 _GL_ARG_NONNULL ((2))); 821 _GL_ARG_NONNULL ((2)));
814# endif 822# endif
815_GL_CXXALIAS_SYS (mknodat, int, 823_GL_CXXALIAS_SYS (mknodat, int,
@@ -916,7 +924,7 @@ _GL_CXXALIAS_RPL_1 (lstat, stat, int,
916# define lstat rpl_lstat 924# define lstat rpl_lstat
917# endif 925# endif
918_GL_FUNCDECL_RPL (lstat, int, 926_GL_FUNCDECL_RPL (lstat, int,
919 (const char *restrict name, struct stat *restrict buf) 927 (const char *restrict name, struct stat *restrict buf),
920 _GL_ARG_NONNULL ((1, 2))); 928 _GL_ARG_NONNULL ((1, 2)));
921_GL_CXXALIAS_RPL (lstat, int, 929_GL_CXXALIAS_RPL (lstat, int,
922 (const char *restrict name, struct stat *restrict buf)); 930 (const char *restrict name, struct stat *restrict buf));
@@ -928,8 +936,10 @@ _GL_CXXALIAS_SYS (lstat, int,
928_GL_CXXALIASWARN (lstat); 936_GL_CXXALIASWARN (lstat);
929# endif 937# endif
930#elif @GNULIB_OVERRIDES_STRUCT_STAT@ 938#elif @GNULIB_OVERRIDES_STRUCT_STAT@
931# undef lstat 939# if !GNULIB_LSTAT
932# define lstat lstat_used_without_requesting_gnulib_module_lstat 940# undef lstat
941# define lstat lstat_used_without_requesting_gnulib_module_lstat
942# endif
933#elif defined GNULIB_POSIXCHECK 943#elif defined GNULIB_POSIXCHECK
934# undef lstat 944# undef lstat
935# if HAVE_RAW_DECL_LSTAT 945# if HAVE_RAW_DECL_LSTAT
@@ -968,14 +978,14 @@ _GL_CXXALIASWARN (umask);
968# define utimensat rpl_utimensat 978# define utimensat rpl_utimensat
969# endif 979# endif
970_GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name, 980_GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name,
971 struct timespec const times[2], int flag) 981 struct timespec const times[2], int flag),
972 _GL_ARG_NONNULL ((2))); 982 _GL_ARG_NONNULL ((2)));
973_GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name, 983_GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name,
974 struct timespec const times[2], int flag)); 984 struct timespec const times[2], int flag));
975# else 985# else
976# if !@HAVE_UTIMENSAT@ 986# if !@HAVE_UTIMENSAT@
977_GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name, 987_GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name,
978 struct timespec const times[2], int flag) 988 struct timespec const times[2], int flag),
979 _GL_ARG_NONNULL ((2))); 989 _GL_ARG_NONNULL ((2)));
980# endif 990# endif
981_GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name, 991_GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name,
diff --git a/lib/sys_time.in.h b/lib/sys_time.in.h
index 4a301c48ba1..88e912e60e5 100644
--- a/lib/sys_time.in.h
+++ b/lib/sys_time.in.h
@@ -105,14 +105,14 @@ struct timeval
105# define gettimeofday rpl_gettimeofday 105# define gettimeofday rpl_gettimeofday
106# endif 106# endif
107_GL_FUNCDECL_RPL (gettimeofday, int, 107_GL_FUNCDECL_RPL (gettimeofday, int,
108 (struct timeval *restrict, void *restrict) 108 (struct timeval *restrict, void *restrict),
109 _GL_ARG_NONNULL ((1))); 109 _GL_ARG_NONNULL ((1)));
110_GL_CXXALIAS_RPL (gettimeofday, int, 110_GL_CXXALIAS_RPL (gettimeofday, int,
111 (struct timeval *restrict, void *restrict)); 111 (struct timeval *restrict, void *restrict));
112# else 112# else
113# if !@HAVE_GETTIMEOFDAY@ 113# if !@HAVE_GETTIMEOFDAY@
114_GL_FUNCDECL_SYS (gettimeofday, int, 114_GL_FUNCDECL_SYS (gettimeofday, int,
115 (struct timeval *restrict, void *restrict) 115 (struct timeval *restrict, void *restrict),
116 _GL_ARG_NONNULL ((1))); 116 _GL_ARG_NONNULL ((1)));
117# endif 117# endif
118/* Need to cast, because on glibc systems, by default, the second argument is 118/* Need to cast, because on glibc systems, by default, the second argument is
diff --git a/lib/time.in.h b/lib/time.in.h
index b91018937ad..097c509d3cc 100644
--- a/lib/time.in.h
+++ b/lib/time.in.h
@@ -147,12 +147,12 @@ extern
147# undef timespec_get 147# undef timespec_get
148# define timespec_get rpl_timespec_get 148# define timespec_get rpl_timespec_get
149# endif 149# endif
150_GL_FUNCDECL_RPL (timespec_get, int, (struct timespec *ts, int base) 150_GL_FUNCDECL_RPL (timespec_get, int, (struct timespec *ts, int base),
151 _GL_ARG_NONNULL ((1))); 151 _GL_ARG_NONNULL ((1)));
152_GL_CXXALIAS_RPL (timespec_get, int, (struct timespec *ts, int base)); 152_GL_CXXALIAS_RPL (timespec_get, int, (struct timespec *ts, int base));
153# else 153# else
154# if !@HAVE_TIMESPEC_GET@ 154# if !@HAVE_TIMESPEC_GET@
155_GL_FUNCDECL_SYS (timespec_get, int, (struct timespec *ts, int base) 155_GL_FUNCDECL_SYS (timespec_get, int, (struct timespec *ts, int base),
156 _GL_ARG_NONNULL ((1))); 156 _GL_ARG_NONNULL ((1)));
157# endif 157# endif
158_GL_CXXALIAS_SYS (timespec_get, int, (struct timespec *ts, int base)); 158_GL_CXXALIAS_SYS (timespec_get, int, (struct timespec *ts, int base));
@@ -176,12 +176,12 @@ _GL_WARN_ON_USE (timespec_get, "timespec_get is unportable - "
176# undef timespec_getres 176# undef timespec_getres
177# define timespec_getres rpl_timespec_getres 177# define timespec_getres rpl_timespec_getres
178# endif 178# endif
179_GL_FUNCDECL_RPL (timespec_getres, int, (struct timespec *ts, int base) 179_GL_FUNCDECL_RPL (timespec_getres, int, (struct timespec *ts, int base),
180 _GL_ARG_NONNULL ((1))); 180 _GL_ARG_NONNULL ((1)));
181_GL_CXXALIAS_RPL (timespec_getres, int, (struct timespec *ts, int base)); 181_GL_CXXALIAS_RPL (timespec_getres, int, (struct timespec *ts, int base));
182# else 182# else
183# if !@HAVE_TIMESPEC_GETRES@ 183# if !@HAVE_TIMESPEC_GETRES@
184_GL_FUNCDECL_SYS (timespec_getres, int, (struct timespec *ts, int base) 184_GL_FUNCDECL_SYS (timespec_getres, int, (struct timespec *ts, int base),
185 _GL_ARG_NONNULL ((1))); 185 _GL_ARG_NONNULL ((1)));
186# endif 186# endif
187_GL_CXXALIAS_SYS (timespec_getres, int, (struct timespec *ts, int base)); 187_GL_CXXALIAS_SYS (timespec_getres, int, (struct timespec *ts, int base));
@@ -226,14 +226,14 @@ _GL_WARN_ON_USE (time, "time has consistency problems - "
226# define nanosleep rpl_nanosleep 226# define nanosleep rpl_nanosleep
227# endif 227# endif
228_GL_FUNCDECL_RPL (nanosleep, int, 228_GL_FUNCDECL_RPL (nanosleep, int,
229 (struct timespec const *__rqtp, struct timespec *__rmtp) 229 (struct timespec const *__rqtp, struct timespec *__rmtp),
230 _GL_ARG_NONNULL ((1))); 230 _GL_ARG_NONNULL ((1)));
231_GL_CXXALIAS_RPL (nanosleep, int, 231_GL_CXXALIAS_RPL (nanosleep, int,
232 (struct timespec const *__rqtp, struct timespec *__rmtp)); 232 (struct timespec const *__rqtp, struct timespec *__rmtp));
233# else 233# else
234# if ! @HAVE_NANOSLEEP@ 234# if ! @HAVE_NANOSLEEP@
235_GL_FUNCDECL_SYS (nanosleep, int, 235_GL_FUNCDECL_SYS (nanosleep, int,
236 (struct timespec const *__rqtp, struct timespec *__rmtp) 236 (struct timespec const *__rqtp, struct timespec *__rmtp),
237 _GL_ARG_NONNULL ((1))); 237 _GL_ARG_NONNULL ((1)));
238# endif 238# endif
239_GL_CXXALIAS_SYS (nanosleep, int, 239_GL_CXXALIAS_SYS (nanosleep, int,
@@ -295,7 +295,7 @@ _GL_WARN_ON_USE (tzset, "tzset has portability problems - "
295# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 295# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
296# define mktime rpl_mktime 296# define mktime rpl_mktime
297# endif 297# endif
298_GL_FUNCDECL_RPL (mktime, time_t, (struct tm *__tp) _GL_ARG_NONNULL ((1))); 298_GL_FUNCDECL_RPL (mktime, time_t, (struct tm *__tp), _GL_ARG_NONNULL ((1)));
299_GL_CXXALIAS_RPL (mktime, time_t, (struct tm *__tp)); 299_GL_CXXALIAS_RPL (mktime, time_t, (struct tm *__tp));
300# else 300# else
301_GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp)); 301_GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp));
@@ -321,14 +321,14 @@ _GL_WARN_ON_USE (mktime, "mktime has portability problems - "
321# define localtime_r rpl_localtime_r 321# define localtime_r rpl_localtime_r
322# endif 322# endif
323_GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer, 323_GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
324 struct tm *restrict __result) 324 struct tm *restrict __result),
325 _GL_ARG_NONNULL ((1, 2))); 325 _GL_ARG_NONNULL ((1, 2)));
326_GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer, 326_GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
327 struct tm *restrict __result)); 327 struct tm *restrict __result));
328# else 328# else
329# if ! @HAVE_DECL_LOCALTIME_R@ 329# if ! @HAVE_DECL_LOCALTIME_R@
330_GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer, 330_GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
331 struct tm *restrict __result) 331 struct tm *restrict __result),
332 _GL_ARG_NONNULL ((1, 2))); 332 _GL_ARG_NONNULL ((1, 2)));
333# endif 333# endif
334_GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer, 334_GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
@@ -343,14 +343,14 @@ _GL_CXXALIASWARN (localtime_r);
343# define gmtime_r rpl_gmtime_r 343# define gmtime_r rpl_gmtime_r
344# endif 344# endif
345_GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer, 345_GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
346 struct tm *restrict __result) 346 struct tm *restrict __result),
347 _GL_ARG_NONNULL ((1, 2))); 347 _GL_ARG_NONNULL ((1, 2)));
348_GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer, 348_GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
349 struct tm *restrict __result)); 349 struct tm *restrict __result));
350# else 350# else
351# if ! @HAVE_DECL_LOCALTIME_R@ 351# if ! @HAVE_DECL_LOCALTIME_R@
352_GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, 352_GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
353 struct tm *restrict __result) 353 struct tm *restrict __result),
354 _GL_ARG_NONNULL ((1, 2))); 354 _GL_ARG_NONNULL ((1, 2)));
355# endif 355# endif
356_GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, 356_GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
@@ -381,7 +381,7 @@ _GL_WARN_ON_USE (gmtime_r, "gmtime_r is unportable - "
381# undef localtime 381# undef localtime
382# define localtime rpl_localtime 382# define localtime rpl_localtime
383# endif 383# endif
384_GL_FUNCDECL_RPL (localtime, struct tm *, (time_t const *__timer) 384_GL_FUNCDECL_RPL (localtime, struct tm *, (time_t const *__timer),
385 _GL_ARG_NONNULL ((1))); 385 _GL_ARG_NONNULL ((1)));
386_GL_CXXALIAS_RPL (localtime, struct tm *, (time_t const *__timer)); 386_GL_CXXALIAS_RPL (localtime, struct tm *, (time_t const *__timer));
387# else 387# else
@@ -404,7 +404,7 @@ _GL_WARN_ON_USE (localtime, "localtime has portability problems - "
404# undef gmtime 404# undef gmtime
405# define gmtime rpl_gmtime 405# define gmtime rpl_gmtime
406# endif 406# endif
407_GL_FUNCDECL_RPL (gmtime, struct tm *, (time_t const *__timer) 407_GL_FUNCDECL_RPL (gmtime, struct tm *, (time_t const *__timer),
408 _GL_ARG_NONNULL ((1))); 408 _GL_ARG_NONNULL ((1)));
409_GL_CXXALIAS_RPL (gmtime, struct tm *, (time_t const *__timer)); 409_GL_CXXALIAS_RPL (gmtime, struct tm *, (time_t const *__timer));
410# else 410# else
@@ -420,7 +420,7 @@ _GL_CXXALIASWARN (gmtime);
420# if ! @HAVE_STRPTIME@ 420# if ! @HAVE_STRPTIME@
421_GL_FUNCDECL_SYS (strptime, char *, (char const *restrict __buf, 421_GL_FUNCDECL_SYS (strptime, char *, (char const *restrict __buf,
422 char const *restrict __format, 422 char const *restrict __format,
423 struct tm *restrict __tm) 423 struct tm *restrict __tm),
424 _GL_ARG_NONNULL ((1, 2, 3))); 424 _GL_ARG_NONNULL ((1, 2, 3)));
425# endif 425# endif
426_GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf, 426_GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf,
@@ -445,7 +445,7 @@ _GL_WARN_ON_USE (strptime, "strptime is unportable - "
445# ifndef __cplusplus 445# ifndef __cplusplus
446_GL_ATTRIBUTE_DEPRECATED 446_GL_ATTRIBUTE_DEPRECATED
447# endif 447# endif
448_GL_FUNCDECL_RPL (ctime, char *, (time_t const *__tp) 448_GL_FUNCDECL_RPL (ctime, char *, (time_t const *__tp),
449 _GL_ARG_NONNULL ((1))); 449 _GL_ARG_NONNULL ((1)));
450_GL_CXXALIAS_RPL (ctime, char *, (time_t const *__tp)); 450_GL_CXXALIAS_RPL (ctime, char *, (time_t const *__tp));
451# else 451# else
@@ -467,7 +467,7 @@ _GL_CXXALIASWARN (ctime);
467# endif 467# endif
468_GL_FUNCDECL_RPL (strftime, size_t, 468_GL_FUNCDECL_RPL (strftime, size_t,
469 (char *restrict __buf, size_t __bufsize, 469 (char *restrict __buf, size_t __bufsize,
470 const char *restrict __fmt, const struct tm *restrict __tp) 470 const char *restrict __fmt, const struct tm *restrict __tp),
471 _GL_ARG_NONNULL ((1, 3, 4))); 471 _GL_ARG_NONNULL ((1, 3, 4)));
472_GL_CXXALIAS_RPL (strftime, size_t, 472_GL_CXXALIAS_RPL (strftime, size_t,
473 (char *restrict __buf, size_t __bufsize, 473 (char *restrict __buf, size_t __bufsize,
@@ -488,14 +488,24 @@ _GL_WARN_ON_USE (strftime, "strftime has portability problems - "
488# endif 488# endif
489# endif 489# endif
490 490
491# if defined _GNU_SOURCE && @GNULIB_TIME_RZ@ && ! @HAVE_TIMEZONE_T@ 491# if @GNULIB_TIME_RZ@
492/* Functions that use a first-class time zone data type, instead of 492/* Functions that use a first-class time zone data type, instead of
493 relying on an implicit global time zone. 493 relying on an implicit global time zone.
494 Inspired by NetBSD. */ 494 Inspired by NetBSD. */
495 495
496/* Represents a time zone. 496/* Represents a time zone.
497 (timezone_t) NULL stands for UTC. */ 497 (timezone_t) NULL stands for UTC. */
498# if !@HAVE_TZALLOC@
499# if !GNULIB_defined_timezone_t
500# if !@HAVE_TIMEZONE_T@
498typedef struct tm_zone *timezone_t; 501typedef struct tm_zone *timezone_t;
502# else
503typedef struct tm_zone *rpl_timezone_t;
504# define timezone_t rpl_timezone_t
505# endif
506# define GNULIB_defined_timezone_t 1
507# endif
508# endif
499 509
500/* tzalloc (name) 510/* tzalloc (name)
501 Returns a time zone object for the given time zone NAME. This object 511 Returns a time zone object for the given time zone NAME. This object
@@ -505,37 +515,72 @@ typedef struct tm_zone *timezone_t;
505 would use it the TZ environment variable was unset. 515 would use it the TZ environment variable was unset.
506 May return NULL if NAME is invalid (this is platform dependent) or 516 May return NULL if NAME is invalid (this is platform dependent) or
507 upon memory allocation failure. */ 517 upon memory allocation failure. */
518# if !@HAVE_TZALLOC@
508_GL_FUNCDECL_SYS (tzalloc, timezone_t, (char const *__name)); 519_GL_FUNCDECL_SYS (tzalloc, timezone_t, (char const *__name));
509_GL_CXXALIAS_SYS (tzalloc, timezone_t, (char const *__name)); 520_GL_CXXALIAS_SYS (tzalloc, timezone_t, (char const *__name));
521# endif
510 522
511/* tzfree (tz) 523/* tzfree (tz)
512 Frees a time zone object. 524 Frees a time zone object.
513 The argument must have been returned by tzalloc(). */ 525 The argument must have been returned by tzalloc(). */
526# if !@HAVE_TZALLOC@
514_GL_FUNCDECL_SYS (tzfree, void, (timezone_t __tz)); 527_GL_FUNCDECL_SYS (tzfree, void, (timezone_t __tz));
515_GL_CXXALIAS_SYS (tzfree, void, (timezone_t __tz)); 528_GL_CXXALIAS_SYS (tzfree, void, (timezone_t __tz));
529# endif
516 530
517/* localtime_rz (tz, &t, &result) 531/* localtime_rz (tz, &t, &result)
518 Converts an absolute time T to a broken-down time RESULT, assuming the 532 Converts an absolute time T to a broken-down time RESULT, assuming the
519 time zone TZ. 533 time zone TZ.
520 This function is like 'localtime_r', but relies on the argument TZ instead 534 This function is like 'localtime_r', but relies on the argument TZ instead
521 of an implicit global time zone. */ 535 of an implicit global time zone. */
536# if @REPLACE_LOCALTIME_RZ@
537# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
538# undef localtime_rz
539# define localtime_rz rpl_localtime_rz
540# endif
541_GL_FUNCDECL_RPL (localtime_rz, struct tm *,
542 (timezone_t __tz, time_t const *restrict __timer,
543 struct tm *restrict __result),
544 _GL_ARG_NONNULL ((2, 3)));
545_GL_CXXALIAS_RPL (localtime_rz, struct tm *,
546 (timezone_t __tz, time_t const *restrict __timer,
547 struct tm *restrict __result));
548# else
549# if !@HAVE_TZALLOC@
522_GL_FUNCDECL_SYS (localtime_rz, struct tm *, 550_GL_FUNCDECL_SYS (localtime_rz, struct tm *,
523 (timezone_t __tz, time_t const *restrict __timer, 551 (timezone_t __tz, time_t const *restrict __timer,
524 struct tm *restrict __result) _GL_ARG_NONNULL ((2, 3))); 552 struct tm *restrict __result),
553 _GL_ARG_NONNULL ((2, 3)));
554# endif
525_GL_CXXALIAS_SYS (localtime_rz, struct tm *, 555_GL_CXXALIAS_SYS (localtime_rz, struct tm *,
526 (timezone_t __tz, time_t const *restrict __timer, 556 (timezone_t __tz, time_t const *restrict __timer,
527 struct tm *restrict __result)); 557 struct tm *restrict __result));
558# endif
528 559
529/* mktime_z (tz, &tm) 560/* mktime_z (tz, &tm)
530 Normalizes the broken-down time TM and converts it to an absolute time, 561 Normalizes the broken-down time TM and converts it to an absolute time,
531 assuming the time zone TZ. Returns the absolute time. 562 assuming the time zone TZ. Returns the absolute time.
532 This function is like 'mktime', but relies on the argument TZ instead 563 This function is like 'mktime', but relies on the argument TZ instead
533 of an implicit global time zone. */ 564 of an implicit global time zone. */
565# if @REPLACE_MKTIME_Z@
566# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
567# undef mktime_z
568# define mktime_z rpl_mktime_z
569# endif
570_GL_FUNCDECL_RPL (mktime_z, time_t,
571 (timezone_t __tz, struct tm *restrict __tm),
572 _GL_ARG_NONNULL ((2)));
573_GL_CXXALIAS_RPL (mktime_z, time_t,
574 (timezone_t __tz, struct tm *restrict __tm));
575# else
576# if !@HAVE_TZALLOC@
534_GL_FUNCDECL_SYS (mktime_z, time_t, 577_GL_FUNCDECL_SYS (mktime_z, time_t,
535 (timezone_t __tz, struct tm *restrict __tm) 578 (timezone_t __tz, struct tm *restrict __tm),
536 _GL_ARG_NONNULL ((2))); 579 _GL_ARG_NONNULL ((2)));
580# endif
537_GL_CXXALIAS_SYS (mktime_z, time_t, 581_GL_CXXALIAS_SYS (mktime_z, time_t,
538 (timezone_t __tz, struct tm *restrict __tm)); 582 (timezone_t __tz, struct tm *restrict __tm));
583# endif
539 584
540/* Time zone abbreviation strings (returned by 'localtime_rz' or 'mktime_z' 585/* Time zone abbreviation strings (returned by 'localtime_rz' or 'mktime_z'
541 in the 'tm_zone' member of 'struct tm') are valid as long as 586 in the 'tm_zone' member of 'struct tm') are valid as long as
@@ -552,11 +597,11 @@ _GL_CXXALIAS_SYS (mktime_z, time_t,
552# undef timegm 597# undef timegm
553# define timegm rpl_timegm 598# define timegm rpl_timegm
554# endif 599# endif
555_GL_FUNCDECL_RPL (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1))); 600_GL_FUNCDECL_RPL (timegm, time_t, (struct tm *__tm), _GL_ARG_NONNULL ((1)));
556_GL_CXXALIAS_RPL (timegm, time_t, (struct tm *__tm)); 601_GL_CXXALIAS_RPL (timegm, time_t, (struct tm *__tm));
557# else 602# else
558# if ! @HAVE_TIMEGM@ 603# if ! @HAVE_TIMEGM@
559_GL_FUNCDECL_SYS (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1))); 604_GL_FUNCDECL_SYS (timegm, time_t, (struct tm *__tm), _GL_ARG_NONNULL ((1)));
560# endif 605# endif
561_GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm)); 606_GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm));
562# endif 607# endif
diff --git a/lib/time_rz.c b/lib/time_rz.c
index a6523e1285b..14f43fd67a9 100644
--- a/lib/time_rz.c
+++ b/lib/time_rz.c
@@ -24,16 +24,41 @@
24 24
25#include <config.h> 25#include <config.h>
26 26
27/* Specification. */
27#include <time.h> 28#include <time.h>
28 29
29#include <errno.h> 30#if NEED_TIMEZONE_NULL_SUPPORT /* Android API level >= 35 */
30#include <stddef.h>
31#include <stdlib.h>
32#include <string.h>
33 31
34#include "flexmember.h" 32struct tm *
35#include "idx.h" 33localtime_rz (timezone_t tz, time_t const *t, struct tm *tm)
36#include "time-internal.h" 34# undef localtime_rz
35{
36 if (!tz)
37 return gmtime_r (t, tm);
38 else
39 return localtime_rz (tz, t, tm);
40}
41
42time_t
43mktime_z (timezone_t tz, struct tm *tm)
44# undef mktime_z
45{
46 if (!tz)
47 return timegm (tm);
48 else
49 return mktime_z (tz, tm);
50}
51
52#else
53
54# include <errno.h>
55# include <stddef.h>
56# include <stdlib.h>
57# include <string.h>
58
59# include "flexmember.h"
60# include "idx.h"
61# include "time-internal.h"
37 62
38/* The approximate size to use for small allocation requests. This is 63/* The approximate size to use for small allocation requests. This is
39 the largest "small" request for the GNU C library malloc. */ 64 the largest "small" request for the GNU C library malloc. */
@@ -79,7 +104,7 @@ tzalloc (char const *name)
79static bool 104static bool
80save_abbr (timezone_t tz, struct tm *tm) 105save_abbr (timezone_t tz, struct tm *tm)
81{ 106{
82#if HAVE_STRUCT_TM_TM_ZONE 107# if HAVE_STRUCT_TM_TM_ZONE
83 char const *zone = tm->tm_zone; 108 char const *zone = tm->tm_zone;
84 char *zone_copy = (char *) ""; 109 char *zone_copy = (char *) "";
85 110
@@ -120,7 +145,7 @@ save_abbr (timezone_t tz, struct tm *tm)
120 145
121 /* Replace the zone name so that its lifetime matches that of TZ. */ 146 /* Replace the zone name so that its lifetime matches that of TZ. */
122 tm->tm_zone = zone_copy; 147 tm->tm_zone = zone_copy;
123#endif 148# endif
124 149
125 return true; 150 return true;
126} 151}
@@ -141,21 +166,21 @@ tzfree (timezone_t tz)
141/* Get and set the TZ environment variable. These functions can be 166/* Get and set the TZ environment variable. These functions can be
142 overridden by programs like Emacs that manage their own environment. */ 167 overridden by programs like Emacs that manage their own environment. */
143 168
144#ifndef getenv_TZ 169# ifndef getenv_TZ
145static char * 170static char *
146getenv_TZ (void) 171getenv_TZ (void)
147{ 172{
148 return getenv ("TZ"); 173 return getenv ("TZ");
149} 174}
150#endif 175# endif
151 176
152#ifndef setenv_TZ 177# ifndef setenv_TZ
153static int 178static int
154setenv_TZ (char const *tz) 179setenv_TZ (char const *tz)
155{ 180{
156 return tz ? setenv ("TZ", tz, 1) : unsetenv ("TZ"); 181 return tz ? setenv ("TZ", tz, 1) : unsetenv ("TZ");
157} 182}
158#endif 183# endif
159 184
160/* Change the environment to match the specified timezone_t value. 185/* Change the environment to match the specified timezone_t value.
161 Return true if successful, false (setting errno) otherwise. */ 186 Return true if successful, false (setting errno) otherwise. */
@@ -220,7 +245,7 @@ revert_tz (timezone_t tz)
220struct tm * 245struct tm *
221localtime_rz (timezone_t tz, time_t const *t, struct tm *tm) 246localtime_rz (timezone_t tz, time_t const *t, struct tm *tm)
222{ 247{
223#ifdef HAVE_LOCALTIME_INFLOOP_BUG 248# ifdef HAVE_LOCALTIME_INFLOOP_BUG
224 /* The -67768038400665599 comes from: 249 /* The -67768038400665599 comes from:
225 https://lists.gnu.org/r/bug-gnulib/2017-07/msg00142.html 250 https://lists.gnu.org/r/bug-gnulib/2017-07/msg00142.html
226 On affected platforms the greatest POSIX-compatible time_t value 251 On affected platforms the greatest POSIX-compatible time_t value
@@ -233,7 +258,7 @@ localtime_rz (timezone_t tz, time_t const *t, struct tm *tm)
233 errno = EOVERFLOW; 258 errno = EOVERFLOW;
234 return NULL; 259 return NULL;
235 } 260 }
236#endif 261# endif
237 262
238 if (!tz) 263 if (!tz)
239 return gmtime_r (t, tm); 264 return gmtime_r (t, tm);
@@ -282,3 +307,5 @@ mktime_z (timezone_t tz, struct tm *tm)
282 return -1; 307 return -1;
283 } 308 }
284} 309}
310
311#endif
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index e01629af259..3222f5a568f 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -69,8 +69,8 @@
69#if !defined _@GUARD_PREFIX@_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H 69#if !defined _@GUARD_PREFIX@_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H
70#define _@GUARD_PREFIX@_UNISTD_H 70#define _@GUARD_PREFIX@_UNISTD_H
71 71
72/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, GNULIB_POSIXCHECK, 72/* This file uses _GL_ATTRIBUTE_NODISCARD, _GL_INLINE_HEADER_BEGIN, _GL_INLINE,
73 HAVE_RAW_DECL_*. */ 73 GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
74#if !_GL_CONFIG_H_INCLUDED 74#if !_GL_CONFIG_H_INCLUDED
75 #error "Please include config.h first." 75 #error "Please include config.h first."
76#endif 76#endif
@@ -287,7 +287,7 @@ _GL_INLINE_HEADER_BEGIN
287# undef access 287# undef access
288# define access rpl_access 288# define access rpl_access
289# endif 289# endif
290_GL_FUNCDECL_RPL (access, int, (const char *file, int mode) 290_GL_FUNCDECL_RPL (access, int, (const char *file, int mode),
291 _GL_ARG_NONNULL ((1))); 291 _GL_ARG_NONNULL ((1)));
292_GL_CXXALIAS_RPL (access, int, (const char *file, int mode)); 292_GL_CXXALIAS_RPL (access, int, (const char *file, int mode));
293# elif defined _WIN32 && !defined __CYGWIN__ 293# elif defined _WIN32 && !defined __CYGWIN__
@@ -340,7 +340,7 @@ _GL_CXXALIASWARN (chdir);
340#elif defined GNULIB_POSIXCHECK 340#elif defined GNULIB_POSIXCHECK
341# undef chdir 341# undef chdir
342# if HAVE_RAW_DECL_CHDIR 342# if HAVE_RAW_DECL_CHDIR
343_GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - " 343_GL_WARN_ON_USE (chdir, "chdir is not always in <unistd.h> - "
344 "use gnulib module chdir for portability"); 344 "use gnulib module chdir for portability");
345# endif 345# endif
346#elif @GNULIB_MDA_CHDIR@ 346#elif @GNULIB_MDA_CHDIR@
@@ -371,13 +371,13 @@ _GL_CXXALIASWARN (chdir);
371# undef chown 371# undef chown
372# define chown rpl_chown 372# define chown rpl_chown
373# endif 373# endif
374_GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid) 374_GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid),
375 _GL_ARG_NONNULL ((1))); 375 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
376_GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid)); 376_GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid));
377# else 377# else
378# if !@HAVE_CHOWN@ 378# if !@HAVE_CHOWN@
379_GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid) 379_GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid),
380 _GL_ARG_NONNULL ((1))); 380 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
381# endif 381# endif
382_GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid)); 382_GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid));
383# endif 383# endif
@@ -412,8 +412,10 @@ _GL_CXXALIAS_SYS (close, int, (int fd));
412# endif 412# endif
413_GL_CXXALIASWARN (close); 413_GL_CXXALIASWARN (close);
414#elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ 414#elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
415# undef close 415# if !GNULIB_CLOSE
416# define close close_used_without_requesting_gnulib_module_close 416# undef close
417# define close close_used_without_requesting_gnulib_module_close
418# endif
417#elif defined GNULIB_POSIXCHECK 419#elif defined GNULIB_POSIXCHECK
418# undef close 420# undef close
419/* Assume close is always declared. */ 421/* Assume close is always declared. */
@@ -474,7 +476,7 @@ _GL_WARN_ON_USE (copy_file_range,
474# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 476# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
475# define dup rpl_dup 477# define dup rpl_dup
476# endif 478# endif
477_GL_FUNCDECL_RPL (dup, int, (int oldfd)); 479_GL_FUNCDECL_RPL (dup, int, (int oldfd), _GL_ATTRIBUTE_NODISCARD);
478_GL_CXXALIAS_RPL (dup, int, (int oldfd)); 480_GL_CXXALIAS_RPL (dup, int, (int oldfd));
479# elif defined _WIN32 && !defined __CYGWIN__ 481# elif defined _WIN32 && !defined __CYGWIN__
480# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 482# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -637,7 +639,7 @@ rpl_environ (void)
637/* Like access(), except that it uses the effective user id and group id of 639/* Like access(), except that it uses the effective user id and group id of
638 the current process. */ 640 the current process. */
639# if !@HAVE_EUIDACCESS@ 641# if !@HAVE_EUIDACCESS@
640_GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode) 642_GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode),
641 _GL_ARG_NONNULL ((1))); 643 _GL_ARG_NONNULL ((1)));
642# endif 644# endif
643_GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode)); 645_GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode));
@@ -662,7 +664,7 @@ _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
662# undef execl 664# undef execl
663# define execl rpl_execl 665# define execl rpl_execl
664# endif 666# endif
665_GL_FUNCDECL_RPL (execl, int, (const char *program, const char *arg, ...) 667_GL_FUNCDECL_RPL (execl, int, (const char *program, const char *arg, ...),
666 _GL_ARG_NONNULL ((1))); 668 _GL_ARG_NONNULL ((1)));
667_GL_CXXALIAS_RPL (execl, int, (const char *program, const char *arg, ...)); 669_GL_CXXALIAS_RPL (execl, int, (const char *program, const char *arg, ...));
668# else 670# else
@@ -697,7 +699,7 @@ _GL_CXXALIASWARN (execl);
697# undef execle 699# undef execle
698# define execle rpl_execle 700# define execle rpl_execle
699# endif 701# endif
700_GL_FUNCDECL_RPL (execle, int, (const char *program, const char *arg, ...) 702_GL_FUNCDECL_RPL (execle, int, (const char *program, const char *arg, ...),
701 _GL_ARG_NONNULL ((1))); 703 _GL_ARG_NONNULL ((1)));
702_GL_CXXALIAS_RPL (execle, int, (const char *program, const char *arg, ...)); 704_GL_CXXALIAS_RPL (execle, int, (const char *program, const char *arg, ...));
703# else 705# else
@@ -733,7 +735,7 @@ _GL_CXXALIASWARN (execle);
733# undef execlp 735# undef execlp
734# define execlp rpl_execlp 736# define execlp rpl_execlp
735# endif 737# endif
736_GL_FUNCDECL_RPL (execlp, int, (const char *program, const char *arg, ...) 738_GL_FUNCDECL_RPL (execlp, int, (const char *program, const char *arg, ...),
737 _GL_ARG_NONNULL ((1))); 739 _GL_ARG_NONNULL ((1)));
738_GL_CXXALIAS_RPL (execlp, int, (const char *program, const char *arg, ...)); 740_GL_CXXALIAS_RPL (execlp, int, (const char *program, const char *arg, ...));
739# else 741# else
@@ -770,7 +772,7 @@ _GL_CXXALIASWARN (execlp);
770# undef execv 772# undef execv
771# define execv rpl_execv 773# define execv rpl_execv
772# endif 774# endif
773_GL_FUNCDECL_RPL (execv, int, (const char *program, char * const *argv) 775_GL_FUNCDECL_RPL (execv, int, (const char *program, char * const *argv),
774 _GL_ARG_NONNULL ((1, 2))); 776 _GL_ARG_NONNULL ((1, 2)));
775_GL_CXXALIAS_RPL (execv, int, (const char *program, char * const *argv)); 777_GL_CXXALIAS_RPL (execv, int, (const char *program, char * const *argv));
776# else 778# else
@@ -807,7 +809,7 @@ _GL_CXXALIASWARN (execv);
807# define execve rpl_execve 809# define execve rpl_execve
808# endif 810# endif
809_GL_FUNCDECL_RPL (execve, int, 811_GL_FUNCDECL_RPL (execve, int,
810 (const char *program, char * const *argv, char * const *env) 812 (const char *program, char * const *argv, char * const *env),
811 _GL_ARG_NONNULL ((1, 2))); 813 _GL_ARG_NONNULL ((1, 2)));
812_GL_CXXALIAS_RPL (execve, int, 814_GL_CXXALIAS_RPL (execve, int,
813 (const char *program, char * const *argv, char * const *env)); 815 (const char *program, char * const *argv, char * const *env));
@@ -847,7 +849,7 @@ _GL_CXXALIASWARN (execve);
847# undef execvp 849# undef execvp
848# define execvp rpl_execvp 850# define execvp rpl_execvp
849# endif 851# endif
850_GL_FUNCDECL_RPL (execvp, int, (const char *program, char * const *argv) 852_GL_FUNCDECL_RPL (execvp, int, (const char *program, char * const *argv),
851 _GL_ARG_NONNULL ((1, 2))); 853 _GL_ARG_NONNULL ((1, 2)));
852_GL_CXXALIAS_RPL (execvp, int, (const char *program, char * const *argv)); 854_GL_CXXALIAS_RPL (execvp, int, (const char *program, char * const *argv));
853# else 855# else
@@ -884,14 +886,14 @@ _GL_CXXALIASWARN (execvp);
884# define execvpe rpl_execvpe 886# define execvpe rpl_execvpe
885# endif 887# endif
886_GL_FUNCDECL_RPL (execvpe, int, 888_GL_FUNCDECL_RPL (execvpe, int,
887 (const char *program, char * const *argv, char * const *env) 889 (const char *program, char * const *argv, char * const *env),
888 _GL_ARG_NONNULL ((1, 2))); 890 _GL_ARG_NONNULL ((1, 2)));
889_GL_CXXALIAS_RPL (execvpe, int, 891_GL_CXXALIAS_RPL (execvpe, int,
890 (const char *program, char * const *argv, char * const *env)); 892 (const char *program, char * const *argv, char * const *env));
891# else 893# else
892# if !@HAVE_DECL_EXECVPE@ 894# if !@HAVE_DECL_EXECVPE@
893_GL_FUNCDECL_SYS (execvpe, int, 895_GL_FUNCDECL_SYS (execvpe, int,
894 (const char *program, char * const *argv, char * const *env) 896 (const char *program, char * const *argv, char * const *env),
895 _GL_ARG_NONNULL ((1, 2))); 897 _GL_ARG_NONNULL ((1, 2)));
896# endif 898# endif
897_GL_CXXALIAS_SYS (execvpe, int, 899_GL_CXXALIAS_SYS (execvpe, int,
@@ -922,7 +924,7 @@ _GL_CXXALIAS_MDA_CAST (execvpe, intptr_t,
922# elif @HAVE_EXECVPE@ 924# elif @HAVE_EXECVPE@
923# if !@HAVE_DECL_EXECVPE@ 925# if !@HAVE_DECL_EXECVPE@
924_GL_FUNCDECL_SYS (execvpe, int, 926_GL_FUNCDECL_SYS (execvpe, int,
925 (const char *program, char * const *argv, char * const *env) 927 (const char *program, char * const *argv, char * const *env),
926 _GL_ARG_NONNULL ((1, 2))); 928 _GL_ARG_NONNULL ((1, 2)));
927# endif 929# endif
928_GL_CXXALIAS_SYS (execvpe, int, 930_GL_CXXALIAS_SYS (execvpe, int,
@@ -941,15 +943,15 @@ _GL_CXXALIASWARN (execvpe);
941# define faccessat rpl_faccessat 943# define faccessat rpl_faccessat
942# endif 944# endif
943_GL_FUNCDECL_RPL (faccessat, int, 945_GL_FUNCDECL_RPL (faccessat, int,
944 (int fd, char const *name, int mode, int flag) 946 (int fd, char const *name, int mode, int flag),
945 _GL_ARG_NONNULL ((2))); 947 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
946_GL_CXXALIAS_RPL (faccessat, int, 948_GL_CXXALIAS_RPL (faccessat, int,
947 (int fd, char const *name, int mode, int flag)); 949 (int fd, char const *name, int mode, int flag));
948# else 950# else
949# if !@HAVE_FACCESSAT@ 951# if !@HAVE_FACCESSAT@
950_GL_FUNCDECL_SYS (faccessat, int, 952_GL_FUNCDECL_SYS (faccessat, int,
951 (int fd, char const *file, int mode, int flag) 953 (int fd, char const *file, int mode, int flag),
952 _GL_ARG_NONNULL ((2))); 954 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
953# endif 955# endif
954_GL_CXXALIAS_SYS (faccessat, int, 956_GL_CXXALIAS_SYS (faccessat, int,
955 (int fd, char const *file, int mode, int flag)); 957 (int fd, char const *file, int mode, int flag));
@@ -977,11 +979,11 @@ _GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
977# undef fchdir 979# undef fchdir
978# define fchdir rpl_fchdir 980# define fchdir rpl_fchdir
979# endif 981# endif
980_GL_FUNCDECL_RPL (fchdir, int, (int /*fd*/)); 982_GL_FUNCDECL_RPL (fchdir, int, (int /*fd*/), _GL_ATTRIBUTE_NODISCARD);
981_GL_CXXALIAS_RPL (fchdir, int, (int /*fd*/)); 983_GL_CXXALIAS_RPL (fchdir, int, (int /*fd*/));
982# else 984# else
983# if !@HAVE_FCHDIR@ || !@HAVE_DECL_FCHDIR@ 985# if !@HAVE_FCHDIR@ || !@HAVE_DECL_FCHDIR@
984_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); 986_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/), _GL_ATTRIBUTE_NODISCARD);
985# endif 987# endif
986_GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/)); 988_GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/));
987# endif 989# endif
@@ -1010,15 +1012,15 @@ _GL_WARN_ON_USE (fchdir, "fchdir is unportable - "
1010# define fchownat rpl_fchownat 1012# define fchownat rpl_fchownat
1011# endif 1013# endif
1012_GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file, 1014_GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file,
1013 uid_t owner, gid_t group, int flag) 1015 uid_t owner, gid_t group, int flag),
1014 _GL_ARG_NONNULL ((2))); 1016 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
1015_GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file, 1017_GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file,
1016 uid_t owner, gid_t group, int flag)); 1018 uid_t owner, gid_t group, int flag));
1017# else 1019# else
1018# if !@HAVE_FCHOWNAT@ 1020# if !@HAVE_FCHOWNAT@
1019_GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file, 1021_GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file,
1020 uid_t owner, gid_t group, int flag) 1022 uid_t owner, gid_t group, int flag),
1021 _GL_ARG_NONNULL ((2))); 1023 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
1022# endif 1024# endif
1023_GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file, 1025_GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file,
1024 uid_t owner, gid_t group, int flag)); 1026 uid_t owner, gid_t group, int flag));
@@ -1092,13 +1094,17 @@ _GL_WARN_ON_USE (fsync, "fsync is unportable - "
1092# undef ftruncate 1094# undef ftruncate
1093# define ftruncate rpl_ftruncate 1095# define ftruncate rpl_ftruncate
1094# endif 1096# endif
1095_GL_FUNCDECL_RPL (ftruncate, int, (int fd, off_t length)); 1097_GL_FUNCDECL_RPL (ftruncate, int,
1096_GL_CXXALIAS_RPL (ftruncate, int, (int fd, off_t length)); 1098 (int fd, off_t length), _GL_ATTRIBUTE_NODISCARD);
1099_GL_CXXALIAS_RPL (ftruncate, int,
1100 (int fd, off_t length));
1097# else 1101# else
1098# if !@HAVE_FTRUNCATE@ 1102# if !@HAVE_FTRUNCATE@
1099_GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length)); 1103_GL_FUNCDECL_SYS (ftruncate, int,
1104 (int fd, off_t length), _GL_ATTRIBUTE_NODISCARD);
1100# endif 1105# endif
1101_GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length)); 1106_GL_CXXALIAS_SYS (ftruncate, int,
1107 (int fd, off_t length));
1102# endif 1108# endif
1103# if __GLIBC__ >= 2 1109# if __GLIBC__ >= 2
1104_GL_CXXALIASWARN (ftruncate); 1110_GL_CXXALIASWARN (ftruncate);
@@ -1127,7 +1133,8 @@ _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
1127# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1133# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1128# define getcwd rpl_getcwd 1134# define getcwd rpl_getcwd
1129# endif 1135# endif
1130_GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size)); 1136_GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size),
1137 _GL_ATTRIBUTE_NODISCARD);
1131_GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size)); 1138_GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size));
1132# elif defined _WIN32 && !defined __CYGWIN__ 1139# elif defined _WIN32 && !defined __CYGWIN__
1133# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1140# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1182,15 +1189,19 @@ _GL_CXXALIASWARN (getcwd);
1182# undef getdomainname 1189# undef getdomainname
1183# define getdomainname rpl_getdomainname 1190# define getdomainname rpl_getdomainname
1184# endif 1191# endif
1185_GL_FUNCDECL_RPL (getdomainname, int, (char *name, size_t len) 1192_GL_FUNCDECL_RPL (getdomainname, int,
1186 _GL_ARG_NONNULL ((1))); 1193 (char *name, size_t len),
1187_GL_CXXALIAS_RPL (getdomainname, int, (char *name, size_t len)); 1194 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1195_GL_CXXALIAS_RPL (getdomainname, int,
1196 (char *name, size_t len));
1188# else 1197# else
1189# if !@HAVE_DECL_GETDOMAINNAME@ 1198# if !@HAVE_DECL_GETDOMAINNAME@
1190_GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len) 1199_GL_FUNCDECL_SYS (getdomainname, int,
1191 _GL_ARG_NONNULL ((1))); 1200 (char *name, size_t len),
1201 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1192# endif 1202# endif
1193_GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len)); 1203_GL_CXXALIAS_SYS (getdomainname, int,
1204 (char *name, size_t len));
1194# endif 1205# endif
1195# if __GLIBC__ >= 2 1206# if __GLIBC__ >= 2
1196_GL_CXXALIASWARN (getdomainname); 1207_GL_CXXALIASWARN (getdomainname);
@@ -1239,13 +1250,17 @@ _GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
1239# undef getentropy 1250# undef getentropy
1240# define getentropy rpl_getentropy 1251# define getentropy rpl_getentropy
1241# endif 1252# endif
1242_GL_FUNCDECL_RPL (getentropy, int, (void *buffer, size_t length)); 1253_GL_FUNCDECL_RPL (getentropy, int,
1243_GL_CXXALIAS_RPL (getentropy, int, (void *buffer, size_t length)); 1254 (void *buffer, size_t length), _GL_ATTRIBUTE_NODISCARD);
1255_GL_CXXALIAS_RPL (getentropy, int,
1256 (void *buffer, size_t length));
1244# else 1257# else
1245# if !@HAVE_GETENTROPY@ 1258# if !@HAVE_GETENTROPY@
1246_GL_FUNCDECL_SYS (getentropy, int, (void *buffer, size_t length)); 1259_GL_FUNCDECL_SYS (getentropy, int,
1260 (void *buffer, size_t length), _GL_ATTRIBUTE_NODISCARD);
1247# endif 1261# endif
1248_GL_CXXALIAS_SYS (getentropy, int, (void *buffer, size_t length)); 1262_GL_CXXALIAS_SYS (getentropy, int,
1263 (void *buffer, size_t length));
1249# endif 1264# endif
1250# if __GLIBC__ >= 2 1265# if __GLIBC__ >= 2
1251_GL_CXXALIASWARN (getentropy); 1266_GL_CXXALIASWARN (getentropy);
@@ -1270,13 +1285,17 @@ _GL_WARN_ON_USE (getentropy, "getentropy is unportable - "
1270# undef getgroups 1285# undef getgroups
1271# define getgroups rpl_getgroups 1286# define getgroups rpl_getgroups
1272# endif 1287# endif
1273_GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups)); 1288_GL_FUNCDECL_RPL (getgroups, int,
1274_GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups)); 1289 (int n, gid_t *groups), _GL_ATTRIBUTE_NODISCARD);
1290_GL_CXXALIAS_RPL (getgroups, int,
1291 (int n, gid_t *groups));
1275# else 1292# else
1276# if !@HAVE_GETGROUPS@ 1293# if !@HAVE_GETGROUPS@
1277_GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups)); 1294_GL_FUNCDECL_SYS (getgroups, int,
1295 (int n, gid_t *groups), _GL_ATTRIBUTE_NODISCARD);
1278# endif 1296# endif
1279_GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups)); 1297_GL_CXXALIAS_SYS (getgroups, int,
1298 (int n, gid_t *groups));
1280# endif 1299# endif
1281_GL_CXXALIASWARN (getgroups); 1300_GL_CXXALIASWARN (getgroups);
1282#elif defined GNULIB_POSIXCHECK 1301#elif defined GNULIB_POSIXCHECK
@@ -1301,12 +1320,12 @@ _GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
1301# undef gethostname 1320# undef gethostname
1302# define gethostname rpl_gethostname 1321# define gethostname rpl_gethostname
1303# endif 1322# endif
1304_GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len) 1323_GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len),
1305 _GL_ARG_NONNULL ((1))); 1324 _GL_ARG_NONNULL ((1)));
1306_GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len)); 1325_GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len));
1307# else 1326# else
1308# if !@HAVE_GETHOSTNAME@ 1327# if !@HAVE_GETHOSTNAME@
1309_GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len) 1328_GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len),
1310 _GL_ARG_NONNULL ((1))); 1329 _GL_ARG_NONNULL ((1)));
1311# endif 1330# endif
1312/* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second 1331/* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second
@@ -1316,8 +1335,10 @@ _GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len));
1316# endif 1335# endif
1317_GL_CXXALIASWARN (gethostname); 1336_GL_CXXALIASWARN (gethostname);
1318#elif @UNISTD_H_HAVE_WINSOCK2_H@ 1337#elif @UNISTD_H_HAVE_WINSOCK2_H@
1319# undef gethostname 1338# if !GNULIB_GETHOSTNAME
1320# define gethostname gethostname_used_without_requesting_gnulib_module_gethostname 1339# undef gethostname
1340# define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
1341# endif
1321#elif defined GNULIB_POSIXCHECK 1342#elif defined GNULIB_POSIXCHECK
1322# undef gethostname 1343# undef gethostname
1323# if HAVE_RAW_DECL_GETHOSTNAME 1344# if HAVE_RAW_DECL_GETHOSTNAME
@@ -1371,12 +1392,12 @@ _GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
1371# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1392# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1372# define getlogin_r rpl_getlogin_r 1393# define getlogin_r rpl_getlogin_r
1373# endif 1394# endif
1374_GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size) 1395_GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size),
1375 _GL_ARG_NONNULL ((1))); 1396 _GL_ARG_NONNULL ((1)));
1376_GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size)); 1397_GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size));
1377# else 1398# else
1378# if !@HAVE_DECL_GETLOGIN_R@ 1399# if !@HAVE_DECL_GETLOGIN_R@
1379_GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size) 1400_GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size),
1380 _GL_ARG_NONNULL ((1))); 1401 _GL_ARG_NONNULL ((1)));
1381# endif 1402# endif
1382/* Need to cast, because on Solaris 10 systems, the second argument is 1403/* Need to cast, because on Solaris 10 systems, the second argument is
@@ -1493,12 +1514,12 @@ _GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
1493# undef getpass 1514# undef getpass
1494# define getpass rpl_getpass 1515# define getpass rpl_getpass
1495# endif 1516# endif
1496_GL_FUNCDECL_RPL (getpass, char *, (const char *prompt) 1517_GL_FUNCDECL_RPL (getpass, char *, (const char *prompt),
1497 _GL_ARG_NONNULL ((1))); 1518 _GL_ARG_NONNULL ((1)));
1498_GL_CXXALIAS_RPL (getpass, char *, (const char *prompt)); 1519_GL_CXXALIAS_RPL (getpass, char *, (const char *prompt));
1499# else 1520# else
1500# if !@HAVE_GETPASS@ 1521# if !@HAVE_GETPASS@
1501_GL_FUNCDECL_SYS (getpass, char *, (const char *prompt) 1522_GL_FUNCDECL_SYS (getpass, char *, (const char *prompt),
1502 _GL_ARG_NONNULL ((1))); 1523 _GL_ARG_NONNULL ((1)));
1503# endif 1524# endif
1504_GL_CXXALIAS_SYS (getpass, char *, (const char *prompt)); 1525_GL_CXXALIAS_SYS (getpass, char *, (const char *prompt));
@@ -1674,13 +1695,13 @@ _GL_CXXALIASWARN (isatty);
1674# undef lchown 1695# undef lchown
1675# define lchown rpl_lchown 1696# define lchown rpl_lchown
1676# endif 1697# endif
1677_GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group) 1698_GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group),
1678 _GL_ARG_NONNULL ((1))); 1699 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1679_GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)); 1700_GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group));
1680# else 1701# else
1681# if !@HAVE_LCHOWN@ 1702# if !@HAVE_LCHOWN@
1682_GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group) 1703_GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group),
1683 _GL_ARG_NONNULL ((1))); 1704 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1684# endif 1705# endif
1685_GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)); 1706_GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group));
1686# endif 1707# endif
@@ -1703,13 +1724,13 @@ _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
1703# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1724# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1704# define link rpl_link 1725# define link rpl_link
1705# endif 1726# endif
1706_GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2) 1727_GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2),
1707 _GL_ARG_NONNULL ((1, 2))); 1728 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
1708_GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2)); 1729_GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2));
1709# else 1730# else
1710# if !@HAVE_LINK@ 1731# if !@HAVE_LINK@
1711_GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2) 1732_GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2),
1712 _GL_ARG_NONNULL ((1, 2))); 1733 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
1713# endif 1734# endif
1714_GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2)); 1735_GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2));
1715# endif 1736# endif
@@ -1734,8 +1755,8 @@ _GL_WARN_ON_USE (link, "link is unportable - "
1734# endif 1755# endif
1735_GL_FUNCDECL_RPL (linkat, int, 1756_GL_FUNCDECL_RPL (linkat, int,
1736 (int fd1, const char *path1, int fd2, const char *path2, 1757 (int fd1, const char *path1, int fd2, const char *path2,
1737 int flag) 1758 int flag),
1738 _GL_ARG_NONNULL ((2, 4))); 1759 _GL_ARG_NONNULL ((2, 4)) _GL_ATTRIBUTE_NODISCARD);
1739_GL_CXXALIAS_RPL (linkat, int, 1760_GL_CXXALIAS_RPL (linkat, int,
1740 (int fd1, const char *path1, int fd2, const char *path2, 1761 (int fd1, const char *path1, int fd2, const char *path2,
1741 int flag)); 1762 int flag));
@@ -1743,8 +1764,8 @@ _GL_CXXALIAS_RPL (linkat, int,
1743# if !@HAVE_LINKAT@ 1764# if !@HAVE_LINKAT@
1744_GL_FUNCDECL_SYS (linkat, int, 1765_GL_FUNCDECL_SYS (linkat, int,
1745 (int fd1, const char *path1, int fd2, const char *path2, 1766 (int fd1, const char *path1, int fd2, const char *path2,
1746 int flag) 1767 int flag),
1747 _GL_ARG_NONNULL ((2, 4))); 1768 _GL_ARG_NONNULL ((2, 4)) _GL_ATTRIBUTE_NODISCARD);
1748# endif 1769# endif
1749_GL_CXXALIAS_SYS (linkat, int, 1770_GL_CXXALIAS_SYS (linkat, int,
1750 (int fd1, const char *path1, int fd2, const char *path2, 1771 (int fd1, const char *path1, int fd2, const char *path2,
@@ -1811,7 +1832,8 @@ _GL_CXXALIASWARN (lseek);
1811 Store the read-end as fd[0] and the write-end as fd[1]. 1832 Store the read-end as fd[0] and the write-end as fd[1].
1812 Return 0 upon success, or -1 with errno set upon failure. */ 1833 Return 0 upon success, or -1 with errno set upon failure. */
1813# if !@HAVE_PIPE@ 1834# if !@HAVE_PIPE@
1814_GL_FUNCDECL_SYS (pipe, int, (int fd[2]) _GL_ARG_NONNULL ((1))); 1835_GL_FUNCDECL_SYS (pipe, int, (int fd[2]),
1836 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1815# endif 1837# endif
1816_GL_CXXALIAS_SYS (pipe, int, (int fd[2])); 1838_GL_CXXALIAS_SYS (pipe, int, (int fd[2]));
1817_GL_CXXALIASWARN (pipe); 1839_GL_CXXALIASWARN (pipe);
@@ -1838,10 +1860,12 @@ _GL_WARN_ON_USE (pipe, "pipe is unportable - "
1838# undef pipe2 1860# undef pipe2
1839# define pipe2 rpl_pipe2 1861# define pipe2 rpl_pipe2
1840# endif 1862# endif
1841_GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1))); 1863_GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags),
1864 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1842_GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags)); 1865_GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags));
1843# else 1866# else
1844_GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1))); 1867_GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags),
1868 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1845_GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags)); 1869_GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags));
1846# endif 1870# endif
1847# if __GLIBC__ >= 2 1871# if __GLIBC__ >= 2
@@ -1868,15 +1892,15 @@ _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
1868# define pread rpl_pread 1892# define pread rpl_pread
1869# endif 1893# endif
1870_GL_FUNCDECL_RPL (pread, ssize_t, 1894_GL_FUNCDECL_RPL (pread, ssize_t,
1871 (int fd, void *buf, size_t bufsize, off_t offset) 1895 (int fd, void *buf, size_t bufsize, off_t offset),
1872 _GL_ARG_NONNULL ((2))); 1896 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
1873_GL_CXXALIAS_RPL (pread, ssize_t, 1897_GL_CXXALIAS_RPL (pread, ssize_t,
1874 (int fd, void *buf, size_t bufsize, off_t offset)); 1898 (int fd, void *buf, size_t bufsize, off_t offset));
1875# else 1899# else
1876# if !@HAVE_PREAD@ 1900# if !@HAVE_PREAD@
1877_GL_FUNCDECL_SYS (pread, ssize_t, 1901_GL_FUNCDECL_SYS (pread, ssize_t,
1878 (int fd, void *buf, size_t bufsize, off_t offset) 1902 (int fd, void *buf, size_t bufsize, off_t offset),
1879 _GL_ARG_NONNULL ((2))); 1903 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
1880# endif 1904# endif
1881_GL_CXXALIAS_SYS (pread, ssize_t, 1905_GL_CXXALIAS_SYS (pread, ssize_t,
1882 (int fd, void *buf, size_t bufsize, off_t offset)); 1906 (int fd, void *buf, size_t bufsize, off_t offset));
@@ -1905,15 +1929,15 @@ _GL_WARN_ON_USE (pread, "pread is unportable - "
1905# define pwrite rpl_pwrite 1929# define pwrite rpl_pwrite
1906# endif 1930# endif
1907_GL_FUNCDECL_RPL (pwrite, ssize_t, 1931_GL_FUNCDECL_RPL (pwrite, ssize_t,
1908 (int fd, const void *buf, size_t bufsize, off_t offset) 1932 (int fd, const void *buf, size_t bufsize, off_t offset),
1909 _GL_ARG_NONNULL ((2))); 1933 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
1910_GL_CXXALIAS_RPL (pwrite, ssize_t, 1934_GL_CXXALIAS_RPL (pwrite, ssize_t,
1911 (int fd, const void *buf, size_t bufsize, off_t offset)); 1935 (int fd, const void *buf, size_t bufsize, off_t offset));
1912# else 1936# else
1913# if !@HAVE_PWRITE@ 1937# if !@HAVE_PWRITE@
1914_GL_FUNCDECL_SYS (pwrite, ssize_t, 1938_GL_FUNCDECL_SYS (pwrite, ssize_t,
1915 (int fd, const void *buf, size_t bufsize, off_t offset) 1939 (int fd, const void *buf, size_t bufsize, off_t offset),
1916 _GL_ARG_NONNULL ((2))); 1940 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
1917# endif 1941# endif
1918_GL_CXXALIAS_SYS (pwrite, ssize_t, 1942_GL_CXXALIAS_SYS (pwrite, ssize_t,
1919 (int fd, const void *buf, size_t bufsize, off_t offset)); 1943 (int fd, const void *buf, size_t bufsize, off_t offset));
@@ -1939,8 +1963,9 @@ _GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
1939# undef read 1963# undef read
1940# define read rpl_read 1964# define read rpl_read
1941# endif 1965# endif
1942_GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count) 1966
1943 _GL_ARG_NONNULL ((2))); 1967_GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count),
1968 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
1944_GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count)); 1969_GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count));
1945# elif defined _WIN32 && !defined __CYGWIN__ 1970# elif defined _WIN32 && !defined __CYGWIN__
1946# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1971# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1981,8 +2006,8 @@ _GL_CXXALIASWARN (read);
1981# endif 2006# endif
1982_GL_FUNCDECL_RPL (readlink, ssize_t, 2007_GL_FUNCDECL_RPL (readlink, ssize_t,
1983 (const char *restrict file, 2008 (const char *restrict file,
1984 char *restrict buf, size_t bufsize) 2009 char *restrict buf, size_t bufsize),
1985 _GL_ARG_NONNULL ((1, 2))); 2010 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
1986_GL_CXXALIAS_RPL (readlink, ssize_t, 2011_GL_CXXALIAS_RPL (readlink, ssize_t,
1987 (const char *restrict file, 2012 (const char *restrict file,
1988 char *restrict buf, size_t bufsize)); 2013 char *restrict buf, size_t bufsize));
@@ -1990,8 +2015,8 @@ _GL_CXXALIAS_RPL (readlink, ssize_t,
1990# if !@HAVE_READLINK@ 2015# if !@HAVE_READLINK@
1991_GL_FUNCDECL_SYS (readlink, ssize_t, 2016_GL_FUNCDECL_SYS (readlink, ssize_t,
1992 (const char *restrict file, 2017 (const char *restrict file,
1993 char *restrict buf, size_t bufsize) 2018 char *restrict buf, size_t bufsize),
1994 _GL_ARG_NONNULL ((1, 2))); 2019 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
1995# endif 2020# endif
1996_GL_CXXALIAS_SYS (readlink, ssize_t, 2021_GL_CXXALIAS_SYS (readlink, ssize_t,
1997 (const char *restrict file, 2022 (const char *restrict file,
@@ -2014,8 +2039,8 @@ _GL_WARN_ON_USE (readlink, "readlink is unportable - "
2014# endif 2039# endif
2015_GL_FUNCDECL_RPL (readlinkat, ssize_t, 2040_GL_FUNCDECL_RPL (readlinkat, ssize_t,
2016 (int fd, char const *restrict file, 2041 (int fd, char const *restrict file,
2017 char *restrict buf, size_t len) 2042 char *restrict buf, size_t len),
2018 _GL_ARG_NONNULL ((2, 3))); 2043 _GL_ARG_NONNULL ((2, 3)) _GL_ATTRIBUTE_NODISCARD);
2019_GL_CXXALIAS_RPL (readlinkat, ssize_t, 2044_GL_CXXALIAS_RPL (readlinkat, ssize_t,
2020 (int fd, char const *restrict file, 2045 (int fd, char const *restrict file,
2021 char *restrict buf, size_t len)); 2046 char *restrict buf, size_t len));
@@ -2023,8 +2048,8 @@ _GL_CXXALIAS_RPL (readlinkat, ssize_t,
2023# if !@HAVE_READLINKAT@ 2048# if !@HAVE_READLINKAT@
2024_GL_FUNCDECL_SYS (readlinkat, ssize_t, 2049_GL_FUNCDECL_SYS (readlinkat, ssize_t,
2025 (int fd, char const *restrict file, 2050 (int fd, char const *restrict file,
2026 char *restrict buf, size_t len) 2051 char *restrict buf, size_t len),
2027 _GL_ARG_NONNULL ((2, 3))); 2052 _GL_ARG_NONNULL ((2, 3)) _GL_ATTRIBUTE_NODISCARD);
2028# endif 2053# endif
2029_GL_CXXALIAS_SYS (readlinkat, ssize_t, 2054_GL_CXXALIAS_SYS (readlinkat, ssize_t,
2030 (int fd, char const *restrict file, 2055 (int fd, char const *restrict file,
@@ -2048,7 +2073,7 @@ _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
2048# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2073# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2049# define rmdir rpl_rmdir 2074# define rmdir rpl_rmdir
2050# endif 2075# endif
2051_GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1))); 2076_GL_FUNCDECL_RPL (rmdir, int, (char const *name), _GL_ARG_NONNULL ((1)));
2052_GL_CXXALIAS_RPL (rmdir, int, (char const *name)); 2077_GL_CXXALIAS_RPL (rmdir, int, (char const *name));
2053# elif defined _WIN32 && !defined __CYGWIN__ 2078# elif defined _WIN32 && !defined __CYGWIN__
2054# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2079# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -2097,18 +2122,22 @@ _GL_CXXALIASWARN (rmdir);
2097# undef sethostname 2122# undef sethostname
2098# define sethostname rpl_sethostname 2123# define sethostname rpl_sethostname
2099# endif 2124# endif
2100_GL_FUNCDECL_RPL (sethostname, int, (const char *name, size_t len) 2125_GL_FUNCDECL_RPL (sethostname, int,
2101 _GL_ARG_NONNULL ((1))); 2126 (const char *name, size_t len),
2102_GL_CXXALIAS_RPL (sethostname, int, (const char *name, size_t len)); 2127 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
2128_GL_CXXALIAS_RPL (sethostname, int,
2129 (const char *name, size_t len));
2103# else 2130# else
2104# if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@ 2131# if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@
2105_GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len) 2132_GL_FUNCDECL_SYS (sethostname, int,
2106 _GL_ARG_NONNULL ((1))); 2133 (const char *name, size_t len),
2134 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
2107# endif 2135# endif
2108/* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5 2136/* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5
2109 and FreeBSD 6.4 the second parameter is int. On Solaris 11 2137 and FreeBSD 6.4 the second parameter is int. On Solaris 11
2110 2011-10, the first parameter is not const. */ 2138 2011-10, the first parameter is not const. */
2111_GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len)); 2139_GL_CXXALIAS_SYS_CAST (sethostname, int,
2140 (const char *name, size_t len));
2112# endif 2141# endif
2113# if __GLIBC__ >= 2 2142# if __GLIBC__ >= 2
2114_GL_CXXALIASWARN (sethostname); 2143_GL_CXXALIASWARN (sethostname);
@@ -2181,15 +2210,19 @@ _GL_CXXALIASWARN (swab);
2181# undef symlink 2210# undef symlink
2182# define symlink rpl_symlink 2211# define symlink rpl_symlink
2183# endif 2212# endif
2184_GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file) 2213_GL_FUNCDECL_RPL (symlink, int,
2185 _GL_ARG_NONNULL ((1, 2))); 2214 (char const *contents, char const *file),
2186_GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file)); 2215 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
2216_GL_CXXALIAS_RPL (symlink, int,
2217 (char const *contents, char const *file));
2187# else 2218# else
2188# if !@HAVE_SYMLINK@ 2219# if !@HAVE_SYMLINK@
2189_GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file) 2220_GL_FUNCDECL_SYS (symlink, int,
2190 _GL_ARG_NONNULL ((1, 2))); 2221 (char const *contents, char const *file),
2222 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
2191# endif 2223# endif
2192_GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file)); 2224_GL_CXXALIAS_SYS (symlink, int,
2225 (char const *contents, char const *file));
2193# endif 2226# endif
2194_GL_CXXALIASWARN (symlink); 2227_GL_CXXALIASWARN (symlink);
2195#elif defined GNULIB_POSIXCHECK 2228#elif defined GNULIB_POSIXCHECK
@@ -2208,15 +2241,15 @@ _GL_WARN_ON_USE (symlink, "symlink is not portable - "
2208# define symlinkat rpl_symlinkat 2241# define symlinkat rpl_symlinkat
2209# endif 2242# endif
2210_GL_FUNCDECL_RPL (symlinkat, int, 2243_GL_FUNCDECL_RPL (symlinkat, int,
2211 (char const *contents, int fd, char const *file) 2244 (char const *contents, int fd, char const *file),
2212 _GL_ARG_NONNULL ((1, 3))); 2245 _GL_ARG_NONNULL ((1, 3)) _GL_ATTRIBUTE_NODISCARD);
2213_GL_CXXALIAS_RPL (symlinkat, int, 2246_GL_CXXALIAS_RPL (symlinkat, int,
2214 (char const *contents, int fd, char const *file)); 2247 (char const *contents, int fd, char const *file));
2215# else 2248# else
2216# if !@HAVE_SYMLINKAT@ 2249# if !@HAVE_SYMLINKAT@
2217_GL_FUNCDECL_SYS (symlinkat, int, 2250_GL_FUNCDECL_SYS (symlinkat, int,
2218 (char const *contents, int fd, char const *file) 2251 (char const *contents, int fd, char const *file),
2219 _GL_ARG_NONNULL ((1, 3))); 2252 _GL_ARG_NONNULL ((1, 3)) _GL_ATTRIBUTE_NODISCARD);
2220# endif 2253# endif
2221_GL_CXXALIAS_SYS (symlinkat, int, 2254_GL_CXXALIAS_SYS (symlinkat, int,
2222 (char const *contents, int fd, char const *file)); 2255 (char const *contents, int fd, char const *file));
@@ -2243,13 +2276,13 @@ _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
2243# undef truncate 2276# undef truncate
2244# define truncate rpl_truncate 2277# define truncate rpl_truncate
2245# endif 2278# endif
2246_GL_FUNCDECL_RPL (truncate, int, (const char *filename, off_t length) 2279_GL_FUNCDECL_RPL (truncate, int, (const char *filename, off_t length),
2247 _GL_ARG_NONNULL ((1))); 2280 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
2248_GL_CXXALIAS_RPL (truncate, int, (const char *filename, off_t length)); 2281_GL_CXXALIAS_RPL (truncate, int, (const char *filename, off_t length));
2249# else 2282# else
2250# if !@HAVE_DECL_TRUNCATE@ 2283# if !@HAVE_DECL_TRUNCATE@
2251_GL_FUNCDECL_SYS (truncate, int, (const char *filename, off_t length) 2284_GL_FUNCDECL_SYS (truncate, int, (const char *filename, off_t length),
2252 _GL_ARG_NONNULL ((1))); 2285 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
2253# endif 2286# endif
2254_GL_CXXALIAS_SYS (truncate, int, (const char *filename, off_t length)); 2287_GL_CXXALIAS_SYS (truncate, int, (const char *filename, off_t length));
2255# endif 2288# endif
@@ -2274,13 +2307,15 @@ _GL_WARN_ON_USE (truncate, "truncate is unportable - "
2274# define ttyname_r rpl_ttyname_r 2307# define ttyname_r rpl_ttyname_r
2275# endif 2308# endif
2276_GL_FUNCDECL_RPL (ttyname_r, int, 2309_GL_FUNCDECL_RPL (ttyname_r, int,
2277 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); 2310 (int fd, char *buf, size_t buflen),
2311 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
2278_GL_CXXALIAS_RPL (ttyname_r, int, 2312_GL_CXXALIAS_RPL (ttyname_r, int,
2279 (int fd, char *buf, size_t buflen)); 2313 (int fd, char *buf, size_t buflen));
2280# else 2314# else
2281# if !@HAVE_DECL_TTYNAME_R@ 2315# if !@HAVE_DECL_TTYNAME_R@
2282_GL_FUNCDECL_SYS (ttyname_r, int, 2316_GL_FUNCDECL_SYS (ttyname_r, int,
2283 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); 2317 (int fd, char *buf, size_t buflen),
2318 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
2284# endif 2319# endif
2285_GL_CXXALIAS_SYS (ttyname_r, int, 2320_GL_CXXALIAS_SYS (ttyname_r, int,
2286 (int fd, char *buf, size_t buflen)); 2321 (int fd, char *buf, size_t buflen));
@@ -2303,7 +2338,7 @@ _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - "
2303# undef unlink 2338# undef unlink
2304# define unlink rpl_unlink 2339# define unlink rpl_unlink
2305# endif 2340# endif
2306_GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1))); 2341_GL_FUNCDECL_RPL (unlink, int, (char const *file), _GL_ARG_NONNULL ((1)));
2307_GL_CXXALIAS_RPL (unlink, int, (char const *file)); 2342_GL_CXXALIAS_RPL (unlink, int, (char const *file));
2308# elif defined _WIN32 && !defined __CYGWIN__ 2343# elif defined _WIN32 && !defined __CYGWIN__
2309# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2344# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -2344,12 +2379,12 @@ _GL_CXXALIASWARN (unlink);
2344# undef unlinkat 2379# undef unlinkat
2345# define unlinkat rpl_unlinkat 2380# define unlinkat rpl_unlinkat
2346# endif 2381# endif
2347_GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag) 2382_GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag),
2348 _GL_ARG_NONNULL ((2))); 2383 _GL_ARG_NONNULL ((2)));
2349_GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag)); 2384_GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag));
2350# else 2385# else
2351# if !@HAVE_UNLINKAT@ 2386# if !@HAVE_UNLINKAT@
2352_GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag) 2387_GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag),
2353 _GL_ARG_NONNULL ((2))); 2388 _GL_ARG_NONNULL ((2)));
2354# endif 2389# endif
2355_GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag)); 2390_GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag));
@@ -2403,17 +2438,21 @@ _GL_WARN_ON_USE (usleep, "usleep is unportable - "
2403# undef write 2438# undef write
2404# define write rpl_write 2439# define write rpl_write
2405# endif 2440# endif
2406_GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count) 2441_GL_FUNCDECL_RPL (write, ssize_t,
2407 _GL_ARG_NONNULL ((2))); 2442 (int fd, const void *buf, size_t count),
2408_GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count)); 2443 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
2444_GL_CXXALIAS_RPL (write, ssize_t,
2445 (int fd, const void *buf, size_t count));
2409# elif defined _WIN32 && !defined __CYGWIN__ 2446# elif defined _WIN32 && !defined __CYGWIN__
2410# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2447# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2411# undef write 2448# undef write
2412# define write _write 2449# define write _write
2413# endif 2450# endif
2414_GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, size_t count)); 2451_GL_CXXALIAS_MDA (write, ssize_t,
2452 (int fd, const void *buf, size_t count));
2415# else 2453# else
2416_GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count)); 2454_GL_CXXALIAS_SYS (write, ssize_t,
2455 (int fd, const void *buf, size_t count));
2417# endif 2456# endif
2418_GL_CXXALIASWARN (write); 2457_GL_CXXALIASWARN (write);
2419#elif @GNULIB_MDA_WRITE@ 2458#elif @GNULIB_MDA_WRITE@
@@ -2425,9 +2464,11 @@ _GL_CXXALIASWARN (write);
2425# undef write 2464# undef write
2426# define write _write 2465# define write _write
2427# endif 2466# endif
2428_GL_CXXALIAS_MDA_CAST (write, ssize_t, (int fd, const void *buf, unsigned int count)); 2467_GL_CXXALIAS_MDA_CAST (write, ssize_t,
2468 (int fd, const void *buf, unsigned int count));
2429# else 2469# else
2430_GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count)); 2470_GL_CXXALIAS_SYS (write, ssize_t,
2471 (int fd, const void *buf, size_t count));
2431# endif 2472# endif
2432_GL_CXXALIASWARN (write); 2473_GL_CXXALIASWARN (write);
2433#endif 2474#endif
diff --git a/lib/verify.h b/lib/verify.h
index 978926a4918..49a73c05088 100644
--- a/lib/verify.h
+++ b/lib/verify.h
@@ -34,11 +34,12 @@
34#ifndef __cplusplus 34#ifndef __cplusplus
35# if (201112 <= __STDC_VERSION__ \ 35# if (201112 <= __STDC_VERSION__ \
36 || (!defined __STRICT_ANSI__ \ 36 || (!defined __STRICT_ANSI__ \
37 && (4 < __GNUC__ + (6 <= __GNUC_MINOR__) || 5 <= __clang_major__))) 37 && ((4 < __GNUC__ + (6 <= __GNUC_MINOR__) && !defined __clang__) \
38 || 5 <= __clang_major__)))
38# define _GL_HAVE__STATIC_ASSERT 1 39# define _GL_HAVE__STATIC_ASSERT 1
39# endif 40# endif
40# if (202311 <= __STDC_VERSION__ \ 41# if (202311 <= __STDC_VERSION__ \
41 || (!defined __STRICT_ANSI__ && 9 <= __GNUC__)) 42 || (!defined __STRICT_ANSI__ && 9 <= __GNUC__ && !defined __clang__))
42# define _GL_HAVE__STATIC_ASSERT1 1 43# define _GL_HAVE__STATIC_ASSERT1 1
43# endif 44# endif
44#endif 45#endif
@@ -215,7 +216,7 @@ template <int w>
215# define _GL_VERIFY(R, DIAGNOSTIC, ...) \ 216# define _GL_VERIFY(R, DIAGNOSTIC, ...) \
216 extern int (*_GL_GENSYM (_gl_verify_function) (void)) \ 217 extern int (*_GL_GENSYM (_gl_verify_function) (void)) \
217 [_GL_VERIFY_TRUE (R, DIAGNOSTIC)] 218 [_GL_VERIFY_TRUE (R, DIAGNOSTIC)]
218# if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) 219# if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) && !defined __clang__
219# pragma GCC diagnostic ignored "-Wnested-externs" 220# pragma GCC diagnostic ignored "-Wnested-externs"
220# endif 221# endif
221#endif 222#endif
@@ -305,7 +306,7 @@ template <int w>
305#ifndef _GL_HAS_BUILTIN_UNREACHABLE 306#ifndef _GL_HAS_BUILTIN_UNREACHABLE
306# if defined __clang_major__ && __clang_major__ < 5 307# if defined __clang_major__ && __clang_major__ < 5
307# define _GL_HAS_BUILTIN_UNREACHABLE 0 308# define _GL_HAS_BUILTIN_UNREACHABLE 0
308# elif 4 < __GNUC__ + (5 <= __GNUC_MINOR__) 309# elif 4 < __GNUC__ + (5 <= __GNUC_MINOR__) && !defined __clang__
309# define _GL_HAS_BUILTIN_UNREACHABLE 1 310# define _GL_HAS_BUILTIN_UNREACHABLE 1
310# elif defined __has_builtin 311# elif defined __has_builtin
311# define _GL_HAS_BUILTIN_UNREACHABLE __has_builtin (__builtin_unreachable) 312# define _GL_HAS_BUILTIN_UNREACHABLE __has_builtin (__builtin_unreachable)
diff --git a/lib/warn-on-use.h b/lib/warn-on-use.h
index 701013a07f4..73c439714ab 100644
--- a/lib/warn-on-use.h
+++ b/lib/warn-on-use.h
@@ -85,7 +85,7 @@
85 */ 85 */
86#ifndef _GL_WARN_ON_USE 86#ifndef _GL_WARN_ON_USE
87 87
88# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 88# if (4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)) && !defined __clang__
89/* A compiler attribute is available in gcc versions 4.3.0 and later. */ 89/* A compiler attribute is available in gcc versions 4.3.0 and later. */
90# define _GL_WARN_ON_USE(function, message) \ 90# define _GL_WARN_ON_USE(function, message) \
91_GL_WARN_EXTERN_C __typeof__ (function) function __attribute__ ((__warning__ (message))) 91_GL_WARN_EXTERN_C __typeof__ (function) function __attribute__ ((__warning__ (message)))
@@ -98,7 +98,7 @@ _GL_WARN_EXTERN_C __typeof__ (function) function \
98 __attribute__ ((__diagnose_if__ (1, message, "warning"))) 98 __attribute__ ((__diagnose_if__ (1, message, "warning")))
99# define _GL_WARN_ON_USE_ATTRIBUTE(message) \ 99# define _GL_WARN_ON_USE_ATTRIBUTE(message) \
100 __attribute__ ((__diagnose_if__ (1, message, "warning"))) 100 __attribute__ ((__diagnose_if__ (1, message, "warning")))
101# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 101# elif (__GNUC__ >= 3 || defined __clang__) && GNULIB_STRICT_CHECKING
102/* Verify the existence of the function. */ 102/* Verify the existence of the function. */
103# define _GL_WARN_ON_USE(function, message) \ 103# define _GL_WARN_ON_USE(function, message) \
104_GL_WARN_EXTERN_C __typeof__ (function) function 104_GL_WARN_EXTERN_C __typeof__ (function) function
@@ -121,7 +121,7 @@ _GL_WARN_EXTERN_C int _gl_warn_on_use
121# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ 121# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
122 _GL_WARN_ON_USE (function, msg) 122 _GL_WARN_ON_USE (function, msg)
123# else 123# else
124# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 124# if (4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)) && !defined __clang__
125/* A compiler attribute is available in gcc versions 4.3.0 and later. */ 125/* A compiler attribute is available in gcc versions 4.3.0 and later. */
126# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ 126# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
127extern rettype_gcc function parameters_and_attributes \ 127extern rettype_gcc function parameters_and_attributes \
@@ -131,7 +131,7 @@ extern rettype_gcc function parameters_and_attributes \
131# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ 131# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
132extern rettype_clang function parameters_and_attributes \ 132extern rettype_clang function parameters_and_attributes \
133 __attribute__ ((__diagnose_if__ (1, msg, "warning"))) 133 __attribute__ ((__diagnose_if__ (1, msg, "warning")))
134# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 134# elif (__GNUC__ >= 3 || defined __clang__) && GNULIB_STRICT_CHECKING
135/* Verify the existence of the function. */ 135/* Verify the existence of the function. */
136# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ 136# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
137extern rettype_gcc function parameters_and_attributes 137extern rettype_gcc function parameters_and_attributes
diff --git a/lib/xalloc-oversized.h b/lib/xalloc-oversized.h
index 7f30f83e769..cfa527d38ce 100644
--- a/lib/xalloc-oversized.h
+++ b/lib/xalloc-oversized.h
@@ -47,7 +47,8 @@
47#if 7 <= __GNUC__ && !defined __clang__ && PTRDIFF_MAX < SIZE_MAX 47#if 7 <= __GNUC__ && !defined __clang__ && PTRDIFF_MAX < SIZE_MAX
48# define xalloc_oversized(n, s) \ 48# define xalloc_oversized(n, s) \
49 __builtin_mul_overflow_p (n, s, (ptrdiff_t) 1) 49 __builtin_mul_overflow_p (n, s, (ptrdiff_t) 1)
50#elif 5 <= __GNUC__ && !defined __ICC && PTRDIFF_MAX < SIZE_MAX 50#elif 5 <= __GNUC__ && !defined __clang__ && !defined __ICC \
51 && PTRDIFF_MAX < SIZE_MAX
51# define xalloc_oversized(n, s) \ 52# define xalloc_oversized(n, s) \
52 (__builtin_constant_p (n) && __builtin_constant_p (s) \ 53 (__builtin_constant_p (n) && __builtin_constant_p (s) \
53 ? __xalloc_oversized (n, s) \ 54 ? __xalloc_oversized (n, s) \