summaryrefslogtreecommitdiffstats
path: root/gl/wchar.in.h
diff options
context:
space:
mode:
authorRincewindsHat <12514511+RincewindsHat@users.noreply.github.com>2022-08-23 19:42:51 +0200
committerRincewindsHat <12514511+RincewindsHat@users.noreply.github.com>2022-09-14 11:08:55 +0200
commit868beb15ae02c352005a2df8857f4ebb9bd758fd (patch)
tree0dc6e6a91c4ef0f131ca82a777e6ac2ad193c399 /gl/wchar.in.h
parentb89aee56964f7d933f2da5f371e32b4d7db9410b (diff)
downloadmonitoring-plugins-868beb1.tar.gz
Sync with the latest Gnulib code (d27c820595)
Diffstat (limited to 'gl/wchar.in.h')
-rw-r--r--gl/wchar.in.h534
1 files changed, 422 insertions, 112 deletions
diff --git a/gl/wchar.in.h b/gl/wchar.in.h
index b6e43627..835ddbe6 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-2022 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,43 @@
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# define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (free, 1)
103#endif
104
105/* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly
106 allocated memory. */
107/* Applies to: functions. */
108#ifndef _GL_ATTRIBUTE_MALLOC
109# if __GNUC__ >= 3 || defined __clang__
110# define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
111# else
112# define _GL_ATTRIBUTE_MALLOC
113# endif
114#endif
115
86/* The __attribute__ feature is available in gcc versions 2.5 and later. 116/* The __attribute__ feature is available in gcc versions 2.5 and later.
87 The attribute __pure__ was added in gcc 2.96. */ 117 The attribute __pure__ was added in gcc 2.96. */
88#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) 118#ifndef _GL_ATTRIBUTE_PURE
89# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) 119# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
90#else 120# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
91# define _GL_ATTRIBUTE_PURE /* empty */ 121# else
122# define _GL_ATTRIBUTE_PURE /* empty */
123# endif
92#endif 124#endif
93 125
94/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 126/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
@@ -105,12 +137,16 @@
105# define WEOF -1 137# define WEOF -1
106# endif 138# endif
107#else 139#else
108/* MSVC defines wint_t as 'unsigned short' in <crtdefs.h>. 140/* 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 141 <stddef.h>. This is too small: ISO C 99 section 7.24.1.(2) says that
110 "unchanged by default argument promotions". Override it. */ 142 wint_t must be "unchanged by default argument promotions". Override it. */
111# if defined _MSC_VER 143# if @GNULIBHEADERS_OVERRIDE_WINT_T@
112# if !GNULIB_defined_wint_t 144# if !GNULIB_defined_wint_t
113# include <crtdefs.h> 145# if @HAVE_CRTDEFS_H@
146# include <crtdefs.h>
147# else
148# include <stddef.h>
149# endif
114typedef unsigned int rpl_wint_t; 150typedef unsigned int rpl_wint_t;
115# undef wint_t 151# undef wint_t
116# define wint_t rpl_wint_t 152# define wint_t rpl_wint_t
@@ -125,16 +161,59 @@ typedef unsigned int rpl_wint_t;
125 161
126/* Override mbstate_t if it is too small. 162/* Override mbstate_t if it is too small.
127 On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for 163 On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for
128 implementing mbrtowc for encodings like UTF-8. */ 164 implementing mbrtowc for encodings like UTF-8.
129#if !(@HAVE_MBSINIT@ && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@ 165 On AIX and MSVC, mbrtowc needs to be overridden, but mbstate_t exists and is
166 large enough and overriding it would cause problems in C++ mode. */
167#if !(((defined _WIN32 && !defined __CYGWIN__) || @HAVE_MBSINIT@) && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@
130# if !GNULIB_defined_mbstate_t 168# if !GNULIB_defined_mbstate_t
169# if !(defined _AIX || defined _MSC_VER)
131typedef int rpl_mbstate_t; 170typedef int rpl_mbstate_t;
132# undef mbstate_t 171# undef mbstate_t
133# define mbstate_t rpl_mbstate_t 172# define mbstate_t rpl_mbstate_t
173# endif
134# define GNULIB_defined_mbstate_t 1 174# define GNULIB_defined_mbstate_t 1
135# endif 175# endif
136#endif 176#endif
137 177
178/* Make _GL_ATTRIBUTE_DEALLOC_FREE work, even though <stdlib.h> may not have
179 been included yet. */
180#if @GNULIB_FREE_POSIX@
181# if (@REPLACE_FREE@ && !defined free \
182 && !(defined __cplusplus && defined GNULIB_NAMESPACE))
183/* We can't do '#define free rpl_free' here. */
184_GL_EXTERN_C void rpl_free (void *);
185# undef _GL_ATTRIBUTE_DEALLOC_FREE
186# define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1)
187# else
188# if defined _MSC_VER && !defined free
189_GL_EXTERN_C
190# if defined _DLL
191 __declspec (dllimport)
192# endif
193 void __cdecl free (void *);
194# else
195# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
196_GL_EXTERN_C void free (void *) throw ();
197# else
198_GL_EXTERN_C void free (void *);
199# endif
200# endif
201# endif
202#else
203# if defined _MSC_VER && !defined free
204_GL_EXTERN_C
205# if defined _DLL
206 __declspec (dllimport)
207# endif
208 void __cdecl free (void *);
209# else
210# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
211_GL_EXTERN_C void free (void *) throw ();
212# else
213_GL_EXTERN_C void free (void *);
214# endif
215# endif
216#endif
138 217
139/* Convert a single-byte character to a wide character. */ 218/* Convert a single-byte character to a wide character. */
140#if @GNULIB_BTOWC@ 219#if @GNULIB_BTOWC@
@@ -149,9 +228,12 @@ _GL_CXXALIAS_RPL (btowc, wint_t, (int c));
149# if !@HAVE_BTOWC@ 228# if !@HAVE_BTOWC@
150_GL_FUNCDECL_SYS (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE); 229_GL_FUNCDECL_SYS (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE);
151# endif 230# endif
152_GL_CXXALIAS_SYS (btowc, wint_t, (int c)); 231/* Need to cast, because on mingw, the return type is 'unsigned short'. */
232_GL_CXXALIAS_SYS_CAST (btowc, wint_t, (int c));
153# endif 233# endif
234# if __GLIBC__ >= 2
154_GL_CXXALIASWARN (btowc); 235_GL_CXXALIASWARN (btowc);
236# endif
155#elif defined GNULIB_POSIXCHECK 237#elif defined GNULIB_POSIXCHECK
156# undef btowc 238# undef btowc
157# if HAVE_RAW_DECL_BTOWC 239# if HAVE_RAW_DECL_BTOWC
@@ -177,7 +259,9 @@ _GL_FUNCDECL_SYS (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE);
177# endif 259# endif
178_GL_CXXALIAS_SYS (wctob, int, (wint_t wc)); 260_GL_CXXALIAS_SYS (wctob, int, (wint_t wc));
179# endif 261# endif
262# if __GLIBC__ >= 2
180_GL_CXXALIASWARN (wctob); 263_GL_CXXALIASWARN (wctob);
264# endif
181#elif defined GNULIB_POSIXCHECK 265#elif defined GNULIB_POSIXCHECK
182# undef wctob 266# undef wctob
183# if HAVE_RAW_DECL_WCTOB 267# if HAVE_RAW_DECL_WCTOB
@@ -202,7 +286,9 @@ _GL_FUNCDECL_SYS (mbsinit, int, (const mbstate_t *ps));
202# endif 286# endif
203_GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps)); 287_GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps));
204# endif 288# endif
289# if __GLIBC__ >= 2
205_GL_CXXALIASWARN (mbsinit); 290_GL_CXXALIASWARN (mbsinit);
291# endif
206#elif defined GNULIB_POSIXCHECK 292#elif defined GNULIB_POSIXCHECK
207# undef mbsinit 293# undef mbsinit
208# if HAVE_RAW_DECL_MBSINIT 294# if HAVE_RAW_DECL_MBSINIT
@@ -220,18 +306,24 @@ _GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - "
220# define mbrtowc rpl_mbrtowc 306# define mbrtowc rpl_mbrtowc
221# endif 307# endif
222_GL_FUNCDECL_RPL (mbrtowc, size_t, 308_GL_FUNCDECL_RPL (mbrtowc, size_t,
223 (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); 309 (wchar_t *restrict pwc, const char *restrict s, size_t n,
310 mbstate_t *restrict ps));
224_GL_CXXALIAS_RPL (mbrtowc, size_t, 311_GL_CXXALIAS_RPL (mbrtowc, size_t,
225 (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); 312 (wchar_t *restrict pwc, const char *restrict s, size_t n,
313 mbstate_t *restrict ps));
226# else 314# else
227# if !@HAVE_MBRTOWC@ 315# if !@HAVE_MBRTOWC@
228_GL_FUNCDECL_SYS (mbrtowc, size_t, 316_GL_FUNCDECL_SYS (mbrtowc, size_t,
229 (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); 317 (wchar_t *restrict pwc, const char *restrict s, size_t n,
318 mbstate_t *restrict ps));
230# endif 319# endif
231_GL_CXXALIAS_SYS (mbrtowc, size_t, 320_GL_CXXALIAS_SYS (mbrtowc, size_t,
232 (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); 321 (wchar_t *restrict pwc, const char *restrict s, size_t n,
322 mbstate_t *restrict ps));
233# endif 323# endif
324# if __GLIBC__ >= 2
234_GL_CXXALIASWARN (mbrtowc); 325_GL_CXXALIASWARN (mbrtowc);
326# endif
235#elif defined GNULIB_POSIXCHECK 327#elif defined GNULIB_POSIXCHECK
236# undef mbrtowc 328# undef mbrtowc
237# if HAVE_RAW_DECL_MBRTOWC 329# if HAVE_RAW_DECL_MBRTOWC
@@ -248,15 +340,21 @@ _GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - "
248# undef mbrlen 340# undef mbrlen
249# define mbrlen rpl_mbrlen 341# define mbrlen rpl_mbrlen
250# endif 342# endif
251_GL_FUNCDECL_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); 343_GL_FUNCDECL_RPL (mbrlen, size_t,
252_GL_CXXALIAS_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); 344 (const char *restrict s, size_t n, mbstate_t *restrict ps));
345_GL_CXXALIAS_RPL (mbrlen, size_t,
346 (const char *restrict s, size_t n, mbstate_t *restrict ps));
253# else 347# else
254# if !@HAVE_MBRLEN@ 348# if !@HAVE_MBRLEN@
255_GL_FUNCDECL_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); 349_GL_FUNCDECL_SYS (mbrlen, size_t,
350 (const char *restrict s, size_t n, mbstate_t *restrict ps));
256# endif 351# endif
257_GL_CXXALIAS_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); 352_GL_CXXALIAS_SYS (mbrlen, size_t,
353 (const char *restrict s, size_t n, mbstate_t *restrict ps));
258# endif 354# endif
355# if __GLIBC__ >= 2
259_GL_CXXALIASWARN (mbrlen); 356_GL_CXXALIASWARN (mbrlen);
357# endif
260#elif defined GNULIB_POSIXCHECK 358#elif defined GNULIB_POSIXCHECK
261# undef mbrlen 359# undef mbrlen
262# if HAVE_RAW_DECL_MBRLEN 360# if HAVE_RAW_DECL_MBRLEN
@@ -274,22 +372,30 @@ _GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - "
274# define mbsrtowcs rpl_mbsrtowcs 372# define mbsrtowcs rpl_mbsrtowcs
275# endif 373# endif
276_GL_FUNCDECL_RPL (mbsrtowcs, size_t, 374_GL_FUNCDECL_RPL (mbsrtowcs, size_t,
277 (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps) 375 (wchar_t *restrict dest,
376 const char **restrict srcp, size_t len,
377 mbstate_t *restrict ps)
278 _GL_ARG_NONNULL ((2))); 378 _GL_ARG_NONNULL ((2)));
279_GL_CXXALIAS_RPL (mbsrtowcs, size_t, 379_GL_CXXALIAS_RPL (mbsrtowcs, size_t,
280 (wchar_t *dest, const char **srcp, size_t len, 380 (wchar_t *restrict dest,
281 mbstate_t *ps)); 381 const char **restrict srcp, size_t len,
382 mbstate_t *restrict ps));
282# else 383# else
283# if !@HAVE_MBSRTOWCS@ 384# if !@HAVE_MBSRTOWCS@
284_GL_FUNCDECL_SYS (mbsrtowcs, size_t, 385_GL_FUNCDECL_SYS (mbsrtowcs, size_t,
285 (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps) 386 (wchar_t *restrict dest,
387 const char **restrict srcp, size_t len,
388 mbstate_t *restrict ps)
286 _GL_ARG_NONNULL ((2))); 389 _GL_ARG_NONNULL ((2)));
287# endif 390# endif
288_GL_CXXALIAS_SYS (mbsrtowcs, size_t, 391_GL_CXXALIAS_SYS (mbsrtowcs, size_t,
289 (wchar_t *dest, const char **srcp, size_t len, 392 (wchar_t *restrict dest,
290 mbstate_t *ps)); 393 const char **restrict srcp, size_t len,
394 mbstate_t *restrict ps));
291# endif 395# endif
396# if __GLIBC__ >= 2
292_GL_CXXALIASWARN (mbsrtowcs); 397_GL_CXXALIASWARN (mbsrtowcs);
398# endif
293#elif defined GNULIB_POSIXCHECK 399#elif defined GNULIB_POSIXCHECK
294# undef mbsrtowcs 400# undef mbsrtowcs
295# if HAVE_RAW_DECL_MBSRTOWCS 401# if HAVE_RAW_DECL_MBSRTOWCS
@@ -307,22 +413,26 @@ _GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - "
307# define mbsnrtowcs rpl_mbsnrtowcs 413# define mbsnrtowcs rpl_mbsnrtowcs
308# endif 414# endif
309_GL_FUNCDECL_RPL (mbsnrtowcs, size_t, 415_GL_FUNCDECL_RPL (mbsnrtowcs, size_t,
310 (wchar_t *dest, const char **srcp, size_t srclen, size_t len, 416 (wchar_t *restrict dest,
311 mbstate_t *ps) 417 const char **restrict srcp, size_t srclen, size_t len,
418 mbstate_t *restrict ps)
312 _GL_ARG_NONNULL ((2))); 419 _GL_ARG_NONNULL ((2)));
313_GL_CXXALIAS_RPL (mbsnrtowcs, size_t, 420_GL_CXXALIAS_RPL (mbsnrtowcs, size_t,
314 (wchar_t *dest, const char **srcp, size_t srclen, size_t len, 421 (wchar_t *restrict dest,
315 mbstate_t *ps)); 422 const char **restrict srcp, size_t srclen, size_t len,
423 mbstate_t *restrict ps));
316# else 424# else
317# if !@HAVE_MBSNRTOWCS@ 425# if !@HAVE_MBSNRTOWCS@
318_GL_FUNCDECL_SYS (mbsnrtowcs, size_t, 426_GL_FUNCDECL_SYS (mbsnrtowcs, size_t,
319 (wchar_t *dest, const char **srcp, size_t srclen, size_t len, 427 (wchar_t *restrict dest,
320 mbstate_t *ps) 428 const char **restrict srcp, size_t srclen, size_t len,
429 mbstate_t *restrict ps)
321 _GL_ARG_NONNULL ((2))); 430 _GL_ARG_NONNULL ((2)));
322# endif 431# endif
323_GL_CXXALIAS_SYS (mbsnrtowcs, size_t, 432_GL_CXXALIAS_SYS (mbsnrtowcs, size_t,
324 (wchar_t *dest, const char **srcp, size_t srclen, size_t len, 433 (wchar_t *restrict dest,
325 mbstate_t *ps)); 434 const char **restrict srcp, size_t srclen, size_t len,
435 mbstate_t *restrict ps));
326# endif 436# endif
327_GL_CXXALIASWARN (mbsnrtowcs); 437_GL_CXXALIASWARN (mbsnrtowcs);
328#elif defined GNULIB_POSIXCHECK 438#elif defined GNULIB_POSIXCHECK
@@ -341,15 +451,21 @@ _GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - "
341# undef wcrtomb 451# undef wcrtomb
342# define wcrtomb rpl_wcrtomb 452# define wcrtomb rpl_wcrtomb
343# endif 453# endif
344_GL_FUNCDECL_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); 454_GL_FUNCDECL_RPL (wcrtomb, size_t,
345_GL_CXXALIAS_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); 455 (char *restrict s, wchar_t wc, mbstate_t *restrict ps));
456_GL_CXXALIAS_RPL (wcrtomb, size_t,
457 (char *restrict s, wchar_t wc, mbstate_t *restrict ps));
346# else 458# else
347# if !@HAVE_WCRTOMB@ 459# if !@HAVE_WCRTOMB@
348_GL_FUNCDECL_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); 460_GL_FUNCDECL_SYS (wcrtomb, size_t,
461 (char *restrict s, wchar_t wc, mbstate_t *restrict ps));
349# endif 462# endif
350_GL_CXXALIAS_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); 463_GL_CXXALIAS_SYS (wcrtomb, size_t,
464 (char *restrict s, wchar_t wc, mbstate_t *restrict ps));
351# endif 465# endif
466# if __GLIBC__ >= 2
352_GL_CXXALIASWARN (wcrtomb); 467_GL_CXXALIASWARN (wcrtomb);
468# endif
353#elif defined GNULIB_POSIXCHECK 469#elif defined GNULIB_POSIXCHECK
354# undef wcrtomb 470# undef wcrtomb
355# if HAVE_RAW_DECL_WCRTOMB 471# if HAVE_RAW_DECL_WCRTOMB
@@ -367,22 +483,30 @@ _GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - "
367# define wcsrtombs rpl_wcsrtombs 483# define wcsrtombs rpl_wcsrtombs
368# endif 484# endif
369_GL_FUNCDECL_RPL (wcsrtombs, size_t, 485_GL_FUNCDECL_RPL (wcsrtombs, size_t,
370 (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps) 486 (char *restrict dest, const wchar_t **restrict srcp,
487 size_t len,
488 mbstate_t *restrict ps)
371 _GL_ARG_NONNULL ((2))); 489 _GL_ARG_NONNULL ((2)));
372_GL_CXXALIAS_RPL (wcsrtombs, size_t, 490_GL_CXXALIAS_RPL (wcsrtombs, size_t,
373 (char *dest, const wchar_t **srcp, size_t len, 491 (char *restrict dest, const wchar_t **restrict srcp,
374 mbstate_t *ps)); 492 size_t len,
493 mbstate_t *restrict ps));
375# else 494# else
376# if !@HAVE_WCSRTOMBS@ 495# if !@HAVE_WCSRTOMBS@
377_GL_FUNCDECL_SYS (wcsrtombs, size_t, 496_GL_FUNCDECL_SYS (wcsrtombs, size_t,
378 (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps) 497 (char *restrict dest, const wchar_t **restrict srcp,
498 size_t len,
499 mbstate_t *restrict ps)
379 _GL_ARG_NONNULL ((2))); 500 _GL_ARG_NONNULL ((2)));
380# endif 501# endif
381_GL_CXXALIAS_SYS (wcsrtombs, size_t, 502_GL_CXXALIAS_SYS (wcsrtombs, size_t,
382 (char *dest, const wchar_t **srcp, size_t len, 503 (char *restrict dest, const wchar_t **restrict srcp,
383 mbstate_t *ps)); 504 size_t len,
505 mbstate_t *restrict ps));
384# endif 506# endif
507# if __GLIBC__ >= 2
385_GL_CXXALIASWARN (wcsrtombs); 508_GL_CXXALIASWARN (wcsrtombs);
509# endif
386#elif defined GNULIB_POSIXCHECK 510#elif defined GNULIB_POSIXCHECK
387# undef wcsrtombs 511# undef wcsrtombs
388# if HAVE_RAW_DECL_WCSRTOMBS 512# if HAVE_RAW_DECL_WCSRTOMBS
@@ -400,24 +524,34 @@ _GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - "
400# define wcsnrtombs rpl_wcsnrtombs 524# define wcsnrtombs rpl_wcsnrtombs
401# endif 525# endif
402_GL_FUNCDECL_RPL (wcsnrtombs, size_t, 526_GL_FUNCDECL_RPL (wcsnrtombs, size_t,
403 (char *dest, const wchar_t **srcp, size_t srclen, size_t len, 527 (char *restrict dest,
404 mbstate_t *ps) 528 const wchar_t **restrict srcp, size_t srclen,
529 size_t len,
530 mbstate_t *restrict ps)
405 _GL_ARG_NONNULL ((2))); 531 _GL_ARG_NONNULL ((2)));
406_GL_CXXALIAS_RPL (wcsnrtombs, size_t, 532_GL_CXXALIAS_RPL (wcsnrtombs, size_t,
407 (char *dest, const wchar_t **srcp, size_t srclen, size_t len, 533 (char *restrict dest,
408 mbstate_t *ps)); 534 const wchar_t **restrict srcp, size_t srclen,
535 size_t len,
536 mbstate_t *restrict ps));
409# else 537# else
410# if !@HAVE_WCSNRTOMBS@ 538# if !@HAVE_WCSNRTOMBS@ || (defined __cplusplus && defined __sun)
411_GL_FUNCDECL_SYS (wcsnrtombs, size_t, 539_GL_FUNCDECL_SYS (wcsnrtombs, size_t,
412 (char *dest, const wchar_t **srcp, size_t srclen, size_t len, 540 (char *restrict dest,
413 mbstate_t *ps) 541 const wchar_t **restrict srcp, size_t srclen,
542 size_t len,
543 mbstate_t *restrict ps)
414 _GL_ARG_NONNULL ((2))); 544 _GL_ARG_NONNULL ((2)));
415# endif 545# endif
416_GL_CXXALIAS_SYS (wcsnrtombs, size_t, 546_GL_CXXALIAS_SYS (wcsnrtombs, size_t,
417 (char *dest, const wchar_t **srcp, size_t srclen, size_t len, 547 (char *restrict dest,
418 mbstate_t *ps)); 548 const wchar_t **restrict srcp, size_t srclen,
549 size_t len,
550 mbstate_t *restrict ps));
419# endif 551# endif
552# if __GLIBC__ >= 2
420_GL_CXXALIASWARN (wcsnrtombs); 553_GL_CXXALIASWARN (wcsnrtombs);
554# endif
421#elif defined GNULIB_POSIXCHECK 555#elif defined GNULIB_POSIXCHECK
422# undef wcsnrtombs 556# undef wcsnrtombs
423# if HAVE_RAW_DECL_WCSNRTOMBS 557# if HAVE_RAW_DECL_WCSNRTOMBS
@@ -443,7 +577,9 @@ _GL_FUNCDECL_SYS (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE);
443# endif 577# endif
444_GL_CXXALIAS_SYS (wcwidth, int, (wchar_t)); 578_GL_CXXALIAS_SYS (wcwidth, int, (wchar_t));
445# endif 579# endif
580# if __GLIBC__ >= 2
446_GL_CXXALIASWARN (wcwidth); 581_GL_CXXALIASWARN (wcwidth);
582# endif
447#elif defined GNULIB_POSIXCHECK 583#elif defined GNULIB_POSIXCHECK
448# undef wcwidth 584# undef wcwidth
449# if HAVE_RAW_DECL_WCWIDTH 585# if HAVE_RAW_DECL_WCWIDTH
@@ -472,7 +608,7 @@ _GL_CXXALIAS_SYS_CAST2 (wmemchr,
472_GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); 608_GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
473_GL_CXXALIASWARN1 (wmemchr, const wchar_t *, 609_GL_CXXALIASWARN1 (wmemchr, const wchar_t *,
474 (const wchar_t *s, wchar_t c, size_t n)); 610 (const wchar_t *s, wchar_t c, size_t n));
475# else 611# elif __GLIBC__ >= 2
476_GL_CXXALIASWARN (wmemchr); 612_GL_CXXALIASWARN (wmemchr);
477# endif 613# endif
478#elif defined GNULIB_POSIXCHECK 614#elif defined GNULIB_POSIXCHECK
@@ -493,7 +629,9 @@ _GL_FUNCDECL_SYS (wmemcmp, int,
493# endif 629# endif
494_GL_CXXALIAS_SYS (wmemcmp, int, 630_GL_CXXALIAS_SYS (wmemcmp, int,
495 (const wchar_t *s1, const wchar_t *s2, size_t n)); 631 (const wchar_t *s1, const wchar_t *s2, size_t n));
632# if __GLIBC__ >= 2
496_GL_CXXALIASWARN (wmemcmp); 633_GL_CXXALIASWARN (wmemcmp);
634# endif
497#elif defined GNULIB_POSIXCHECK 635#elif defined GNULIB_POSIXCHECK
498# undef wmemcmp 636# undef wmemcmp
499# if HAVE_RAW_DECL_WMEMCMP 637# if HAVE_RAW_DECL_WMEMCMP
@@ -507,11 +645,15 @@ _GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - "
507#if @GNULIB_WMEMCPY@ 645#if @GNULIB_WMEMCPY@
508# if !@HAVE_WMEMCPY@ 646# if !@HAVE_WMEMCPY@
509_GL_FUNCDECL_SYS (wmemcpy, wchar_t *, 647_GL_FUNCDECL_SYS (wmemcpy, wchar_t *,
510 (wchar_t *dest, const wchar_t *src, size_t n)); 648 (wchar_t *restrict dest,
649 const wchar_t *restrict src, size_t n));
511# endif 650# endif
512_GL_CXXALIAS_SYS (wmemcpy, wchar_t *, 651_GL_CXXALIAS_SYS (wmemcpy, wchar_t *,
513 (wchar_t *dest, const wchar_t *src, size_t n)); 652 (wchar_t *restrict dest,
653 const wchar_t *restrict src, size_t n));
654# if __GLIBC__ >= 2
514_GL_CXXALIASWARN (wmemcpy); 655_GL_CXXALIASWARN (wmemcpy);
656# endif
515#elif defined GNULIB_POSIXCHECK 657#elif defined GNULIB_POSIXCHECK
516# undef wmemcpy 658# undef wmemcpy
517# if HAVE_RAW_DECL_WMEMCPY 659# if HAVE_RAW_DECL_WMEMCPY
@@ -530,7 +672,9 @@ _GL_FUNCDECL_SYS (wmemmove, wchar_t *,
530# endif 672# endif
531_GL_CXXALIAS_SYS (wmemmove, wchar_t *, 673_GL_CXXALIAS_SYS (wmemmove, wchar_t *,
532 (wchar_t *dest, const wchar_t *src, size_t n)); 674 (wchar_t *dest, const wchar_t *src, size_t n));
675# if __GLIBC__ >= 2
533_GL_CXXALIASWARN (wmemmove); 676_GL_CXXALIASWARN (wmemmove);
677# endif
534#elif defined GNULIB_POSIXCHECK 678#elif defined GNULIB_POSIXCHECK
535# undef wmemmove 679# undef wmemmove
536# if HAVE_RAW_DECL_WMEMMOVE 680# if HAVE_RAW_DECL_WMEMMOVE
@@ -540,13 +684,38 @@ _GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - "
540#endif 684#endif
541 685
542 686
687/* Copy N wide characters of SRC to DEST.
688 Return pointer to wide characters after the last written wide character. */
689#if @GNULIB_WMEMPCPY@
690# if !@HAVE_WMEMPCPY@
691_GL_FUNCDECL_SYS (wmempcpy, wchar_t *,
692 (wchar_t *restrict dest,
693 const wchar_t *restrict src, size_t n));
694# endif
695_GL_CXXALIAS_SYS (wmempcpy, wchar_t *,
696 (wchar_t *restrict dest,
697 const wchar_t *restrict src, size_t n));
698# if __GLIBC__ >= 2
699_GL_CXXALIASWARN (wmempcpy);
700# endif
701#elif defined GNULIB_POSIXCHECK
702# undef wmempcpy
703# if HAVE_RAW_DECL_WMEMPCPY
704_GL_WARN_ON_USE (wmempcpy, "wmempcpy is unportable - "
705 "use gnulib module wmempcpy for portability");
706# endif
707#endif
708
709
543/* Set N wide characters of S to C. */ 710/* Set N wide characters of S to C. */
544#if @GNULIB_WMEMSET@ 711#if @GNULIB_WMEMSET@
545# if !@HAVE_WMEMSET@ 712# if !@HAVE_WMEMSET@
546_GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); 713_GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
547# endif 714# endif
548_GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); 715_GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
716# if __GLIBC__ >= 2
549_GL_CXXALIASWARN (wmemset); 717_GL_CXXALIASWARN (wmemset);
718# endif
550#elif defined GNULIB_POSIXCHECK 719#elif defined GNULIB_POSIXCHECK
551# undef wmemset 720# undef wmemset
552# if HAVE_RAW_DECL_WMEMSET 721# if HAVE_RAW_DECL_WMEMSET
@@ -562,7 +731,9 @@ _GL_WARN_ON_USE (wmemset, "wmemset is unportable - "
562_GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s) _GL_ATTRIBUTE_PURE); 731_GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s) _GL_ATTRIBUTE_PURE);
563# endif 732# endif
564_GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s)); 733_GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s));
734# if __GLIBC__ >= 2
565_GL_CXXALIASWARN (wcslen); 735_GL_CXXALIASWARN (wcslen);
736# endif
566#elif defined GNULIB_POSIXCHECK 737#elif defined GNULIB_POSIXCHECK
567# undef wcslen 738# undef wcslen
568# if HAVE_RAW_DECL_WCSLEN 739# if HAVE_RAW_DECL_WCSLEN
@@ -592,10 +763,14 @@ _GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - "
592/* Copy SRC to DEST. */ 763/* Copy SRC to DEST. */
593#if @GNULIB_WCSCPY@ 764#if @GNULIB_WCSCPY@
594# if !@HAVE_WCSCPY@ 765# if !@HAVE_WCSCPY@
595_GL_FUNCDECL_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src)); 766_GL_FUNCDECL_SYS (wcscpy, wchar_t *,
767 (wchar_t *restrict dest, const wchar_t *restrict src));
596# endif 768# endif
597_GL_CXXALIAS_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src)); 769_GL_CXXALIAS_SYS (wcscpy, wchar_t *,
770 (wchar_t *restrict dest, const wchar_t *restrict src));
771# if __GLIBC__ >= 2
598_GL_CXXALIASWARN (wcscpy); 772_GL_CXXALIASWARN (wcscpy);
773# endif
599#elif defined GNULIB_POSIXCHECK 774#elif defined GNULIB_POSIXCHECK
600# undef wcscpy 775# undef wcscpy
601# if HAVE_RAW_DECL_WCSCPY 776# if HAVE_RAW_DECL_WCSCPY
@@ -608,9 +783,11 @@ _GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - "
608/* Copy SRC to DEST, returning the address of the terminating L'\0' in DEST. */ 783/* Copy SRC to DEST, returning the address of the terminating L'\0' in DEST. */
609#if @GNULIB_WCPCPY@ 784#if @GNULIB_WCPCPY@
610# if !@HAVE_WCPCPY@ 785# if !@HAVE_WCPCPY@
611_GL_FUNCDECL_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src)); 786_GL_FUNCDECL_SYS (wcpcpy, wchar_t *,
787 (wchar_t *restrict dest, const wchar_t *restrict src));
612# endif 788# endif
613_GL_CXXALIAS_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src)); 789_GL_CXXALIAS_SYS (wcpcpy, wchar_t *,
790 (wchar_t *restrict dest, const wchar_t *restrict src));
614_GL_CXXALIASWARN (wcpcpy); 791_GL_CXXALIASWARN (wcpcpy);
615#elif defined GNULIB_POSIXCHECK 792#elif defined GNULIB_POSIXCHECK
616# undef wcpcpy 793# undef wcpcpy
@@ -625,11 +802,15 @@ _GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - "
625#if @GNULIB_WCSNCPY@ 802#if @GNULIB_WCSNCPY@
626# if !@HAVE_WCSNCPY@ 803# if !@HAVE_WCSNCPY@
627_GL_FUNCDECL_SYS (wcsncpy, wchar_t *, 804_GL_FUNCDECL_SYS (wcsncpy, wchar_t *,
628 (wchar_t *dest, const wchar_t *src, size_t n)); 805 (wchar_t *restrict dest,
806 const wchar_t *restrict src, size_t n));
629# endif 807# endif
630_GL_CXXALIAS_SYS (wcsncpy, wchar_t *, 808_GL_CXXALIAS_SYS (wcsncpy, wchar_t *,
631 (wchar_t *dest, const wchar_t *src, size_t n)); 809 (wchar_t *restrict dest,
810 const wchar_t *restrict src, size_t n));
811# if __GLIBC__ >= 2
632_GL_CXXALIASWARN (wcsncpy); 812_GL_CXXALIASWARN (wcsncpy);
813# endif
633#elif defined GNULIB_POSIXCHECK 814#elif defined GNULIB_POSIXCHECK
634# undef wcsncpy 815# undef wcsncpy
635# if HAVE_RAW_DECL_WCSNCPY 816# if HAVE_RAW_DECL_WCSNCPY
@@ -644,10 +825,12 @@ _GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - "
644#if @GNULIB_WCPNCPY@ 825#if @GNULIB_WCPNCPY@
645# if !@HAVE_WCPNCPY@ 826# if !@HAVE_WCPNCPY@
646_GL_FUNCDECL_SYS (wcpncpy, wchar_t *, 827_GL_FUNCDECL_SYS (wcpncpy, wchar_t *,
647 (wchar_t *dest, const wchar_t *src, size_t n)); 828 (wchar_t *restrict dest,
829 const wchar_t *restrict src, size_t n));
648# endif 830# endif
649_GL_CXXALIAS_SYS (wcpncpy, wchar_t *, 831_GL_CXXALIAS_SYS (wcpncpy, wchar_t *,
650 (wchar_t *dest, const wchar_t *src, size_t n)); 832 (wchar_t *restrict dest,
833 const wchar_t *restrict src, size_t n));
651_GL_CXXALIASWARN (wcpncpy); 834_GL_CXXALIASWARN (wcpncpy);
652#elif defined GNULIB_POSIXCHECK 835#elif defined GNULIB_POSIXCHECK
653# undef wcpncpy 836# undef wcpncpy
@@ -661,10 +844,14 @@ _GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - "
661/* Append SRC onto DEST. */ 844/* Append SRC onto DEST. */
662#if @GNULIB_WCSCAT@ 845#if @GNULIB_WCSCAT@
663# if !@HAVE_WCSCAT@ 846# if !@HAVE_WCSCAT@
664_GL_FUNCDECL_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src)); 847_GL_FUNCDECL_SYS (wcscat, wchar_t *,
848 (wchar_t *restrict dest, const wchar_t *restrict src));
665# endif 849# endif
666_GL_CXXALIAS_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src)); 850_GL_CXXALIAS_SYS (wcscat, wchar_t *,
851 (wchar_t *restrict dest, const wchar_t *restrict src));
852# if __GLIBC__ >= 2
667_GL_CXXALIASWARN (wcscat); 853_GL_CXXALIASWARN (wcscat);
854# endif
668#elif defined GNULIB_POSIXCHECK 855#elif defined GNULIB_POSIXCHECK
669# undef wcscat 856# undef wcscat
670# if HAVE_RAW_DECL_WCSCAT 857# if HAVE_RAW_DECL_WCSCAT
@@ -678,11 +865,15 @@ _GL_WARN_ON_USE (wcscat, "wcscat is unportable - "
678#if @GNULIB_WCSNCAT@ 865#if @GNULIB_WCSNCAT@
679# if !@HAVE_WCSNCAT@ 866# if !@HAVE_WCSNCAT@
680_GL_FUNCDECL_SYS (wcsncat, wchar_t *, 867_GL_FUNCDECL_SYS (wcsncat, wchar_t *,
681 (wchar_t *dest, const wchar_t *src, size_t n)); 868 (wchar_t *restrict dest, const wchar_t *restrict src,
869 size_t n));
682# endif 870# endif
683_GL_CXXALIAS_SYS (wcsncat, wchar_t *, 871_GL_CXXALIAS_SYS (wcsncat, wchar_t *,
684 (wchar_t *dest, const wchar_t *src, size_t n)); 872 (wchar_t *restrict dest, const wchar_t *restrict src,
873 size_t n));
874# if __GLIBC__ >= 2
685_GL_CXXALIASWARN (wcsncat); 875_GL_CXXALIASWARN (wcsncat);
876# endif
686#elif defined GNULIB_POSIXCHECK 877#elif defined GNULIB_POSIXCHECK
687# undef wcsncat 878# undef wcsncat
688# if HAVE_RAW_DECL_WCSNCAT 879# if HAVE_RAW_DECL_WCSNCAT
@@ -699,7 +890,9 @@ _GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)
699 _GL_ATTRIBUTE_PURE); 890 _GL_ATTRIBUTE_PURE);
700# endif 891# endif
701_GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)); 892_GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
893# if __GLIBC__ >= 2
702_GL_CXXALIASWARN (wcscmp); 894_GL_CXXALIASWARN (wcscmp);
895# endif
703#elif defined GNULIB_POSIXCHECK 896#elif defined GNULIB_POSIXCHECK
704# undef wcscmp 897# undef wcscmp
705# if HAVE_RAW_DECL_WCSCMP 898# if HAVE_RAW_DECL_WCSCMP
@@ -718,7 +911,9 @@ _GL_FUNCDECL_SYS (wcsncmp, int,
718# endif 911# endif
719_GL_CXXALIAS_SYS (wcsncmp, int, 912_GL_CXXALIAS_SYS (wcsncmp, int,
720 (const wchar_t *s1, const wchar_t *s2, size_t n)); 913 (const wchar_t *s1, const wchar_t *s2, size_t n));
914# if __GLIBC__ >= 2
721_GL_CXXALIASWARN (wcsncmp); 915_GL_CXXALIASWARN (wcsncmp);
916# endif
722#elif defined GNULIB_POSIXCHECK 917#elif defined GNULIB_POSIXCHECK
723# undef wcsncmp 918# undef wcsncmp
724# if HAVE_RAW_DECL_WCSNCMP 919# if HAVE_RAW_DECL_WCSNCMP
@@ -771,7 +966,9 @@ _GL_WARN_ON_USE (wcsncasecmp, "wcsncasecmp is unportable - "
771_GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2)); 966_GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
772# endif 967# endif
773_GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2)); 968_GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
969# if __GLIBC__ >= 2
774_GL_CXXALIASWARN (wcscoll); 970_GL_CXXALIASWARN (wcscoll);
971# endif
775#elif defined GNULIB_POSIXCHECK 972#elif defined GNULIB_POSIXCHECK
776# undef wcscoll 973# undef wcscoll
777# if HAVE_RAW_DECL_WCSCOLL 974# if HAVE_RAW_DECL_WCSCOLL
@@ -786,10 +983,14 @@ _GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - "
786 original strings. */ 983 original strings. */
787#if @GNULIB_WCSXFRM@ 984#if @GNULIB_WCSXFRM@
788# if !@HAVE_WCSXFRM@ 985# if !@HAVE_WCSXFRM@
789_GL_FUNCDECL_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n)); 986_GL_FUNCDECL_SYS (wcsxfrm, size_t,
987 (wchar_t *restrict s1, const wchar_t *restrict s2, size_t n));
790# endif 988# endif
791_GL_CXXALIAS_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n)); 989_GL_CXXALIAS_SYS (wcsxfrm, size_t,
990 (wchar_t *restrict s1, const wchar_t *restrict s2, size_t n));
991# if __GLIBC__ >= 2
792_GL_CXXALIASWARN (wcsxfrm); 992_GL_CXXALIASWARN (wcsxfrm);
993# endif
793#elif defined GNULIB_POSIXCHECK 994#elif defined GNULIB_POSIXCHECK
794# undef wcsxfrm 995# undef wcsxfrm
795# if HAVE_RAW_DECL_WCSXFRM 996# if HAVE_RAW_DECL_WCSXFRM
@@ -801,16 +1002,55 @@ _GL_WARN_ON_USE (wcsxfrm, "wcsxfrm is unportable - "
801 1002
802/* Duplicate S, returning an identical malloc'd string. */ 1003/* Duplicate S, returning an identical malloc'd string. */
803#if @GNULIB_WCSDUP@ 1004#if @GNULIB_WCSDUP@
804# if !@HAVE_WCSDUP@ 1005# if defined _WIN32 && !defined __CYGWIN__
805_GL_FUNCDECL_SYS (wcsdup, wchar_t *, (const wchar_t *s)); 1006# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
806# endif 1007# undef wcsdup
1008# define wcsdup _wcsdup
1009# endif
1010_GL_CXXALIAS_MDA (wcsdup, wchar_t *, (const wchar_t *s));
1011# else
1012# if !@HAVE_WCSDUP@ || __GNUC__ >= 11
1013_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
1014 (const wchar_t *s)
1015 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
1016# endif
807_GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s)); 1017_GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s));
1018# endif
808_GL_CXXALIASWARN (wcsdup); 1019_GL_CXXALIASWARN (wcsdup);
809#elif defined GNULIB_POSIXCHECK 1020#else
810# undef wcsdup 1021# if __GNUC__ >= 11 && !defined wcsdup
811# if HAVE_RAW_DECL_WCSDUP 1022/* For -Wmismatched-dealloc: Associate wcsdup with free or rpl_free. */
1023_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
1024 (const wchar_t *s)
1025 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
1026# endif
1027# if defined GNULIB_POSIXCHECK
1028# undef wcsdup
1029# if HAVE_RAW_DECL_WCSDUP
812_GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - " 1030_GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - "
813 "use gnulib module wcsdup for portability"); 1031 "use gnulib module wcsdup for portability");
1032# endif
1033# elif @GNULIB_MDA_WCSDUP@
1034/* On native Windows, map 'wcsdup' to '_wcsdup', so that -loldnames is not
1035 required. In C++ with GNULIB_NAMESPACE, avoid differences between
1036 platforms by defining GNULIB_NAMESPACE::wcsdup always. */
1037# if defined _WIN32 && !defined __CYGWIN__
1038# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1039# undef wcsdup
1040# define wcsdup _wcsdup
1041# endif
1042_GL_CXXALIAS_MDA (wcsdup, wchar_t *, (const wchar_t *s));
1043# else
1044_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
1045 (const wchar_t *s)
1046 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
1047# if @HAVE_DECL_WCSDUP@
1048_GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s));
1049# endif
1050# endif
1051# if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_WCSDUP@
1052_GL_CXXALIASWARN (wcsdup);
1053# endif
814# endif 1054# endif
815#endif 1055#endif
816 1056
@@ -833,7 +1073,7 @@ _GL_CXXALIAS_SYS_CAST2 (wcschr,
833 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 1073 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
834_GL_CXXALIASWARN1 (wcschr, wchar_t *, (wchar_t *wcs, wchar_t wc)); 1074_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)); 1075_GL_CXXALIASWARN1 (wcschr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
836# else 1076# elif __GLIBC__ >= 2
837_GL_CXXALIASWARN (wcschr); 1077_GL_CXXALIASWARN (wcschr);
838# endif 1078# endif
839#elif defined GNULIB_POSIXCHECK 1079#elif defined GNULIB_POSIXCHECK
@@ -863,7 +1103,7 @@ _GL_CXXALIAS_SYS_CAST2 (wcsrchr,
863 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 1103 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
864_GL_CXXALIASWARN1 (wcsrchr, wchar_t *, (wchar_t *wcs, wchar_t wc)); 1104_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)); 1105_GL_CXXALIASWARN1 (wcsrchr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
866# else 1106# elif __GLIBC__ >= 2
867_GL_CXXALIASWARN (wcsrchr); 1107_GL_CXXALIASWARN (wcsrchr);
868# endif 1108# endif
869#elif defined GNULIB_POSIXCHECK 1109#elif defined GNULIB_POSIXCHECK
@@ -883,7 +1123,9 @@ _GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject)
883 _GL_ATTRIBUTE_PURE); 1123 _GL_ATTRIBUTE_PURE);
884# endif 1124# endif
885_GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject)); 1125_GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject));
1126# if __GLIBC__ >= 2
886_GL_CXXALIASWARN (wcscspn); 1127_GL_CXXALIASWARN (wcscspn);
1128# endif
887#elif defined GNULIB_POSIXCHECK 1129#elif defined GNULIB_POSIXCHECK
888# undef wcscspn 1130# undef wcscspn
889# if HAVE_RAW_DECL_WCSCSPN 1131# if HAVE_RAW_DECL_WCSCSPN
@@ -901,7 +1143,9 @@ _GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept)
901 _GL_ATTRIBUTE_PURE); 1143 _GL_ATTRIBUTE_PURE);
902# endif 1144# endif
903_GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept)); 1145_GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept));
1146# if __GLIBC__ >= 2
904_GL_CXXALIASWARN (wcsspn); 1147_GL_CXXALIASWARN (wcsspn);
1148# endif
905#elif defined GNULIB_POSIXCHECK 1149#elif defined GNULIB_POSIXCHECK
906# undef wcsspn 1150# undef wcsspn
907# if HAVE_RAW_DECL_WCSSPN 1151# if HAVE_RAW_DECL_WCSSPN
@@ -932,7 +1176,7 @@ _GL_CXXALIASWARN1 (wcspbrk, wchar_t *,
932 (wchar_t *wcs, const wchar_t *accept)); 1176 (wchar_t *wcs, const wchar_t *accept));
933_GL_CXXALIASWARN1 (wcspbrk, const wchar_t *, 1177_GL_CXXALIASWARN1 (wcspbrk, const wchar_t *,
934 (const wchar_t *wcs, const wchar_t *accept)); 1178 (const wchar_t *wcs, const wchar_t *accept));
935# else 1179# elif __GLIBC__ >= 2
936_GL_CXXALIASWARN (wcspbrk); 1180_GL_CXXALIASWARN (wcspbrk);
937# endif 1181# endif
938#elif defined GNULIB_POSIXCHECK 1182#elif defined GNULIB_POSIXCHECK
@@ -948,7 +1192,8 @@ _GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - "
948#if @GNULIB_WCSSTR@ 1192#if @GNULIB_WCSSTR@
949# if !@HAVE_WCSSTR@ 1193# if !@HAVE_WCSSTR@
950_GL_FUNCDECL_SYS (wcsstr, wchar_t *, 1194_GL_FUNCDECL_SYS (wcsstr, wchar_t *,
951 (const wchar_t *haystack, const wchar_t *needle) 1195 (const wchar_t *restrict haystack,
1196 const wchar_t *restrict needle)
952 _GL_ATTRIBUTE_PURE); 1197 _GL_ATTRIBUTE_PURE);
953# endif 1198# endif
954 /* On some systems, this function is defined as an overloaded function: 1199 /* On some systems, this function is defined as an overloaded function:
@@ -957,15 +1202,19 @@ _GL_FUNCDECL_SYS (wcsstr, wchar_t *,
957 wchar_t * std::wcsstr (wchar_t *, const wchar_t *); 1202 wchar_t * std::wcsstr (wchar_t *, const wchar_t *);
958 } */ 1203 } */
959_GL_CXXALIAS_SYS_CAST2 (wcsstr, 1204_GL_CXXALIAS_SYS_CAST2 (wcsstr,
960 wchar_t *, (const wchar_t *, const wchar_t *), 1205 wchar_t *,
961 const wchar_t *, (const wchar_t *, const wchar_t *)); 1206 (const wchar_t *restrict, const wchar_t *restrict),
1207 const wchar_t *,
1208 (const wchar_t *restrict, const wchar_t *restrict));
962# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 1209# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
963 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 1210 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
964_GL_CXXALIASWARN1 (wcsstr, wchar_t *, 1211_GL_CXXALIASWARN1 (wcsstr, wchar_t *,
965 (wchar_t *haystack, const wchar_t *needle)); 1212 (wchar_t *restrict haystack,
1213 const wchar_t *restrict needle));
966_GL_CXXALIASWARN1 (wcsstr, const wchar_t *, 1214_GL_CXXALIASWARN1 (wcsstr, const wchar_t *,
967 (const wchar_t *haystack, const wchar_t *needle)); 1215 (const wchar_t *restrict haystack,
968# else 1216 const wchar_t *restrict needle));
1217# elif __GLIBC__ >= 2
969_GL_CXXALIASWARN (wcsstr); 1218_GL_CXXALIASWARN (wcsstr);
970# endif 1219# endif
971#elif defined GNULIB_POSIXCHECK 1220#elif defined GNULIB_POSIXCHECK
@@ -979,13 +1228,30 @@ _GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - "
979 1228
980/* Divide WCS into tokens separated by characters in DELIM. */ 1229/* Divide WCS into tokens separated by characters in DELIM. */
981#if @GNULIB_WCSTOK@ 1230#if @GNULIB_WCSTOK@
982# if !@HAVE_WCSTOK@ 1231# if @REPLACE_WCSTOK@
1232# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1233# undef wcstok
1234# define wcstok rpl_wcstok
1235# endif
1236_GL_FUNCDECL_RPL (wcstok, wchar_t *,
1237 (wchar_t *restrict wcs, const wchar_t *restrict delim,
1238 wchar_t **restrict ptr));
1239_GL_CXXALIAS_RPL (wcstok, wchar_t *,
1240 (wchar_t *restrict wcs, const wchar_t *restrict delim,
1241 wchar_t **restrict ptr));
1242# else
1243# if !@HAVE_WCSTOK@
983_GL_FUNCDECL_SYS (wcstok, wchar_t *, 1244_GL_FUNCDECL_SYS (wcstok, wchar_t *,
984 (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)); 1245 (wchar_t *restrict wcs, const wchar_t *restrict delim,
985# endif 1246 wchar_t **restrict ptr));
1247# endif
986_GL_CXXALIAS_SYS (wcstok, wchar_t *, 1248_GL_CXXALIAS_SYS (wcstok, wchar_t *,
987 (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)); 1249 (wchar_t *restrict wcs, const wchar_t *restrict delim,
1250 wchar_t **restrict ptr));
1251# endif
1252# if __GLIBC__ >= 2
988_GL_CXXALIASWARN (wcstok); 1253_GL_CXXALIASWARN (wcstok);
1254# endif
989#elif defined GNULIB_POSIXCHECK 1255#elif defined GNULIB_POSIXCHECK
990# undef wcstok 1256# undef wcstok
991# if HAVE_RAW_DECL_WCSTOK 1257# if HAVE_RAW_DECL_WCSTOK
@@ -1013,7 +1279,9 @@ _GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n)
1013# endif 1279# endif
1014_GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n)); 1280_GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n));
1015# endif 1281# endif
1282# if __GLIBC__ >= 2
1016_GL_CXXALIASWARN (wcswidth); 1283_GL_CXXALIASWARN (wcswidth);
1284# endif
1017#elif defined GNULIB_POSIXCHECK 1285#elif defined GNULIB_POSIXCHECK
1018# undef wcswidth 1286# undef wcswidth
1019# if HAVE_RAW_DECL_WCSWIDTH 1287# if HAVE_RAW_DECL_WCSWIDTH
@@ -1023,6 +1291,48 @@ _GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - "
1023#endif 1291#endif
1024 1292
1025 1293
1294/* Convert *TP to a date and time wide string. See
1295 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/wcsftime.html>. */
1296#if @GNULIB_WCSFTIME@
1297# if @REPLACE_WCSFTIME@
1298# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1299# undef wcsftime
1300# define wcsftime rpl_wcsftime
1301# endif
1302_GL_FUNCDECL_RPL (wcsftime, size_t,
1303 (wchar_t *restrict __buf, size_t __bufsize,
1304 const wchar_t *restrict __fmt,
1305 const struct tm *restrict __tp)
1306 _GL_ARG_NONNULL ((1, 3, 4)));
1307_GL_CXXALIAS_RPL (wcsftime, size_t,
1308 (wchar_t *restrict __buf, size_t __bufsize,
1309 const wchar_t *restrict __fmt,
1310 const struct tm *restrict __tp));
1311# else
1312# if !@HAVE_WCSFTIME@
1313_GL_FUNCDECL_SYS (wcsftime, size_t,
1314 (wchar_t *restrict __buf, size_t __bufsize,
1315 const wchar_t *restrict __fmt,
1316 const struct tm *restrict __tp)
1317 _GL_ARG_NONNULL ((1, 3, 4)));
1318# endif
1319_GL_CXXALIAS_SYS (wcsftime, size_t,
1320 (wchar_t *restrict __buf, size_t __bufsize,
1321 const wchar_t *restrict __fmt,
1322 const struct tm *restrict __tp));
1323# endif
1324# if __GLIBC__ >= 2
1325_GL_CXXALIASWARN (wcsftime);
1326# endif
1327#elif defined GNULIB_POSIXCHECK
1328# undef wcsftime
1329# if HAVE_RAW_DECL_WCSFTIME
1330_GL_WARN_ON_USE (wcsftime, "wcsftime is unportable - "
1331 "use gnulib module wcsftime for portability");
1332# endif
1333#endif
1334
1335
1026#endif /* _@GUARD_PREFIX@_WCHAR_H */ 1336#endif /* _@GUARD_PREFIX@_WCHAR_H */
1027#endif /* _@GUARD_PREFIX@_WCHAR_H */ 1337#endif /* _@GUARD_PREFIX@_WCHAR_H */
1028#endif 1338#endif