diff options
Diffstat (limited to 'gl/wchar.in.h')
-rw-r--r-- | gl/wchar.in.h | 571 |
1 files changed, 453 insertions, 118 deletions
diff --git a/gl/wchar.in.h b/gl/wchar.in.h index b6e4362..09c9185 100644 --- a/gl/wchar.in.h +++ b/gl/wchar.in.h | |||
@@ -1,25 +1,25 @@ | |||
1 | /* A substitute for ISO C99 <wchar.h>, for platforms that have issues. | 1 | /* A substitute for ISO C99 <wchar.h>, for platforms that have issues. |
2 | 2 | ||
3 | Copyright (C) 2007-2013 Free Software Foundation, Inc. | 3 | Copyright (C) 2007-2023 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU Lesser General Public License as |
7 | the Free Software Foundation; either version 3, or (at your option) | 7 | published by the Free Software Foundation; either version 2.1 of the |
8 | any later version. | 8 | License, or (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This file is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU Lesser General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Lesser General Public License |
16 | along with this program; if not, see <http://www.gnu.org/licenses/>. */ | 16 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
17 | 17 | ||
18 | /* Written by Eric Blake. */ | 18 | /* Written by Eric Blake. */ |
19 | 19 | ||
20 | /* | 20 | /* |
21 | * ISO C 99 <wchar.h> for platforms that have issues. | 21 | * ISO C 99 <wchar.h> for platforms that have issues. |
22 | * <http://www.opengroup.org/susv3xbd/wchar.h.html> | 22 | * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/wchar.h.html> |
23 | * | 23 | * |
24 | * For now, this just ensures proper prerequisite inclusion order and | 24 | * For now, this just ensures proper prerequisite inclusion order and |
25 | * the declaration of wcwidth(). | 25 | * the declaration of wcwidth(). |
@@ -30,15 +30,24 @@ | |||
30 | #endif | 30 | #endif |
31 | @PRAGMA_COLUMNS@ | 31 | @PRAGMA_COLUMNS@ |
32 | 32 | ||
33 | #if defined __need_mbstate_t || defined __need_wint_t || (defined __hpux && ((defined _INTTYPES_INCLUDED && !defined strtoimax) || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) || defined _GL_ALREADY_INCLUDING_WCHAR_H | 33 | #if (((defined __need_mbstate_t || defined __need_wint_t) \ |
34 | && !defined __MINGW32__) \ | ||
35 | || (defined __hpux \ | ||
36 | && ((defined _INTTYPES_INCLUDED \ | ||
37 | && !defined _GL_FINISHED_INCLUDING_SYSTEM_INTTYPES_H) \ | ||
38 | || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) \ | ||
39 | || (defined __MINGW32__ && defined __STRING_H_SOURCED__) \ | ||
40 | || defined _GL_ALREADY_INCLUDING_WCHAR_H) | ||
34 | /* Special invocation convention: | 41 | /* Special invocation convention: |
35 | - Inside glibc and uClibc header files. | 42 | - Inside glibc and uClibc header files, but not MinGW. |
36 | - On HP-UX 11.00 we have a sequence of nested includes | 43 | - On HP-UX 11.00 we have a sequence of nested includes |
37 | <wchar.h> -> <stdlib.h> -> <stdint.h>, and the latter includes <wchar.h>, | 44 | <wchar.h> -> <stdlib.h> -> <stdint.h>, and the latter includes <wchar.h>, |
38 | once indirectly <stdint.h> -> <sys/types.h> -> <inttypes.h> -> <wchar.h> | 45 | once indirectly <stdint.h> -> <sys/types.h> -> <inttypes.h> -> <wchar.h> |
39 | and once directly. In both situations 'wint_t' is not yet defined, | 46 | and once directly. In both situations 'wint_t' is not yet defined, |
40 | therefore we cannot provide the function overrides; instead include only | 47 | therefore we cannot provide the function overrides; instead include only |
41 | the system's <wchar.h>. | 48 | the system's <wchar.h>. |
49 | - With MinGW 3.22, when <string.h> includes <wchar.h>, only some part of | ||
50 | <wchar.h> is actually processed, and that doesn't include 'mbstate_t'. | ||
42 | - On IRIX 6.5, similarly, we have an include <wchar.h> -> <wctype.h>, and | 51 | - On IRIX 6.5, similarly, we have an include <wchar.h> -> <wctype.h>, and |
43 | the latter includes <wchar.h>. But here, we have no way to detect whether | 52 | the latter includes <wchar.h>. But here, we have no way to detect whether |
44 | <wctype.h> is completely included or is still being included. */ | 53 | <wctype.h> is completely included or is still being included. */ |
@@ -56,20 +65,12 @@ | |||
56 | # include <features.h> /* for __GLIBC__ */ | 65 | # include <features.h> /* for __GLIBC__ */ |
57 | #endif | 66 | #endif |
58 | 67 | ||
59 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | 68 | /* In some builds of uClibc, <wchar.h> is nonexistent and wchar_t is defined |
60 | <wchar.h>. | ||
61 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | ||
62 | included before <wchar.h>. | ||
63 | In some builds of uClibc, <wchar.h> is nonexistent and wchar_t is defined | ||
64 | by <stddef.h>. | 69 | by <stddef.h>. |
65 | But avoid namespace pollution on glibc systems. */ | 70 | But avoid namespace pollution on glibc systems. */ |
66 | #if !(defined __GLIBC__ && !defined __UCLIBC__) | 71 | #if !(defined __GLIBC__ && !defined __UCLIBC__) |
67 | # include <stddef.h> | 72 | # include <stddef.h> |
68 | #endif | 73 | #endif |
69 | #ifndef __GLIBC__ | ||
70 | # include <stdio.h> | ||
71 | # include <time.h> | ||
72 | #endif | ||
73 | 74 | ||
74 | /* Include the original <wchar.h> if it exists. | 75 | /* Include the original <wchar.h> if it exists. |
75 | Some builds of uClibc lack it. */ | 76 | Some builds of uClibc lack it. */ |
@@ -83,12 +84,50 @@ | |||
83 | #ifndef _@GUARD_PREFIX@_WCHAR_H | 84 | #ifndef _@GUARD_PREFIX@_WCHAR_H |
84 | #define _@GUARD_PREFIX@_WCHAR_H | 85 | #define _@GUARD_PREFIX@_WCHAR_H |
85 | 86 | ||
87 | /* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers | ||
88 | that can be freed by passing them as the Ith argument to the | ||
89 | function F. */ | ||
90 | #ifndef _GL_ATTRIBUTE_DEALLOC | ||
91 | # if __GNUC__ >= 11 | ||
92 | # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) | ||
93 | # else | ||
94 | # define _GL_ATTRIBUTE_DEALLOC(f, i) | ||
95 | # endif | ||
96 | #endif | ||
97 | |||
98 | /* _GL_ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that | ||
99 | can be freed via 'free'; it can be used only after declaring 'free'. */ | ||
100 | /* Applies to: functions. Cannot be used on inline functions. */ | ||
101 | #ifndef _GL_ATTRIBUTE_DEALLOC_FREE | ||
102 | # if defined __cplusplus && defined __GNUC__ && !defined __clang__ | ||
103 | /* Work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108231> */ | ||
104 | # define _GL_ATTRIBUTE_DEALLOC_FREE \ | ||
105 | _GL_ATTRIBUTE_DEALLOC ((void (*) (void *)) free, 1) | ||
106 | # else | ||
107 | # define _GL_ATTRIBUTE_DEALLOC_FREE \ | ||
108 | _GL_ATTRIBUTE_DEALLOC (free, 1) | ||
109 | # endif | ||
110 | #endif | ||
111 | |||
112 | /* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly | ||
113 | allocated memory. */ | ||
114 | /* Applies to: functions. */ | ||
115 | #ifndef _GL_ATTRIBUTE_MALLOC | ||
116 | # if __GNUC__ >= 3 || defined __clang__ | ||
117 | # define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__)) | ||
118 | # else | ||
119 | # define _GL_ATTRIBUTE_MALLOC | ||
120 | # endif | ||
121 | #endif | ||
122 | |||
86 | /* The __attribute__ feature is available in gcc versions 2.5 and later. | 123 | /* The __attribute__ feature is available in gcc versions 2.5 and later. |
87 | The attribute __pure__ was added in gcc 2.96. */ | 124 | The attribute __pure__ was added in gcc 2.96. */ |
88 | #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) | 125 | #ifndef _GL_ATTRIBUTE_PURE |
89 | # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) | 126 | # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__ |
90 | #else | 127 | # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) |
91 | # define _GL_ATTRIBUTE_PURE /* empty */ | 128 | # else |
129 | # define _GL_ATTRIBUTE_PURE /* empty */ | ||
130 | # endif | ||
92 | #endif | 131 | #endif |
93 | 132 | ||
94 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ | 133 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ |
@@ -105,12 +144,16 @@ | |||
105 | # define WEOF -1 | 144 | # define WEOF -1 |
106 | # endif | 145 | # endif |
107 | #else | 146 | #else |
108 | /* MSVC defines wint_t as 'unsigned short' in <crtdefs.h>. | 147 | /* mingw and MSVC define wint_t as 'unsigned short' in <crtdefs.h> or |
109 | This is too small: ISO C 99 section 7.24.1.(2) says that wint_t must be | 148 | <stddef.h>. This is too small: ISO C 99 section 7.24.1.(2) says that |
110 | "unchanged by default argument promotions". Override it. */ | 149 | wint_t must be "unchanged by default argument promotions". Override it. */ |
111 | # if defined _MSC_VER | 150 | # if @GNULIBHEADERS_OVERRIDE_WINT_T@ |
112 | # if !GNULIB_defined_wint_t | 151 | # if !GNULIB_defined_wint_t |
113 | # include <crtdefs.h> | 152 | # if @HAVE_CRTDEFS_H@ |
153 | # include <crtdefs.h> | ||
154 | # else | ||
155 | # include <stddef.h> | ||
156 | # endif | ||
114 | typedef unsigned int rpl_wint_t; | 157 | typedef unsigned int rpl_wint_t; |
115 | # undef wint_t | 158 | # undef wint_t |
116 | # define wint_t rpl_wint_t | 159 | # define wint_t rpl_wint_t |
@@ -125,16 +168,59 @@ typedef unsigned int rpl_wint_t; | |||
125 | 168 | ||
126 | /* Override mbstate_t if it is too small. | 169 | /* Override mbstate_t if it is too small. |
127 | On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for | 170 | On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for |
128 | implementing mbrtowc for encodings like UTF-8. */ | 171 | implementing mbrtowc for encodings like UTF-8. |
129 | #if !(@HAVE_MBSINIT@ && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@ | 172 | On AIX and MSVC, mbrtowc needs to be overridden, but mbstate_t exists and is |
173 | large enough and overriding it would cause problems in C++ mode. */ | ||
174 | #if !(((defined _WIN32 && !defined __CYGWIN__) || @HAVE_MBSINIT@) && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@ | ||
130 | # if !GNULIB_defined_mbstate_t | 175 | # if !GNULIB_defined_mbstate_t |
176 | # if !(defined _AIX || defined _MSC_VER) | ||
131 | typedef int rpl_mbstate_t; | 177 | typedef int rpl_mbstate_t; |
132 | # undef mbstate_t | 178 | # undef mbstate_t |
133 | # define mbstate_t rpl_mbstate_t | 179 | # define mbstate_t rpl_mbstate_t |
180 | # endif | ||
134 | # define GNULIB_defined_mbstate_t 1 | 181 | # define GNULIB_defined_mbstate_t 1 |
135 | # endif | 182 | # endif |
136 | #endif | 183 | #endif |
137 | 184 | ||
185 | /* Make _GL_ATTRIBUTE_DEALLOC_FREE work, even though <stdlib.h> may not have | ||
186 | been included yet. */ | ||
187 | #if @GNULIB_FREE_POSIX@ | ||
188 | # if (@REPLACE_FREE@ && !defined free \ | ||
189 | && !(defined __cplusplus && defined GNULIB_NAMESPACE)) | ||
190 | /* We can't do '#define free rpl_free' here. */ | ||
191 | _GL_EXTERN_C void rpl_free (void *); | ||
192 | # undef _GL_ATTRIBUTE_DEALLOC_FREE | ||
193 | # define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1) | ||
194 | # else | ||
195 | # if defined _MSC_VER && !defined free | ||
196 | _GL_EXTERN_C | ||
197 | # if defined _DLL | ||
198 | __declspec (dllimport) | ||
199 | # endif | ||
200 | void __cdecl free (void *); | ||
201 | # else | ||
202 | # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) | ||
203 | _GL_EXTERN_C void free (void *) throw (); | ||
204 | # else | ||
205 | _GL_EXTERN_C void free (void *); | ||
206 | # endif | ||
207 | # endif | ||
208 | # endif | ||
209 | #else | ||
210 | # if defined _MSC_VER && !defined free | ||
211 | _GL_EXTERN_C | ||
212 | # if defined _DLL | ||
213 | __declspec (dllimport) | ||
214 | # endif | ||
215 | void __cdecl free (void *); | ||
216 | # else | ||
217 | # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) | ||
218 | _GL_EXTERN_C void free (void *) throw (); | ||
219 | # else | ||
220 | _GL_EXTERN_C void free (void *); | ||
221 | # endif | ||
222 | # endif | ||
223 | #endif | ||
138 | 224 | ||
139 | /* Convert a single-byte character to a wide character. */ | 225 | /* Convert a single-byte character to a wide character. */ |
140 | #if @GNULIB_BTOWC@ | 226 | #if @GNULIB_BTOWC@ |
@@ -149,9 +235,12 @@ _GL_CXXALIAS_RPL (btowc, wint_t, (int c)); | |||
149 | # if !@HAVE_BTOWC@ | 235 | # if !@HAVE_BTOWC@ |
150 | _GL_FUNCDECL_SYS (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE); | 236 | _GL_FUNCDECL_SYS (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE); |
151 | # endif | 237 | # endif |
152 | _GL_CXXALIAS_SYS (btowc, wint_t, (int c)); | 238 | /* Need to cast, because on mingw, the return type is 'unsigned short'. */ |
239 | _GL_CXXALIAS_SYS_CAST (btowc, wint_t, (int c)); | ||
153 | # endif | 240 | # endif |
241 | # if __GLIBC__ >= 2 | ||
154 | _GL_CXXALIASWARN (btowc); | 242 | _GL_CXXALIASWARN (btowc); |
243 | # endif | ||
155 | #elif defined GNULIB_POSIXCHECK | 244 | #elif defined GNULIB_POSIXCHECK |
156 | # undef btowc | 245 | # undef btowc |
157 | # if HAVE_RAW_DECL_BTOWC | 246 | # if HAVE_RAW_DECL_BTOWC |
@@ -177,7 +266,9 @@ _GL_FUNCDECL_SYS (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE); | |||
177 | # endif | 266 | # endif |
178 | _GL_CXXALIAS_SYS (wctob, int, (wint_t wc)); | 267 | _GL_CXXALIAS_SYS (wctob, int, (wint_t wc)); |
179 | # endif | 268 | # endif |
269 | # if __GLIBC__ >= 2 | ||
180 | _GL_CXXALIASWARN (wctob); | 270 | _GL_CXXALIASWARN (wctob); |
271 | # endif | ||
181 | #elif defined GNULIB_POSIXCHECK | 272 | #elif defined GNULIB_POSIXCHECK |
182 | # undef wctob | 273 | # undef wctob |
183 | # if HAVE_RAW_DECL_WCTOB | 274 | # if HAVE_RAW_DECL_WCTOB |
@@ -202,7 +293,9 @@ _GL_FUNCDECL_SYS (mbsinit, int, (const mbstate_t *ps)); | |||
202 | # endif | 293 | # endif |
203 | _GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps)); | 294 | _GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps)); |
204 | # endif | 295 | # endif |
296 | # if __GLIBC__ >= 2 | ||
205 | _GL_CXXALIASWARN (mbsinit); | 297 | _GL_CXXALIASWARN (mbsinit); |
298 | # endif | ||
206 | #elif defined GNULIB_POSIXCHECK | 299 | #elif defined GNULIB_POSIXCHECK |
207 | # undef mbsinit | 300 | # undef mbsinit |
208 | # if HAVE_RAW_DECL_MBSINIT | 301 | # if HAVE_RAW_DECL_MBSINIT |
@@ -220,18 +313,24 @@ _GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - " | |||
220 | # define mbrtowc rpl_mbrtowc | 313 | # define mbrtowc rpl_mbrtowc |
221 | # endif | 314 | # endif |
222 | _GL_FUNCDECL_RPL (mbrtowc, size_t, | 315 | _GL_FUNCDECL_RPL (mbrtowc, size_t, |
223 | (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); | 316 | (wchar_t *restrict pwc, const char *restrict s, size_t n, |
317 | mbstate_t *restrict ps)); | ||
224 | _GL_CXXALIAS_RPL (mbrtowc, size_t, | 318 | _GL_CXXALIAS_RPL (mbrtowc, size_t, |
225 | (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); | 319 | (wchar_t *restrict pwc, const char *restrict s, size_t n, |
320 | mbstate_t *restrict ps)); | ||
226 | # else | 321 | # else |
227 | # if !@HAVE_MBRTOWC@ | 322 | # if !@HAVE_MBRTOWC@ |
228 | _GL_FUNCDECL_SYS (mbrtowc, size_t, | 323 | _GL_FUNCDECL_SYS (mbrtowc, size_t, |
229 | (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); | 324 | (wchar_t *restrict pwc, const char *restrict s, size_t n, |
325 | mbstate_t *restrict ps)); | ||
230 | # endif | 326 | # endif |
231 | _GL_CXXALIAS_SYS (mbrtowc, size_t, | 327 | _GL_CXXALIAS_SYS (mbrtowc, size_t, |
232 | (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); | 328 | (wchar_t *restrict pwc, const char *restrict s, size_t n, |
329 | mbstate_t *restrict ps)); | ||
233 | # endif | 330 | # endif |
331 | # if __GLIBC__ >= 2 | ||
234 | _GL_CXXALIASWARN (mbrtowc); | 332 | _GL_CXXALIASWARN (mbrtowc); |
333 | # endif | ||
235 | #elif defined GNULIB_POSIXCHECK | 334 | #elif defined GNULIB_POSIXCHECK |
236 | # undef mbrtowc | 335 | # undef mbrtowc |
237 | # if HAVE_RAW_DECL_MBRTOWC | 336 | # if HAVE_RAW_DECL_MBRTOWC |
@@ -248,15 +347,21 @@ _GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - " | |||
248 | # undef mbrlen | 347 | # undef mbrlen |
249 | # define mbrlen rpl_mbrlen | 348 | # define mbrlen rpl_mbrlen |
250 | # endif | 349 | # endif |
251 | _GL_FUNCDECL_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); | 350 | _GL_FUNCDECL_RPL (mbrlen, size_t, |
252 | _GL_CXXALIAS_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); | 351 | (const char *restrict s, size_t n, mbstate_t *restrict ps)); |
352 | _GL_CXXALIAS_RPL (mbrlen, size_t, | ||
353 | (const char *restrict s, size_t n, mbstate_t *restrict ps)); | ||
253 | # else | 354 | # else |
254 | # if !@HAVE_MBRLEN@ | 355 | # if !@HAVE_MBRLEN@ |
255 | _GL_FUNCDECL_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); | 356 | _GL_FUNCDECL_SYS (mbrlen, size_t, |
357 | (const char *restrict s, size_t n, mbstate_t *restrict ps)); | ||
256 | # endif | 358 | # endif |
257 | _GL_CXXALIAS_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); | 359 | _GL_CXXALIAS_SYS (mbrlen, size_t, |
360 | (const char *restrict s, size_t n, mbstate_t *restrict ps)); | ||
258 | # endif | 361 | # endif |
362 | # if __GLIBC__ >= 2 | ||
259 | _GL_CXXALIASWARN (mbrlen); | 363 | _GL_CXXALIASWARN (mbrlen); |
364 | # endif | ||
260 | #elif defined GNULIB_POSIXCHECK | 365 | #elif defined GNULIB_POSIXCHECK |
261 | # undef mbrlen | 366 | # undef mbrlen |
262 | # if HAVE_RAW_DECL_MBRLEN | 367 | # if HAVE_RAW_DECL_MBRLEN |
@@ -274,22 +379,30 @@ _GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - " | |||
274 | # define mbsrtowcs rpl_mbsrtowcs | 379 | # define mbsrtowcs rpl_mbsrtowcs |
275 | # endif | 380 | # endif |
276 | _GL_FUNCDECL_RPL (mbsrtowcs, size_t, | 381 | _GL_FUNCDECL_RPL (mbsrtowcs, size_t, |
277 | (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps) | 382 | (wchar_t *restrict dest, |
383 | const char **restrict srcp, size_t len, | ||
384 | mbstate_t *restrict ps) | ||
278 | _GL_ARG_NONNULL ((2))); | 385 | _GL_ARG_NONNULL ((2))); |
279 | _GL_CXXALIAS_RPL (mbsrtowcs, size_t, | 386 | _GL_CXXALIAS_RPL (mbsrtowcs, size_t, |
280 | (wchar_t *dest, const char **srcp, size_t len, | 387 | (wchar_t *restrict dest, |
281 | mbstate_t *ps)); | 388 | const char **restrict srcp, size_t len, |
389 | mbstate_t *restrict ps)); | ||
282 | # else | 390 | # else |
283 | # if !@HAVE_MBSRTOWCS@ | 391 | # if !@HAVE_MBSRTOWCS@ |
284 | _GL_FUNCDECL_SYS (mbsrtowcs, size_t, | 392 | _GL_FUNCDECL_SYS (mbsrtowcs, size_t, |
285 | (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps) | 393 | (wchar_t *restrict dest, |
394 | const char **restrict srcp, size_t len, | ||
395 | mbstate_t *restrict ps) | ||
286 | _GL_ARG_NONNULL ((2))); | 396 | _GL_ARG_NONNULL ((2))); |
287 | # endif | 397 | # endif |
288 | _GL_CXXALIAS_SYS (mbsrtowcs, size_t, | 398 | _GL_CXXALIAS_SYS (mbsrtowcs, size_t, |
289 | (wchar_t *dest, const char **srcp, size_t len, | 399 | (wchar_t *restrict dest, |
290 | mbstate_t *ps)); | 400 | const char **restrict srcp, size_t len, |
401 | mbstate_t *restrict ps)); | ||
291 | # endif | 402 | # endif |
403 | # if __GLIBC__ >= 2 | ||
292 | _GL_CXXALIASWARN (mbsrtowcs); | 404 | _GL_CXXALIASWARN (mbsrtowcs); |
405 | # endif | ||
293 | #elif defined GNULIB_POSIXCHECK | 406 | #elif defined GNULIB_POSIXCHECK |
294 | # undef mbsrtowcs | 407 | # undef mbsrtowcs |
295 | # if HAVE_RAW_DECL_MBSRTOWCS | 408 | # if HAVE_RAW_DECL_MBSRTOWCS |
@@ -307,22 +420,26 @@ _GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - " | |||
307 | # define mbsnrtowcs rpl_mbsnrtowcs | 420 | # define mbsnrtowcs rpl_mbsnrtowcs |
308 | # endif | 421 | # endif |
309 | _GL_FUNCDECL_RPL (mbsnrtowcs, size_t, | 422 | _GL_FUNCDECL_RPL (mbsnrtowcs, size_t, |
310 | (wchar_t *dest, const char **srcp, size_t srclen, size_t len, | 423 | (wchar_t *restrict dest, |
311 | mbstate_t *ps) | 424 | const char **restrict srcp, size_t srclen, size_t len, |
425 | mbstate_t *restrict ps) | ||
312 | _GL_ARG_NONNULL ((2))); | 426 | _GL_ARG_NONNULL ((2))); |
313 | _GL_CXXALIAS_RPL (mbsnrtowcs, size_t, | 427 | _GL_CXXALIAS_RPL (mbsnrtowcs, size_t, |
314 | (wchar_t *dest, const char **srcp, size_t srclen, size_t len, | 428 | (wchar_t *restrict dest, |
315 | mbstate_t *ps)); | 429 | const char **restrict srcp, size_t srclen, size_t len, |
430 | mbstate_t *restrict ps)); | ||
316 | # else | 431 | # else |
317 | # if !@HAVE_MBSNRTOWCS@ | 432 | # if !@HAVE_MBSNRTOWCS@ |
318 | _GL_FUNCDECL_SYS (mbsnrtowcs, size_t, | 433 | _GL_FUNCDECL_SYS (mbsnrtowcs, size_t, |
319 | (wchar_t *dest, const char **srcp, size_t srclen, size_t len, | 434 | (wchar_t *restrict dest, |
320 | mbstate_t *ps) | 435 | const char **restrict srcp, size_t srclen, size_t len, |
436 | mbstate_t *restrict ps) | ||
321 | _GL_ARG_NONNULL ((2))); | 437 | _GL_ARG_NONNULL ((2))); |
322 | # endif | 438 | # endif |
323 | _GL_CXXALIAS_SYS (mbsnrtowcs, size_t, | 439 | _GL_CXXALIAS_SYS (mbsnrtowcs, size_t, |
324 | (wchar_t *dest, const char **srcp, size_t srclen, size_t len, | 440 | (wchar_t *restrict dest, |
325 | mbstate_t *ps)); | 441 | const char **restrict srcp, size_t srclen, size_t len, |
442 | mbstate_t *restrict ps)); | ||
326 | # endif | 443 | # endif |
327 | _GL_CXXALIASWARN (mbsnrtowcs); | 444 | _GL_CXXALIASWARN (mbsnrtowcs); |
328 | #elif defined GNULIB_POSIXCHECK | 445 | #elif defined GNULIB_POSIXCHECK |
@@ -341,15 +458,21 @@ _GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - " | |||
341 | # undef wcrtomb | 458 | # undef wcrtomb |
342 | # define wcrtomb rpl_wcrtomb | 459 | # define wcrtomb rpl_wcrtomb |
343 | # endif | 460 | # endif |
344 | _GL_FUNCDECL_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); | 461 | _GL_FUNCDECL_RPL (wcrtomb, size_t, |
345 | _GL_CXXALIAS_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); | 462 | (char *restrict s, wchar_t wc, mbstate_t *restrict ps)); |
463 | _GL_CXXALIAS_RPL (wcrtomb, size_t, | ||
464 | (char *restrict s, wchar_t wc, mbstate_t *restrict ps)); | ||
346 | # else | 465 | # else |
347 | # if !@HAVE_WCRTOMB@ | 466 | # if !@HAVE_WCRTOMB@ |
348 | _GL_FUNCDECL_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); | 467 | _GL_FUNCDECL_SYS (wcrtomb, size_t, |
468 | (char *restrict s, wchar_t wc, mbstate_t *restrict ps)); | ||
349 | # endif | 469 | # endif |
350 | _GL_CXXALIAS_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); | 470 | _GL_CXXALIAS_SYS (wcrtomb, size_t, |
471 | (char *restrict s, wchar_t wc, mbstate_t *restrict ps)); | ||
351 | # endif | 472 | # endif |
473 | # if __GLIBC__ >= 2 | ||
352 | _GL_CXXALIASWARN (wcrtomb); | 474 | _GL_CXXALIASWARN (wcrtomb); |
475 | # endif | ||
353 | #elif defined GNULIB_POSIXCHECK | 476 | #elif defined GNULIB_POSIXCHECK |
354 | # undef wcrtomb | 477 | # undef wcrtomb |
355 | # if HAVE_RAW_DECL_WCRTOMB | 478 | # if HAVE_RAW_DECL_WCRTOMB |
@@ -367,22 +490,30 @@ _GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - " | |||
367 | # define wcsrtombs rpl_wcsrtombs | 490 | # define wcsrtombs rpl_wcsrtombs |
368 | # endif | 491 | # endif |
369 | _GL_FUNCDECL_RPL (wcsrtombs, size_t, | 492 | _GL_FUNCDECL_RPL (wcsrtombs, size_t, |
370 | (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps) | 493 | (char *restrict dest, const wchar_t **restrict srcp, |
494 | size_t len, | ||
495 | mbstate_t *restrict ps) | ||
371 | _GL_ARG_NONNULL ((2))); | 496 | _GL_ARG_NONNULL ((2))); |
372 | _GL_CXXALIAS_RPL (wcsrtombs, size_t, | 497 | _GL_CXXALIAS_RPL (wcsrtombs, size_t, |
373 | (char *dest, const wchar_t **srcp, size_t len, | 498 | (char *restrict dest, const wchar_t **restrict srcp, |
374 | mbstate_t *ps)); | 499 | size_t len, |
500 | mbstate_t *restrict ps)); | ||
375 | # else | 501 | # else |
376 | # if !@HAVE_WCSRTOMBS@ | 502 | # if !@HAVE_WCSRTOMBS@ |
377 | _GL_FUNCDECL_SYS (wcsrtombs, size_t, | 503 | _GL_FUNCDECL_SYS (wcsrtombs, size_t, |
378 | (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps) | 504 | (char *restrict dest, const wchar_t **restrict srcp, |
505 | size_t len, | ||
506 | mbstate_t *restrict ps) | ||
379 | _GL_ARG_NONNULL ((2))); | 507 | _GL_ARG_NONNULL ((2))); |
380 | # endif | 508 | # endif |
381 | _GL_CXXALIAS_SYS (wcsrtombs, size_t, | 509 | _GL_CXXALIAS_SYS (wcsrtombs, size_t, |
382 | (char *dest, const wchar_t **srcp, size_t len, | 510 | (char *restrict dest, const wchar_t **restrict srcp, |
383 | mbstate_t *ps)); | 511 | size_t len, |
512 | mbstate_t *restrict ps)); | ||
384 | # endif | 513 | # endif |
514 | # if __GLIBC__ >= 2 | ||
385 | _GL_CXXALIASWARN (wcsrtombs); | 515 | _GL_CXXALIASWARN (wcsrtombs); |
516 | # endif | ||
386 | #elif defined GNULIB_POSIXCHECK | 517 | #elif defined GNULIB_POSIXCHECK |
387 | # undef wcsrtombs | 518 | # undef wcsrtombs |
388 | # if HAVE_RAW_DECL_WCSRTOMBS | 519 | # if HAVE_RAW_DECL_WCSRTOMBS |
@@ -400,24 +531,34 @@ _GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - " | |||
400 | # define wcsnrtombs rpl_wcsnrtombs | 531 | # define wcsnrtombs rpl_wcsnrtombs |
401 | # endif | 532 | # endif |
402 | _GL_FUNCDECL_RPL (wcsnrtombs, size_t, | 533 | _GL_FUNCDECL_RPL (wcsnrtombs, size_t, |
403 | (char *dest, const wchar_t **srcp, size_t srclen, size_t len, | 534 | (char *restrict dest, |
404 | mbstate_t *ps) | 535 | const wchar_t **restrict srcp, size_t srclen, |
536 | size_t len, | ||
537 | mbstate_t *restrict ps) | ||
405 | _GL_ARG_NONNULL ((2))); | 538 | _GL_ARG_NONNULL ((2))); |
406 | _GL_CXXALIAS_RPL (wcsnrtombs, size_t, | 539 | _GL_CXXALIAS_RPL (wcsnrtombs, size_t, |
407 | (char *dest, const wchar_t **srcp, size_t srclen, size_t len, | 540 | (char *restrict dest, |
408 | mbstate_t *ps)); | 541 | const wchar_t **restrict srcp, size_t srclen, |
542 | size_t len, | ||
543 | mbstate_t *restrict ps)); | ||
409 | # else | 544 | # else |
410 | # if !@HAVE_WCSNRTOMBS@ | 545 | # if !@HAVE_WCSNRTOMBS@ || (defined __cplusplus && defined __sun) |
411 | _GL_FUNCDECL_SYS (wcsnrtombs, size_t, | 546 | _GL_FUNCDECL_SYS (wcsnrtombs, size_t, |
412 | (char *dest, const wchar_t **srcp, size_t srclen, size_t len, | 547 | (char *restrict dest, |
413 | mbstate_t *ps) | 548 | const wchar_t **restrict srcp, size_t srclen, |
549 | size_t len, | ||
550 | mbstate_t *restrict ps) | ||
414 | _GL_ARG_NONNULL ((2))); | 551 | _GL_ARG_NONNULL ((2))); |
415 | # endif | 552 | # endif |
416 | _GL_CXXALIAS_SYS (wcsnrtombs, size_t, | 553 | _GL_CXXALIAS_SYS (wcsnrtombs, size_t, |
417 | (char *dest, const wchar_t **srcp, size_t srclen, size_t len, | 554 | (char *restrict dest, |
418 | mbstate_t *ps)); | 555 | const wchar_t **restrict srcp, size_t srclen, |
556 | size_t len, | ||
557 | mbstate_t *restrict ps)); | ||
419 | # endif | 558 | # endif |
559 | # if __GLIBC__ >= 2 | ||
420 | _GL_CXXALIASWARN (wcsnrtombs); | 560 | _GL_CXXALIASWARN (wcsnrtombs); |
561 | # endif | ||
421 | #elif defined GNULIB_POSIXCHECK | 562 | #elif defined GNULIB_POSIXCHECK |
422 | # undef wcsnrtombs | 563 | # undef wcsnrtombs |
423 | # if HAVE_RAW_DECL_WCSNRTOMBS | 564 | # if HAVE_RAW_DECL_WCSNRTOMBS |
@@ -443,7 +584,9 @@ _GL_FUNCDECL_SYS (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE); | |||
443 | # endif | 584 | # endif |
444 | _GL_CXXALIAS_SYS (wcwidth, int, (wchar_t)); | 585 | _GL_CXXALIAS_SYS (wcwidth, int, (wchar_t)); |
445 | # endif | 586 | # endif |
587 | # if __GLIBC__ >= 2 | ||
446 | _GL_CXXALIASWARN (wcwidth); | 588 | _GL_CXXALIASWARN (wcwidth); |
589 | # endif | ||
447 | #elif defined GNULIB_POSIXCHECK | 590 | #elif defined GNULIB_POSIXCHECK |
448 | # undef wcwidth | 591 | # undef wcwidth |
449 | # if HAVE_RAW_DECL_WCWIDTH | 592 | # if HAVE_RAW_DECL_WCWIDTH |
@@ -472,7 +615,7 @@ _GL_CXXALIAS_SYS_CAST2 (wmemchr, | |||
472 | _GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); | 615 | _GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); |
473 | _GL_CXXALIASWARN1 (wmemchr, const wchar_t *, | 616 | _GL_CXXALIASWARN1 (wmemchr, const wchar_t *, |
474 | (const wchar_t *s, wchar_t c, size_t n)); | 617 | (const wchar_t *s, wchar_t c, size_t n)); |
475 | # else | 618 | # elif __GLIBC__ >= 2 |
476 | _GL_CXXALIASWARN (wmemchr); | 619 | _GL_CXXALIASWARN (wmemchr); |
477 | # endif | 620 | # endif |
478 | #elif defined GNULIB_POSIXCHECK | 621 | #elif defined GNULIB_POSIXCHECK |
@@ -493,7 +636,9 @@ _GL_FUNCDECL_SYS (wmemcmp, int, | |||
493 | # endif | 636 | # endif |
494 | _GL_CXXALIAS_SYS (wmemcmp, int, | 637 | _GL_CXXALIAS_SYS (wmemcmp, int, |
495 | (const wchar_t *s1, const wchar_t *s2, size_t n)); | 638 | (const wchar_t *s1, const wchar_t *s2, size_t n)); |
639 | # if __GLIBC__ >= 2 | ||
496 | _GL_CXXALIASWARN (wmemcmp); | 640 | _GL_CXXALIASWARN (wmemcmp); |
641 | # endif | ||
497 | #elif defined GNULIB_POSIXCHECK | 642 | #elif defined GNULIB_POSIXCHECK |
498 | # undef wmemcmp | 643 | # undef wmemcmp |
499 | # if HAVE_RAW_DECL_WMEMCMP | 644 | # if HAVE_RAW_DECL_WMEMCMP |
@@ -507,11 +652,15 @@ _GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - " | |||
507 | #if @GNULIB_WMEMCPY@ | 652 | #if @GNULIB_WMEMCPY@ |
508 | # if !@HAVE_WMEMCPY@ | 653 | # if !@HAVE_WMEMCPY@ |
509 | _GL_FUNCDECL_SYS (wmemcpy, wchar_t *, | 654 | _GL_FUNCDECL_SYS (wmemcpy, wchar_t *, |
510 | (wchar_t *dest, const wchar_t *src, size_t n)); | 655 | (wchar_t *restrict dest, |
656 | const wchar_t *restrict src, size_t n)); | ||
511 | # endif | 657 | # endif |
512 | _GL_CXXALIAS_SYS (wmemcpy, wchar_t *, | 658 | _GL_CXXALIAS_SYS (wmemcpy, wchar_t *, |
513 | (wchar_t *dest, const wchar_t *src, size_t n)); | 659 | (wchar_t *restrict dest, |
660 | const wchar_t *restrict src, size_t n)); | ||
661 | # if __GLIBC__ >= 2 | ||
514 | _GL_CXXALIASWARN (wmemcpy); | 662 | _GL_CXXALIASWARN (wmemcpy); |
663 | # endif | ||
515 | #elif defined GNULIB_POSIXCHECK | 664 | #elif defined GNULIB_POSIXCHECK |
516 | # undef wmemcpy | 665 | # undef wmemcpy |
517 | # if HAVE_RAW_DECL_WMEMCPY | 666 | # if HAVE_RAW_DECL_WMEMCPY |
@@ -530,7 +679,9 @@ _GL_FUNCDECL_SYS (wmemmove, wchar_t *, | |||
530 | # endif | 679 | # endif |
531 | _GL_CXXALIAS_SYS (wmemmove, wchar_t *, | 680 | _GL_CXXALIAS_SYS (wmemmove, wchar_t *, |
532 | (wchar_t *dest, const wchar_t *src, size_t n)); | 681 | (wchar_t *dest, const wchar_t *src, size_t n)); |
682 | # if __GLIBC__ >= 2 | ||
533 | _GL_CXXALIASWARN (wmemmove); | 683 | _GL_CXXALIASWARN (wmemmove); |
684 | # endif | ||
534 | #elif defined GNULIB_POSIXCHECK | 685 | #elif defined GNULIB_POSIXCHECK |
535 | # undef wmemmove | 686 | # undef wmemmove |
536 | # if HAVE_RAW_DECL_WMEMMOVE | 687 | # if HAVE_RAW_DECL_WMEMMOVE |
@@ -540,13 +691,38 @@ _GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - " | |||
540 | #endif | 691 | #endif |
541 | 692 | ||
542 | 693 | ||
694 | /* Copy N wide characters of SRC to DEST. | ||
695 | Return pointer to wide characters after the last written wide character. */ | ||
696 | #if @GNULIB_WMEMPCPY@ | ||
697 | # if !@HAVE_WMEMPCPY@ | ||
698 | _GL_FUNCDECL_SYS (wmempcpy, wchar_t *, | ||
699 | (wchar_t *restrict dest, | ||
700 | const wchar_t *restrict src, size_t n)); | ||
701 | # endif | ||
702 | _GL_CXXALIAS_SYS (wmempcpy, wchar_t *, | ||
703 | (wchar_t *restrict dest, | ||
704 | const wchar_t *restrict src, size_t n)); | ||
705 | # if __GLIBC__ >= 2 | ||
706 | _GL_CXXALIASWARN (wmempcpy); | ||
707 | # endif | ||
708 | #elif defined GNULIB_POSIXCHECK | ||
709 | # undef wmempcpy | ||
710 | # if HAVE_RAW_DECL_WMEMPCPY | ||
711 | _GL_WARN_ON_USE (wmempcpy, "wmempcpy is unportable - " | ||
712 | "use gnulib module wmempcpy for portability"); | ||
713 | # endif | ||
714 | #endif | ||
715 | |||
716 | |||
543 | /* Set N wide characters of S to C. */ | 717 | /* Set N wide characters of S to C. */ |
544 | #if @GNULIB_WMEMSET@ | 718 | #if @GNULIB_WMEMSET@ |
545 | # if !@HAVE_WMEMSET@ | 719 | # if !@HAVE_WMEMSET@ |
546 | _GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); | 720 | _GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); |
547 | # endif | 721 | # endif |
548 | _GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); | 722 | _GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); |
723 | # if __GLIBC__ >= 2 | ||
549 | _GL_CXXALIASWARN (wmemset); | 724 | _GL_CXXALIASWARN (wmemset); |
725 | # endif | ||
550 | #elif defined GNULIB_POSIXCHECK | 726 | #elif defined GNULIB_POSIXCHECK |
551 | # undef wmemset | 727 | # undef wmemset |
552 | # if HAVE_RAW_DECL_WMEMSET | 728 | # if HAVE_RAW_DECL_WMEMSET |
@@ -562,7 +738,9 @@ _GL_WARN_ON_USE (wmemset, "wmemset is unportable - " | |||
562 | _GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s) _GL_ATTRIBUTE_PURE); | 738 | _GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s) _GL_ATTRIBUTE_PURE); |
563 | # endif | 739 | # endif |
564 | _GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s)); | 740 | _GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s)); |
741 | # if __GLIBC__ >= 2 | ||
565 | _GL_CXXALIASWARN (wcslen); | 742 | _GL_CXXALIASWARN (wcslen); |
743 | # endif | ||
566 | #elif defined GNULIB_POSIXCHECK | 744 | #elif defined GNULIB_POSIXCHECK |
567 | # undef wcslen | 745 | # undef wcslen |
568 | # if HAVE_RAW_DECL_WCSLEN | 746 | # if HAVE_RAW_DECL_WCSLEN |
@@ -574,7 +752,10 @@ _GL_WARN_ON_USE (wcslen, "wcslen is unportable - " | |||
574 | 752 | ||
575 | /* Return the number of wide characters in S, but at most MAXLEN. */ | 753 | /* Return the number of wide characters in S, but at most MAXLEN. */ |
576 | #if @GNULIB_WCSNLEN@ | 754 | #if @GNULIB_WCSNLEN@ |
577 | # if !@HAVE_WCSNLEN@ | 755 | /* On Solaris 11.3, the header files declare the function in the std:: |
756 | namespace, not in the global namespace. So, force a declaration in | ||
757 | the global namespace. */ | ||
758 | # if !@HAVE_WCSNLEN@ || (defined __sun && defined __cplusplus) | ||
578 | _GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen) | 759 | _GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen) |
579 | _GL_ATTRIBUTE_PURE); | 760 | _GL_ATTRIBUTE_PURE); |
580 | # endif | 761 | # endif |
@@ -592,10 +773,14 @@ _GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - " | |||
592 | /* Copy SRC to DEST. */ | 773 | /* Copy SRC to DEST. */ |
593 | #if @GNULIB_WCSCPY@ | 774 | #if @GNULIB_WCSCPY@ |
594 | # if !@HAVE_WCSCPY@ | 775 | # if !@HAVE_WCSCPY@ |
595 | _GL_FUNCDECL_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src)); | 776 | _GL_FUNCDECL_SYS (wcscpy, wchar_t *, |
777 | (wchar_t *restrict dest, const wchar_t *restrict src)); | ||
596 | # endif | 778 | # endif |
597 | _GL_CXXALIAS_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src)); | 779 | _GL_CXXALIAS_SYS (wcscpy, wchar_t *, |
780 | (wchar_t *restrict dest, const wchar_t *restrict src)); | ||
781 | # if __GLIBC__ >= 2 | ||
598 | _GL_CXXALIASWARN (wcscpy); | 782 | _GL_CXXALIASWARN (wcscpy); |
783 | # endif | ||
599 | #elif defined GNULIB_POSIXCHECK | 784 | #elif defined GNULIB_POSIXCHECK |
600 | # undef wcscpy | 785 | # undef wcscpy |
601 | # if HAVE_RAW_DECL_WCSCPY | 786 | # if HAVE_RAW_DECL_WCSCPY |
@@ -607,10 +792,15 @@ _GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - " | |||
607 | 792 | ||
608 | /* Copy SRC to DEST, returning the address of the terminating L'\0' in DEST. */ | 793 | /* Copy SRC to DEST, returning the address of the terminating L'\0' in DEST. */ |
609 | #if @GNULIB_WCPCPY@ | 794 | #if @GNULIB_WCPCPY@ |
610 | # if !@HAVE_WCPCPY@ | 795 | /* On Solaris 11.3, the header files declare the function in the std:: |
611 | _GL_FUNCDECL_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src)); | 796 | namespace, not in the global namespace. So, force a declaration in |
612 | # endif | 797 | the global namespace. */ |
613 | _GL_CXXALIAS_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src)); | 798 | # if !@HAVE_WCPCPY@ || (defined __sun && defined __cplusplus) |
799 | _GL_FUNCDECL_SYS (wcpcpy, wchar_t *, | ||
800 | (wchar_t *restrict dest, const wchar_t *restrict src)); | ||
801 | # endif | ||
802 | _GL_CXXALIAS_SYS (wcpcpy, wchar_t *, | ||
803 | (wchar_t *restrict dest, const wchar_t *restrict src)); | ||
614 | _GL_CXXALIASWARN (wcpcpy); | 804 | _GL_CXXALIASWARN (wcpcpy); |
615 | #elif defined GNULIB_POSIXCHECK | 805 | #elif defined GNULIB_POSIXCHECK |
616 | # undef wcpcpy | 806 | # undef wcpcpy |
@@ -625,11 +815,15 @@ _GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - " | |||
625 | #if @GNULIB_WCSNCPY@ | 815 | #if @GNULIB_WCSNCPY@ |
626 | # if !@HAVE_WCSNCPY@ | 816 | # if !@HAVE_WCSNCPY@ |
627 | _GL_FUNCDECL_SYS (wcsncpy, wchar_t *, | 817 | _GL_FUNCDECL_SYS (wcsncpy, wchar_t *, |
628 | (wchar_t *dest, const wchar_t *src, size_t n)); | 818 | (wchar_t *restrict dest, |
819 | const wchar_t *restrict src, size_t n)); | ||
629 | # endif | 820 | # endif |
630 | _GL_CXXALIAS_SYS (wcsncpy, wchar_t *, | 821 | _GL_CXXALIAS_SYS (wcsncpy, wchar_t *, |
631 | (wchar_t *dest, const wchar_t *src, size_t n)); | 822 | (wchar_t *restrict dest, |
823 | const wchar_t *restrict src, size_t n)); | ||
824 | # if __GLIBC__ >= 2 | ||
632 | _GL_CXXALIASWARN (wcsncpy); | 825 | _GL_CXXALIASWARN (wcsncpy); |
826 | # endif | ||
633 | #elif defined GNULIB_POSIXCHECK | 827 | #elif defined GNULIB_POSIXCHECK |
634 | # undef wcsncpy | 828 | # undef wcsncpy |
635 | # if HAVE_RAW_DECL_WCSNCPY | 829 | # if HAVE_RAW_DECL_WCSNCPY |
@@ -642,12 +836,17 @@ _GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - " | |||
642 | /* Copy no more than N characters of SRC to DEST, returning the address of | 836 | /* Copy no more than N characters of SRC to DEST, returning the address of |
643 | the last character written into DEST. */ | 837 | the last character written into DEST. */ |
644 | #if @GNULIB_WCPNCPY@ | 838 | #if @GNULIB_WCPNCPY@ |
645 | # if !@HAVE_WCPNCPY@ | 839 | /* On Solaris 11.3, the header files declare the function in the std:: |
840 | namespace, not in the global namespace. So, force a declaration in | ||
841 | the global namespace. */ | ||
842 | # if !@HAVE_WCPNCPY@ || (defined __sun && defined __cplusplus) | ||
646 | _GL_FUNCDECL_SYS (wcpncpy, wchar_t *, | 843 | _GL_FUNCDECL_SYS (wcpncpy, wchar_t *, |
647 | (wchar_t *dest, const wchar_t *src, size_t n)); | 844 | (wchar_t *restrict dest, |
845 | const wchar_t *restrict src, size_t n)); | ||
648 | # endif | 846 | # endif |
649 | _GL_CXXALIAS_SYS (wcpncpy, wchar_t *, | 847 | _GL_CXXALIAS_SYS (wcpncpy, wchar_t *, |
650 | (wchar_t *dest, const wchar_t *src, size_t n)); | 848 | (wchar_t *restrict dest, |
849 | const wchar_t *restrict src, size_t n)); | ||
651 | _GL_CXXALIASWARN (wcpncpy); | 850 | _GL_CXXALIASWARN (wcpncpy); |
652 | #elif defined GNULIB_POSIXCHECK | 851 | #elif defined GNULIB_POSIXCHECK |
653 | # undef wcpncpy | 852 | # undef wcpncpy |
@@ -661,10 +860,14 @@ _GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - " | |||
661 | /* Append SRC onto DEST. */ | 860 | /* Append SRC onto DEST. */ |
662 | #if @GNULIB_WCSCAT@ | 861 | #if @GNULIB_WCSCAT@ |
663 | # if !@HAVE_WCSCAT@ | 862 | # if !@HAVE_WCSCAT@ |
664 | _GL_FUNCDECL_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src)); | 863 | _GL_FUNCDECL_SYS (wcscat, wchar_t *, |
864 | (wchar_t *restrict dest, const wchar_t *restrict src)); | ||
665 | # endif | 865 | # endif |
666 | _GL_CXXALIAS_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src)); | 866 | _GL_CXXALIAS_SYS (wcscat, wchar_t *, |
867 | (wchar_t *restrict dest, const wchar_t *restrict src)); | ||
868 | # if __GLIBC__ >= 2 | ||
667 | _GL_CXXALIASWARN (wcscat); | 869 | _GL_CXXALIASWARN (wcscat); |
870 | # endif | ||
668 | #elif defined GNULIB_POSIXCHECK | 871 | #elif defined GNULIB_POSIXCHECK |
669 | # undef wcscat | 872 | # undef wcscat |
670 | # if HAVE_RAW_DECL_WCSCAT | 873 | # if HAVE_RAW_DECL_WCSCAT |
@@ -678,11 +881,15 @@ _GL_WARN_ON_USE (wcscat, "wcscat is unportable - " | |||
678 | #if @GNULIB_WCSNCAT@ | 881 | #if @GNULIB_WCSNCAT@ |
679 | # if !@HAVE_WCSNCAT@ | 882 | # if !@HAVE_WCSNCAT@ |
680 | _GL_FUNCDECL_SYS (wcsncat, wchar_t *, | 883 | _GL_FUNCDECL_SYS (wcsncat, wchar_t *, |
681 | (wchar_t *dest, const wchar_t *src, size_t n)); | 884 | (wchar_t *restrict dest, const wchar_t *restrict src, |
885 | size_t n)); | ||
682 | # endif | 886 | # endif |
683 | _GL_CXXALIAS_SYS (wcsncat, wchar_t *, | 887 | _GL_CXXALIAS_SYS (wcsncat, wchar_t *, |
684 | (wchar_t *dest, const wchar_t *src, size_t n)); | 888 | (wchar_t *restrict dest, const wchar_t *restrict src, |
889 | size_t n)); | ||
890 | # if __GLIBC__ >= 2 | ||
685 | _GL_CXXALIASWARN (wcsncat); | 891 | _GL_CXXALIASWARN (wcsncat); |
892 | # endif | ||
686 | #elif defined GNULIB_POSIXCHECK | 893 | #elif defined GNULIB_POSIXCHECK |
687 | # undef wcsncat | 894 | # undef wcsncat |
688 | # if HAVE_RAW_DECL_WCSNCAT | 895 | # if HAVE_RAW_DECL_WCSNCAT |
@@ -699,7 +906,9 @@ _GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2) | |||
699 | _GL_ATTRIBUTE_PURE); | 906 | _GL_ATTRIBUTE_PURE); |
700 | # endif | 907 | # endif |
701 | _GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)); | 908 | _GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)); |
909 | # if __GLIBC__ >= 2 | ||
702 | _GL_CXXALIASWARN (wcscmp); | 910 | _GL_CXXALIASWARN (wcscmp); |
911 | # endif | ||
703 | #elif defined GNULIB_POSIXCHECK | 912 | #elif defined GNULIB_POSIXCHECK |
704 | # undef wcscmp | 913 | # undef wcscmp |
705 | # if HAVE_RAW_DECL_WCSCMP | 914 | # if HAVE_RAW_DECL_WCSCMP |
@@ -718,7 +927,9 @@ _GL_FUNCDECL_SYS (wcsncmp, int, | |||
718 | # endif | 927 | # endif |
719 | _GL_CXXALIAS_SYS (wcsncmp, int, | 928 | _GL_CXXALIAS_SYS (wcsncmp, int, |
720 | (const wchar_t *s1, const wchar_t *s2, size_t n)); | 929 | (const wchar_t *s1, const wchar_t *s2, size_t n)); |
930 | # if __GLIBC__ >= 2 | ||
721 | _GL_CXXALIASWARN (wcsncmp); | 931 | _GL_CXXALIASWARN (wcsncmp); |
932 | # endif | ||
722 | #elif defined GNULIB_POSIXCHECK | 933 | #elif defined GNULIB_POSIXCHECK |
723 | # undef wcsncmp | 934 | # undef wcsncmp |
724 | # if HAVE_RAW_DECL_WCSNCMP | 935 | # if HAVE_RAW_DECL_WCSNCMP |
@@ -730,7 +941,10 @@ _GL_WARN_ON_USE (wcsncmp, "wcsncmp is unportable - " | |||
730 | 941 | ||
731 | /* Compare S1 and S2, ignoring case. */ | 942 | /* Compare S1 and S2, ignoring case. */ |
732 | #if @GNULIB_WCSCASECMP@ | 943 | #if @GNULIB_WCSCASECMP@ |
733 | # if !@HAVE_WCSCASECMP@ | 944 | /* On Solaris 11.3, the header files declare the function in the std:: |
945 | namespace, not in the global namespace. So, force a declaration in | ||
946 | the global namespace. */ | ||
947 | # if !@HAVE_WCSCASECMP@ || (defined __sun && defined __cplusplus) | ||
734 | _GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2) | 948 | _GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2) |
735 | _GL_ATTRIBUTE_PURE); | 949 | _GL_ATTRIBUTE_PURE); |
736 | # endif | 950 | # endif |
@@ -747,7 +961,10 @@ _GL_WARN_ON_USE (wcscasecmp, "wcscasecmp is unportable - " | |||
747 | 961 | ||
748 | /* Compare no more than N chars of S1 and S2, ignoring case. */ | 962 | /* Compare no more than N chars of S1 and S2, ignoring case. */ |
749 | #if @GNULIB_WCSNCASECMP@ | 963 | #if @GNULIB_WCSNCASECMP@ |
750 | # if !@HAVE_WCSNCASECMP@ | 964 | /* On Solaris 11.3, the header files declare the function in the std:: |
965 | namespace, not in the global namespace. So, force a declaration in | ||
966 | the global namespace. */ | ||
967 | # if !@HAVE_WCSNCASECMP@ || (defined __sun && defined __cplusplus) | ||
751 | _GL_FUNCDECL_SYS (wcsncasecmp, int, | 968 | _GL_FUNCDECL_SYS (wcsncasecmp, int, |
752 | (const wchar_t *s1, const wchar_t *s2, size_t n) | 969 | (const wchar_t *s1, const wchar_t *s2, size_t n) |
753 | _GL_ATTRIBUTE_PURE); | 970 | _GL_ATTRIBUTE_PURE); |
@@ -771,7 +988,9 @@ _GL_WARN_ON_USE (wcsncasecmp, "wcsncasecmp is unportable - " | |||
771 | _GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2)); | 988 | _GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2)); |
772 | # endif | 989 | # endif |
773 | _GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2)); | 990 | _GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2)); |
991 | # if __GLIBC__ >= 2 | ||
774 | _GL_CXXALIASWARN (wcscoll); | 992 | _GL_CXXALIASWARN (wcscoll); |
993 | # endif | ||
775 | #elif defined GNULIB_POSIXCHECK | 994 | #elif defined GNULIB_POSIXCHECK |
776 | # undef wcscoll | 995 | # undef wcscoll |
777 | # if HAVE_RAW_DECL_WCSCOLL | 996 | # if HAVE_RAW_DECL_WCSCOLL |
@@ -786,10 +1005,14 @@ _GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - " | |||
786 | original strings. */ | 1005 | original strings. */ |
787 | #if @GNULIB_WCSXFRM@ | 1006 | #if @GNULIB_WCSXFRM@ |
788 | # if !@HAVE_WCSXFRM@ | 1007 | # if !@HAVE_WCSXFRM@ |
789 | _GL_FUNCDECL_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n)); | 1008 | _GL_FUNCDECL_SYS (wcsxfrm, size_t, |
1009 | (wchar_t *restrict s1, const wchar_t *restrict s2, size_t n)); | ||
790 | # endif | 1010 | # endif |
791 | _GL_CXXALIAS_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n)); | 1011 | _GL_CXXALIAS_SYS (wcsxfrm, size_t, |
1012 | (wchar_t *restrict s1, const wchar_t *restrict s2, size_t n)); | ||
1013 | # if __GLIBC__ >= 2 | ||
792 | _GL_CXXALIASWARN (wcsxfrm); | 1014 | _GL_CXXALIASWARN (wcsxfrm); |
1015 | # endif | ||
793 | #elif defined GNULIB_POSIXCHECK | 1016 | #elif defined GNULIB_POSIXCHECK |
794 | # undef wcsxfrm | 1017 | # undef wcsxfrm |
795 | # if HAVE_RAW_DECL_WCSXFRM | 1018 | # if HAVE_RAW_DECL_WCSXFRM |
@@ -801,16 +1024,58 @@ _GL_WARN_ON_USE (wcsxfrm, "wcsxfrm is unportable - " | |||
801 | 1024 | ||
802 | /* Duplicate S, returning an identical malloc'd string. */ | 1025 | /* Duplicate S, returning an identical malloc'd string. */ |
803 | #if @GNULIB_WCSDUP@ | 1026 | #if @GNULIB_WCSDUP@ |
804 | # if !@HAVE_WCSDUP@ | 1027 | # if defined _WIN32 && !defined __CYGWIN__ |
805 | _GL_FUNCDECL_SYS (wcsdup, wchar_t *, (const wchar_t *s)); | 1028 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
806 | # endif | 1029 | # undef wcsdup |
1030 | # define wcsdup _wcsdup | ||
1031 | # endif | ||
1032 | _GL_CXXALIAS_MDA (wcsdup, wchar_t *, (const wchar_t *s)); | ||
1033 | # else | ||
1034 | /* On Solaris 11.3, the header files declare the function in the std:: | ||
1035 | namespace, not in the global namespace. So, force a declaration in | ||
1036 | the global namespace. */ | ||
1037 | # if !@HAVE_WCSDUP@ || (defined __sun && defined __cplusplus) || __GNUC__ >= 11 | ||
1038 | _GL_FUNCDECL_SYS (wcsdup, wchar_t *, | ||
1039 | (const wchar_t *s) | ||
1040 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
1041 | # endif | ||
807 | _GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s)); | 1042 | _GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s)); |
1043 | # endif | ||
808 | _GL_CXXALIASWARN (wcsdup); | 1044 | _GL_CXXALIASWARN (wcsdup); |
809 | #elif defined GNULIB_POSIXCHECK | 1045 | #else |
810 | # undef wcsdup | 1046 | # if __GNUC__ >= 11 && !defined wcsdup |
811 | # if HAVE_RAW_DECL_WCSDUP | 1047 | /* For -Wmismatched-dealloc: Associate wcsdup with free or rpl_free. */ |
1048 | _GL_FUNCDECL_SYS (wcsdup, wchar_t *, | ||
1049 | (const wchar_t *s) | ||
1050 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
1051 | # endif | ||
1052 | # if defined GNULIB_POSIXCHECK | ||
1053 | # undef wcsdup | ||
1054 | # if HAVE_RAW_DECL_WCSDUP | ||
812 | _GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - " | 1055 | _GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - " |
813 | "use gnulib module wcsdup for portability"); | 1056 | "use gnulib module wcsdup for portability"); |
1057 | # endif | ||
1058 | # elif @GNULIB_MDA_WCSDUP@ | ||
1059 | /* On native Windows, map 'wcsdup' to '_wcsdup', so that -loldnames is not | ||
1060 | required. In C++ with GNULIB_NAMESPACE, avoid differences between | ||
1061 | platforms by defining GNULIB_NAMESPACE::wcsdup always. */ | ||
1062 | # if defined _WIN32 && !defined __CYGWIN__ | ||
1063 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
1064 | # undef wcsdup | ||
1065 | # define wcsdup _wcsdup | ||
1066 | # endif | ||
1067 | _GL_CXXALIAS_MDA (wcsdup, wchar_t *, (const wchar_t *s)); | ||
1068 | # else | ||
1069 | _GL_FUNCDECL_SYS (wcsdup, wchar_t *, | ||
1070 | (const wchar_t *s) | ||
1071 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); | ||
1072 | # if @HAVE_DECL_WCSDUP@ | ||
1073 | _GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s)); | ||
1074 | # endif | ||
1075 | # endif | ||
1076 | # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_WCSDUP@ | ||
1077 | _GL_CXXALIASWARN (wcsdup); | ||
1078 | # endif | ||
814 | # endif | 1079 | # endif |
815 | #endif | 1080 | #endif |
816 | 1081 | ||
@@ -833,7 +1098,7 @@ _GL_CXXALIAS_SYS_CAST2 (wcschr, | |||
833 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) | 1098 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) |
834 | _GL_CXXALIASWARN1 (wcschr, wchar_t *, (wchar_t *wcs, wchar_t wc)); | 1099 | _GL_CXXALIASWARN1 (wcschr, wchar_t *, (wchar_t *wcs, wchar_t wc)); |
835 | _GL_CXXALIASWARN1 (wcschr, const wchar_t *, (const wchar_t *wcs, wchar_t wc)); | 1100 | _GL_CXXALIASWARN1 (wcschr, const wchar_t *, (const wchar_t *wcs, wchar_t wc)); |
836 | # else | 1101 | # elif __GLIBC__ >= 2 |
837 | _GL_CXXALIASWARN (wcschr); | 1102 | _GL_CXXALIASWARN (wcschr); |
838 | # endif | 1103 | # endif |
839 | #elif defined GNULIB_POSIXCHECK | 1104 | #elif defined GNULIB_POSIXCHECK |
@@ -863,7 +1128,7 @@ _GL_CXXALIAS_SYS_CAST2 (wcsrchr, | |||
863 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) | 1128 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) |
864 | _GL_CXXALIASWARN1 (wcsrchr, wchar_t *, (wchar_t *wcs, wchar_t wc)); | 1129 | _GL_CXXALIASWARN1 (wcsrchr, wchar_t *, (wchar_t *wcs, wchar_t wc)); |
865 | _GL_CXXALIASWARN1 (wcsrchr, const wchar_t *, (const wchar_t *wcs, wchar_t wc)); | 1130 | _GL_CXXALIASWARN1 (wcsrchr, const wchar_t *, (const wchar_t *wcs, wchar_t wc)); |
866 | # else | 1131 | # elif __GLIBC__ >= 2 |
867 | _GL_CXXALIASWARN (wcsrchr); | 1132 | _GL_CXXALIASWARN (wcsrchr); |
868 | # endif | 1133 | # endif |
869 | #elif defined GNULIB_POSIXCHECK | 1134 | #elif defined GNULIB_POSIXCHECK |
@@ -883,7 +1148,9 @@ _GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject) | |||
883 | _GL_ATTRIBUTE_PURE); | 1148 | _GL_ATTRIBUTE_PURE); |
884 | # endif | 1149 | # endif |
885 | _GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject)); | 1150 | _GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject)); |
1151 | # if __GLIBC__ >= 2 | ||
886 | _GL_CXXALIASWARN (wcscspn); | 1152 | _GL_CXXALIASWARN (wcscspn); |
1153 | # endif | ||
887 | #elif defined GNULIB_POSIXCHECK | 1154 | #elif defined GNULIB_POSIXCHECK |
888 | # undef wcscspn | 1155 | # undef wcscspn |
889 | # if HAVE_RAW_DECL_WCSCSPN | 1156 | # if HAVE_RAW_DECL_WCSCSPN |
@@ -901,7 +1168,9 @@ _GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept) | |||
901 | _GL_ATTRIBUTE_PURE); | 1168 | _GL_ATTRIBUTE_PURE); |
902 | # endif | 1169 | # endif |
903 | _GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept)); | 1170 | _GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept)); |
1171 | # if __GLIBC__ >= 2 | ||
904 | _GL_CXXALIASWARN (wcsspn); | 1172 | _GL_CXXALIASWARN (wcsspn); |
1173 | # endif | ||
905 | #elif defined GNULIB_POSIXCHECK | 1174 | #elif defined GNULIB_POSIXCHECK |
906 | # undef wcsspn | 1175 | # undef wcsspn |
907 | # if HAVE_RAW_DECL_WCSSPN | 1176 | # if HAVE_RAW_DECL_WCSSPN |
@@ -932,7 +1201,7 @@ _GL_CXXALIASWARN1 (wcspbrk, wchar_t *, | |||
932 | (wchar_t *wcs, const wchar_t *accept)); | 1201 | (wchar_t *wcs, const wchar_t *accept)); |
933 | _GL_CXXALIASWARN1 (wcspbrk, const wchar_t *, | 1202 | _GL_CXXALIASWARN1 (wcspbrk, const wchar_t *, |
934 | (const wchar_t *wcs, const wchar_t *accept)); | 1203 | (const wchar_t *wcs, const wchar_t *accept)); |
935 | # else | 1204 | # elif __GLIBC__ >= 2 |
936 | _GL_CXXALIASWARN (wcspbrk); | 1205 | _GL_CXXALIASWARN (wcspbrk); |
937 | # endif | 1206 | # endif |
938 | #elif defined GNULIB_POSIXCHECK | 1207 | #elif defined GNULIB_POSIXCHECK |
@@ -948,7 +1217,8 @@ _GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - " | |||
948 | #if @GNULIB_WCSSTR@ | 1217 | #if @GNULIB_WCSSTR@ |
949 | # if !@HAVE_WCSSTR@ | 1218 | # if !@HAVE_WCSSTR@ |
950 | _GL_FUNCDECL_SYS (wcsstr, wchar_t *, | 1219 | _GL_FUNCDECL_SYS (wcsstr, wchar_t *, |
951 | (const wchar_t *haystack, const wchar_t *needle) | 1220 | (const wchar_t *restrict haystack, |
1221 | const wchar_t *restrict needle) | ||
952 | _GL_ATTRIBUTE_PURE); | 1222 | _GL_ATTRIBUTE_PURE); |
953 | # endif | 1223 | # endif |
954 | /* On some systems, this function is defined as an overloaded function: | 1224 | /* On some systems, this function is defined as an overloaded function: |
@@ -957,15 +1227,19 @@ _GL_FUNCDECL_SYS (wcsstr, wchar_t *, | |||
957 | wchar_t * std::wcsstr (wchar_t *, const wchar_t *); | 1227 | wchar_t * std::wcsstr (wchar_t *, const wchar_t *); |
958 | } */ | 1228 | } */ |
959 | _GL_CXXALIAS_SYS_CAST2 (wcsstr, | 1229 | _GL_CXXALIAS_SYS_CAST2 (wcsstr, |
960 | wchar_t *, (const wchar_t *, const wchar_t *), | 1230 | wchar_t *, |
961 | const wchar_t *, (const wchar_t *, const wchar_t *)); | 1231 | (const wchar_t *restrict, const wchar_t *restrict), |
1232 | const wchar_t *, | ||
1233 | (const wchar_t *restrict, const wchar_t *restrict)); | ||
962 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ | 1234 | # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ |
963 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) | 1235 | && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) |
964 | _GL_CXXALIASWARN1 (wcsstr, wchar_t *, | 1236 | _GL_CXXALIASWARN1 (wcsstr, wchar_t *, |
965 | (wchar_t *haystack, const wchar_t *needle)); | 1237 | (wchar_t *restrict haystack, |
1238 | const wchar_t *restrict needle)); | ||
966 | _GL_CXXALIASWARN1 (wcsstr, const wchar_t *, | 1239 | _GL_CXXALIASWARN1 (wcsstr, const wchar_t *, |
967 | (const wchar_t *haystack, const wchar_t *needle)); | 1240 | (const wchar_t *restrict haystack, |
968 | # else | 1241 | const wchar_t *restrict needle)); |
1242 | # elif __GLIBC__ >= 2 | ||
969 | _GL_CXXALIASWARN (wcsstr); | 1243 | _GL_CXXALIASWARN (wcsstr); |
970 | # endif | 1244 | # endif |
971 | #elif defined GNULIB_POSIXCHECK | 1245 | #elif defined GNULIB_POSIXCHECK |
@@ -979,13 +1253,30 @@ _GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - " | |||
979 | 1253 | ||
980 | /* Divide WCS into tokens separated by characters in DELIM. */ | 1254 | /* Divide WCS into tokens separated by characters in DELIM. */ |
981 | #if @GNULIB_WCSTOK@ | 1255 | #if @GNULIB_WCSTOK@ |
982 | # if !@HAVE_WCSTOK@ | 1256 | # if @REPLACE_WCSTOK@ |
1257 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
1258 | # undef wcstok | ||
1259 | # define wcstok rpl_wcstok | ||
1260 | # endif | ||
1261 | _GL_FUNCDECL_RPL (wcstok, wchar_t *, | ||
1262 | (wchar_t *restrict wcs, const wchar_t *restrict delim, | ||
1263 | wchar_t **restrict ptr)); | ||
1264 | _GL_CXXALIAS_RPL (wcstok, wchar_t *, | ||
1265 | (wchar_t *restrict wcs, const wchar_t *restrict delim, | ||
1266 | wchar_t **restrict ptr)); | ||
1267 | # else | ||
1268 | # if !@HAVE_WCSTOK@ | ||
983 | _GL_FUNCDECL_SYS (wcstok, wchar_t *, | 1269 | _GL_FUNCDECL_SYS (wcstok, wchar_t *, |
984 | (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)); | 1270 | (wchar_t *restrict wcs, const wchar_t *restrict delim, |
985 | # endif | 1271 | wchar_t **restrict ptr)); |
1272 | # endif | ||
986 | _GL_CXXALIAS_SYS (wcstok, wchar_t *, | 1273 | _GL_CXXALIAS_SYS (wcstok, wchar_t *, |
987 | (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)); | 1274 | (wchar_t *restrict wcs, const wchar_t *restrict delim, |
1275 | wchar_t **restrict ptr)); | ||
1276 | # endif | ||
1277 | # if __GLIBC__ >= 2 | ||
988 | _GL_CXXALIASWARN (wcstok); | 1278 | _GL_CXXALIASWARN (wcstok); |
1279 | # endif | ||
989 | #elif defined GNULIB_POSIXCHECK | 1280 | #elif defined GNULIB_POSIXCHECK |
990 | # undef wcstok | 1281 | # undef wcstok |
991 | # if HAVE_RAW_DECL_WCSTOK | 1282 | # if HAVE_RAW_DECL_WCSTOK |
@@ -1013,7 +1304,9 @@ _GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n) | |||
1013 | # endif | 1304 | # endif |
1014 | _GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n)); | 1305 | _GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n)); |
1015 | # endif | 1306 | # endif |
1307 | # if __GLIBC__ >= 2 | ||
1016 | _GL_CXXALIASWARN (wcswidth); | 1308 | _GL_CXXALIASWARN (wcswidth); |
1309 | # endif | ||
1017 | #elif defined GNULIB_POSIXCHECK | 1310 | #elif defined GNULIB_POSIXCHECK |
1018 | # undef wcswidth | 1311 | # undef wcswidth |
1019 | # if HAVE_RAW_DECL_WCSWIDTH | 1312 | # if HAVE_RAW_DECL_WCSWIDTH |
@@ -1023,6 +1316,48 @@ _GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - " | |||
1023 | #endif | 1316 | #endif |
1024 | 1317 | ||
1025 | 1318 | ||
1319 | /* Convert *TP to a date and time wide string. See | ||
1320 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/wcsftime.html>. */ | ||
1321 | #if @GNULIB_WCSFTIME@ | ||
1322 | # if @REPLACE_WCSFTIME@ | ||
1323 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
1324 | # undef wcsftime | ||
1325 | # define wcsftime rpl_wcsftime | ||
1326 | # endif | ||
1327 | _GL_FUNCDECL_RPL (wcsftime, size_t, | ||
1328 | (wchar_t *restrict __buf, size_t __bufsize, | ||
1329 | const wchar_t *restrict __fmt, | ||
1330 | const struct tm *restrict __tp) | ||
1331 | _GL_ARG_NONNULL ((1, 3, 4))); | ||
1332 | _GL_CXXALIAS_RPL (wcsftime, size_t, | ||
1333 | (wchar_t *restrict __buf, size_t __bufsize, | ||
1334 | const wchar_t *restrict __fmt, | ||
1335 | const struct tm *restrict __tp)); | ||
1336 | # else | ||
1337 | # if !@HAVE_WCSFTIME@ | ||
1338 | _GL_FUNCDECL_SYS (wcsftime, size_t, | ||
1339 | (wchar_t *restrict __buf, size_t __bufsize, | ||
1340 | const wchar_t *restrict __fmt, | ||
1341 | const struct tm *restrict __tp) | ||
1342 | _GL_ARG_NONNULL ((1, 3, 4))); | ||
1343 | # endif | ||
1344 | _GL_CXXALIAS_SYS (wcsftime, size_t, | ||
1345 | (wchar_t *restrict __buf, size_t __bufsize, | ||
1346 | const wchar_t *restrict __fmt, | ||
1347 | const struct tm *restrict __tp)); | ||
1348 | # endif | ||
1349 | # if __GLIBC__ >= 2 | ||
1350 | _GL_CXXALIASWARN (wcsftime); | ||
1351 | # endif | ||
1352 | #elif defined GNULIB_POSIXCHECK | ||
1353 | # undef wcsftime | ||
1354 | # if HAVE_RAW_DECL_WCSFTIME | ||
1355 | _GL_WARN_ON_USE (wcsftime, "wcsftime is unportable - " | ||
1356 | "use gnulib module wcsftime for portability"); | ||
1357 | # endif | ||
1358 | #endif | ||
1359 | |||
1360 | |||
1026 | #endif /* _@GUARD_PREFIX@_WCHAR_H */ | 1361 | #endif /* _@GUARD_PREFIX@_WCHAR_H */ |
1027 | #endif /* _@GUARD_PREFIX@_WCHAR_H */ | 1362 | #endif /* _@GUARD_PREFIX@_WCHAR_H */ |
1028 | #endif | 1363 | #endif |