summaryrefslogtreecommitdiffstats
path: root/gl/wchar.in.h
diff options
context:
space:
mode:
Diffstat (limited to 'gl/wchar.in.h')
-rw-r--r--gl/wchar.in.h703
1 files changed, 549 insertions, 154 deletions
diff --git a/gl/wchar.in.h b/gl/wchar.in.h
index 09c9185f..a60a4dfc 100644
--- a/gl/wchar.in.h
+++ b/gl/wchar.in.h
@@ -1,6 +1,6 @@
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-2023 Free Software Foundation, Inc. 3 Copyright (C) 2007-2026 Free Software Foundation, Inc.
4 4
5 This file 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 Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -36,8 +36,7 @@
36 && ((defined _INTTYPES_INCLUDED \ 36 && ((defined _INTTYPES_INCLUDED \
37 && !defined _GL_FINISHED_INCLUDING_SYSTEM_INTTYPES_H) \ 37 && !defined _GL_FINISHED_INCLUDING_SYSTEM_INTTYPES_H) \
38 || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) \ 38 || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) \
39 || (defined __MINGW32__ && defined __STRING_H_SOURCED__) \ 39 || (defined __MINGW32__ && defined __STRING_H_SOURCED__))
40 || defined _GL_ALREADY_INCLUDING_WCHAR_H)
41/* Special invocation convention: 40/* Special invocation convention:
42 - Inside glibc and uClibc header files, but not MinGW. 41 - Inside glibc and uClibc header files, but not MinGW.
43 - On HP-UX 11.00 we have a sequence of nested includes 42 - On HP-UX 11.00 we have a sequence of nested includes
@@ -47,20 +46,18 @@
47 therefore we cannot provide the function overrides; instead include only 46 therefore we cannot provide the function overrides; instead include only
48 the system's <wchar.h>. 47 the system's <wchar.h>.
49 - With MinGW 3.22, when <string.h> includes <wchar.h>, only some part of 48 - 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'. 49 <wchar.h> is actually processed, and that doesn't include 'mbstate_t'. */
51 - On IRIX 6.5, similarly, we have an include <wchar.h> -> <wctype.h>, and
52 the latter includes <wchar.h>. But here, we have no way to detect whether
53 <wctype.h> is completely included or is still being included. */
54 50
55#@INCLUDE_NEXT@ @NEXT_WCHAR_H@ 51#@INCLUDE_NEXT@ @NEXT_WCHAR_H@
52/* The glibc 2.5 /usr/include/wchar.h defines __need_wint_t but never undefines
53 it. We need to do that here. */
54#undef __need_wint_t
56 55
57#else 56#else
58/* Normal invocation convention. */ 57/* Normal invocation convention. */
59 58
60#ifndef _@GUARD_PREFIX@_WCHAR_H 59#ifndef _@GUARD_PREFIX@_WCHAR_H
61 60
62#define _GL_ALREADY_INCLUDING_WCHAR_H
63
64#if @HAVE_FEATURES_H@ 61#if @HAVE_FEATURES_H@
65# include <features.h> /* for __GLIBC__ */ 62# include <features.h> /* for __GLIBC__ */
66#endif 63#endif
@@ -79,16 +76,21 @@
79# @INCLUDE_NEXT@ @NEXT_WCHAR_H@ 76# @INCLUDE_NEXT@ @NEXT_WCHAR_H@
80#endif 77#endif
81 78
82#undef _GL_ALREADY_INCLUDING_WCHAR_H
83
84#ifndef _@GUARD_PREFIX@_WCHAR_H 79#ifndef _@GUARD_PREFIX@_WCHAR_H
85#define _@GUARD_PREFIX@_WCHAR_H 80#define _@GUARD_PREFIX@_WCHAR_H
86 81
82/* This file uses _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_MALLOC,
83 _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PURE, GNULIB_POSIXCHECK,
84 HAVE_RAW_DECL_*. */
85#if !_GL_CONFIG_H_INCLUDED
86 #error "Please include config.h first."
87#endif
88
87/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers 89/* _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 90 that can be freed by passing them as the Ith argument to the
89 function F. */ 91 function F. */
90#ifndef _GL_ATTRIBUTE_DEALLOC 92#ifndef _GL_ATTRIBUTE_DEALLOC
91# if __GNUC__ >= 11 93# if __GNUC__ >= 11 && !defined __clang__
92# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) 94# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
93# else 95# else
94# define _GL_ATTRIBUTE_DEALLOC(f, i) 96# define _GL_ATTRIBUTE_DEALLOC(f, i)
@@ -100,7 +102,7 @@
100/* Applies to: functions. Cannot be used on inline functions. */ 102/* Applies to: functions. Cannot be used on inline functions. */
101#ifndef _GL_ATTRIBUTE_DEALLOC_FREE 103#ifndef _GL_ATTRIBUTE_DEALLOC_FREE
102# if defined __cplusplus && defined __GNUC__ && !defined __clang__ 104# if defined __cplusplus && defined __GNUC__ && !defined __clang__
103/* Work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108231> */ 105/* Work around GCC bug <https://gcc.gnu.org/PR108231> */
104# define _GL_ATTRIBUTE_DEALLOC_FREE \ 106# define _GL_ATTRIBUTE_DEALLOC_FREE \
105 _GL_ATTRIBUTE_DEALLOC ((void (*) (void *)) free, 1) 107 _GL_ATTRIBUTE_DEALLOC ((void (*) (void *)) free, 1)
106# else 108# else
@@ -130,6 +132,40 @@
130# endif 132# endif
131#endif 133#endif
132 134
135/* _GL_ATTRIBUTE_NONNULL_IF_NONZERO (NP, NI) declares that the argument NP
136 (a pointer) must not be NULL if the argument NI (an integer) is != 0. */
137/* Applies to: functions. */
138#ifndef _GL_ATTRIBUTE_NONNULL_IF_NONZERO
139# if __GNUC__ >= 15 && !defined __clang__
140# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni) \
141 __attribute__ ((__nonnull_if_nonzero__ (np, ni)))
142# else
143# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni)
144# endif
145#endif
146
147/* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions.
148 */
149#ifndef _GL_ATTRIBUTE_NOTHROW
150# if defined __cplusplus
151# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4
152# if __cplusplus >= 201103L
153# define _GL_ATTRIBUTE_NOTHROW noexcept (true)
154# else
155# define _GL_ATTRIBUTE_NOTHROW throw ()
156# endif
157# else
158# define _GL_ATTRIBUTE_NOTHROW
159# endif
160# else
161# if (__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__
162# define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__))
163# else
164# define _GL_ATTRIBUTE_NOTHROW
165# endif
166# endif
167#endif
168
133/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 169/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
134 170
135/* The definition of _GL_ARG_NONNULL is copied here. */ 171/* The definition of _GL_ARG_NONNULL is copied here. */
@@ -167,17 +203,11 @@ typedef unsigned int rpl_wint_t;
167 203
168 204
169/* Override mbstate_t if it is too small. 205/* Override mbstate_t if it is too small.
170 On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for 206 On AIX, MSVC, and OpenBSD 6.0, mbrtowc needs to be overridden, but
171 implementing mbrtowc for encodings like UTF-8. 207 mbstate_t exists and is large enough and overriding it would cause problems
172 On AIX and MSVC, mbrtowc needs to be overridden, but mbstate_t exists and is 208 in C++ mode. */
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@ 209#if !(((defined _WIN32 && !defined __CYGWIN__) || @HAVE_MBSINIT@) && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@
175# if !GNULIB_defined_mbstate_t 210# if !GNULIB_defined_mbstate_t
176# if !(defined _AIX || defined _MSC_VER)
177typedef int rpl_mbstate_t;
178# undef mbstate_t
179# define mbstate_t rpl_mbstate_t
180# endif
181# define GNULIB_defined_mbstate_t 1 211# define GNULIB_defined_mbstate_t 1
182# endif 212# endif
183#endif 213#endif
@@ -188,7 +218,11 @@ typedef int rpl_mbstate_t;
188# if (@REPLACE_FREE@ && !defined free \ 218# if (@REPLACE_FREE@ && !defined free \
189 && !(defined __cplusplus && defined GNULIB_NAMESPACE)) 219 && !(defined __cplusplus && defined GNULIB_NAMESPACE))
190/* We can't do '#define free rpl_free' here. */ 220/* We can't do '#define free rpl_free' here. */
221# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
222_GL_EXTERN_C void rpl_free (void *) _GL_ATTRIBUTE_NOTHROW;
223# else
191_GL_EXTERN_C void rpl_free (void *); 224_GL_EXTERN_C void rpl_free (void *);
225# endif
192# undef _GL_ATTRIBUTE_DEALLOC_FREE 226# undef _GL_ATTRIBUTE_DEALLOC_FREE
193# define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1) 227# define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1)
194# else 228# else
@@ -200,7 +234,7 @@ _GL_EXTERN_C
200 void __cdecl free (void *); 234 void __cdecl free (void *);
201# else 235# else
202# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) 236# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
203_GL_EXTERN_C void free (void *) throw (); 237_GL_EXTERN_C void free (void *) _GL_ATTRIBUTE_NOTHROW;
204# else 238# else
205_GL_EXTERN_C void free (void *); 239_GL_EXTERN_C void free (void *);
206# endif 240# endif
@@ -215,13 +249,69 @@ _GL_EXTERN_C
215 void __cdecl free (void *); 249 void __cdecl free (void *);
216# else 250# else
217# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) 251# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
218_GL_EXTERN_C void free (void *) throw (); 252_GL_EXTERN_C void free (void *) _GL_ATTRIBUTE_NOTHROW;
219# else 253# else
220_GL_EXTERN_C void free (void *); 254_GL_EXTERN_C void free (void *);
221# endif 255# endif
222# endif 256# endif
223#endif 257#endif
224 258
259
260#if @GNULIB_MBSZERO@
261/* Get memset(). */
262# include <string.h>
263#endif
264
265
266/* Declarations for ISO C N3322. */
267#if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__
268_GL_EXTERN_C wchar_t *wmemcpy (wchar_t *__dest, const wchar_t *__src, size_t __n)
269# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
270 _GL_ATTRIBUTE_NOTHROW
271# endif
272 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
273 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3);
274_GL_EXTERN_C wchar_t *wmemmove (wchar_t *__dest, const wchar_t *__src, size_t __n)
275# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
276 _GL_ATTRIBUTE_NOTHROW
277# endif
278 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
279 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3);
280_GL_EXTERN_C wchar_t *wcsncpy (wchar_t *__dest, const wchar_t *__src, size_t __n)
281# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
282 _GL_ATTRIBUTE_NOTHROW
283# endif
284 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
285 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3);
286_GL_EXTERN_C wchar_t *wcsncat (wchar_t *__dest, const wchar_t *__src, size_t __n)
287# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
288 _GL_ATTRIBUTE_NOTHROW
289# endif
290 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3);
291_GL_EXTERN_C int wmemcmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n)
292# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
293 _GL_ATTRIBUTE_NOTHROW
294# endif
295 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
296 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3);
297_GL_EXTERN_C int wcsncmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n)
298# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
299 _GL_ATTRIBUTE_NOTHROW
300# endif
301 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
302 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3);
303# ifndef __cplusplus
304_GL_EXTERN_C wchar_t *(wmemchr) (const wchar_t *__s, wchar_t __wc, size_t __n)
305 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3);
306# endif
307_GL_EXTERN_C wchar_t *wmemset (wchar_t *__s, wchar_t __wc, size_t __n)
308# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
309 _GL_ATTRIBUTE_NOTHROW
310# endif
311 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3);
312#endif
313
314
225/* Convert a single-byte character to a wide character. */ 315/* Convert a single-byte character to a wide character. */
226#if @GNULIB_BTOWC@ 316#if @GNULIB_BTOWC@
227# if @REPLACE_BTOWC@ 317# if @REPLACE_BTOWC@
@@ -229,11 +319,11 @@ _GL_EXTERN_C void free (void *);
229# undef btowc 319# undef btowc
230# define btowc rpl_btowc 320# define btowc rpl_btowc
231# endif 321# endif
232_GL_FUNCDECL_RPL (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE); 322_GL_FUNCDECL_RPL (btowc, wint_t, (int c), _GL_ATTRIBUTE_PURE);
233_GL_CXXALIAS_RPL (btowc, wint_t, (int c)); 323_GL_CXXALIAS_RPL (btowc, wint_t, (int c));
234# else 324# else
235# if !@HAVE_BTOWC@ 325# if !@HAVE_BTOWC@
236_GL_FUNCDECL_SYS (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE); 326_GL_FUNCDECL_SYS (btowc, wint_t, (int c), _GL_ATTRIBUTE_PURE);
237# endif 327# endif
238/* Need to cast, because on mingw, the return type is 'unsigned short'. */ 328/* Need to cast, because on mingw, the return type is 'unsigned short'. */
239_GL_CXXALIAS_SYS_CAST (btowc, wint_t, (int c)); 329_GL_CXXALIAS_SYS_CAST (btowc, wint_t, (int c));
@@ -242,7 +332,6 @@ _GL_CXXALIAS_SYS_CAST (btowc, wint_t, (int c));
242_GL_CXXALIASWARN (btowc); 332_GL_CXXALIASWARN (btowc);
243# endif 333# endif
244#elif defined GNULIB_POSIXCHECK 334#elif defined GNULIB_POSIXCHECK
245# undef btowc
246# if HAVE_RAW_DECL_BTOWC 335# if HAVE_RAW_DECL_BTOWC
247_GL_WARN_ON_USE (btowc, "btowc is unportable - " 336_GL_WARN_ON_USE (btowc, "btowc is unportable - "
248 "use gnulib module btowc for portability"); 337 "use gnulib module btowc for portability");
@@ -257,12 +346,12 @@ _GL_WARN_ON_USE (btowc, "btowc is unportable - "
257# undef wctob 346# undef wctob
258# define wctob rpl_wctob 347# define wctob rpl_wctob
259# endif 348# endif
260_GL_FUNCDECL_RPL (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE); 349_GL_FUNCDECL_RPL (wctob, int, (wint_t wc), _GL_ATTRIBUTE_PURE);
261_GL_CXXALIAS_RPL (wctob, int, (wint_t wc)); 350_GL_CXXALIAS_RPL (wctob, int, (wint_t wc));
262# else 351# else
263# if !defined wctob && !@HAVE_DECL_WCTOB@ 352# if !defined wctob && !@HAVE_WCTOB@
264/* wctob is provided by gnulib, or wctob exists but is not declared. */ 353/* wctob is provided by gnulib. */
265_GL_FUNCDECL_SYS (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE); 354_GL_FUNCDECL_SYS (wctob, int, (wint_t wc), _GL_ATTRIBUTE_PURE);
266# endif 355# endif
267_GL_CXXALIAS_SYS (wctob, int, (wint_t wc)); 356_GL_CXXALIAS_SYS (wctob, int, (wint_t wc));
268# endif 357# endif
@@ -270,7 +359,6 @@ _GL_CXXALIAS_SYS (wctob, int, (wint_t wc));
270_GL_CXXALIASWARN (wctob); 359_GL_CXXALIASWARN (wctob);
271# endif 360# endif
272#elif defined GNULIB_POSIXCHECK 361#elif defined GNULIB_POSIXCHECK
273# undef wctob
274# if HAVE_RAW_DECL_WCTOB 362# if HAVE_RAW_DECL_WCTOB
275_GL_WARN_ON_USE (wctob, "wctob is unportable - " 363_GL_WARN_ON_USE (wctob, "wctob is unportable - "
276 "use gnulib module wctob for portability"); 364 "use gnulib module wctob for portability");
@@ -278,18 +366,18 @@ _GL_WARN_ON_USE (wctob, "wctob is unportable - "
278#endif 366#endif
279 367
280 368
281/* Test whether *PS is in the initial state. */ 369/* Test whether *PS is in an initial state. */
282#if @GNULIB_MBSINIT@ 370#if @GNULIB_MBSINIT@
283# if @REPLACE_MBSINIT@ 371# if @REPLACE_MBSINIT@
284# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 372# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
285# undef mbsinit 373# undef mbsinit
286# define mbsinit rpl_mbsinit 374# define mbsinit rpl_mbsinit
287# endif 375# endif
288_GL_FUNCDECL_RPL (mbsinit, int, (const mbstate_t *ps)); 376_GL_FUNCDECL_RPL (mbsinit, int, (const mbstate_t *ps), );
289_GL_CXXALIAS_RPL (mbsinit, int, (const mbstate_t *ps)); 377_GL_CXXALIAS_RPL (mbsinit, int, (const mbstate_t *ps));
290# else 378# else
291# if !@HAVE_MBSINIT@ 379# if !@HAVE_MBSINIT@
292_GL_FUNCDECL_SYS (mbsinit, int, (const mbstate_t *ps)); 380_GL_FUNCDECL_SYS (mbsinit, int, (const mbstate_t *ps), );
293# endif 381# endif
294_GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps)); 382_GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps));
295# endif 383# endif
@@ -297,7 +385,6 @@ _GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps));
297_GL_CXXALIASWARN (mbsinit); 385_GL_CXXALIASWARN (mbsinit);
298# endif 386# endif
299#elif defined GNULIB_POSIXCHECK 387#elif defined GNULIB_POSIXCHECK
300# undef mbsinit
301# if HAVE_RAW_DECL_MBSINIT 388# if HAVE_RAW_DECL_MBSINIT
302_GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - " 389_GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - "
303 "use gnulib module mbsinit for portability"); 390 "use gnulib module mbsinit for portability");
@@ -305,6 +392,211 @@ _GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - "
305#endif 392#endif
306 393
307 394
395/* Put *PS into an initial state. */
396#if @GNULIB_MBSZERO@
397/* ISO C 23 § 7.31.6.(3) says that zeroing an mbstate_t is a way to put the
398 mbstate_t into an initial state. However, on many platforms an mbstate_t
399 is large, and it is possible - as an optimization - to get away with zeroing
400 only part of it. So, instead of
401
402 mbstate_t state = { 0 };
403
404 or
405
406 mbstate_t state;
407 memset (&state, 0, sizeof (mbstate_t));
408
409 we can write this faster code:
410
411 mbstate_t state;
412 mbszero (&state);
413 */
414/* _GL_MBSTATE_INIT_SIZE describes how mbsinit() behaves: It is the number of
415 bytes at the beginning of an mbstate_t that need to be zero, for mbsinit()
416 to return true.
417 _GL_MBSTATE_ZERO_SIZE is the number of bytes at the beginning of an mbstate_t
418 that need to be zero,
419 - for mbsinit() to return true, and
420 - for all other multibyte-aware functions to operate properly.
421 0 < _GL_MBSTATE_INIT_SIZE <= _GL_MBSTATE_ZERO_SIZE <= sizeof (mbstate_t).
422 These values are determined by source code inspection, where possible, and
423 by running the gnulib unit tests.
424 We need _GL_MBSTATE_INIT_SIZE because if we define _GL_MBSTATE_ZERO_SIZE
425 without considering what mbsinit() does, we get test failures such as
426 assertion "mbsinit (&iter->state)" failed
427 */
428# if GNULIB_defined_mbstate_t /* AIX */
429/* mbstate_t has at least 4 bytes. They are used as coded in
430 gnulib/lib/mbrtowc.c. */
431# define _GL_MBSTATE_INIT_SIZE 1
432/* define _GL_MBSTATE_ZERO_SIZE 4
433 does not work: it causes test failures.
434 So, use the safe fallback value, below. */
435# elif __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 /* glibc */
436/* mbstate_t is defined in <bits/types/__mbstate_t.h>.
437 For more details, see glibc/iconv/skeleton.c. */
438# define _GL_MBSTATE_INIT_SIZE 4 /* sizeof (((mbstate_t) {0}).__count) */
439# define _GL_MBSTATE_ZERO_SIZE /* 8 */ sizeof (mbstate_t)
440# elif defined MUSL_LIBC /* musl libc */
441/* mbstate_t is defined in <bits/alltypes.h>.
442 It is an opaque aligned 8-byte struct, of which at most the first
443 4 bytes are used.
444 For more details, see src/multibyte/mbrtowc.c. */
445# define _GL_MBSTATE_INIT_SIZE 4 /* sizeof (unsigned) */
446# define _GL_MBSTATE_ZERO_SIZE 4
447# elif defined __APPLE__ && defined __MACH__ /* macOS */
448/* On macOS, mbstate_t is defined in <machine/_types.h>.
449 It is an opaque aligned 128-byte struct, of which at most the first
450 12 bytes are used.
451 For more details, see the __mbsinit implementations in
452 Libc-<version>/locale/FreeBSD/
453 {ascii,none,euc,mskanji,big5,gb2312,gbk,gb18030,utf8,utf2}.c. */
454/* File INIT_SIZE ZERO_SIZE
455 ascii.c 0 0
456 none.c 0 0
457 euc.c 12 12
458 mskanji.c 4 4
459 big5.c 4 4
460 gb2312.c 4 6
461 gbk.c 4 4
462 gb18030.c 4 8
463 utf8.c 8 10
464 utf2.c 8 12 */
465# define _GL_MBSTATE_INIT_SIZE 12
466# define _GL_MBSTATE_ZERO_SIZE 12
467# elif defined __FreeBSD__ /* FreeBSD */
468/* On FreeBSD, mbstate_t is defined in src/sys/sys/_types.h.
469 It is an opaque aligned 128-byte struct, of which at most the first
470 12 bytes are used.
471 For more details, see the __mbsinit implementations in
472 src/lib/libc/locale/
473 {ascii,none,euc,mskanji,big5,gb2312,gbk,gb18030,utf8}.c. */
474/* File INIT_SIZE ZERO_SIZE
475 ascii.c 0 0
476 none.c 0 0
477 euc.c 12 12
478 mskanji.c 4 4
479 big5.c 4 4
480 gb2312.c 4 6
481 gbk.c 4 4
482 gb18030.c 4 8
483 utf8.c 8 12 */
484# define _GL_MBSTATE_INIT_SIZE 12
485# define _GL_MBSTATE_ZERO_SIZE 12
486# elif defined __NetBSD__ /* NetBSD */
487/* On NetBSD, mbstate_t is defined in src/sys/sys/ansi.h.
488 It is an opaque aligned 128-byte struct, of which at most the first
489 28 bytes are used.
490 For more details, see the *State types in
491 src/lib/libc/citrus/modules/citrus_*.c
492 (ignoring citrus_{hz,iso2022,utf7,viqr,zw}.c, since these implement
493 stateful encodings, not usable as locale encodings). */
494/* File ZERO_SIZE
495 citrus/citrus_none.c 0
496 citrus/modules/citrus_euc.c 8
497 citrus/modules/citrus_euctw.c 8
498 citrus/modules/citrus_mskanji.c 8
499 citrus/modules/citrus_big5.c 8
500 citrus/modules/citrus_gbk2k.c 8
501 citrus/modules/citrus_dechanyu.c 8
502 citrus/modules/citrus_johab.c 6
503 citrus/modules/citrus_utf8.c 12 */
504/* But 12 is not the correct value for _GL_MBSTATE_ZERO_SIZE: we get test
505 failures for values < 28. */
506# define _GL_MBSTATE_ZERO_SIZE 28
507# elif defined __OpenBSD__ /* OpenBSD */
508/* On OpenBSD, mbstate_t is defined in src/sys/sys/_types.h.
509 It is an opaque aligned 128-byte struct, of which at most the first
510 12 bytes are used.
511 For more details, see src/lib/libc/citrus/citrus_*.c. */
512/* File INIT_SIZE ZERO_SIZE
513 citrus_none.c 0 0
514 citrus_utf8.c 12 12 */
515# define _GL_MBSTATE_INIT_SIZE 12
516# define _GL_MBSTATE_ZERO_SIZE 12
517# elif defined __minix /* Minix */
518/* On Minix, mbstate_t is defined in sys/sys/ansi.h.
519 It is an opaque aligned 128-byte struct.
520 For more details, see the *State types in
521 lib/libc/citrus/citrus_*.c. */
522/* File INIT_SIZE ZERO_SIZE
523 citrus_none.c 0 0 */
524/* But 1 is not the correct value for _GL_MBSTATE_ZERO_SIZE: we get test
525 failures for values < 4. */
526# define _GL_MBSTATE_ZERO_SIZE 4
527# elif defined __sun /* Solaris */
528/* On Solaris, mbstate_t is defined in <wchar_impl.h>.
529 It is an opaque aligned 24-byte or 32-byte struct, of which at most the first
530 20 or 28 bytes are used.
531 For more details on OpenSolaris derivatives, see the *State types in
532 illumos-gate/usr/src/lib/libc/port/locale/
533 {none,euc,mskanji,big5,gb2312,gbk,gb18030,utf8}.c. */
534/* File INIT_SIZE ZERO_SIZE
535 none.c 0 0
536 euc.c 12 12
537 mskanji.c 4 4
538 big5.c 4 4
539 gb2312.c 4 6
540 gbk.c 4 4
541 gb18030.c 4 8
542 utf8.c 12 12 */
543/* But 12 is not the correct value for _GL_MBSTATE_ZERO_SIZE: we get test
544 failures
545 - in OpenIndiana and OmniOS: for values < 16,
546 - in Solaris 10 and 11: for values < 20 (in 32-bit mode)
547 or < 28 (in 64-bit mode).
548 Since we don't have a good way to distinguish the OpenSolaris derivatives
549 from the proprietary Solaris versions, and can't inspect the Solaris source
550 code, use the safe fallback values, below. */
551# elif defined __CYGWIN__ /* Cygwin */
552/* On Cygwin, mbstate_t is defined in <sys/_types.h>.
553 For more details, see newlib/libc/stdlib/mbtowc_r.c and
554 winsup/cygwin/strfuncs.cc. */
555# define _GL_MBSTATE_INIT_SIZE 4 /* sizeof (int) */
556# define _GL_MBSTATE_ZERO_SIZE 8
557# elif defined _WIN32 && !defined __CYGWIN__ /* Native Windows. */
558/* MSVC defines 'mbstate_t' as an aligned 8-byte struct.
559 On mingw, 'mbstate_t' is sometimes defined as 'int', sometimes defined
560 as an aligned 8-byte struct, of which the first 4 bytes matter.
561 Use the safe values, below. */
562# elif defined __ANDROID__ /* Android */
563/* Android defines 'mbstate_t' in <bits/mbstate_t.h>.
564 It is an opaque 4-byte or 8-byte struct.
565 For more details, see
566 bionic/libc/private/bionic_mbstate.h
567 bionic/libc/bionic/mbrtoc32.cpp
568 bionic/libc/bionic/mbrtoc16.cpp
569 */
570# define _GL_MBSTATE_INIT_SIZE 4
571# define _GL_MBSTATE_ZERO_SIZE 4
572# endif
573/* Use safe values as defaults. */
574# ifndef _GL_MBSTATE_INIT_SIZE
575# define _GL_MBSTATE_INIT_SIZE sizeof (mbstate_t)
576# endif
577# ifndef _GL_MBSTATE_ZERO_SIZE
578# define _GL_MBSTATE_ZERO_SIZE sizeof (mbstate_t)
579# endif
580_GL_BEGIN_C_LINKAGE
581# if !GNULIB_defined_mbszero
582# if defined IN_MBSZERO
583_GL_EXTERN_INLINE
584# else
585_GL_INLINE
586# endif
587_GL_ARG_NONNULL ((1)) void
588mbszero (mbstate_t *ps)
589{
590 memset (ps, 0, _GL_MBSTATE_ZERO_SIZE);
591}
592# define GNULIB_defined_mbszero 1
593# endif
594_GL_END_C_LINKAGE
595_GL_CXXALIAS_SYS (mbszero, void, (mbstate_t *ps));
596_GL_CXXALIASWARN (mbszero);
597#endif
598
599
308/* Convert a multibyte character to a wide character. */ 600/* Convert a multibyte character to a wide character. */
309#if @GNULIB_MBRTOWC@ 601#if @GNULIB_MBRTOWC@
310# if @REPLACE_MBRTOWC@ 602# if @REPLACE_MBRTOWC@
@@ -314,7 +606,7 @@ _GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - "
314# endif 606# endif
315_GL_FUNCDECL_RPL (mbrtowc, size_t, 607_GL_FUNCDECL_RPL (mbrtowc, size_t,
316 (wchar_t *restrict pwc, const char *restrict s, size_t n, 608 (wchar_t *restrict pwc, const char *restrict s, size_t n,
317 mbstate_t *restrict ps)); 609 mbstate_t *restrict ps), );
318_GL_CXXALIAS_RPL (mbrtowc, size_t, 610_GL_CXXALIAS_RPL (mbrtowc, size_t,
319 (wchar_t *restrict pwc, const char *restrict s, size_t n, 611 (wchar_t *restrict pwc, const char *restrict s, size_t n,
320 mbstate_t *restrict ps)); 612 mbstate_t *restrict ps));
@@ -322,7 +614,7 @@ _GL_CXXALIAS_RPL (mbrtowc, size_t,
322# if !@HAVE_MBRTOWC@ 614# if !@HAVE_MBRTOWC@
323_GL_FUNCDECL_SYS (mbrtowc, size_t, 615_GL_FUNCDECL_SYS (mbrtowc, size_t,
324 (wchar_t *restrict pwc, const char *restrict s, size_t n, 616 (wchar_t *restrict pwc, const char *restrict s, size_t n,
325 mbstate_t *restrict ps)); 617 mbstate_t *restrict ps), );
326# endif 618# endif
327_GL_CXXALIAS_SYS (mbrtowc, size_t, 619_GL_CXXALIAS_SYS (mbrtowc, size_t,
328 (wchar_t *restrict pwc, const char *restrict s, size_t n, 620 (wchar_t *restrict pwc, const char *restrict s, size_t n,
@@ -332,7 +624,6 @@ _GL_CXXALIAS_SYS (mbrtowc, size_t,
332_GL_CXXALIASWARN (mbrtowc); 624_GL_CXXALIASWARN (mbrtowc);
333# endif 625# endif
334#elif defined GNULIB_POSIXCHECK 626#elif defined GNULIB_POSIXCHECK
335# undef mbrtowc
336# if HAVE_RAW_DECL_MBRTOWC 627# if HAVE_RAW_DECL_MBRTOWC
337_GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - " 628_GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - "
338 "use gnulib module mbrtowc for portability"); 629 "use gnulib module mbrtowc for portability");
@@ -348,13 +639,13 @@ _GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - "
348# define mbrlen rpl_mbrlen 639# define mbrlen rpl_mbrlen
349# endif 640# endif
350_GL_FUNCDECL_RPL (mbrlen, size_t, 641_GL_FUNCDECL_RPL (mbrlen, size_t,
351 (const char *restrict s, size_t n, mbstate_t *restrict ps)); 642 (const char *restrict s, size_t n, mbstate_t *restrict ps), );
352_GL_CXXALIAS_RPL (mbrlen, size_t, 643_GL_CXXALIAS_RPL (mbrlen, size_t,
353 (const char *restrict s, size_t n, mbstate_t *restrict ps)); 644 (const char *restrict s, size_t n, mbstate_t *restrict ps));
354# else 645# else
355# if !@HAVE_MBRLEN@ 646# if !@HAVE_MBRLEN@
356_GL_FUNCDECL_SYS (mbrlen, size_t, 647_GL_FUNCDECL_SYS (mbrlen, size_t,
357 (const char *restrict s, size_t n, mbstate_t *restrict ps)); 648 (const char *restrict s, size_t n, mbstate_t *restrict ps), );
358# endif 649# endif
359_GL_CXXALIAS_SYS (mbrlen, size_t, 650_GL_CXXALIAS_SYS (mbrlen, size_t,
360 (const char *restrict s, size_t n, mbstate_t *restrict ps)); 651 (const char *restrict s, size_t n, mbstate_t *restrict ps));
@@ -363,7 +654,6 @@ _GL_CXXALIAS_SYS (mbrlen, size_t,
363_GL_CXXALIASWARN (mbrlen); 654_GL_CXXALIASWARN (mbrlen);
364# endif 655# endif
365#elif defined GNULIB_POSIXCHECK 656#elif defined GNULIB_POSIXCHECK
366# undef mbrlen
367# if HAVE_RAW_DECL_MBRLEN 657# if HAVE_RAW_DECL_MBRLEN
368_GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - " 658_GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - "
369 "use gnulib module mbrlen for portability"); 659 "use gnulib module mbrlen for portability");
@@ -381,7 +671,7 @@ _GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - "
381_GL_FUNCDECL_RPL (mbsrtowcs, size_t, 671_GL_FUNCDECL_RPL (mbsrtowcs, size_t,
382 (wchar_t *restrict dest, 672 (wchar_t *restrict dest,
383 const char **restrict srcp, size_t len, 673 const char **restrict srcp, size_t len,
384 mbstate_t *restrict ps) 674 mbstate_t *restrict ps),
385 _GL_ARG_NONNULL ((2))); 675 _GL_ARG_NONNULL ((2)));
386_GL_CXXALIAS_RPL (mbsrtowcs, size_t, 676_GL_CXXALIAS_RPL (mbsrtowcs, size_t,
387 (wchar_t *restrict dest, 677 (wchar_t *restrict dest,
@@ -392,7 +682,7 @@ _GL_CXXALIAS_RPL (mbsrtowcs, size_t,
392_GL_FUNCDECL_SYS (mbsrtowcs, size_t, 682_GL_FUNCDECL_SYS (mbsrtowcs, size_t,
393 (wchar_t *restrict dest, 683 (wchar_t *restrict dest,
394 const char **restrict srcp, size_t len, 684 const char **restrict srcp, size_t len,
395 mbstate_t *restrict ps) 685 mbstate_t *restrict ps),
396 _GL_ARG_NONNULL ((2))); 686 _GL_ARG_NONNULL ((2)));
397# endif 687# endif
398_GL_CXXALIAS_SYS (mbsrtowcs, size_t, 688_GL_CXXALIAS_SYS (mbsrtowcs, size_t,
@@ -404,7 +694,6 @@ _GL_CXXALIAS_SYS (mbsrtowcs, size_t,
404_GL_CXXALIASWARN (mbsrtowcs); 694_GL_CXXALIASWARN (mbsrtowcs);
405# endif 695# endif
406#elif defined GNULIB_POSIXCHECK 696#elif defined GNULIB_POSIXCHECK
407# undef mbsrtowcs
408# if HAVE_RAW_DECL_MBSRTOWCS 697# if HAVE_RAW_DECL_MBSRTOWCS
409_GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - " 698_GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - "
410 "use gnulib module mbsrtowcs for portability"); 699 "use gnulib module mbsrtowcs for portability");
@@ -422,7 +711,7 @@ _GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - "
422_GL_FUNCDECL_RPL (mbsnrtowcs, size_t, 711_GL_FUNCDECL_RPL (mbsnrtowcs, size_t,
423 (wchar_t *restrict dest, 712 (wchar_t *restrict dest,
424 const char **restrict srcp, size_t srclen, size_t len, 713 const char **restrict srcp, size_t srclen, size_t len,
425 mbstate_t *restrict ps) 714 mbstate_t *restrict ps),
426 _GL_ARG_NONNULL ((2))); 715 _GL_ARG_NONNULL ((2)));
427_GL_CXXALIAS_RPL (mbsnrtowcs, size_t, 716_GL_CXXALIAS_RPL (mbsnrtowcs, size_t,
428 (wchar_t *restrict dest, 717 (wchar_t *restrict dest,
@@ -433,7 +722,7 @@ _GL_CXXALIAS_RPL (mbsnrtowcs, size_t,
433_GL_FUNCDECL_SYS (mbsnrtowcs, size_t, 722_GL_FUNCDECL_SYS (mbsnrtowcs, size_t,
434 (wchar_t *restrict dest, 723 (wchar_t *restrict dest,
435 const char **restrict srcp, size_t srclen, size_t len, 724 const char **restrict srcp, size_t srclen, size_t len,
436 mbstate_t *restrict ps) 725 mbstate_t *restrict ps),
437 _GL_ARG_NONNULL ((2))); 726 _GL_ARG_NONNULL ((2)));
438# endif 727# endif
439_GL_CXXALIAS_SYS (mbsnrtowcs, size_t, 728_GL_CXXALIAS_SYS (mbsnrtowcs, size_t,
@@ -441,9 +730,10 @@ _GL_CXXALIAS_SYS (mbsnrtowcs, size_t,
441 const char **restrict srcp, size_t srclen, size_t len, 730 const char **restrict srcp, size_t srclen, size_t len,
442 mbstate_t *restrict ps)); 731 mbstate_t *restrict ps));
443# endif 732# endif
733# if __GLIBC__ >= 2
444_GL_CXXALIASWARN (mbsnrtowcs); 734_GL_CXXALIASWARN (mbsnrtowcs);
735# endif
445#elif defined GNULIB_POSIXCHECK 736#elif defined GNULIB_POSIXCHECK
446# undef mbsnrtowcs
447# if HAVE_RAW_DECL_MBSNRTOWCS 737# if HAVE_RAW_DECL_MBSNRTOWCS
448_GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - " 738_GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - "
449 "use gnulib module mbsnrtowcs for portability"); 739 "use gnulib module mbsnrtowcs for portability");
@@ -459,13 +749,13 @@ _GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - "
459# define wcrtomb rpl_wcrtomb 749# define wcrtomb rpl_wcrtomb
460# endif 750# endif
461_GL_FUNCDECL_RPL (wcrtomb, size_t, 751_GL_FUNCDECL_RPL (wcrtomb, size_t,
462 (char *restrict s, wchar_t wc, mbstate_t *restrict ps)); 752 (char *restrict s, wchar_t wc, mbstate_t *restrict ps), );
463_GL_CXXALIAS_RPL (wcrtomb, size_t, 753_GL_CXXALIAS_RPL (wcrtomb, size_t,
464 (char *restrict s, wchar_t wc, mbstate_t *restrict ps)); 754 (char *restrict s, wchar_t wc, mbstate_t *restrict ps));
465# else 755# else
466# if !@HAVE_WCRTOMB@ 756# if !@HAVE_WCRTOMB@
467_GL_FUNCDECL_SYS (wcrtomb, size_t, 757_GL_FUNCDECL_SYS (wcrtomb, size_t,
468 (char *restrict s, wchar_t wc, mbstate_t *restrict ps)); 758 (char *restrict s, wchar_t wc, mbstate_t *restrict ps), );
469# endif 759# endif
470_GL_CXXALIAS_SYS (wcrtomb, size_t, 760_GL_CXXALIAS_SYS (wcrtomb, size_t,
471 (char *restrict s, wchar_t wc, mbstate_t *restrict ps)); 761 (char *restrict s, wchar_t wc, mbstate_t *restrict ps));
@@ -474,7 +764,6 @@ _GL_CXXALIAS_SYS (wcrtomb, size_t,
474_GL_CXXALIASWARN (wcrtomb); 764_GL_CXXALIASWARN (wcrtomb);
475# endif 765# endif
476#elif defined GNULIB_POSIXCHECK 766#elif defined GNULIB_POSIXCHECK
477# undef wcrtomb
478# if HAVE_RAW_DECL_WCRTOMB 767# if HAVE_RAW_DECL_WCRTOMB
479_GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - " 768_GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - "
480 "use gnulib module wcrtomb for portability"); 769 "use gnulib module wcrtomb for portability");
@@ -492,7 +781,7 @@ _GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - "
492_GL_FUNCDECL_RPL (wcsrtombs, size_t, 781_GL_FUNCDECL_RPL (wcsrtombs, size_t,
493 (char *restrict dest, const wchar_t **restrict srcp, 782 (char *restrict dest, const wchar_t **restrict srcp,
494 size_t len, 783 size_t len,
495 mbstate_t *restrict ps) 784 mbstate_t *restrict ps),
496 _GL_ARG_NONNULL ((2))); 785 _GL_ARG_NONNULL ((2)));
497_GL_CXXALIAS_RPL (wcsrtombs, size_t, 786_GL_CXXALIAS_RPL (wcsrtombs, size_t,
498 (char *restrict dest, const wchar_t **restrict srcp, 787 (char *restrict dest, const wchar_t **restrict srcp,
@@ -503,7 +792,7 @@ _GL_CXXALIAS_RPL (wcsrtombs, size_t,
503_GL_FUNCDECL_SYS (wcsrtombs, size_t, 792_GL_FUNCDECL_SYS (wcsrtombs, size_t,
504 (char *restrict dest, const wchar_t **restrict srcp, 793 (char *restrict dest, const wchar_t **restrict srcp,
505 size_t len, 794 size_t len,
506 mbstate_t *restrict ps) 795 mbstate_t *restrict ps),
507 _GL_ARG_NONNULL ((2))); 796 _GL_ARG_NONNULL ((2)));
508# endif 797# endif
509_GL_CXXALIAS_SYS (wcsrtombs, size_t, 798_GL_CXXALIAS_SYS (wcsrtombs, size_t,
@@ -515,7 +804,6 @@ _GL_CXXALIAS_SYS (wcsrtombs, size_t,
515_GL_CXXALIASWARN (wcsrtombs); 804_GL_CXXALIASWARN (wcsrtombs);
516# endif 805# endif
517#elif defined GNULIB_POSIXCHECK 806#elif defined GNULIB_POSIXCHECK
518# undef wcsrtombs
519# if HAVE_RAW_DECL_WCSRTOMBS 807# if HAVE_RAW_DECL_WCSRTOMBS
520_GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - " 808_GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - "
521 "use gnulib module wcsrtombs for portability"); 809 "use gnulib module wcsrtombs for portability");
@@ -534,7 +822,7 @@ _GL_FUNCDECL_RPL (wcsnrtombs, size_t,
534 (char *restrict dest, 822 (char *restrict dest,
535 const wchar_t **restrict srcp, size_t srclen, 823 const wchar_t **restrict srcp, size_t srclen,
536 size_t len, 824 size_t len,
537 mbstate_t *restrict ps) 825 mbstate_t *restrict ps),
538 _GL_ARG_NONNULL ((2))); 826 _GL_ARG_NONNULL ((2)));
539_GL_CXXALIAS_RPL (wcsnrtombs, size_t, 827_GL_CXXALIAS_RPL (wcsnrtombs, size_t,
540 (char *restrict dest, 828 (char *restrict dest,
@@ -547,7 +835,7 @@ _GL_FUNCDECL_SYS (wcsnrtombs, size_t,
547 (char *restrict dest, 835 (char *restrict dest,
548 const wchar_t **restrict srcp, size_t srclen, 836 const wchar_t **restrict srcp, size_t srclen,
549 size_t len, 837 size_t len,
550 mbstate_t *restrict ps) 838 mbstate_t *restrict ps),
551 _GL_ARG_NONNULL ((2))); 839 _GL_ARG_NONNULL ((2)));
552# endif 840# endif
553_GL_CXXALIAS_SYS (wcsnrtombs, size_t, 841_GL_CXXALIAS_SYS (wcsnrtombs, size_t,
@@ -560,7 +848,6 @@ _GL_CXXALIAS_SYS (wcsnrtombs, size_t,
560_GL_CXXALIASWARN (wcsnrtombs); 848_GL_CXXALIASWARN (wcsnrtombs);
561# endif 849# endif
562#elif defined GNULIB_POSIXCHECK 850#elif defined GNULIB_POSIXCHECK
563# undef wcsnrtombs
564# if HAVE_RAW_DECL_WCSNRTOMBS 851# if HAVE_RAW_DECL_WCSNRTOMBS
565_GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - " 852_GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - "
566 "use gnulib module wcsnrtombs for portability"); 853 "use gnulib module wcsnrtombs for portability");
@@ -575,12 +862,12 @@ _GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - "
575# undef wcwidth 862# undef wcwidth
576# define wcwidth rpl_wcwidth 863# define wcwidth rpl_wcwidth
577# endif 864# endif
578_GL_FUNCDECL_RPL (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE); 865_GL_FUNCDECL_RPL (wcwidth, int, (wchar_t), _GL_ATTRIBUTE_PURE);
579_GL_CXXALIAS_RPL (wcwidth, int, (wchar_t)); 866_GL_CXXALIAS_RPL (wcwidth, int, (wchar_t));
580# else 867# else
581# if !@HAVE_DECL_WCWIDTH@ 868# if !@HAVE_DECL_WCWIDTH@
582/* wcwidth exists but is not declared. */ 869/* wcwidth exists but is not declared. */
583_GL_FUNCDECL_SYS (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE); 870_GL_FUNCDECL_SYS (wcwidth, int, (wchar_t), _GL_ATTRIBUTE_PURE);
584# endif 871# endif
585_GL_CXXALIAS_SYS (wcwidth, int, (wchar_t)); 872_GL_CXXALIAS_SYS (wcwidth, int, (wchar_t));
586# endif 873# endif
@@ -588,7 +875,6 @@ _GL_CXXALIAS_SYS (wcwidth, int, (wchar_t));
588_GL_CXXALIASWARN (wcwidth); 875_GL_CXXALIASWARN (wcwidth);
589# endif 876# endif
590#elif defined GNULIB_POSIXCHECK 877#elif defined GNULIB_POSIXCHECK
591# undef wcwidth
592# if HAVE_RAW_DECL_WCWIDTH 878# if HAVE_RAW_DECL_WCWIDTH
593_GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - " 879_GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - "
594 "use gnulib module wcwidth for portability"); 880 "use gnulib module wcwidth for portability");
@@ -599,8 +885,9 @@ _GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - "
599/* Search N wide characters of S for C. */ 885/* Search N wide characters of S for C. */
600#if @GNULIB_WMEMCHR@ 886#if @GNULIB_WMEMCHR@
601# if !@HAVE_WMEMCHR@ 887# if !@HAVE_WMEMCHR@
602_GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n) 888_GL_FUNCDECL_SYS (wmemchr, wchar_t *,
603 _GL_ATTRIBUTE_PURE); 889 (const wchar_t *s, wchar_t c, size_t n),
890 _GL_ATTRIBUTE_PURE _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3));
604# endif 891# endif
605 /* On some systems, this function is defined as an overloaded function: 892 /* On some systems, this function is defined as an overloaded function:
606 extern "C++" { 893 extern "C++" {
@@ -611,15 +898,15 @@ _GL_CXXALIAS_SYS_CAST2 (wmemchr,
611 wchar_t *, (const wchar_t *, wchar_t, size_t), 898 wchar_t *, (const wchar_t *, wchar_t, size_t),
612 const wchar_t *, (const wchar_t *, wchar_t, size_t)); 899 const wchar_t *, (const wchar_t *, wchar_t, size_t));
613# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 900# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
614 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 901 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) \
902 && !defined __clang__
615_GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); 903_GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
616_GL_CXXALIASWARN1 (wmemchr, const wchar_t *, 904_GL_CXXALIASWARN1 (wmemchr, const wchar_t *,
617 (const wchar_t *s, wchar_t c, size_t n)); 905 (const wchar_t *s, wchar_t c, size_t n));
618# elif __GLIBC__ >= 2 906# elif __GLIBC__ >= 2 && !defined __CORRECT_ISO_CPP_WCHAR_H_PROTO
619_GL_CXXALIASWARN (wmemchr); 907_GL_CXXALIASWARN (wmemchr);
620# endif 908# endif
621#elif defined GNULIB_POSIXCHECK 909#elif defined GNULIB_POSIXCHECK
622# undef wmemchr
623# if HAVE_RAW_DECL_WMEMCHR 910# if HAVE_RAW_DECL_WMEMCHR
624_GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - " 911_GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - "
625 "use gnulib module wmemchr for portability"); 912 "use gnulib module wmemchr for portability");
@@ -629,18 +916,33 @@ _GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - "
629 916
630/* Compare N wide characters of S1 and S2. */ 917/* Compare N wide characters of S1 and S2. */
631#if @GNULIB_WMEMCMP@ 918#if @GNULIB_WMEMCMP@
632# if !@HAVE_WMEMCMP@ 919# if @REPLACE_WMEMCMP@
920# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
921# undef wmemcmp
922# define wmemcmp rpl_wmemcmp
923# endif
924_GL_FUNCDECL_RPL (wmemcmp, int,
925 (const wchar_t *s1, const wchar_t *s2, size_t n),
926 _GL_ATTRIBUTE_PURE
927 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
928 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3));
929_GL_CXXALIAS_RPL (wmemcmp, int,
930 (const wchar_t *s1, const wchar_t *s2, size_t n));
931# else
932# if !@HAVE_WMEMCMP@
633_GL_FUNCDECL_SYS (wmemcmp, int, 933_GL_FUNCDECL_SYS (wmemcmp, int,
634 (const wchar_t *s1, const wchar_t *s2, size_t n) 934 (const wchar_t *s1, const wchar_t *s2, size_t n),
635 _GL_ATTRIBUTE_PURE); 935 _GL_ATTRIBUTE_PURE
636# endif 936 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
937 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3));
938# endif
637_GL_CXXALIAS_SYS (wmemcmp, int, 939_GL_CXXALIAS_SYS (wmemcmp, int,
638 (const wchar_t *s1, const wchar_t *s2, size_t n)); 940 (const wchar_t *s1, const wchar_t *s2, size_t n));
941# endif
639# if __GLIBC__ >= 2 942# if __GLIBC__ >= 2
640_GL_CXXALIASWARN (wmemcmp); 943_GL_CXXALIASWARN (wmemcmp);
641# endif 944# endif
642#elif defined GNULIB_POSIXCHECK 945#elif defined GNULIB_POSIXCHECK
643# undef wmemcmp
644# if HAVE_RAW_DECL_WMEMCMP 946# if HAVE_RAW_DECL_WMEMCMP
645_GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - " 947_GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - "
646 "use gnulib module wmemcmp for portability"); 948 "use gnulib module wmemcmp for portability");
@@ -653,7 +955,9 @@ _GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - "
653# if !@HAVE_WMEMCPY@ 955# if !@HAVE_WMEMCPY@
654_GL_FUNCDECL_SYS (wmemcpy, wchar_t *, 956_GL_FUNCDECL_SYS (wmemcpy, wchar_t *,
655 (wchar_t *restrict dest, 957 (wchar_t *restrict dest,
656 const wchar_t *restrict src, size_t n)); 958 const wchar_t *restrict src, size_t n),
959 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
960 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3));
657# endif 961# endif
658_GL_CXXALIAS_SYS (wmemcpy, wchar_t *, 962_GL_CXXALIAS_SYS (wmemcpy, wchar_t *,
659 (wchar_t *restrict dest, 963 (wchar_t *restrict dest,
@@ -662,7 +966,6 @@ _GL_CXXALIAS_SYS (wmemcpy, wchar_t *,
662_GL_CXXALIASWARN (wmemcpy); 966_GL_CXXALIASWARN (wmemcpy);
663# endif 967# endif
664#elif defined GNULIB_POSIXCHECK 968#elif defined GNULIB_POSIXCHECK
665# undef wmemcpy
666# if HAVE_RAW_DECL_WMEMCPY 969# if HAVE_RAW_DECL_WMEMCPY
667_GL_WARN_ON_USE (wmemcpy, "wmemcpy is unportable - " 970_GL_WARN_ON_USE (wmemcpy, "wmemcpy is unportable - "
668 "use gnulib module wmemcpy for portability"); 971 "use gnulib module wmemcpy for portability");
@@ -675,7 +978,9 @@ _GL_WARN_ON_USE (wmemcpy, "wmemcpy is unportable - "
675#if @GNULIB_WMEMMOVE@ 978#if @GNULIB_WMEMMOVE@
676# if !@HAVE_WMEMMOVE@ 979# if !@HAVE_WMEMMOVE@
677_GL_FUNCDECL_SYS (wmemmove, wchar_t *, 980_GL_FUNCDECL_SYS (wmemmove, wchar_t *,
678 (wchar_t *dest, const wchar_t *src, size_t n)); 981 (wchar_t *dest, const wchar_t *src, size_t n),
982 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
983 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3));
679# endif 984# endif
680_GL_CXXALIAS_SYS (wmemmove, wchar_t *, 985_GL_CXXALIAS_SYS (wmemmove, wchar_t *,
681 (wchar_t *dest, const wchar_t *src, size_t n)); 986 (wchar_t *dest, const wchar_t *src, size_t n));
@@ -683,7 +988,6 @@ _GL_CXXALIAS_SYS (wmemmove, wchar_t *,
683_GL_CXXALIASWARN (wmemmove); 988_GL_CXXALIASWARN (wmemmove);
684# endif 989# endif
685#elif defined GNULIB_POSIXCHECK 990#elif defined GNULIB_POSIXCHECK
686# undef wmemmove
687# if HAVE_RAW_DECL_WMEMMOVE 991# if HAVE_RAW_DECL_WMEMMOVE
688_GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - " 992_GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - "
689 "use gnulib module wmemmove for portability"); 993 "use gnulib module wmemmove for portability");
@@ -694,19 +998,31 @@ _GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - "
694/* Copy N wide characters of SRC to DEST. 998/* Copy N wide characters of SRC to DEST.
695 Return pointer to wide characters after the last written wide character. */ 999 Return pointer to wide characters after the last written wide character. */
696#if @GNULIB_WMEMPCPY@ 1000#if @GNULIB_WMEMPCPY@
697# if !@HAVE_WMEMPCPY@ 1001# if @REPLACE_WMEMPCPY@
698_GL_FUNCDECL_SYS (wmempcpy, wchar_t *, 1002# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1003# undef wmempcpy
1004# define wmempcpy rpl_wmempcpy
1005# endif
1006_GL_FUNCDECL_RPL (wmempcpy, wchar_t *,
1007 (wchar_t *restrict dest,
1008 const wchar_t *restrict src, size_t n), );
1009_GL_CXXALIAS_RPL (wmempcpy, wchar_t *,
699 (wchar_t *restrict dest, 1010 (wchar_t *restrict dest,
700 const wchar_t *restrict src, size_t n)); 1011 const wchar_t *restrict src, size_t n));
701# endif 1012# else
1013# if !@HAVE_WMEMPCPY@
1014_GL_FUNCDECL_SYS (wmempcpy, wchar_t *,
1015 (wchar_t *restrict dest,
1016 const wchar_t *restrict src, size_t n), );
1017# endif
702_GL_CXXALIAS_SYS (wmempcpy, wchar_t *, 1018_GL_CXXALIAS_SYS (wmempcpy, wchar_t *,
703 (wchar_t *restrict dest, 1019 (wchar_t *restrict dest,
704 const wchar_t *restrict src, size_t n)); 1020 const wchar_t *restrict src, size_t n));
1021# endif
705# if __GLIBC__ >= 2 1022# if __GLIBC__ >= 2
706_GL_CXXALIASWARN (wmempcpy); 1023_GL_CXXALIASWARN (wmempcpy);
707# endif 1024# endif
708#elif defined GNULIB_POSIXCHECK 1025#elif defined GNULIB_POSIXCHECK
709# undef wmempcpy
710# if HAVE_RAW_DECL_WMEMPCPY 1026# if HAVE_RAW_DECL_WMEMPCPY
711_GL_WARN_ON_USE (wmempcpy, "wmempcpy is unportable - " 1027_GL_WARN_ON_USE (wmempcpy, "wmempcpy is unportable - "
712 "use gnulib module wmempcpy for portability"); 1028 "use gnulib module wmempcpy for portability");
@@ -717,14 +1033,14 @@ _GL_WARN_ON_USE (wmempcpy, "wmempcpy is unportable - "
717/* Set N wide characters of S to C. */ 1033/* Set N wide characters of S to C. */
718#if @GNULIB_WMEMSET@ 1034#if @GNULIB_WMEMSET@
719# if !@HAVE_WMEMSET@ 1035# if !@HAVE_WMEMSET@
720_GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); 1036_GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n),
1037 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3));
721# endif 1038# endif
722_GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); 1039_GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
723# if __GLIBC__ >= 2 1040# if __GLIBC__ >= 2
724_GL_CXXALIASWARN (wmemset); 1041_GL_CXXALIASWARN (wmemset);
725# endif 1042# endif
726#elif defined GNULIB_POSIXCHECK 1043#elif defined GNULIB_POSIXCHECK
727# undef wmemset
728# if HAVE_RAW_DECL_WMEMSET 1044# if HAVE_RAW_DECL_WMEMSET
729_GL_WARN_ON_USE (wmemset, "wmemset is unportable - " 1045_GL_WARN_ON_USE (wmemset, "wmemset is unportable - "
730 "use gnulib module wmemset for portability"); 1046 "use gnulib module wmemset for portability");
@@ -735,14 +1051,13 @@ _GL_WARN_ON_USE (wmemset, "wmemset is unportable - "
735/* Return the number of wide characters in S. */ 1051/* Return the number of wide characters in S. */
736#if @GNULIB_WCSLEN@ 1052#if @GNULIB_WCSLEN@
737# if !@HAVE_WCSLEN@ 1053# if !@HAVE_WCSLEN@
738_GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s) _GL_ATTRIBUTE_PURE); 1054_GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s), _GL_ATTRIBUTE_PURE);
739# endif 1055# endif
740_GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s)); 1056_GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s));
741# if __GLIBC__ >= 2 1057# if __GLIBC__ >= 2
742_GL_CXXALIASWARN (wcslen); 1058_GL_CXXALIASWARN (wcslen);
743# endif 1059# endif
744#elif defined GNULIB_POSIXCHECK 1060#elif defined GNULIB_POSIXCHECK
745# undef wcslen
746# if HAVE_RAW_DECL_WCSLEN 1061# if HAVE_RAW_DECL_WCSLEN
747_GL_WARN_ON_USE (wcslen, "wcslen is unportable - " 1062_GL_WARN_ON_USE (wcslen, "wcslen is unportable - "
748 "use gnulib module wcslen for portability"); 1063 "use gnulib module wcslen for portability");
@@ -756,13 +1071,12 @@ _GL_WARN_ON_USE (wcslen, "wcslen is unportable - "
756 namespace, not in the global namespace. So, force a declaration in 1071 namespace, not in the global namespace. So, force a declaration in
757 the global namespace. */ 1072 the global namespace. */
758# if !@HAVE_WCSNLEN@ || (defined __sun && defined __cplusplus) 1073# if !@HAVE_WCSNLEN@ || (defined __sun && defined __cplusplus)
759_GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen) 1074_GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen),
760 _GL_ATTRIBUTE_PURE); 1075 _GL_ATTRIBUTE_PURE);
761# endif 1076# endif
762_GL_CXXALIAS_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen)); 1077_GL_CXXALIAS_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen));
763_GL_CXXALIASWARN (wcsnlen); 1078_GL_CXXALIASWARN (wcsnlen);
764#elif defined GNULIB_POSIXCHECK 1079#elif defined GNULIB_POSIXCHECK
765# undef wcsnlen
766# if HAVE_RAW_DECL_WCSNLEN 1080# if HAVE_RAW_DECL_WCSNLEN
767_GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - " 1081_GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - "
768 "use gnulib module wcsnlen for portability"); 1082 "use gnulib module wcsnlen for portability");
@@ -774,7 +1088,7 @@ _GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - "
774#if @GNULIB_WCSCPY@ 1088#if @GNULIB_WCSCPY@
775# if !@HAVE_WCSCPY@ 1089# if !@HAVE_WCSCPY@
776_GL_FUNCDECL_SYS (wcscpy, wchar_t *, 1090_GL_FUNCDECL_SYS (wcscpy, wchar_t *,
777 (wchar_t *restrict dest, const wchar_t *restrict src)); 1091 (wchar_t *restrict dest, const wchar_t *restrict src), );
778# endif 1092# endif
779_GL_CXXALIAS_SYS (wcscpy, wchar_t *, 1093_GL_CXXALIAS_SYS (wcscpy, wchar_t *,
780 (wchar_t *restrict dest, const wchar_t *restrict src)); 1094 (wchar_t *restrict dest, const wchar_t *restrict src));
@@ -782,7 +1096,6 @@ _GL_CXXALIAS_SYS (wcscpy, wchar_t *,
782_GL_CXXALIASWARN (wcscpy); 1096_GL_CXXALIASWARN (wcscpy);
783# endif 1097# endif
784#elif defined GNULIB_POSIXCHECK 1098#elif defined GNULIB_POSIXCHECK
785# undef wcscpy
786# if HAVE_RAW_DECL_WCSCPY 1099# if HAVE_RAW_DECL_WCSCPY
787_GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - " 1100_GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - "
788 "use gnulib module wcscpy for portability"); 1101 "use gnulib module wcscpy for portability");
@@ -797,13 +1110,12 @@ _GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - "
797 the global namespace. */ 1110 the global namespace. */
798# if !@HAVE_WCPCPY@ || (defined __sun && defined __cplusplus) 1111# if !@HAVE_WCPCPY@ || (defined __sun && defined __cplusplus)
799_GL_FUNCDECL_SYS (wcpcpy, wchar_t *, 1112_GL_FUNCDECL_SYS (wcpcpy, wchar_t *,
800 (wchar_t *restrict dest, const wchar_t *restrict src)); 1113 (wchar_t *restrict dest, const wchar_t *restrict src), );
801# endif 1114# endif
802_GL_CXXALIAS_SYS (wcpcpy, wchar_t *, 1115_GL_CXXALIAS_SYS (wcpcpy, wchar_t *,
803 (wchar_t *restrict dest, const wchar_t *restrict src)); 1116 (wchar_t *restrict dest, const wchar_t *restrict src));
804_GL_CXXALIASWARN (wcpcpy); 1117_GL_CXXALIASWARN (wcpcpy);
805#elif defined GNULIB_POSIXCHECK 1118#elif defined GNULIB_POSIXCHECK
806# undef wcpcpy
807# if HAVE_RAW_DECL_WCPCPY 1119# if HAVE_RAW_DECL_WCPCPY
808_GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - " 1120_GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - "
809 "use gnulib module wcpcpy for portability"); 1121 "use gnulib module wcpcpy for portability");
@@ -816,7 +1128,9 @@ _GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - "
816# if !@HAVE_WCSNCPY@ 1128# if !@HAVE_WCSNCPY@
817_GL_FUNCDECL_SYS (wcsncpy, wchar_t *, 1129_GL_FUNCDECL_SYS (wcsncpy, wchar_t *,
818 (wchar_t *restrict dest, 1130 (wchar_t *restrict dest,
819 const wchar_t *restrict src, size_t n)); 1131 const wchar_t *restrict src, size_t n),
1132 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
1133 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3));
820# endif 1134# endif
821_GL_CXXALIAS_SYS (wcsncpy, wchar_t *, 1135_GL_CXXALIAS_SYS (wcsncpy, wchar_t *,
822 (wchar_t *restrict dest, 1136 (wchar_t *restrict dest,
@@ -825,7 +1139,6 @@ _GL_CXXALIAS_SYS (wcsncpy, wchar_t *,
825_GL_CXXALIASWARN (wcsncpy); 1139_GL_CXXALIASWARN (wcsncpy);
826# endif 1140# endif
827#elif defined GNULIB_POSIXCHECK 1141#elif defined GNULIB_POSIXCHECK
828# undef wcsncpy
829# if HAVE_RAW_DECL_WCSNCPY 1142# if HAVE_RAW_DECL_WCSNCPY
830_GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - " 1143_GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - "
831 "use gnulib module wcsncpy for portability"); 1144 "use gnulib module wcsncpy for portability");
@@ -842,14 +1155,13 @@ _GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - "
842# if !@HAVE_WCPNCPY@ || (defined __sun && defined __cplusplus) 1155# if !@HAVE_WCPNCPY@ || (defined __sun && defined __cplusplus)
843_GL_FUNCDECL_SYS (wcpncpy, wchar_t *, 1156_GL_FUNCDECL_SYS (wcpncpy, wchar_t *,
844 (wchar_t *restrict dest, 1157 (wchar_t *restrict dest,
845 const wchar_t *restrict src, size_t n)); 1158 const wchar_t *restrict src, size_t n), );
846# endif 1159# endif
847_GL_CXXALIAS_SYS (wcpncpy, wchar_t *, 1160_GL_CXXALIAS_SYS (wcpncpy, wchar_t *,
848 (wchar_t *restrict dest, 1161 (wchar_t *restrict dest,
849 const wchar_t *restrict src, size_t n)); 1162 const wchar_t *restrict src, size_t n));
850_GL_CXXALIASWARN (wcpncpy); 1163_GL_CXXALIASWARN (wcpncpy);
851#elif defined GNULIB_POSIXCHECK 1164#elif defined GNULIB_POSIXCHECK
852# undef wcpncpy
853# if HAVE_RAW_DECL_WCPNCPY 1165# if HAVE_RAW_DECL_WCPNCPY
854_GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - " 1166_GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - "
855 "use gnulib module wcpncpy for portability"); 1167 "use gnulib module wcpncpy for portability");
@@ -861,7 +1173,7 @@ _GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - "
861#if @GNULIB_WCSCAT@ 1173#if @GNULIB_WCSCAT@
862# if !@HAVE_WCSCAT@ 1174# if !@HAVE_WCSCAT@
863_GL_FUNCDECL_SYS (wcscat, wchar_t *, 1175_GL_FUNCDECL_SYS (wcscat, wchar_t *,
864 (wchar_t *restrict dest, const wchar_t *restrict src)); 1176 (wchar_t *restrict dest, const wchar_t *restrict src), );
865# endif 1177# endif
866_GL_CXXALIAS_SYS (wcscat, wchar_t *, 1178_GL_CXXALIAS_SYS (wcscat, wchar_t *,
867 (wchar_t *restrict dest, const wchar_t *restrict src)); 1179 (wchar_t *restrict dest, const wchar_t *restrict src));
@@ -869,7 +1181,6 @@ _GL_CXXALIAS_SYS (wcscat, wchar_t *,
869_GL_CXXALIASWARN (wcscat); 1181_GL_CXXALIASWARN (wcscat);
870# endif 1182# endif
871#elif defined GNULIB_POSIXCHECK 1183#elif defined GNULIB_POSIXCHECK
872# undef wcscat
873# if HAVE_RAW_DECL_WCSCAT 1184# if HAVE_RAW_DECL_WCSCAT
874_GL_WARN_ON_USE (wcscat, "wcscat is unportable - " 1185_GL_WARN_ON_USE (wcscat, "wcscat is unportable - "
875 "use gnulib module wcscat for portability"); 1186 "use gnulib module wcscat for portability");
@@ -879,19 +1190,35 @@ _GL_WARN_ON_USE (wcscat, "wcscat is unportable - "
879 1190
880/* Append no more than N wide characters of SRC onto DEST. */ 1191/* Append no more than N wide characters of SRC onto DEST. */
881#if @GNULIB_WCSNCAT@ 1192#if @GNULIB_WCSNCAT@
882# if !@HAVE_WCSNCAT@ 1193# if @REPLACE_WCSNCAT@
883_GL_FUNCDECL_SYS (wcsncat, wchar_t *, 1194# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1195# undef wcsncat
1196# define wcsncat rpl_wcsncat
1197# endif
1198_GL_FUNCDECL_RPL (wcsncat, wchar_t *,
1199 (wchar_t *restrict dest, const wchar_t *restrict src,
1200 size_t n),
1201 _GL_ARG_NONNULL ((1))
1202 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3));
1203_GL_CXXALIAS_RPL (wcsncat, wchar_t *,
884 (wchar_t *restrict dest, const wchar_t *restrict src, 1204 (wchar_t *restrict dest, const wchar_t *restrict src,
885 size_t n)); 1205 size_t n));
886# endif 1206# else
1207# if !@HAVE_WCSNCAT@
1208_GL_FUNCDECL_SYS (wcsncat, wchar_t *,
1209 (wchar_t *restrict dest, const wchar_t *restrict src,
1210 size_t n),
1211 _GL_ARG_NONNULL ((1))
1212 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3));
1213# endif
887_GL_CXXALIAS_SYS (wcsncat, wchar_t *, 1214_GL_CXXALIAS_SYS (wcsncat, wchar_t *,
888 (wchar_t *restrict dest, const wchar_t *restrict src, 1215 (wchar_t *restrict dest, const wchar_t *restrict src,
889 size_t n)); 1216 size_t n));
1217# endif
890# if __GLIBC__ >= 2 1218# if __GLIBC__ >= 2
891_GL_CXXALIASWARN (wcsncat); 1219_GL_CXXALIASWARN (wcsncat);
892# endif 1220# endif
893#elif defined GNULIB_POSIXCHECK 1221#elif defined GNULIB_POSIXCHECK
894# undef wcsncat
895# if HAVE_RAW_DECL_WCSNCAT 1222# if HAVE_RAW_DECL_WCSNCAT
896_GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - " 1223_GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - "
897 "use gnulib module wcsncat for portability"); 1224 "use gnulib module wcsncat for portability");
@@ -901,16 +1228,25 @@ _GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - "
901 1228
902/* Compare S1 and S2. */ 1229/* Compare S1 and S2. */
903#if @GNULIB_WCSCMP@ 1230#if @GNULIB_WCSCMP@
904# if !@HAVE_WCSCMP@ 1231# if @REPLACE_WCSCMP@
905_GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2) 1232# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1233# undef wcscmp
1234# define wcscmp rpl_wcscmp
1235# endif
1236_GL_FUNCDECL_RPL (wcscmp, int, (const wchar_t *s1, const wchar_t *s2),
906 _GL_ATTRIBUTE_PURE); 1237 _GL_ATTRIBUTE_PURE);
907# endif 1238_GL_CXXALIAS_RPL (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
1239# else
1240# if !@HAVE_WCSCMP@
1241_GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2),
1242 _GL_ATTRIBUTE_PURE);
1243# endif
908_GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)); 1244_GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
1245# endif
909# if __GLIBC__ >= 2 1246# if __GLIBC__ >= 2
910_GL_CXXALIASWARN (wcscmp); 1247_GL_CXXALIASWARN (wcscmp);
911# endif 1248# endif
912#elif defined GNULIB_POSIXCHECK 1249#elif defined GNULIB_POSIXCHECK
913# undef wcscmp
914# if HAVE_RAW_DECL_WCSCMP 1250# if HAVE_RAW_DECL_WCSCMP
915_GL_WARN_ON_USE (wcscmp, "wcscmp is unportable - " 1251_GL_WARN_ON_USE (wcscmp, "wcscmp is unportable - "
916 "use gnulib module wcscmp for portability"); 1252 "use gnulib module wcscmp for portability");
@@ -920,18 +1256,33 @@ _GL_WARN_ON_USE (wcscmp, "wcscmp is unportable - "
920 1256
921/* Compare no more than N wide characters of S1 and S2. */ 1257/* Compare no more than N wide characters of S1 and S2. */
922#if @GNULIB_WCSNCMP@ 1258#if @GNULIB_WCSNCMP@
923# if !@HAVE_WCSNCMP@ 1259# if @REPLACE_WCSNCMP@
1260# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1261# undef wcsncmp
1262# define wcsncmp rpl_wcsncmp
1263# endif
1264_GL_FUNCDECL_RPL (wcsncmp, int,
1265 (const wchar_t *s1, const wchar_t *s2, size_t n),
1266 _GL_ATTRIBUTE_PURE
1267 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
1268 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3));
1269_GL_CXXALIAS_RPL (wcsncmp, int,
1270 (const wchar_t *s1, const wchar_t *s2, size_t n));
1271# else
1272# if !@HAVE_WCSNCMP@
924_GL_FUNCDECL_SYS (wcsncmp, int, 1273_GL_FUNCDECL_SYS (wcsncmp, int,
925 (const wchar_t *s1, const wchar_t *s2, size_t n) 1274 (const wchar_t *s1, const wchar_t *s2, size_t n),
926 _GL_ATTRIBUTE_PURE); 1275 _GL_ATTRIBUTE_PURE
927# endif 1276 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
1277 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3));
1278# endif
928_GL_CXXALIAS_SYS (wcsncmp, int, 1279_GL_CXXALIAS_SYS (wcsncmp, int,
929 (const wchar_t *s1, const wchar_t *s2, size_t n)); 1280 (const wchar_t *s1, const wchar_t *s2, size_t n));
1281# endif
930# if __GLIBC__ >= 2 1282# if __GLIBC__ >= 2
931_GL_CXXALIASWARN (wcsncmp); 1283_GL_CXXALIASWARN (wcsncmp);
932# endif 1284# endif
933#elif defined GNULIB_POSIXCHECK 1285#elif defined GNULIB_POSIXCHECK
934# undef wcsncmp
935# if HAVE_RAW_DECL_WCSNCMP 1286# if HAVE_RAW_DECL_WCSNCMP
936_GL_WARN_ON_USE (wcsncmp, "wcsncmp is unportable - " 1287_GL_WARN_ON_USE (wcsncmp, "wcsncmp is unportable - "
937 "use gnulib module wcsncmp for portability"); 1288 "use gnulib module wcsncmp for portability");
@@ -945,13 +1296,12 @@ _GL_WARN_ON_USE (wcsncmp, "wcsncmp is unportable - "
945 namespace, not in the global namespace. So, force a declaration in 1296 namespace, not in the global namespace. So, force a declaration in
946 the global namespace. */ 1297 the global namespace. */
947# if !@HAVE_WCSCASECMP@ || (defined __sun && defined __cplusplus) 1298# if !@HAVE_WCSCASECMP@ || (defined __sun && defined __cplusplus)
948_GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2) 1299_GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2),
949 _GL_ATTRIBUTE_PURE); 1300 _GL_ATTRIBUTE_PURE);
950# endif 1301# endif
951_GL_CXXALIAS_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2)); 1302_GL_CXXALIAS_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2));
952_GL_CXXALIASWARN (wcscasecmp); 1303_GL_CXXALIASWARN (wcscasecmp);
953#elif defined GNULIB_POSIXCHECK 1304#elif defined GNULIB_POSIXCHECK
954# undef wcscasecmp
955# if HAVE_RAW_DECL_WCSCASECMP 1305# if HAVE_RAW_DECL_WCSCASECMP
956_GL_WARN_ON_USE (wcscasecmp, "wcscasecmp is unportable - " 1306_GL_WARN_ON_USE (wcscasecmp, "wcscasecmp is unportable - "
957 "use gnulib module wcscasecmp for portability"); 1307 "use gnulib module wcscasecmp for portability");
@@ -966,14 +1316,13 @@ _GL_WARN_ON_USE (wcscasecmp, "wcscasecmp is unportable - "
966 the global namespace. */ 1316 the global namespace. */
967# if !@HAVE_WCSNCASECMP@ || (defined __sun && defined __cplusplus) 1317# if !@HAVE_WCSNCASECMP@ || (defined __sun && defined __cplusplus)
968_GL_FUNCDECL_SYS (wcsncasecmp, int, 1318_GL_FUNCDECL_SYS (wcsncasecmp, int,
969 (const wchar_t *s1, const wchar_t *s2, size_t n) 1319 (const wchar_t *s1, const wchar_t *s2, size_t n),
970 _GL_ATTRIBUTE_PURE); 1320 _GL_ATTRIBUTE_PURE);
971# endif 1321# endif
972_GL_CXXALIAS_SYS (wcsncasecmp, int, 1322_GL_CXXALIAS_SYS (wcsncasecmp, int,
973 (const wchar_t *s1, const wchar_t *s2, size_t n)); 1323 (const wchar_t *s1, const wchar_t *s2, size_t n));
974_GL_CXXALIASWARN (wcsncasecmp); 1324_GL_CXXALIASWARN (wcsncasecmp);
975#elif defined GNULIB_POSIXCHECK 1325#elif defined GNULIB_POSIXCHECK
976# undef wcsncasecmp
977# if HAVE_RAW_DECL_WCSNCASECMP 1326# if HAVE_RAW_DECL_WCSNCASECMP
978_GL_WARN_ON_USE (wcsncasecmp, "wcsncasecmp is unportable - " 1327_GL_WARN_ON_USE (wcsncasecmp, "wcsncasecmp is unportable - "
979 "use gnulib module wcsncasecmp for portability"); 1328 "use gnulib module wcsncasecmp for portability");
@@ -985,14 +1334,13 @@ _GL_WARN_ON_USE (wcsncasecmp, "wcsncasecmp is unportable - "
985 category of the current locale. */ 1334 category of the current locale. */
986#if @GNULIB_WCSCOLL@ 1335#if @GNULIB_WCSCOLL@
987# if !@HAVE_WCSCOLL@ 1336# if !@HAVE_WCSCOLL@
988_GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2)); 1337_GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2), );
989# endif 1338# endif
990_GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2)); 1339_GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
991# if __GLIBC__ >= 2 1340# if __GLIBC__ >= 2
992_GL_CXXALIASWARN (wcscoll); 1341_GL_CXXALIASWARN (wcscoll);
993# endif 1342# endif
994#elif defined GNULIB_POSIXCHECK 1343#elif defined GNULIB_POSIXCHECK
995# undef wcscoll
996# if HAVE_RAW_DECL_WCSCOLL 1344# if HAVE_RAW_DECL_WCSCOLL
997_GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - " 1345_GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - "
998 "use gnulib module wcscoll for portability"); 1346 "use gnulib module wcscoll for portability");
@@ -1006,7 +1354,7 @@ _GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - "
1006#if @GNULIB_WCSXFRM@ 1354#if @GNULIB_WCSXFRM@
1007# if !@HAVE_WCSXFRM@ 1355# if !@HAVE_WCSXFRM@
1008_GL_FUNCDECL_SYS (wcsxfrm, size_t, 1356_GL_FUNCDECL_SYS (wcsxfrm, size_t,
1009 (wchar_t *restrict s1, const wchar_t *restrict s2, size_t n)); 1357 (wchar_t *restrict s1, const wchar_t *restrict s2, size_t n), );
1010# endif 1358# endif
1011_GL_CXXALIAS_SYS (wcsxfrm, size_t, 1359_GL_CXXALIAS_SYS (wcsxfrm, size_t,
1012 (wchar_t *restrict s1, const wchar_t *restrict s2, size_t n)); 1360 (wchar_t *restrict s1, const wchar_t *restrict s2, size_t n));
@@ -1014,7 +1362,6 @@ _GL_CXXALIAS_SYS (wcsxfrm, size_t,
1014_GL_CXXALIASWARN (wcsxfrm); 1362_GL_CXXALIASWARN (wcsxfrm);
1015# endif 1363# endif
1016#elif defined GNULIB_POSIXCHECK 1364#elif defined GNULIB_POSIXCHECK
1017# undef wcsxfrm
1018# if HAVE_RAW_DECL_WCSXFRM 1365# if HAVE_RAW_DECL_WCSXFRM
1019_GL_WARN_ON_USE (wcsxfrm, "wcsxfrm is unportable - " 1366_GL_WARN_ON_USE (wcsxfrm, "wcsxfrm is unportable - "
1020 "use gnulib module wcsxfrm for portability"); 1367 "use gnulib module wcsxfrm for portability");
@@ -1034,23 +1381,37 @@ _GL_CXXALIAS_MDA (wcsdup, wchar_t *, (const wchar_t *s));
1034/* On Solaris 11.3, the header files declare the function in the std:: 1381/* 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 1382 namespace, not in the global namespace. So, force a declaration in
1036 the global namespace. */ 1383 the global namespace. */
1037# if !@HAVE_WCSDUP@ || (defined __sun && defined __cplusplus) || __GNUC__ >= 11 1384# if !@HAVE_WCSDUP@ || (defined __sun && defined __cplusplus) \
1385 || (__GNUC__ >= 11 && !defined __clang__)
1386# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
1387_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
1388 (const wchar_t *s),
1389 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
1390 _GL_ATTRIBUTE_NOTHROW;
1391# else
1038_GL_FUNCDECL_SYS (wcsdup, wchar_t *, 1392_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
1039 (const wchar_t *s) 1393 (const wchar_t *s),
1040 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 1394 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
1395# endif
1041# endif 1396# endif
1042_GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s)); 1397_GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s));
1043# endif 1398# endif
1044_GL_CXXALIASWARN (wcsdup); 1399_GL_CXXALIASWARN (wcsdup);
1045#else 1400#else
1046# if __GNUC__ >= 11 && !defined wcsdup 1401# if (__GNUC__ >= 11 && !defined __clang__) && !defined wcsdup
1047/* For -Wmismatched-dealloc: Associate wcsdup with free or rpl_free. */ 1402/* For -Wmismatched-dealloc: Associate wcsdup with free or rpl_free. */
1403# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
1048_GL_FUNCDECL_SYS (wcsdup, wchar_t *, 1404_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
1049 (const wchar_t *s) 1405 (const wchar_t *s),
1406 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
1407 _GL_ATTRIBUTE_NOTHROW;
1408# else
1409_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
1410 (const wchar_t *s),
1050 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 1411 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
1412# endif
1051# endif 1413# endif
1052# if defined GNULIB_POSIXCHECK 1414# if defined GNULIB_POSIXCHECK
1053# undef wcsdup
1054# if HAVE_RAW_DECL_WCSDUP 1415# if HAVE_RAW_DECL_WCSDUP
1055_GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - " 1416_GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - "
1056 "use gnulib module wcsdup for portability"); 1417 "use gnulib module wcsdup for portability");
@@ -1066,9 +1427,16 @@ _GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - "
1066# endif 1427# endif
1067_GL_CXXALIAS_MDA (wcsdup, wchar_t *, (const wchar_t *s)); 1428_GL_CXXALIAS_MDA (wcsdup, wchar_t *, (const wchar_t *s));
1068# else 1429# else
1430# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
1431_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
1432 (const wchar_t *s),
1433 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
1434 _GL_ATTRIBUTE_NOTHROW;
1435# else
1069_GL_FUNCDECL_SYS (wcsdup, wchar_t *, 1436_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
1070 (const wchar_t *s) 1437 (const wchar_t *s),
1071 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 1438 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
1439# endif
1072# if @HAVE_DECL_WCSDUP@ 1440# if @HAVE_DECL_WCSDUP@
1073_GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s)); 1441_GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s));
1074# endif 1442# endif
@@ -1083,7 +1451,7 @@ _GL_CXXALIASWARN (wcsdup);
1083/* Find the first occurrence of WC in WCS. */ 1451/* Find the first occurrence of WC in WCS. */
1084#if @GNULIB_WCSCHR@ 1452#if @GNULIB_WCSCHR@
1085# if !@HAVE_WCSCHR@ 1453# if !@HAVE_WCSCHR@
1086_GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc) 1454_GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc),
1087 _GL_ATTRIBUTE_PURE); 1455 _GL_ATTRIBUTE_PURE);
1088# endif 1456# endif
1089 /* On some systems, this function is defined as an overloaded function: 1457 /* On some systems, this function is defined as an overloaded function:
@@ -1095,14 +1463,14 @@ _GL_CXXALIAS_SYS_CAST2 (wcschr,
1095 wchar_t *, (const wchar_t *, wchar_t), 1463 wchar_t *, (const wchar_t *, wchar_t),
1096 const wchar_t *, (const wchar_t *, wchar_t)); 1464 const wchar_t *, (const wchar_t *, wchar_t));
1097# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 1465# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
1098 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 1466 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) \
1467 && !defined __clang__
1099_GL_CXXALIASWARN1 (wcschr, wchar_t *, (wchar_t *wcs, wchar_t wc)); 1468_GL_CXXALIASWARN1 (wcschr, wchar_t *, (wchar_t *wcs, wchar_t wc));
1100_GL_CXXALIASWARN1 (wcschr, const wchar_t *, (const wchar_t *wcs, wchar_t wc)); 1469_GL_CXXALIASWARN1 (wcschr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
1101# elif __GLIBC__ >= 2 1470# elif __GLIBC__ >= 2 && !defined __CORRECT_ISO_CPP_WCHAR_H_PROTO
1102_GL_CXXALIASWARN (wcschr); 1471_GL_CXXALIASWARN (wcschr);
1103# endif 1472# endif
1104#elif defined GNULIB_POSIXCHECK 1473#elif defined GNULIB_POSIXCHECK
1105# undef wcschr
1106# if HAVE_RAW_DECL_WCSCHR 1474# if HAVE_RAW_DECL_WCSCHR
1107_GL_WARN_ON_USE (wcschr, "wcschr is unportable - " 1475_GL_WARN_ON_USE (wcschr, "wcschr is unportable - "
1108 "use gnulib module wcschr for portability"); 1476 "use gnulib module wcschr for portability");
@@ -1113,7 +1481,7 @@ _GL_WARN_ON_USE (wcschr, "wcschr is unportable - "
1113/* Find the last occurrence of WC in WCS. */ 1481/* Find the last occurrence of WC in WCS. */
1114#if @GNULIB_WCSRCHR@ 1482#if @GNULIB_WCSRCHR@
1115# if !@HAVE_WCSRCHR@ 1483# if !@HAVE_WCSRCHR@
1116_GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc) 1484_GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc),
1117 _GL_ATTRIBUTE_PURE); 1485 _GL_ATTRIBUTE_PURE);
1118# endif 1486# endif
1119 /* On some systems, this function is defined as an overloaded function: 1487 /* On some systems, this function is defined as an overloaded function:
@@ -1125,14 +1493,14 @@ _GL_CXXALIAS_SYS_CAST2 (wcsrchr,
1125 wchar_t *, (const wchar_t *, wchar_t), 1493 wchar_t *, (const wchar_t *, wchar_t),
1126 const wchar_t *, (const wchar_t *, wchar_t)); 1494 const wchar_t *, (const wchar_t *, wchar_t));
1127# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 1495# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
1128 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 1496 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) \
1497 && !defined __clang__
1129_GL_CXXALIASWARN1 (wcsrchr, wchar_t *, (wchar_t *wcs, wchar_t wc)); 1498_GL_CXXALIASWARN1 (wcsrchr, wchar_t *, (wchar_t *wcs, wchar_t wc));
1130_GL_CXXALIASWARN1 (wcsrchr, const wchar_t *, (const wchar_t *wcs, wchar_t wc)); 1499_GL_CXXALIASWARN1 (wcsrchr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
1131# elif __GLIBC__ >= 2 1500# elif __GLIBC__ >= 2 && !defined __CORRECT_ISO_CPP_WCHAR_H_PROTO
1132_GL_CXXALIASWARN (wcsrchr); 1501_GL_CXXALIASWARN (wcsrchr);
1133# endif 1502# endif
1134#elif defined GNULIB_POSIXCHECK 1503#elif defined GNULIB_POSIXCHECK
1135# undef wcsrchr
1136# if HAVE_RAW_DECL_WCSRCHR 1504# if HAVE_RAW_DECL_WCSRCHR
1137_GL_WARN_ON_USE (wcsrchr, "wcsrchr is unportable - " 1505_GL_WARN_ON_USE (wcsrchr, "wcsrchr is unportable - "
1138 "use gnulib module wcsrchr for portability"); 1506 "use gnulib module wcsrchr for portability");
@@ -1140,11 +1508,11 @@ _GL_WARN_ON_USE (wcsrchr, "wcsrchr is unportable - "
1140#endif 1508#endif
1141 1509
1142 1510
1143/* Return the length of the initial segmet of WCS which consists entirely 1511/* Return the length of the initial segment of WCS which consists entirely
1144 of wide characters not in REJECT. */ 1512 of wide characters not in REJECT. */
1145#if @GNULIB_WCSCSPN@ 1513#if @GNULIB_WCSCSPN@
1146# if !@HAVE_WCSCSPN@ 1514# if !@HAVE_WCSCSPN@
1147_GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject) 1515_GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject),
1148 _GL_ATTRIBUTE_PURE); 1516 _GL_ATTRIBUTE_PURE);
1149# endif 1517# endif
1150_GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject)); 1518_GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject));
@@ -1152,7 +1520,6 @@ _GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject));
1152_GL_CXXALIASWARN (wcscspn); 1520_GL_CXXALIASWARN (wcscspn);
1153# endif 1521# endif
1154#elif defined GNULIB_POSIXCHECK 1522#elif defined GNULIB_POSIXCHECK
1155# undef wcscspn
1156# if HAVE_RAW_DECL_WCSCSPN 1523# if HAVE_RAW_DECL_WCSCSPN
1157_GL_WARN_ON_USE (wcscspn, "wcscspn is unportable - " 1524_GL_WARN_ON_USE (wcscspn, "wcscspn is unportable - "
1158 "use gnulib module wcscspn for portability"); 1525 "use gnulib module wcscspn for portability");
@@ -1160,11 +1527,11 @@ _GL_WARN_ON_USE (wcscspn, "wcscspn is unportable - "
1160#endif 1527#endif
1161 1528
1162 1529
1163/* Return the length of the initial segmet of WCS which consists entirely 1530/* Return the length of the initial segment of WCS which consists entirely
1164 of wide characters in ACCEPT. */ 1531 of wide characters in ACCEPT. */
1165#if @GNULIB_WCSSPN@ 1532#if @GNULIB_WCSSPN@
1166# if !@HAVE_WCSSPN@ 1533# if !@HAVE_WCSSPN@
1167_GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept) 1534_GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept),
1168 _GL_ATTRIBUTE_PURE); 1535 _GL_ATTRIBUTE_PURE);
1169# endif 1536# endif
1170_GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept)); 1537_GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept));
@@ -1172,7 +1539,6 @@ _GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept));
1172_GL_CXXALIASWARN (wcsspn); 1539_GL_CXXALIASWARN (wcsspn);
1173# endif 1540# endif
1174#elif defined GNULIB_POSIXCHECK 1541#elif defined GNULIB_POSIXCHECK
1175# undef wcsspn
1176# if HAVE_RAW_DECL_WCSSPN 1542# if HAVE_RAW_DECL_WCSSPN
1177_GL_WARN_ON_USE (wcsspn, "wcsspn is unportable - " 1543_GL_WARN_ON_USE (wcsspn, "wcsspn is unportable - "
1178 "use gnulib module wcsspn for portability"); 1544 "use gnulib module wcsspn for portability");
@@ -1184,7 +1550,7 @@ _GL_WARN_ON_USE (wcsspn, "wcsspn is unportable - "
1184#if @GNULIB_WCSPBRK@ 1550#if @GNULIB_WCSPBRK@
1185# if !@HAVE_WCSPBRK@ 1551# if !@HAVE_WCSPBRK@
1186_GL_FUNCDECL_SYS (wcspbrk, wchar_t *, 1552_GL_FUNCDECL_SYS (wcspbrk, wchar_t *,
1187 (const wchar_t *wcs, const wchar_t *accept) 1553 (const wchar_t *wcs, const wchar_t *accept),
1188 _GL_ATTRIBUTE_PURE); 1554 _GL_ATTRIBUTE_PURE);
1189# endif 1555# endif
1190 /* On some systems, this function is defined as an overloaded function: 1556 /* On some systems, this function is defined as an overloaded function:
@@ -1196,16 +1562,16 @@ _GL_CXXALIAS_SYS_CAST2 (wcspbrk,
1196 wchar_t *, (const wchar_t *, const wchar_t *), 1562 wchar_t *, (const wchar_t *, const wchar_t *),
1197 const wchar_t *, (const wchar_t *, const wchar_t *)); 1563 const wchar_t *, (const wchar_t *, const wchar_t *));
1198# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 1564# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
1199 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 1565 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) \
1566 && !defined __clang__
1200_GL_CXXALIASWARN1 (wcspbrk, wchar_t *, 1567_GL_CXXALIASWARN1 (wcspbrk, wchar_t *,
1201 (wchar_t *wcs, const wchar_t *accept)); 1568 (wchar_t *wcs, const wchar_t *accept));
1202_GL_CXXALIASWARN1 (wcspbrk, const wchar_t *, 1569_GL_CXXALIASWARN1 (wcspbrk, const wchar_t *,
1203 (const wchar_t *wcs, const wchar_t *accept)); 1570 (const wchar_t *wcs, const wchar_t *accept));
1204# elif __GLIBC__ >= 2 1571# elif __GLIBC__ >= 2 && !defined __CORRECT_ISO_CPP_WCHAR_H_PROTO
1205_GL_CXXALIASWARN (wcspbrk); 1572_GL_CXXALIASWARN (wcspbrk);
1206# endif 1573# endif
1207#elif defined GNULIB_POSIXCHECK 1574#elif defined GNULIB_POSIXCHECK
1208# undef wcspbrk
1209# if HAVE_RAW_DECL_WCSPBRK 1575# if HAVE_RAW_DECL_WCSPBRK
1210_GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - " 1576_GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - "
1211 "use gnulib module wcspbrk for portability"); 1577 "use gnulib module wcspbrk for portability");
@@ -1215,12 +1581,25 @@ _GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - "
1215 1581
1216/* Find the first occurrence of NEEDLE in HAYSTACK. */ 1582/* Find the first occurrence of NEEDLE in HAYSTACK. */
1217#if @GNULIB_WCSSTR@ 1583#if @GNULIB_WCSSTR@
1218# if !@HAVE_WCSSTR@ 1584# if @REPLACE_WCSSTR@
1585# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1586# undef wcsstr
1587# define wcsstr rpl_wcsstr
1588# endif
1589_GL_FUNCDECL_RPL (wcsstr, wchar_t *,
1590 (const wchar_t *restrict haystack,
1591 const wchar_t *restrict needle),
1592 _GL_ATTRIBUTE_PURE);
1593_GL_CXXALIAS_RPL (wcsstr, wchar_t *,
1594 (const wchar_t *restrict haystack,
1595 const wchar_t *restrict needle));
1596# else
1597# if !@HAVE_WCSSTR@
1219_GL_FUNCDECL_SYS (wcsstr, wchar_t *, 1598_GL_FUNCDECL_SYS (wcsstr, wchar_t *,
1220 (const wchar_t *restrict haystack, 1599 (const wchar_t *restrict haystack,
1221 const wchar_t *restrict needle) 1600 const wchar_t *restrict needle),
1222 _GL_ATTRIBUTE_PURE); 1601 _GL_ATTRIBUTE_PURE);
1223# endif 1602# endif
1224 /* On some systems, this function is defined as an overloaded function: 1603 /* On some systems, this function is defined as an overloaded function:
1225 extern "C++" { 1604 extern "C++" {
1226 const wchar_t * std::wcsstr (const wchar_t *, const wchar_t *); 1605 const wchar_t * std::wcsstr (const wchar_t *, const wchar_t *);
@@ -1231,19 +1610,20 @@ _GL_CXXALIAS_SYS_CAST2 (wcsstr,
1231 (const wchar_t *restrict, const wchar_t *restrict), 1610 (const wchar_t *restrict, const wchar_t *restrict),
1232 const wchar_t *, 1611 const wchar_t *,
1233 (const wchar_t *restrict, const wchar_t *restrict)); 1612 (const wchar_t *restrict, const wchar_t *restrict));
1613# endif
1234# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 1614# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
1235 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 1615 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) \
1616 && !defined __clang__
1236_GL_CXXALIASWARN1 (wcsstr, wchar_t *, 1617_GL_CXXALIASWARN1 (wcsstr, wchar_t *,
1237 (wchar_t *restrict haystack, 1618 (wchar_t *restrict haystack,
1238 const wchar_t *restrict needle)); 1619 const wchar_t *restrict needle));
1239_GL_CXXALIASWARN1 (wcsstr, const wchar_t *, 1620_GL_CXXALIASWARN1 (wcsstr, const wchar_t *,
1240 (const wchar_t *restrict haystack, 1621 (const wchar_t *restrict haystack,
1241 const wchar_t *restrict needle)); 1622 const wchar_t *restrict needle));
1242# elif __GLIBC__ >= 2 1623# elif __GLIBC__ >= 2 && !defined __CORRECT_ISO_CPP_WCHAR_H_PROTO
1243_GL_CXXALIASWARN (wcsstr); 1624_GL_CXXALIASWARN (wcsstr);
1244# endif 1625# endif
1245#elif defined GNULIB_POSIXCHECK 1626#elif defined GNULIB_POSIXCHECK
1246# undef wcsstr
1247# if HAVE_RAW_DECL_WCSSTR 1627# if HAVE_RAW_DECL_WCSSTR
1248_GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - " 1628_GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - "
1249 "use gnulib module wcsstr for portability"); 1629 "use gnulib module wcsstr for portability");
@@ -1260,7 +1640,7 @@ _GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - "
1260# endif 1640# endif
1261_GL_FUNCDECL_RPL (wcstok, wchar_t *, 1641_GL_FUNCDECL_RPL (wcstok, wchar_t *,
1262 (wchar_t *restrict wcs, const wchar_t *restrict delim, 1642 (wchar_t *restrict wcs, const wchar_t *restrict delim,
1263 wchar_t **restrict ptr)); 1643 wchar_t **restrict ptr), );
1264_GL_CXXALIAS_RPL (wcstok, wchar_t *, 1644_GL_CXXALIAS_RPL (wcstok, wchar_t *,
1265 (wchar_t *restrict wcs, const wchar_t *restrict delim, 1645 (wchar_t *restrict wcs, const wchar_t *restrict delim,
1266 wchar_t **restrict ptr)); 1646 wchar_t **restrict ptr));
@@ -1268,7 +1648,7 @@ _GL_CXXALIAS_RPL (wcstok, wchar_t *,
1268# if !@HAVE_WCSTOK@ 1648# if !@HAVE_WCSTOK@
1269_GL_FUNCDECL_SYS (wcstok, wchar_t *, 1649_GL_FUNCDECL_SYS (wcstok, wchar_t *,
1270 (wchar_t *restrict wcs, const wchar_t *restrict delim, 1650 (wchar_t *restrict wcs, const wchar_t *restrict delim,
1271 wchar_t **restrict ptr)); 1651 wchar_t **restrict ptr), );
1272# endif 1652# endif
1273_GL_CXXALIAS_SYS (wcstok, wchar_t *, 1653_GL_CXXALIAS_SYS (wcstok, wchar_t *,
1274 (wchar_t *restrict wcs, const wchar_t *restrict delim, 1654 (wchar_t *restrict wcs, const wchar_t *restrict delim,
@@ -1278,7 +1658,6 @@ _GL_CXXALIAS_SYS (wcstok, wchar_t *,
1278_GL_CXXALIASWARN (wcstok); 1658_GL_CXXALIASWARN (wcstok);
1279# endif 1659# endif
1280#elif defined GNULIB_POSIXCHECK 1660#elif defined GNULIB_POSIXCHECK
1281# undef wcstok
1282# if HAVE_RAW_DECL_WCSTOK 1661# if HAVE_RAW_DECL_WCSTOK
1283_GL_WARN_ON_USE (wcstok, "wcstok is unportable - " 1662_GL_WARN_ON_USE (wcstok, "wcstok is unportable - "
1284 "use gnulib module wcstok for portability"); 1663 "use gnulib module wcstok for portability");
@@ -1294,12 +1673,12 @@ _GL_WARN_ON_USE (wcstok, "wcstok is unportable - "
1294# undef wcswidth 1673# undef wcswidth
1295# define wcswidth rpl_wcswidth 1674# define wcswidth rpl_wcswidth
1296# endif 1675# endif
1297_GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n) 1676_GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n),
1298 _GL_ATTRIBUTE_PURE); 1677 _GL_ATTRIBUTE_PURE);
1299_GL_CXXALIAS_RPL (wcswidth, int, (const wchar_t *s, size_t n)); 1678_GL_CXXALIAS_RPL (wcswidth, int, (const wchar_t *s, size_t n));
1300# else 1679# else
1301# if !@HAVE_WCSWIDTH@ 1680# if !@HAVE_WCSWIDTH@
1302_GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n) 1681_GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n),
1303 _GL_ATTRIBUTE_PURE); 1682 _GL_ATTRIBUTE_PURE);
1304# endif 1683# endif
1305_GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n)); 1684_GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n));
@@ -1308,7 +1687,6 @@ _GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n));
1308_GL_CXXALIASWARN (wcswidth); 1687_GL_CXXALIASWARN (wcswidth);
1309# endif 1688# endif
1310#elif defined GNULIB_POSIXCHECK 1689#elif defined GNULIB_POSIXCHECK
1311# undef wcswidth
1312# if HAVE_RAW_DECL_WCSWIDTH 1690# if HAVE_RAW_DECL_WCSWIDTH
1313_GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - " 1691_GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - "
1314 "use gnulib module wcswidth for portability"); 1692 "use gnulib module wcswidth for portability");
@@ -1327,7 +1705,7 @@ _GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - "
1327_GL_FUNCDECL_RPL (wcsftime, size_t, 1705_GL_FUNCDECL_RPL (wcsftime, size_t,
1328 (wchar_t *restrict __buf, size_t __bufsize, 1706 (wchar_t *restrict __buf, size_t __bufsize,
1329 const wchar_t *restrict __fmt, 1707 const wchar_t *restrict __fmt,
1330 const struct tm *restrict __tp) 1708 const struct tm *restrict __tp),
1331 _GL_ARG_NONNULL ((1, 3, 4))); 1709 _GL_ARG_NONNULL ((1, 3, 4)));
1332_GL_CXXALIAS_RPL (wcsftime, size_t, 1710_GL_CXXALIAS_RPL (wcsftime, size_t,
1333 (wchar_t *restrict __buf, size_t __bufsize, 1711 (wchar_t *restrict __buf, size_t __bufsize,
@@ -1338,7 +1716,7 @@ _GL_CXXALIAS_RPL (wcsftime, size_t,
1338_GL_FUNCDECL_SYS (wcsftime, size_t, 1716_GL_FUNCDECL_SYS (wcsftime, size_t,
1339 (wchar_t *restrict __buf, size_t __bufsize, 1717 (wchar_t *restrict __buf, size_t __bufsize,
1340 const wchar_t *restrict __fmt, 1718 const wchar_t *restrict __fmt,
1341 const struct tm *restrict __tp) 1719 const struct tm *restrict __tp),
1342 _GL_ARG_NONNULL ((1, 3, 4))); 1720 _GL_ARG_NONNULL ((1, 3, 4)));
1343# endif 1721# endif
1344_GL_CXXALIAS_SYS (wcsftime, size_t, 1722_GL_CXXALIAS_SYS (wcsftime, size_t,
@@ -1350,7 +1728,6 @@ _GL_CXXALIAS_SYS (wcsftime, size_t,
1350_GL_CXXALIASWARN (wcsftime); 1728_GL_CXXALIASWARN (wcsftime);
1351# endif 1729# endif
1352#elif defined GNULIB_POSIXCHECK 1730#elif defined GNULIB_POSIXCHECK
1353# undef wcsftime
1354# if HAVE_RAW_DECL_WCSFTIME 1731# if HAVE_RAW_DECL_WCSFTIME
1355_GL_WARN_ON_USE (wcsftime, "wcsftime is unportable - " 1732_GL_WARN_ON_USE (wcsftime, "wcsftime is unportable - "
1356 "use gnulib module wcsftime for portability"); 1733 "use gnulib module wcsftime for portability");
@@ -1358,6 +1735,24 @@ _GL_WARN_ON_USE (wcsftime, "wcsftime is unportable - "
1358#endif 1735#endif
1359 1736
1360 1737
1738#if @GNULIB_WGETCWD@ && (defined _WIN32 && !defined __CYGWIN__)
1739/* Gets the name of the current working directory.
1740 (a) If BUF is non-NULL, it is assumed to have room for SIZE wide characters.
1741 This function stores the working directory (NUL-terminated) in BUF and
1742 returns BUF.
1743 (b) If BUF is NULL, an array is allocated with 'malloc'. The array is SIZE
1744 wide characters long, unless SIZE == 0, in which case it is as big as
1745 necessary.
1746 If the directory couldn't be determined or SIZE was too small, this function
1747 returns NULL and sets errno. For a directory of length LEN, SIZE should be
1748 >= LEN + 3 in case (a) or >= LEN + 1 in case (b).
1749 Possible errno values include:
1750 - ERANGE if SIZE is too small.
1751 - ENOMEM if the memory could no be allocated. */
1752_GL_FUNCDECL_SYS (wgetcwd, wchar_t *, (wchar_t *buf, size_t size), );
1753#endif
1754
1755
1361#endif /* _@GUARD_PREFIX@_WCHAR_H */ 1756#endif /* _@GUARD_PREFIX@_WCHAR_H */
1362#endif /* _@GUARD_PREFIX@_WCHAR_H */ 1757#endif /* _@GUARD_PREFIX@_WCHAR_H */
1363#endif 1758#endif