1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2 /* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
4 Copyright (C) 2007-2019 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, see <https://www.gnu.org/licenses/>. */
19 /* Written by Eric Blake. */
22 * ISO C 99 <wchar.h> for platforms that have issues.
23 * <http://www.opengroup.org/susv3xbd/wchar.h.html>
25 * For now, this just ensures proper prerequisite inclusion order and
26 * the declaration of wcwidth().
30 #pragma GCC system_header
34 #if (((defined __need_mbstate_t || defined __need_wint_t) \
35 && !defined __MINGW32__) \
37 && ((defined _INTTYPES_INCLUDED && !defined strtoimax) \
38 || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) \
39 || (defined __MINGW32__ && defined __STRING_H_SOURCED__) \
40 || defined _GL_ALREADY_INCLUDING_WCHAR_H)
41 /* Special invocation convention:
42 - Inside glibc and uClibc header files, but not MinGW.
43 - On HP-UX 11.00 we have a sequence of nested includes
44 <wchar.h> -> <stdlib.h> -> <stdint.h>, and the latter includes <wchar.h>,
45 once indirectly <stdint.h> -> <sys/types.h> -> <inttypes.h> -> <wchar.h>
46 and once directly. In both situations 'wint_t' is not yet defined,
47 therefore we cannot provide the function overrides; instead include only
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'.
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. */
55 #include_next <wchar.h>
58 /* Normal invocation convention. */
62 #define _GL_ALREADY_INCLUDING_WCHAR_H
65 # include <features.h> /* for __GLIBC__ */
68 /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
70 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
71 included before <wchar.h>.
72 In some builds of uClibc, <wchar.h> is nonexistent and wchar_t is defined
74 But avoid namespace pollution on glibc systems. */
75 #if !(defined __GLIBC__ && !defined __UCLIBC__)
83 /* Include the original <wchar.h> if it exists.
84 Some builds of uClibc lack it. */
85 /* The include_next requires a split double-inclusion guard. */
87 # include_next <wchar.h>
90 #undef _GL_ALREADY_INCLUDING_WCHAR_H
95 /* The __attribute__ feature is available in gcc versions 2.5 and later.
96 The attribute __pure__ was added in gcc 2.96. */
97 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
98 # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
100 # define _GL_ATTRIBUTE_PURE /* empty */
103 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
104 /* C++ compatible function declaration macros.
105 Copyright (C) 2010-2019 Free Software Foundation, Inc.
107 This program is free software: you can redistribute it and/or modify it
108 under the terms of the GNU General Public License as published
109 by the Free Software Foundation; either version 3 of the License, or
110 (at your option) any later version.
112 This program is distributed in the hope that it will be useful,
113 but WITHOUT ANY WARRANTY; without even the implied warranty of
114 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
115 General Public License for more details.
117 You should have received a copy of the GNU General Public License
118 along with this program. If not, see <https://www.gnu.org/licenses/>. */
120 #ifndef _GL_CXXDEFS_H
121 #define _GL_CXXDEFS_H
123 /* Begin/end the GNULIB_NAMESPACE namespace. */
124 #if defined __cplusplus && defined GNULIB_NAMESPACE
125 # define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE {
126 # define _GL_END_NAMESPACE }
128 # define _GL_BEGIN_NAMESPACE
129 # define _GL_END_NAMESPACE
132 /* The three most frequent use cases of these macros are:
134 * For providing a substitute for a function that is missing on some
135 platforms, but is declared and works fine on the platforms on which
140 _GL_FUNCDECL_SYS (foo, ...);
142 _GL_CXXALIAS_SYS (foo, ...);
143 _GL_CXXALIASWARN (foo);
144 #elif defined GNULIB_POSIXCHECK
148 * For providing a replacement for a function that exists on all platforms,
149 but is broken/insufficient and needs to be replaced on some platforms:
153 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
157 _GL_FUNCDECL_RPL (foo, ...);
158 _GL_CXXALIAS_RPL (foo, ...);
160 _GL_CXXALIAS_SYS (foo, ...);
162 _GL_CXXALIASWARN (foo);
163 #elif defined GNULIB_POSIXCHECK
167 * For providing a replacement for a function that exists on some platforms
168 but is broken/insufficient and needs to be replaced on some of them and
169 is additionally either missing or undeclared on some other platforms:
173 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
177 _GL_FUNCDECL_RPL (foo, ...);
178 _GL_CXXALIAS_RPL (foo, ...);
180 # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@
181 _GL_FUNCDECL_SYS (foo, ...);
183 _GL_CXXALIAS_SYS (foo, ...);
185 _GL_CXXALIASWARN (foo);
186 #elif defined GNULIB_POSIXCHECK
191 /* _GL_EXTERN_C declaration;
192 performs the declaration with C linkage. */
193 #if defined __cplusplus
194 # define _GL_EXTERN_C extern "C"
196 # define _GL_EXTERN_C extern
199 /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
200 declares a replacement function, named rpl_func, with the given prototype,
201 consisting of return type, parameters, and attributes.
203 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
204 _GL_ARG_NONNULL ((1)));
206 #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
207 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
208 #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
209 _GL_EXTERN_C rettype rpl_func parameters_and_attributes
211 /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
212 declares the system function, named func, with the given prototype,
213 consisting of return type, parameters, and attributes.
215 _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
216 _GL_ARG_NONNULL ((1)));
218 #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
219 _GL_EXTERN_C rettype func parameters_and_attributes
221 /* _GL_CXXALIAS_RPL (func, rettype, parameters);
222 declares a C++ alias called GNULIB_NAMESPACE::func
223 that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
225 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
227 Wrapping rpl_func in an object with an inline conversion operator
228 avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is
229 actually used in the program. */
230 #define _GL_CXXALIAS_RPL(func,rettype,parameters) \
231 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
232 #if defined __cplusplus && defined GNULIB_NAMESPACE
233 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
234 namespace GNULIB_NAMESPACE \
236 static const struct _gl_ ## func ## _wrapper \
238 typedef rettype (*type) parameters; \
240 inline operator type () const \
246 _GL_EXTERN_C int _gl_cxxalias_dummy
248 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
249 _GL_EXTERN_C int _gl_cxxalias_dummy
252 /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
253 is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
254 except that the C function rpl_func may have a slightly different
255 declaration. A cast is used to silence the "invalid conversion" error
256 that would otherwise occur. */
257 #if defined __cplusplus && defined GNULIB_NAMESPACE
258 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
259 namespace GNULIB_NAMESPACE \
261 static const struct _gl_ ## func ## _wrapper \
263 typedef rettype (*type) parameters; \
265 inline operator type () const \
267 return reinterpret_cast<type>(::rpl_func); \
271 _GL_EXTERN_C int _gl_cxxalias_dummy
273 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
274 _GL_EXTERN_C int _gl_cxxalias_dummy
277 /* _GL_CXXALIAS_SYS (func, rettype, parameters);
278 declares a C++ alias called GNULIB_NAMESPACE::func
279 that redirects to the system provided function func, if GNULIB_NAMESPACE
282 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
284 Wrapping func in an object with an inline conversion operator
285 avoids a reference to func unless GNULIB_NAMESPACE::func is
286 actually used in the program. */
287 #if defined __cplusplus && defined GNULIB_NAMESPACE
288 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
289 namespace GNULIB_NAMESPACE \
291 static const struct _gl_ ## func ## _wrapper \
293 typedef rettype (*type) parameters; \
295 inline operator type () const \
301 _GL_EXTERN_C int _gl_cxxalias_dummy
303 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
304 _GL_EXTERN_C int _gl_cxxalias_dummy
307 /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
308 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
309 except that the C function func may have a slightly different declaration.
310 A cast is used to silence the "invalid conversion" error that would
312 #if defined __cplusplus && defined GNULIB_NAMESPACE
313 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
314 namespace GNULIB_NAMESPACE \
316 static const struct _gl_ ## func ## _wrapper \
318 typedef rettype (*type) parameters; \
320 inline operator type () const \
322 return reinterpret_cast<type>(::func); \
326 _GL_EXTERN_C int _gl_cxxalias_dummy
328 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
329 _GL_EXTERN_C int _gl_cxxalias_dummy
332 /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
333 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
334 except that the C function is picked among a set of overloaded functions,
335 namely the one with rettype2 and parameters2. Two consecutive casts
336 are used to silence the "cannot find a match" and "invalid conversion"
337 errors that would otherwise occur. */
338 #if defined __cplusplus && defined GNULIB_NAMESPACE
339 /* The outer cast must be a reinterpret_cast.
340 The inner cast: When the function is defined as a set of overloaded
341 functions, it works as a static_cast<>, choosing the designated variant.
342 When the function is defined as a single variant, it works as a
343 reinterpret_cast<>. The parenthesized cast syntax works both ways. */
344 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
345 namespace GNULIB_NAMESPACE \
347 static const struct _gl_ ## func ## _wrapper \
349 typedef rettype (*type) parameters; \
351 inline operator type () const \
353 return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \
357 _GL_EXTERN_C int _gl_cxxalias_dummy
359 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
360 _GL_EXTERN_C int _gl_cxxalias_dummy
363 /* _GL_CXXALIASWARN (func);
364 causes a warning to be emitted when ::func is used but not when
365 GNULIB_NAMESPACE::func is used. func must be defined without overloaded
367 #if defined __cplusplus && defined GNULIB_NAMESPACE
368 # define _GL_CXXALIASWARN(func) \
369 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
370 # define _GL_CXXALIASWARN_1(func,namespace) \
371 _GL_CXXALIASWARN_2 (func, namespace)
372 /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
373 we enable the warning only when not optimizing. */
375 # define _GL_CXXALIASWARN_2(func,namespace) \
376 _GL_WARN_ON_USE (func, \
377 "The symbol ::" #func " refers to the system function. " \
378 "Use " #namespace "::" #func " instead.")
379 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
380 # define _GL_CXXALIASWARN_2(func,namespace) \
381 extern __typeof__ (func) func
383 # define _GL_CXXALIASWARN_2(func,namespace) \
384 _GL_EXTERN_C int _gl_cxxalias_dummy
387 # define _GL_CXXALIASWARN(func) \
388 _GL_EXTERN_C int _gl_cxxalias_dummy
391 /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
392 causes a warning to be emitted when the given overloaded variant of ::func
393 is used but not when GNULIB_NAMESPACE::func is used. */
394 #if defined __cplusplus && defined GNULIB_NAMESPACE
395 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
396 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
398 # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
399 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
400 /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
401 we enable the warning only when not optimizing. */
403 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
404 _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
405 "The symbol ::" #func " refers to the system function. " \
406 "Use " #namespace "::" #func " instead.")
407 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
408 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
409 extern __typeof__ (func) func
411 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
412 _GL_EXTERN_C int _gl_cxxalias_dummy
415 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
416 _GL_EXTERN_C int _gl_cxxalias_dummy
419 #endif /* _GL_CXXDEFS_H */
421 /* The definition of _GL_ARG_NONNULL is copied here. */
422 /* A C macro for declaring that specific arguments must not be NULL.
423 Copyright (C) 2009-2019 Free Software Foundation, Inc.
425 This program is free software: you can redistribute it and/or modify it
426 under the terms of the GNU General Public License as published
427 by the Free Software Foundation; either version 3 of the License, or
428 (at your option) any later version.
430 This program is distributed in the hope that it will be useful,
431 but WITHOUT ANY WARRANTY; without even the implied warranty of
432 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
433 General Public License for more details.
435 You should have received a copy of the GNU General Public License
436 along with this program. If not, see <https://www.gnu.org/licenses/>. */
438 /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
439 that the values passed as arguments n, ..., m must be non-NULL pointers.
440 n = 1 stands for the first argument, n = 2 for the second argument etc. */
441 #ifndef _GL_ARG_NONNULL
442 # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
443 # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
445 # define _GL_ARG_NONNULL(params)
449 /* The definition of _GL_WARN_ON_USE is copied here. */
450 /* A C macro for emitting warnings if a function is used.
451 Copyright (C) 2010-2019 Free Software Foundation, Inc.
453 This program is free software: you can redistribute it and/or modify it
454 under the terms of the GNU General Public License as published
455 by the Free Software Foundation; either version 3 of the License, or
456 (at your option) any later version.
458 This program is distributed in the hope that it will be useful,
459 but WITHOUT ANY WARRANTY; without even the implied warranty of
460 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
461 General Public License for more details.
463 You should have received a copy of the GNU General Public License
464 along with this program. If not, see <https://www.gnu.org/licenses/>. */
466 /* _GL_WARN_ON_USE (function, "literal string") issues a declaration
467 for FUNCTION which will then trigger a compiler warning containing
468 the text of "literal string" anywhere that function is called, if
469 supported by the compiler. If the compiler does not support this
470 feature, the macro expands to an unused extern declaration.
472 _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the
473 attribute used in _GL_WARN_ON_USE. If the compiler does not support
474 this feature, it expands to empty.
476 These macros are useful for marking a function as a potential
477 portability trap, with the intent that "literal string" include
478 instructions on the replacement function that should be used
480 _GL_WARN_ON_USE is for functions with 'extern' linkage.
481 _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline'
484 However, one of the reasons that a function is a portability trap is
485 if it has the wrong signature. Declaring FUNCTION with a different
486 signature in C is a compilation error, so this macro must use the
487 same type as any existing declaration so that programs that avoid
488 the problematic FUNCTION do not fail to compile merely because they
489 included a header that poisoned the function. But this implies that
490 _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already
491 have a declaration. Use of this macro implies that there must not
492 be any other macro hiding the declaration of FUNCTION; but
493 undefining FUNCTION first is part of the poisoning process anyway
494 (although for symbols that are provided only via a macro, the result
495 is a compilation error rather than a warning containing
496 "literal string"). Also note that in C++, it is only safe to use if
497 FUNCTION has no overloads.
499 For an example, it is possible to poison 'getline' by:
500 - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]],
501 [getline]) in configure.ac, which potentially defines
502 HAVE_RAW_DECL_GETLINE
503 - adding this code to a header that wraps the system <stdio.h>:
505 #if HAVE_RAW_DECL_GETLINE
506 _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but"
507 "not universally present; use the gnulib module getline");
510 It is not possible to directly poison global variables. But it is
511 possible to write a wrapper accessor function, and poison that
512 (less common usage, like &environ, will cause a compilation error
513 rather than issue the nice warning, but the end result of informing
514 the developer about their portability problem is still achieved):
515 #if HAVE_RAW_DECL_ENVIRON
517 rpl_environ (void) { return &environ; }
518 _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared");
520 # define environ (*rpl_environ ())
522 or better (avoiding contradictory use of 'static' and 'extern'):
523 #if HAVE_RAW_DECL_ENVIRON
525 _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared")
526 rpl_environ (void) { return &environ; }
528 # define environ (*rpl_environ ())
531 #ifndef _GL_WARN_ON_USE
533 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
534 /* A compiler attribute is available in gcc versions 4.3.0 and later. */
535 # define _GL_WARN_ON_USE(function, message) \
536 extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
537 # define _GL_WARN_ON_USE_ATTRIBUTE(message) \
538 __attribute__ ((__warning__ (message)))
539 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
540 /* Verify the existence of the function. */
541 # define _GL_WARN_ON_USE(function, message) \
542 extern __typeof__ (function) function
543 # define _GL_WARN_ON_USE_ATTRIBUTE(message)
544 # else /* Unsupported. */
545 # define _GL_WARN_ON_USE(function, message) \
546 _GL_WARN_EXTERN_C int _gl_warn_on_use
547 # define _GL_WARN_ON_USE_ATTRIBUTE(message)
551 /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
552 is like _GL_WARN_ON_USE (function, "string"), except that the function is
553 declared with the given prototype, consisting of return type, parameters,
555 This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
556 not work in this case. */
557 #ifndef _GL_WARN_ON_USE_CXX
558 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
559 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
560 extern rettype function parameters_and_attributes \
561 __attribute__ ((__warning__ (msg)))
562 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
563 /* Verify the existence of the function. */
564 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
565 extern rettype function parameters_and_attributes
566 # else /* Unsupported. */
567 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
568 _GL_WARN_EXTERN_C int _gl_warn_on_use
572 /* _GL_WARN_EXTERN_C declaration;
573 performs the declaration with C linkage. */
574 #ifndef _GL_WARN_EXTERN_C
575 # if defined __cplusplus
576 # define _GL_WARN_EXTERN_C extern "C"
578 # define _GL_WARN_EXTERN_C extern
583 /* Define wint_t and WEOF. (Also done in wctype.in.h.) */
584 #if !1 && !defined wint_t
590 /* mingw and MSVC define wint_t as 'unsigned short' in <crtdefs.h> or
591 <stddef.h>. This is too small: ISO C 99 section 7.24.1.(2) says that
592 wint_t must be "unchanged by default argument promotions". Override it. */
594 # if !GNULIB_defined_wint_t
596 # include <crtdefs.h>
600 typedef unsigned int rpl_wint_t
;
602 # define wint_t rpl_wint_t
603 # define GNULIB_defined_wint_t 1
607 # define WEOF ((wint_t) -1)
612 /* Override mbstate_t if it is too small.
613 On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for
614 implementing mbrtowc for encodings like UTF-8. */
616 # if !GNULIB_defined_mbstate_t
617 typedef int rpl_mbstate_t
;
619 # define mbstate_t rpl_mbstate_t
620 # define GNULIB_defined_mbstate_t 1
625 /* Convert a single-byte character to a wide character. */
628 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
630 # define btowc rpl_btowc
632 _GL_FUNCDECL_RPL (btowc
, wint_t, (int c
) _GL_ATTRIBUTE_PURE
);
633 _GL_CXXALIAS_RPL (btowc
, wint_t, (int c
));
636 _GL_FUNCDECL_SYS (btowc
, wint_t, (int c
) _GL_ATTRIBUTE_PURE
);
638 _GL_CXXALIAS_SYS (btowc
, wint_t, (int c
));
640 _GL_CXXALIASWARN (btowc
);
641 #elif defined GNULIB_POSIXCHECK
643 # if HAVE_RAW_DECL_BTOWC
644 _GL_WARN_ON_USE (btowc
, "btowc is unportable - "
645 "use gnulib module btowc for portability");
650 /* Convert a wide character to a single-byte character. */
653 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
655 # define wctob rpl_wctob
657 _GL_FUNCDECL_RPL (wctob
, int, (wint_t wc
) _GL_ATTRIBUTE_PURE
);
658 _GL_CXXALIAS_RPL (wctob
, int, (wint_t wc
));
660 # if !defined wctob && !1
661 /* wctob is provided by gnulib, or wctob exists but is not declared. */
662 _GL_FUNCDECL_SYS (wctob
, int, (wint_t wc
) _GL_ATTRIBUTE_PURE
);
664 _GL_CXXALIAS_SYS (wctob
, int, (wint_t wc
));
666 _GL_CXXALIASWARN (wctob
);
667 #elif defined GNULIB_POSIXCHECK
669 # if HAVE_RAW_DECL_WCTOB
670 _GL_WARN_ON_USE (wctob
, "wctob is unportable - "
671 "use gnulib module wctob for portability");
676 /* Test whether *PS is in the initial state. */
679 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
681 # define mbsinit rpl_mbsinit
683 _GL_FUNCDECL_RPL (mbsinit
, int, (const mbstate_t *ps
));
684 _GL_CXXALIAS_RPL (mbsinit
, int, (const mbstate_t *ps
));
687 _GL_FUNCDECL_SYS (mbsinit
, int, (const mbstate_t *ps
));
689 _GL_CXXALIAS_SYS (mbsinit
, int, (const mbstate_t *ps
));
691 _GL_CXXALIASWARN (mbsinit
);
692 #elif defined GNULIB_POSIXCHECK
694 # if HAVE_RAW_DECL_MBSINIT
695 _GL_WARN_ON_USE (mbsinit
, "mbsinit is unportable - "
696 "use gnulib module mbsinit for portability");
701 /* Convert a multibyte character to a wide character. */
704 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
706 # define mbrtowc rpl_mbrtowc
708 _GL_FUNCDECL_RPL (mbrtowc
, size_t,
709 (wchar_t *pwc
, const char *s
, size_t n
, mbstate_t *ps
));
710 _GL_CXXALIAS_RPL (mbrtowc
, size_t,
711 (wchar_t *pwc
, const char *s
, size_t n
, mbstate_t *ps
));
714 _GL_FUNCDECL_SYS (mbrtowc
, size_t,
715 (wchar_t *pwc
, const char *s
, size_t n
, mbstate_t *ps
));
717 _GL_CXXALIAS_SYS (mbrtowc
, size_t,
718 (wchar_t *pwc
, const char *s
, size_t n
, mbstate_t *ps
));
720 _GL_CXXALIASWARN (mbrtowc
);
721 #elif defined GNULIB_POSIXCHECK
723 # if HAVE_RAW_DECL_MBRTOWC
724 _GL_WARN_ON_USE (mbrtowc
, "mbrtowc is unportable - "
725 "use gnulib module mbrtowc for portability");
730 /* Recognize a multibyte character. */
733 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
735 # define mbrlen rpl_mbrlen
737 _GL_FUNCDECL_RPL (mbrlen
, size_t, (const char *s
, size_t n
, mbstate_t *ps
));
738 _GL_CXXALIAS_RPL (mbrlen
, size_t, (const char *s
, size_t n
, mbstate_t *ps
));
741 _GL_FUNCDECL_SYS (mbrlen
, size_t, (const char *s
, size_t n
, mbstate_t *ps
));
743 _GL_CXXALIAS_SYS (mbrlen
, size_t, (const char *s
, size_t n
, mbstate_t *ps
));
745 _GL_CXXALIASWARN (mbrlen
);
746 #elif defined GNULIB_POSIXCHECK
748 # if HAVE_RAW_DECL_MBRLEN
749 _GL_WARN_ON_USE (mbrlen
, "mbrlen is unportable - "
750 "use gnulib module mbrlen for portability");
755 /* Convert a string to a wide string. */
758 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
760 # define mbsrtowcs rpl_mbsrtowcs
762 _GL_FUNCDECL_RPL (mbsrtowcs
, size_t,
763 (wchar_t *dest
, const char **srcp
, size_t len
, mbstate_t *ps
)
764 _GL_ARG_NONNULL ((2)));
765 _GL_CXXALIAS_RPL (mbsrtowcs
, size_t,
766 (wchar_t *dest
, const char **srcp
, size_t len
,
770 _GL_FUNCDECL_SYS (mbsrtowcs
, size_t,
771 (wchar_t *dest
, const char **srcp
, size_t len
, mbstate_t *ps
)
772 _GL_ARG_NONNULL ((2)));
774 _GL_CXXALIAS_SYS (mbsrtowcs
, size_t,
775 (wchar_t *dest
, const char **srcp
, size_t len
,
778 _GL_CXXALIASWARN (mbsrtowcs
);
779 #elif defined GNULIB_POSIXCHECK
781 # if HAVE_RAW_DECL_MBSRTOWCS
782 _GL_WARN_ON_USE (mbsrtowcs
, "mbsrtowcs is unportable - "
783 "use gnulib module mbsrtowcs for portability");
788 /* Convert a string to a wide string. */
791 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
793 # define mbsnrtowcs rpl_mbsnrtowcs
795 _GL_FUNCDECL_RPL (mbsnrtowcs
, size_t,
796 (wchar_t *dest
, const char **srcp
, size_t srclen
, size_t len
,
798 _GL_ARG_NONNULL ((2)));
799 _GL_CXXALIAS_RPL (mbsnrtowcs
, size_t,
800 (wchar_t *dest
, const char **srcp
, size_t srclen
, size_t len
,
804 _GL_FUNCDECL_SYS (mbsnrtowcs
, size_t,
805 (wchar_t *dest
, const char **srcp
, size_t srclen
, size_t len
,
807 _GL_ARG_NONNULL ((2)));
809 _GL_CXXALIAS_SYS (mbsnrtowcs
, size_t,
810 (wchar_t *dest
, const char **srcp
, size_t srclen
, size_t len
,
813 _GL_CXXALIASWARN (mbsnrtowcs
);
814 #elif defined GNULIB_POSIXCHECK
816 # if HAVE_RAW_DECL_MBSNRTOWCS
817 _GL_WARN_ON_USE (mbsnrtowcs
, "mbsnrtowcs is unportable - "
818 "use gnulib module mbsnrtowcs for portability");
823 /* Convert a wide character to a multibyte character. */
826 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
828 # define wcrtomb rpl_wcrtomb
830 _GL_FUNCDECL_RPL (wcrtomb
, size_t, (char *s
, wchar_t wc
, mbstate_t *ps
));
831 _GL_CXXALIAS_RPL (wcrtomb
, size_t, (char *s
, wchar_t wc
, mbstate_t *ps
));
834 _GL_FUNCDECL_SYS (wcrtomb
, size_t, (char *s
, wchar_t wc
, mbstate_t *ps
));
836 _GL_CXXALIAS_SYS (wcrtomb
, size_t, (char *s
, wchar_t wc
, mbstate_t *ps
));
838 _GL_CXXALIASWARN (wcrtomb
);
839 #elif defined GNULIB_POSIXCHECK
841 # if HAVE_RAW_DECL_WCRTOMB
842 _GL_WARN_ON_USE (wcrtomb
, "wcrtomb is unportable - "
843 "use gnulib module wcrtomb for portability");
848 /* Convert a wide string to a string. */
851 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
853 # define wcsrtombs rpl_wcsrtombs
855 _GL_FUNCDECL_RPL (wcsrtombs
, size_t,
856 (char *dest
, const wchar_t **srcp
, size_t len
, mbstate_t *ps
)
857 _GL_ARG_NONNULL ((2)));
858 _GL_CXXALIAS_RPL (wcsrtombs
, size_t,
859 (char *dest
, const wchar_t **srcp
, size_t len
,
863 _GL_FUNCDECL_SYS (wcsrtombs
, size_t,
864 (char *dest
, const wchar_t **srcp
, size_t len
, mbstate_t *ps
)
865 _GL_ARG_NONNULL ((2)));
867 _GL_CXXALIAS_SYS (wcsrtombs
, size_t,
868 (char *dest
, const wchar_t **srcp
, size_t len
,
871 _GL_CXXALIASWARN (wcsrtombs
);
872 #elif defined GNULIB_POSIXCHECK
874 # if HAVE_RAW_DECL_WCSRTOMBS
875 _GL_WARN_ON_USE (wcsrtombs
, "wcsrtombs is unportable - "
876 "use gnulib module wcsrtombs for portability");
881 /* Convert a wide string to a string. */
884 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
886 # define wcsnrtombs rpl_wcsnrtombs
888 _GL_FUNCDECL_RPL (wcsnrtombs
, size_t,
889 (char *dest
, const wchar_t **srcp
, size_t srclen
, size_t len
,
891 _GL_ARG_NONNULL ((2)));
892 _GL_CXXALIAS_RPL (wcsnrtombs
, size_t,
893 (char *dest
, const wchar_t **srcp
, size_t srclen
, size_t len
,
897 _GL_FUNCDECL_SYS (wcsnrtombs
, size_t,
898 (char *dest
, const wchar_t **srcp
, size_t srclen
, size_t len
,
900 _GL_ARG_NONNULL ((2)));
902 _GL_CXXALIAS_SYS (wcsnrtombs
, size_t,
903 (char *dest
, const wchar_t **srcp
, size_t srclen
, size_t len
,
906 _GL_CXXALIASWARN (wcsnrtombs
);
907 #elif defined GNULIB_POSIXCHECK
909 # if HAVE_RAW_DECL_WCSNRTOMBS
910 _GL_WARN_ON_USE (wcsnrtombs
, "wcsnrtombs is unportable - "
911 "use gnulib module wcsnrtombs for portability");
916 /* Return the number of screen columns needed for WC. */
919 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
921 # define wcwidth rpl_wcwidth
923 _GL_FUNCDECL_RPL (wcwidth
, int, (wchar_t) _GL_ATTRIBUTE_PURE
);
924 _GL_CXXALIAS_RPL (wcwidth
, int, (wchar_t));
927 /* wcwidth exists but is not declared. */
928 _GL_FUNCDECL_SYS (wcwidth
, int, (wchar_t) _GL_ATTRIBUTE_PURE
);
930 _GL_CXXALIAS_SYS (wcwidth
, int, (wchar_t));
932 _GL_CXXALIASWARN (wcwidth
);
933 #elif defined GNULIB_POSIXCHECK
935 # if HAVE_RAW_DECL_WCWIDTH
936 _GL_WARN_ON_USE (wcwidth
, "wcwidth is unportable - "
937 "use gnulib module wcwidth for portability");
942 /* Search N wide characters of S for C. */
945 _GL_FUNCDECL_SYS (wmemchr
, wchar_t *, (const wchar_t *s
, wchar_t c
, size_t n
)
948 /* On some systems, this function is defined as an overloaded function:
950 const wchar_t * std::wmemchr (const wchar_t *, wchar_t, size_t);
951 wchar_t * std::wmemchr (wchar_t *, wchar_t, size_t);
953 _GL_CXXALIAS_SYS_CAST2 (wmemchr
,
954 wchar_t *, (const wchar_t *, wchar_t, size_t),
955 const wchar_t *, (const wchar_t *, wchar_t, size_t));
956 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
957 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
958 _GL_CXXALIASWARN1 (wmemchr
, wchar_t *, (wchar_t *s
, wchar_t c
, size_t n
));
959 _GL_CXXALIASWARN1 (wmemchr
, const wchar_t *,
960 (const wchar_t *s
, wchar_t c
, size_t n
));
962 _GL_CXXALIASWARN (wmemchr
);
964 #elif defined GNULIB_POSIXCHECK
966 # if HAVE_RAW_DECL_WMEMCHR
967 _GL_WARN_ON_USE (wmemchr
, "wmemchr is unportable - "
968 "use gnulib module wmemchr for portability");
973 /* Compare N wide characters of S1 and S2. */
976 _GL_FUNCDECL_SYS (wmemcmp
, int,
977 (const wchar_t *s1
, const wchar_t *s2
, size_t n
)
980 _GL_CXXALIAS_SYS (wmemcmp
, int,
981 (const wchar_t *s1
, const wchar_t *s2
, size_t n
));
982 _GL_CXXALIASWARN (wmemcmp
);
983 #elif defined GNULIB_POSIXCHECK
985 # if HAVE_RAW_DECL_WMEMCMP
986 _GL_WARN_ON_USE (wmemcmp
, "wmemcmp is unportable - "
987 "use gnulib module wmemcmp for portability");
992 /* Copy N wide characters of SRC to DEST. */
995 _GL_FUNCDECL_SYS (wmemcpy
, wchar_t *,
996 (wchar_t *dest
, const wchar_t *src
, size_t n
));
998 _GL_CXXALIAS_SYS (wmemcpy
, wchar_t *,
999 (wchar_t *dest
, const wchar_t *src
, size_t n
));
1000 _GL_CXXALIASWARN (wmemcpy
);
1001 #elif defined GNULIB_POSIXCHECK
1003 # if HAVE_RAW_DECL_WMEMCPY
1004 _GL_WARN_ON_USE (wmemcpy
, "wmemcpy is unportable - "
1005 "use gnulib module wmemcpy for portability");
1010 /* Copy N wide characters of SRC to DEST, guaranteeing correct behavior for
1011 overlapping memory areas. */
1014 _GL_FUNCDECL_SYS (wmemmove
, wchar_t *,
1015 (wchar_t *dest
, const wchar_t *src
, size_t n
));
1017 _GL_CXXALIAS_SYS (wmemmove
, wchar_t *,
1018 (wchar_t *dest
, const wchar_t *src
, size_t n
));
1019 _GL_CXXALIASWARN (wmemmove
);
1020 #elif defined GNULIB_POSIXCHECK
1022 # if HAVE_RAW_DECL_WMEMMOVE
1023 _GL_WARN_ON_USE (wmemmove
, "wmemmove is unportable - "
1024 "use gnulib module wmemmove for portability");
1029 /* Set N wide characters of S to C. */
1032 _GL_FUNCDECL_SYS (wmemset
, wchar_t *, (wchar_t *s
, wchar_t c
, size_t n
));
1034 _GL_CXXALIAS_SYS (wmemset
, wchar_t *, (wchar_t *s
, wchar_t c
, size_t n
));
1035 _GL_CXXALIASWARN (wmemset
);
1036 #elif defined GNULIB_POSIXCHECK
1038 # if HAVE_RAW_DECL_WMEMSET
1039 _GL_WARN_ON_USE (wmemset
, "wmemset is unportable - "
1040 "use gnulib module wmemset for portability");
1045 /* Return the number of wide characters in S. */
1048 _GL_FUNCDECL_SYS (wcslen
, size_t, (const wchar_t *s
) _GL_ATTRIBUTE_PURE
);
1050 _GL_CXXALIAS_SYS (wcslen
, size_t, (const wchar_t *s
));
1051 _GL_CXXALIASWARN (wcslen
);
1052 #elif defined GNULIB_POSIXCHECK
1054 # if HAVE_RAW_DECL_WCSLEN
1055 _GL_WARN_ON_USE (wcslen
, "wcslen is unportable - "
1056 "use gnulib module wcslen for portability");
1061 /* Return the number of wide characters in S, but at most MAXLEN. */
1064 _GL_FUNCDECL_SYS (wcsnlen
, size_t, (const wchar_t *s
, size_t maxlen
)
1065 _GL_ATTRIBUTE_PURE
);
1067 _GL_CXXALIAS_SYS (wcsnlen
, size_t, (const wchar_t *s
, size_t maxlen
));
1068 _GL_CXXALIASWARN (wcsnlen
);
1069 #elif defined GNULIB_POSIXCHECK
1071 # if HAVE_RAW_DECL_WCSNLEN
1072 _GL_WARN_ON_USE (wcsnlen
, "wcsnlen is unportable - "
1073 "use gnulib module wcsnlen for portability");
1078 /* Copy SRC to DEST. */
1081 _GL_FUNCDECL_SYS (wcscpy
, wchar_t *, (wchar_t *dest
, const wchar_t *src
));
1083 _GL_CXXALIAS_SYS (wcscpy
, wchar_t *, (wchar_t *dest
, const wchar_t *src
));
1084 _GL_CXXALIASWARN (wcscpy
);
1085 #elif defined GNULIB_POSIXCHECK
1087 # if HAVE_RAW_DECL_WCSCPY
1088 _GL_WARN_ON_USE (wcscpy
, "wcscpy is unportable - "
1089 "use gnulib module wcscpy for portability");
1094 /* Copy SRC to DEST, returning the address of the terminating L'\0' in DEST. */
1097 _GL_FUNCDECL_SYS (wcpcpy
, wchar_t *, (wchar_t *dest
, const wchar_t *src
));
1099 _GL_CXXALIAS_SYS (wcpcpy
, wchar_t *, (wchar_t *dest
, const wchar_t *src
));
1100 _GL_CXXALIASWARN (wcpcpy
);
1101 #elif defined GNULIB_POSIXCHECK
1103 # if HAVE_RAW_DECL_WCPCPY
1104 _GL_WARN_ON_USE (wcpcpy
, "wcpcpy is unportable - "
1105 "use gnulib module wcpcpy for portability");
1110 /* Copy no more than N wide characters of SRC to DEST. */
1113 _GL_FUNCDECL_SYS (wcsncpy
, wchar_t *,
1114 (wchar_t *dest
, const wchar_t *src
, size_t n
));
1116 _GL_CXXALIAS_SYS (wcsncpy
, wchar_t *,
1117 (wchar_t *dest
, const wchar_t *src
, size_t n
));
1118 _GL_CXXALIASWARN (wcsncpy
);
1119 #elif defined GNULIB_POSIXCHECK
1121 # if HAVE_RAW_DECL_WCSNCPY
1122 _GL_WARN_ON_USE (wcsncpy
, "wcsncpy is unportable - "
1123 "use gnulib module wcsncpy for portability");
1128 /* Copy no more than N characters of SRC to DEST, returning the address of
1129 the last character written into DEST. */
1132 _GL_FUNCDECL_SYS (wcpncpy
, wchar_t *,
1133 (wchar_t *dest
, const wchar_t *src
, size_t n
));
1135 _GL_CXXALIAS_SYS (wcpncpy
, wchar_t *,
1136 (wchar_t *dest
, const wchar_t *src
, size_t n
));
1137 _GL_CXXALIASWARN (wcpncpy
);
1138 #elif defined GNULIB_POSIXCHECK
1140 # if HAVE_RAW_DECL_WCPNCPY
1141 _GL_WARN_ON_USE (wcpncpy
, "wcpncpy is unportable - "
1142 "use gnulib module wcpncpy for portability");
1147 /* Append SRC onto DEST. */
1150 _GL_FUNCDECL_SYS (wcscat
, wchar_t *, (wchar_t *dest
, const wchar_t *src
));
1152 _GL_CXXALIAS_SYS (wcscat
, wchar_t *, (wchar_t *dest
, const wchar_t *src
));
1153 _GL_CXXALIASWARN (wcscat
);
1154 #elif defined GNULIB_POSIXCHECK
1156 # if HAVE_RAW_DECL_WCSCAT
1157 _GL_WARN_ON_USE (wcscat
, "wcscat is unportable - "
1158 "use gnulib module wcscat for portability");
1163 /* Append no more than N wide characters of SRC onto DEST. */
1166 _GL_FUNCDECL_SYS (wcsncat
, wchar_t *,
1167 (wchar_t *dest
, const wchar_t *src
, size_t n
));
1169 _GL_CXXALIAS_SYS (wcsncat
, wchar_t *,
1170 (wchar_t *dest
, const wchar_t *src
, size_t n
));
1171 _GL_CXXALIASWARN (wcsncat
);
1172 #elif defined GNULIB_POSIXCHECK
1174 # if HAVE_RAW_DECL_WCSNCAT
1175 _GL_WARN_ON_USE (wcsncat
, "wcsncat is unportable - "
1176 "use gnulib module wcsncat for portability");
1181 /* Compare S1 and S2. */
1184 _GL_FUNCDECL_SYS (wcscmp
, int, (const wchar_t *s1
, const wchar_t *s2
)
1185 _GL_ATTRIBUTE_PURE
);
1187 _GL_CXXALIAS_SYS (wcscmp
, int, (const wchar_t *s1
, const wchar_t *s2
));
1188 _GL_CXXALIASWARN (wcscmp
);
1189 #elif defined GNULIB_POSIXCHECK
1191 # if HAVE_RAW_DECL_WCSCMP
1192 _GL_WARN_ON_USE (wcscmp
, "wcscmp is unportable - "
1193 "use gnulib module wcscmp for portability");
1198 /* Compare no more than N wide characters of S1 and S2. */
1201 _GL_FUNCDECL_SYS (wcsncmp
, int,
1202 (const wchar_t *s1
, const wchar_t *s2
, size_t n
)
1203 _GL_ATTRIBUTE_PURE
);
1205 _GL_CXXALIAS_SYS (wcsncmp
, int,
1206 (const wchar_t *s1
, const wchar_t *s2
, size_t n
));
1207 _GL_CXXALIASWARN (wcsncmp
);
1208 #elif defined GNULIB_POSIXCHECK
1210 # if HAVE_RAW_DECL_WCSNCMP
1211 _GL_WARN_ON_USE (wcsncmp
, "wcsncmp is unportable - "
1212 "use gnulib module wcsncmp for portability");
1217 /* Compare S1 and S2, ignoring case. */
1220 _GL_FUNCDECL_SYS (wcscasecmp
, int, (const wchar_t *s1
, const wchar_t *s2
)
1221 _GL_ATTRIBUTE_PURE
);
1223 _GL_CXXALIAS_SYS (wcscasecmp
, int, (const wchar_t *s1
, const wchar_t *s2
));
1224 _GL_CXXALIASWARN (wcscasecmp
);
1225 #elif defined GNULIB_POSIXCHECK
1227 # if HAVE_RAW_DECL_WCSCASECMP
1228 _GL_WARN_ON_USE (wcscasecmp
, "wcscasecmp is unportable - "
1229 "use gnulib module wcscasecmp for portability");
1234 /* Compare no more than N chars of S1 and S2, ignoring case. */
1237 _GL_FUNCDECL_SYS (wcsncasecmp
, int,
1238 (const wchar_t *s1
, const wchar_t *s2
, size_t n
)
1239 _GL_ATTRIBUTE_PURE
);
1241 _GL_CXXALIAS_SYS (wcsncasecmp
, int,
1242 (const wchar_t *s1
, const wchar_t *s2
, size_t n
));
1243 _GL_CXXALIASWARN (wcsncasecmp
);
1244 #elif defined GNULIB_POSIXCHECK
1246 # if HAVE_RAW_DECL_WCSNCASECMP
1247 _GL_WARN_ON_USE (wcsncasecmp
, "wcsncasecmp is unportable - "
1248 "use gnulib module wcsncasecmp for portability");
1253 /* Compare S1 and S2, both interpreted as appropriate to the LC_COLLATE
1254 category of the current locale. */
1257 _GL_FUNCDECL_SYS (wcscoll
, int, (const wchar_t *s1
, const wchar_t *s2
));
1259 _GL_CXXALIAS_SYS (wcscoll
, int, (const wchar_t *s1
, const wchar_t *s2
));
1260 _GL_CXXALIASWARN (wcscoll
);
1261 #elif defined GNULIB_POSIXCHECK
1263 # if HAVE_RAW_DECL_WCSCOLL
1264 _GL_WARN_ON_USE (wcscoll
, "wcscoll is unportable - "
1265 "use gnulib module wcscoll for portability");
1270 /* Transform S2 into array pointed to by S1 such that if wcscmp is applied
1271 to two transformed strings the result is the as applying 'wcscoll' to the
1272 original strings. */
1275 _GL_FUNCDECL_SYS (wcsxfrm
, size_t, (wchar_t *s1
, const wchar_t *s2
, size_t n
));
1277 _GL_CXXALIAS_SYS (wcsxfrm
, size_t, (wchar_t *s1
, const wchar_t *s2
, size_t n
));
1278 _GL_CXXALIASWARN (wcsxfrm
);
1279 #elif defined GNULIB_POSIXCHECK
1281 # if HAVE_RAW_DECL_WCSXFRM
1282 _GL_WARN_ON_USE (wcsxfrm
, "wcsxfrm is unportable - "
1283 "use gnulib module wcsxfrm for portability");
1288 /* Duplicate S, returning an identical malloc'd string. */
1291 _GL_FUNCDECL_SYS (wcsdup
, wchar_t *, (const wchar_t *s
));
1293 _GL_CXXALIAS_SYS (wcsdup
, wchar_t *, (const wchar_t *s
));
1294 _GL_CXXALIASWARN (wcsdup
);
1295 #elif defined GNULIB_POSIXCHECK
1297 # if HAVE_RAW_DECL_WCSDUP
1298 _GL_WARN_ON_USE (wcsdup
, "wcsdup is unportable - "
1299 "use gnulib module wcsdup for portability");
1304 /* Find the first occurrence of WC in WCS. */
1307 _GL_FUNCDECL_SYS (wcschr
, wchar_t *, (const wchar_t *wcs
, wchar_t wc
)
1308 _GL_ATTRIBUTE_PURE
);
1310 /* On some systems, this function is defined as an overloaded function:
1312 const wchar_t * std::wcschr (const wchar_t *, wchar_t);
1313 wchar_t * std::wcschr (wchar_t *, wchar_t);
1315 _GL_CXXALIAS_SYS_CAST2 (wcschr
,
1316 wchar_t *, (const wchar_t *, wchar_t),
1317 const wchar_t *, (const wchar_t *, wchar_t));
1318 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
1319 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
1320 _GL_CXXALIASWARN1 (wcschr
, wchar_t *, (wchar_t *wcs
, wchar_t wc
));
1321 _GL_CXXALIASWARN1 (wcschr
, const wchar_t *, (const wchar_t *wcs
, wchar_t wc
));
1323 _GL_CXXALIASWARN (wcschr
);
1325 #elif defined GNULIB_POSIXCHECK
1327 # if HAVE_RAW_DECL_WCSCHR
1328 _GL_WARN_ON_USE (wcschr
, "wcschr is unportable - "
1329 "use gnulib module wcschr for portability");
1334 /* Find the last occurrence of WC in WCS. */
1337 _GL_FUNCDECL_SYS (wcsrchr
, wchar_t *, (const wchar_t *wcs
, wchar_t wc
)
1338 _GL_ATTRIBUTE_PURE
);
1340 /* On some systems, this function is defined as an overloaded function:
1342 const wchar_t * std::wcsrchr (const wchar_t *, wchar_t);
1343 wchar_t * std::wcsrchr (wchar_t *, wchar_t);
1345 _GL_CXXALIAS_SYS_CAST2 (wcsrchr
,
1346 wchar_t *, (const wchar_t *, wchar_t),
1347 const wchar_t *, (const wchar_t *, wchar_t));
1348 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
1349 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
1350 _GL_CXXALIASWARN1 (wcsrchr
, wchar_t *, (wchar_t *wcs
, wchar_t wc
));
1351 _GL_CXXALIASWARN1 (wcsrchr
, const wchar_t *, (const wchar_t *wcs
, wchar_t wc
));
1353 _GL_CXXALIASWARN (wcsrchr
);
1355 #elif defined GNULIB_POSIXCHECK
1357 # if HAVE_RAW_DECL_WCSRCHR
1358 _GL_WARN_ON_USE (wcsrchr
, "wcsrchr is unportable - "
1359 "use gnulib module wcsrchr for portability");
1364 /* Return the length of the initial segmet of WCS which consists entirely
1365 of wide characters not in REJECT. */
1368 _GL_FUNCDECL_SYS (wcscspn
, size_t, (const wchar_t *wcs
, const wchar_t *reject
)
1369 _GL_ATTRIBUTE_PURE
);
1371 _GL_CXXALIAS_SYS (wcscspn
, size_t, (const wchar_t *wcs
, const wchar_t *reject
));
1372 _GL_CXXALIASWARN (wcscspn
);
1373 #elif defined GNULIB_POSIXCHECK
1375 # if HAVE_RAW_DECL_WCSCSPN
1376 _GL_WARN_ON_USE (wcscspn
, "wcscspn is unportable - "
1377 "use gnulib module wcscspn for portability");
1382 /* Return the length of the initial segmet of WCS which consists entirely
1383 of wide characters in ACCEPT. */
1386 _GL_FUNCDECL_SYS (wcsspn
, size_t, (const wchar_t *wcs
, const wchar_t *accept
)
1387 _GL_ATTRIBUTE_PURE
);
1389 _GL_CXXALIAS_SYS (wcsspn
, size_t, (const wchar_t *wcs
, const wchar_t *accept
));
1390 _GL_CXXALIASWARN (wcsspn
);
1391 #elif defined GNULIB_POSIXCHECK
1393 # if HAVE_RAW_DECL_WCSSPN
1394 _GL_WARN_ON_USE (wcsspn
, "wcsspn is unportable - "
1395 "use gnulib module wcsspn for portability");
1400 /* Find the first occurrence in WCS of any character in ACCEPT. */
1403 _GL_FUNCDECL_SYS (wcspbrk
, wchar_t *,
1404 (const wchar_t *wcs
, const wchar_t *accept
)
1405 _GL_ATTRIBUTE_PURE
);
1407 /* On some systems, this function is defined as an overloaded function:
1409 const wchar_t * std::wcspbrk (const wchar_t *, const wchar_t *);
1410 wchar_t * std::wcspbrk (wchar_t *, const wchar_t *);
1412 _GL_CXXALIAS_SYS_CAST2 (wcspbrk
,
1413 wchar_t *, (const wchar_t *, const wchar_t *),
1414 const wchar_t *, (const wchar_t *, const wchar_t *));
1415 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
1416 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
1417 _GL_CXXALIASWARN1 (wcspbrk
, wchar_t *,
1418 (wchar_t *wcs
, const wchar_t *accept
));
1419 _GL_CXXALIASWARN1 (wcspbrk
, const wchar_t *,
1420 (const wchar_t *wcs
, const wchar_t *accept
));
1422 _GL_CXXALIASWARN (wcspbrk
);
1424 #elif defined GNULIB_POSIXCHECK
1426 # if HAVE_RAW_DECL_WCSPBRK
1427 _GL_WARN_ON_USE (wcspbrk
, "wcspbrk is unportable - "
1428 "use gnulib module wcspbrk for portability");
1433 /* Find the first occurrence of NEEDLE in HAYSTACK. */
1436 _GL_FUNCDECL_SYS (wcsstr
, wchar_t *,
1437 (const wchar_t *haystack
, const wchar_t *needle
)
1438 _GL_ATTRIBUTE_PURE
);
1440 /* On some systems, this function is defined as an overloaded function:
1442 const wchar_t * std::wcsstr (const wchar_t *, const wchar_t *);
1443 wchar_t * std::wcsstr (wchar_t *, const wchar_t *);
1445 _GL_CXXALIAS_SYS_CAST2 (wcsstr
,
1446 wchar_t *, (const wchar_t *, const wchar_t *),
1447 const wchar_t *, (const wchar_t *, const wchar_t *));
1448 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
1449 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
1450 _GL_CXXALIASWARN1 (wcsstr
, wchar_t *,
1451 (wchar_t *haystack
, const wchar_t *needle
));
1452 _GL_CXXALIASWARN1 (wcsstr
, const wchar_t *,
1453 (const wchar_t *haystack
, const wchar_t *needle
));
1455 _GL_CXXALIASWARN (wcsstr
);
1457 #elif defined GNULIB_POSIXCHECK
1459 # if HAVE_RAW_DECL_WCSSTR
1460 _GL_WARN_ON_USE (wcsstr
, "wcsstr is unportable - "
1461 "use gnulib module wcsstr for portability");
1466 /* Divide WCS into tokens separated by characters in DELIM. */
1469 _GL_FUNCDECL_SYS (wcstok
, wchar_t *,
1470 (wchar_t *wcs
, const wchar_t *delim
, wchar_t **ptr
));
1472 _GL_CXXALIAS_SYS (wcstok
, wchar_t *,
1473 (wchar_t *wcs
, const wchar_t *delim
, wchar_t **ptr
));
1474 _GL_CXXALIASWARN (wcstok
);
1475 #elif defined GNULIB_POSIXCHECK
1477 # if HAVE_RAW_DECL_WCSTOK
1478 _GL_WARN_ON_USE (wcstok
, "wcstok is unportable - "
1479 "use gnulib module wcstok for portability");
1484 /* Determine number of column positions required for first N wide
1485 characters (or fewer if S ends before this) in S. */
1488 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1490 # define wcswidth rpl_wcswidth
1492 _GL_FUNCDECL_RPL (wcswidth
, int, (const wchar_t *s
, size_t n
)
1493 _GL_ATTRIBUTE_PURE
);
1494 _GL_CXXALIAS_RPL (wcswidth
, int, (const wchar_t *s
, size_t n
));
1497 _GL_FUNCDECL_SYS (wcswidth
, int, (const wchar_t *s
, size_t n
)
1498 _GL_ATTRIBUTE_PURE
);
1500 _GL_CXXALIAS_SYS (wcswidth
, int, (const wchar_t *s
, size_t n
));
1502 _GL_CXXALIASWARN (wcswidth
);
1503 #elif defined GNULIB_POSIXCHECK
1505 # if HAVE_RAW_DECL_WCSWIDTH
1506 _GL_WARN_ON_USE (wcswidth
, "wcswidth is unportable - "
1507 "use gnulib module wcswidth for portability");
1512 /* Convert *TP to a date and time wide string. See
1513 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/wcsftime.html>. */
1516 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1518 # define wcsftime rpl_wcsftime
1520 _GL_FUNCDECL_RPL (wcsftime
, size_t, (wchar_t *__buf
, size_t __bufsize
,
1521 const wchar_t *__fmt
, const struct tm
*__tp
)
1522 _GL_ARG_NONNULL ((1, 3, 4)));
1523 _GL_CXXALIAS_RPL (wcsftime
, size_t, (wchar_t *__buf
, size_t __bufsize
,
1524 const wchar_t *__fmt
, const struct tm
*__tp
));
1527 _GL_FUNCDECL_SYS (wcsftime
, size_t, (wchar_t *__buf
, size_t __bufsize
,
1528 const wchar_t *__fmt
, const struct tm
*__tp
)
1529 _GL_ARG_NONNULL ((1, 3, 4)));
1531 _GL_CXXALIAS_SYS (wcsftime
, size_t, (wchar_t *__buf
, size_t __bufsize
,
1532 const wchar_t *__fmt
, const struct tm
*__tp
));
1534 _GL_CXXALIASWARN (wcsftime
);
1535 #elif defined GNULIB_POSIXCHECK
1537 # if HAVE_RAW_DECL_WCSFTIME
1538 _GL_WARN_ON_USE (wcsftime
, "wcsftime is unportable - "
1539 "use gnulib module wcsftime for portability");
1544 #endif /* _GL_WCHAR_H */
1545 #endif /* _GL_WCHAR_H */