105436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
205436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
305436638acc7c010349a69c3395f1a57c642dc62Ying Wang
405436638acc7c010349a69c3395f1a57c642dc62Ying Wang   Copyright (C) 2007-2012 Free Software Foundation, Inc.
505436638acc7c010349a69c3395f1a57c642dc62Ying Wang
605436638acc7c010349a69c3395f1a57c642dc62Ying Wang   This program is free software; you can redistribute it and/or modify
705436638acc7c010349a69c3395f1a57c642dc62Ying Wang   it under the terms of the GNU General Public License as published by
805436638acc7c010349a69c3395f1a57c642dc62Ying Wang   the Free Software Foundation; either version 3, or (at your option)
905436638acc7c010349a69c3395f1a57c642dc62Ying Wang   any later version.
1005436638acc7c010349a69c3395f1a57c642dc62Ying Wang
1105436638acc7c010349a69c3395f1a57c642dc62Ying Wang   This program is distributed in the hope that it will be useful,
1205436638acc7c010349a69c3395f1a57c642dc62Ying Wang   but WITHOUT ANY WARRANTY; without even the implied warranty of
1305436638acc7c010349a69c3395f1a57c642dc62Ying Wang   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1405436638acc7c010349a69c3395f1a57c642dc62Ying Wang   GNU General Public License for more details.
1505436638acc7c010349a69c3395f1a57c642dc62Ying Wang
1605436638acc7c010349a69c3395f1a57c642dc62Ying Wang   You should have received a copy of the GNU General Public License
1705436638acc7c010349a69c3395f1a57c642dc62Ying Wang   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
1805436638acc7c010349a69c3395f1a57c642dc62Ying Wang
1905436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Written by Eric Blake.  */
2005436638acc7c010349a69c3395f1a57c642dc62Ying Wang
2105436638acc7c010349a69c3395f1a57c642dc62Ying Wang/*
2205436638acc7c010349a69c3395f1a57c642dc62Ying Wang * ISO C 99 <wchar.h> for platforms that have issues.
2305436638acc7c010349a69c3395f1a57c642dc62Ying Wang * <http://www.opengroup.org/susv3xbd/wchar.h.html>
2405436638acc7c010349a69c3395f1a57c642dc62Ying Wang *
2505436638acc7c010349a69c3395f1a57c642dc62Ying Wang * For now, this just ensures proper prerequisite inclusion order and
2605436638acc7c010349a69c3395f1a57c642dc62Ying Wang * the declaration of wcwidth().
2705436638acc7c010349a69c3395f1a57c642dc62Ying Wang */
2805436638acc7c010349a69c3395f1a57c642dc62Ying Wang
2905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if __GNUC__ >= 3
3005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#pragma GCC system_header
3105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
3205436638acc7c010349a69c3395f1a57c642dc62Ying Wang
3305436638acc7c010349a69c3395f1a57c642dc62Ying Wang
3405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if defined __need_mbstate_t || defined __need_wint_t || (defined __hpux && ((defined _INTTYPES_INCLUDED && !defined strtoimax) || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) || defined _GL_ALREADY_INCLUDING_WCHAR_H
3505436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Special invocation convention:
3605436638acc7c010349a69c3395f1a57c642dc62Ying Wang   - Inside glibc and uClibc header files.
3705436638acc7c010349a69c3395f1a57c642dc62Ying Wang   - On HP-UX 11.00 we have a sequence of nested includes
3805436638acc7c010349a69c3395f1a57c642dc62Ying Wang     <wchar.h> -> <stdlib.h> -> <stdint.h>, and the latter includes <wchar.h>,
3905436638acc7c010349a69c3395f1a57c642dc62Ying Wang     once indirectly <stdint.h> -> <sys/types.h> -> <inttypes.h> -> <wchar.h>
4005436638acc7c010349a69c3395f1a57c642dc62Ying Wang     and once directly.  In both situations 'wint_t' is not yet defined,
4105436638acc7c010349a69c3395f1a57c642dc62Ying Wang     therefore we cannot provide the function overrides; instead include only
4205436638acc7c010349a69c3395f1a57c642dc62Ying Wang     the system's <wchar.h>.
4305436638acc7c010349a69c3395f1a57c642dc62Ying Wang   - On IRIX 6.5, similarly, we have an include <wchar.h> -> <wctype.h>, and
4405436638acc7c010349a69c3395f1a57c642dc62Ying Wang     the latter includes <wchar.h>.  But here, we have no way to detect whether
4505436638acc7c010349a69c3395f1a57c642dc62Ying Wang     <wctype.h> is completely included or is still being included.  */
4605436638acc7c010349a69c3395f1a57c642dc62Ying Wang
4705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#include_next <wchar.h>
4805436638acc7c010349a69c3395f1a57c642dc62Ying Wang
4905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#else
5005436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Normal invocation convention.  */
5105436638acc7c010349a69c3395f1a57c642dc62Ying Wang
5205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#ifndef _GL_WCHAR_H
5305436638acc7c010349a69c3395f1a57c642dc62Ying Wang
5405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#define _GL_ALREADY_INCLUDING_WCHAR_H
5505436638acc7c010349a69c3395f1a57c642dc62Ying Wang
5605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
5705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# include <features.h> /* for __GLIBC__ */
5805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
5905436638acc7c010349a69c3395f1a57c642dc62Ying Wang
6005436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
6105436638acc7c010349a69c3395f1a57c642dc62Ying Wang   <wchar.h>.
6205436638acc7c010349a69c3395f1a57c642dc62Ying Wang   BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
6305436638acc7c010349a69c3395f1a57c642dc62Ying Wang   included before <wchar.h>.
6405436638acc7c010349a69c3395f1a57c642dc62Ying Wang   In some builds of uClibc, <wchar.h> is nonexistent and wchar_t is defined
6505436638acc7c010349a69c3395f1a57c642dc62Ying Wang   by <stddef.h>.
6605436638acc7c010349a69c3395f1a57c642dc62Ying Wang   But avoid namespace pollution on glibc systems.  */
6705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if !(defined __GLIBC__ && !defined __UCLIBC__)
6805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# include <stddef.h>
6905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
7005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#ifndef __GLIBC__
7105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# include <stdio.h>
7205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# include <time.h>
7305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
7405436638acc7c010349a69c3395f1a57c642dc62Ying Wang
7505436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Include the original <wchar.h> if it exists.
7605436638acc7c010349a69c3395f1a57c642dc62Ying Wang   Some builds of uClibc lack it.  */
7705436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* The include_next requires a split double-inclusion guard.  */
7805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 1
7905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# include_next <wchar.h>
8005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
8105436638acc7c010349a69c3395f1a57c642dc62Ying Wang
8205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#undef _GL_ALREADY_INCLUDING_WCHAR_H
8305436638acc7c010349a69c3395f1a57c642dc62Ying Wang
8405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#ifndef _GL_WCHAR_H
8505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#define _GL_WCHAR_H
8605436638acc7c010349a69c3395f1a57c642dc62Ying Wang
8705436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* The __attribute__ feature is available in gcc versions 2.5 and later.
8805436638acc7c010349a69c3395f1a57c642dc62Ying Wang   The attribute __pure__ was added in gcc 2.96.  */
8905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
9005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
9105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#else
9205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_ATTRIBUTE_PURE /* empty */
9305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
9405436638acc7c010349a69c3395f1a57c642dc62Ying Wang
9505436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
9605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#ifndef _GL_CXXDEFS_H
9705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#define _GL_CXXDEFS_H
9805436638acc7c010349a69c3395f1a57c642dc62Ying Wang
9905436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* The three most frequent use cases of these macros are:
10005436638acc7c010349a69c3395f1a57c642dc62Ying Wang
10105436638acc7c010349a69c3395f1a57c642dc62Ying Wang   * For providing a substitute for a function that is missing on some
10205436638acc7c010349a69c3395f1a57c642dc62Ying Wang     platforms, but is declared and works fine on the platforms on which
10305436638acc7c010349a69c3395f1a57c642dc62Ying Wang     it exists:
10405436638acc7c010349a69c3395f1a57c642dc62Ying Wang
10505436638acc7c010349a69c3395f1a57c642dc62Ying Wang       #if @GNULIB_FOO@
10605436638acc7c010349a69c3395f1a57c642dc62Ying Wang       # if !@HAVE_FOO@
10705436638acc7c010349a69c3395f1a57c642dc62Ying Wang       _GL_FUNCDECL_SYS (foo, ...);
10805436638acc7c010349a69c3395f1a57c642dc62Ying Wang       # endif
10905436638acc7c010349a69c3395f1a57c642dc62Ying Wang       _GL_CXXALIAS_SYS (foo, ...);
11005436638acc7c010349a69c3395f1a57c642dc62Ying Wang       _GL_CXXALIASWARN (foo);
11105436638acc7c010349a69c3395f1a57c642dc62Ying Wang       #elif defined GNULIB_POSIXCHECK
11205436638acc7c010349a69c3395f1a57c642dc62Ying Wang       ...
11305436638acc7c010349a69c3395f1a57c642dc62Ying Wang       #endif
11405436638acc7c010349a69c3395f1a57c642dc62Ying Wang
11505436638acc7c010349a69c3395f1a57c642dc62Ying Wang   * For providing a replacement for a function that exists on all platforms,
11605436638acc7c010349a69c3395f1a57c642dc62Ying Wang     but is broken/insufficient and needs to be replaced on some platforms:
11705436638acc7c010349a69c3395f1a57c642dc62Ying Wang
11805436638acc7c010349a69c3395f1a57c642dc62Ying Wang       #if @GNULIB_FOO@
11905436638acc7c010349a69c3395f1a57c642dc62Ying Wang       # if @REPLACE_FOO@
12005436638acc7c010349a69c3395f1a57c642dc62Ying Wang       #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
12105436638acc7c010349a69c3395f1a57c642dc62Ying Wang       #   undef foo
12205436638acc7c010349a69c3395f1a57c642dc62Ying Wang       #   define foo rpl_foo
12305436638acc7c010349a69c3395f1a57c642dc62Ying Wang       #  endif
12405436638acc7c010349a69c3395f1a57c642dc62Ying Wang       _GL_FUNCDECL_RPL (foo, ...);
12505436638acc7c010349a69c3395f1a57c642dc62Ying Wang       _GL_CXXALIAS_RPL (foo, ...);
12605436638acc7c010349a69c3395f1a57c642dc62Ying Wang       # else
12705436638acc7c010349a69c3395f1a57c642dc62Ying Wang       _GL_CXXALIAS_SYS (foo, ...);
12805436638acc7c010349a69c3395f1a57c642dc62Ying Wang       # endif
12905436638acc7c010349a69c3395f1a57c642dc62Ying Wang       _GL_CXXALIASWARN (foo);
13005436638acc7c010349a69c3395f1a57c642dc62Ying Wang       #elif defined GNULIB_POSIXCHECK
13105436638acc7c010349a69c3395f1a57c642dc62Ying Wang       ...
13205436638acc7c010349a69c3395f1a57c642dc62Ying Wang       #endif
13305436638acc7c010349a69c3395f1a57c642dc62Ying Wang
13405436638acc7c010349a69c3395f1a57c642dc62Ying Wang   * For providing a replacement for a function that exists on some platforms
13505436638acc7c010349a69c3395f1a57c642dc62Ying Wang     but is broken/insufficient and needs to be replaced on some of them and
13605436638acc7c010349a69c3395f1a57c642dc62Ying Wang     is additionally either missing or undeclared on some other platforms:
13705436638acc7c010349a69c3395f1a57c642dc62Ying Wang
13805436638acc7c010349a69c3395f1a57c642dc62Ying Wang       #if @GNULIB_FOO@
13905436638acc7c010349a69c3395f1a57c642dc62Ying Wang       # if @REPLACE_FOO@
14005436638acc7c010349a69c3395f1a57c642dc62Ying Wang       #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
14105436638acc7c010349a69c3395f1a57c642dc62Ying Wang       #   undef foo
14205436638acc7c010349a69c3395f1a57c642dc62Ying Wang       #   define foo rpl_foo
14305436638acc7c010349a69c3395f1a57c642dc62Ying Wang       #  endif
14405436638acc7c010349a69c3395f1a57c642dc62Ying Wang       _GL_FUNCDECL_RPL (foo, ...);
14505436638acc7c010349a69c3395f1a57c642dc62Ying Wang       _GL_CXXALIAS_RPL (foo, ...);
14605436638acc7c010349a69c3395f1a57c642dc62Ying Wang       # else
14705436638acc7c010349a69c3395f1a57c642dc62Ying Wang       #  if !@HAVE_FOO@   or   if !@HAVE_DECL_FOO@
14805436638acc7c010349a69c3395f1a57c642dc62Ying Wang       _GL_FUNCDECL_SYS (foo, ...);
14905436638acc7c010349a69c3395f1a57c642dc62Ying Wang       #  endif
15005436638acc7c010349a69c3395f1a57c642dc62Ying Wang       _GL_CXXALIAS_SYS (foo, ...);
15105436638acc7c010349a69c3395f1a57c642dc62Ying Wang       # endif
15205436638acc7c010349a69c3395f1a57c642dc62Ying Wang       _GL_CXXALIASWARN (foo);
15305436638acc7c010349a69c3395f1a57c642dc62Ying Wang       #elif defined GNULIB_POSIXCHECK
15405436638acc7c010349a69c3395f1a57c642dc62Ying Wang       ...
15505436638acc7c010349a69c3395f1a57c642dc62Ying Wang       #endif
15605436638acc7c010349a69c3395f1a57c642dc62Ying Wang*/
15705436638acc7c010349a69c3395f1a57c642dc62Ying Wang
15805436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* _GL_EXTERN_C declaration;
15905436638acc7c010349a69c3395f1a57c642dc62Ying Wang   performs the declaration with C linkage.  */
16005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if defined __cplusplus
16105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_EXTERN_C extern "C"
16205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#else
16305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_EXTERN_C extern
16405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
16505436638acc7c010349a69c3395f1a57c642dc62Ying Wang
16605436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
16705436638acc7c010349a69c3395f1a57c642dc62Ying Wang   declares a replacement function, named rpl_func, with the given prototype,
16805436638acc7c010349a69c3395f1a57c642dc62Ying Wang   consisting of return type, parameters, and attributes.
16905436638acc7c010349a69c3395f1a57c642dc62Ying Wang   Example:
17005436638acc7c010349a69c3395f1a57c642dc62Ying Wang     _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
17105436638acc7c010349a69c3395f1a57c642dc62Ying Wang                                  _GL_ARG_NONNULL ((1)));
17205436638acc7c010349a69c3395f1a57c642dc62Ying Wang */
17305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
17405436638acc7c010349a69c3395f1a57c642dc62Ying Wang  _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
17505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
17605436638acc7c010349a69c3395f1a57c642dc62Ying Wang  _GL_EXTERN_C rettype rpl_func parameters_and_attributes
17705436638acc7c010349a69c3395f1a57c642dc62Ying Wang
17805436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
17905436638acc7c010349a69c3395f1a57c642dc62Ying Wang   declares the system function, named func, with the given prototype,
18005436638acc7c010349a69c3395f1a57c642dc62Ying Wang   consisting of return type, parameters, and attributes.
18105436638acc7c010349a69c3395f1a57c642dc62Ying Wang   Example:
18205436638acc7c010349a69c3395f1a57c642dc62Ying Wang     _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
18305436638acc7c010349a69c3395f1a57c642dc62Ying Wang                                  _GL_ARG_NONNULL ((1)));
18405436638acc7c010349a69c3395f1a57c642dc62Ying Wang */
18505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
18605436638acc7c010349a69c3395f1a57c642dc62Ying Wang  _GL_EXTERN_C rettype func parameters_and_attributes
18705436638acc7c010349a69c3395f1a57c642dc62Ying Wang
18805436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* _GL_CXXALIAS_RPL (func, rettype, parameters);
18905436638acc7c010349a69c3395f1a57c642dc62Ying Wang   declares a C++ alias called GNULIB_NAMESPACE::func
19005436638acc7c010349a69c3395f1a57c642dc62Ying Wang   that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
19105436638acc7c010349a69c3395f1a57c642dc62Ying Wang   Example:
19205436638acc7c010349a69c3395f1a57c642dc62Ying Wang     _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
19305436638acc7c010349a69c3395f1a57c642dc62Ying Wang */
19405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#define _GL_CXXALIAS_RPL(func,rettype,parameters) \
19505436638acc7c010349a69c3395f1a57c642dc62Ying Wang  _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
19605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if defined __cplusplus && defined GNULIB_NAMESPACE
19705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
19805436638acc7c010349a69c3395f1a57c642dc62Ying Wang    namespace GNULIB_NAMESPACE                                \
19905436638acc7c010349a69c3395f1a57c642dc62Ying Wang    {                                                         \
20005436638acc7c010349a69c3395f1a57c642dc62Ying Wang      rettype (*const func) parameters = ::rpl_func;          \
20105436638acc7c010349a69c3395f1a57c642dc62Ying Wang    }                                                         \
20205436638acc7c010349a69c3395f1a57c642dc62Ying Wang    _GL_EXTERN_C int _gl_cxxalias_dummy
20305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#else
20405436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
20505436638acc7c010349a69c3395f1a57c642dc62Ying Wang    _GL_EXTERN_C int _gl_cxxalias_dummy
20605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
20705436638acc7c010349a69c3395f1a57c642dc62Ying Wang
20805436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
20905436638acc7c010349a69c3395f1a57c642dc62Ying Wang   is like  _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
21005436638acc7c010349a69c3395f1a57c642dc62Ying Wang   except that the C function rpl_func may have a slightly different
21105436638acc7c010349a69c3395f1a57c642dc62Ying Wang   declaration.  A cast is used to silence the "invalid conversion" error
21205436638acc7c010349a69c3395f1a57c642dc62Ying Wang   that would otherwise occur.  */
21305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if defined __cplusplus && defined GNULIB_NAMESPACE
21405436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
21505436638acc7c010349a69c3395f1a57c642dc62Ying Wang    namespace GNULIB_NAMESPACE                                     \
21605436638acc7c010349a69c3395f1a57c642dc62Ying Wang    {                                                              \
21705436638acc7c010349a69c3395f1a57c642dc62Ying Wang      rettype (*const func) parameters =                           \
21805436638acc7c010349a69c3395f1a57c642dc62Ying Wang        reinterpret_cast<rettype(*)parameters>(::rpl_func);        \
21905436638acc7c010349a69c3395f1a57c642dc62Ying Wang    }                                                              \
22005436638acc7c010349a69c3395f1a57c642dc62Ying Wang    _GL_EXTERN_C int _gl_cxxalias_dummy
22105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#else
22205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
22305436638acc7c010349a69c3395f1a57c642dc62Ying Wang    _GL_EXTERN_C int _gl_cxxalias_dummy
22405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
22505436638acc7c010349a69c3395f1a57c642dc62Ying Wang
22605436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* _GL_CXXALIAS_SYS (func, rettype, parameters);
22705436638acc7c010349a69c3395f1a57c642dc62Ying Wang   declares a C++ alias called GNULIB_NAMESPACE::func
22805436638acc7c010349a69c3395f1a57c642dc62Ying Wang   that redirects to the system provided function func, if GNULIB_NAMESPACE
22905436638acc7c010349a69c3395f1a57c642dc62Ying Wang   is defined.
23005436638acc7c010349a69c3395f1a57c642dc62Ying Wang   Example:
23105436638acc7c010349a69c3395f1a57c642dc62Ying Wang     _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
23205436638acc7c010349a69c3395f1a57c642dc62Ying Wang */
23305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if defined __cplusplus && defined GNULIB_NAMESPACE
23405436638acc7c010349a69c3395f1a57c642dc62Ying Wang  /* If we were to write
23505436638acc7c010349a69c3395f1a57c642dc62Ying Wang       rettype (*const func) parameters = ::func;
23605436638acc7c010349a69c3395f1a57c642dc62Ying Wang     like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls
23705436638acc7c010349a69c3395f1a57c642dc62Ying Wang     better (remove an indirection through a 'static' pointer variable),
23805436638acc7c010349a69c3395f1a57c642dc62Ying Wang     but then the _GL_CXXALIASWARN macro below would cause a warning not only
23905436638acc7c010349a69c3395f1a57c642dc62Ying Wang     for uses of ::func but also for uses of GNULIB_NAMESPACE::func.  */
24005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
24105436638acc7c010349a69c3395f1a57c642dc62Ying Wang    namespace GNULIB_NAMESPACE                     \
24205436638acc7c010349a69c3395f1a57c642dc62Ying Wang    {                                              \
24305436638acc7c010349a69c3395f1a57c642dc62Ying Wang      static rettype (*func) parameters = ::func;  \
24405436638acc7c010349a69c3395f1a57c642dc62Ying Wang    }                                              \
24505436638acc7c010349a69c3395f1a57c642dc62Ying Wang    _GL_EXTERN_C int _gl_cxxalias_dummy
24605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#else
24705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
24805436638acc7c010349a69c3395f1a57c642dc62Ying Wang    _GL_EXTERN_C int _gl_cxxalias_dummy
24905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
25005436638acc7c010349a69c3395f1a57c642dc62Ying Wang
25105436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
25205436638acc7c010349a69c3395f1a57c642dc62Ying Wang   is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
25305436638acc7c010349a69c3395f1a57c642dc62Ying Wang   except that the C function func may have a slightly different declaration.
25405436638acc7c010349a69c3395f1a57c642dc62Ying Wang   A cast is used to silence the "invalid conversion" error that would
25505436638acc7c010349a69c3395f1a57c642dc62Ying Wang   otherwise occur.  */
25605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if defined __cplusplus && defined GNULIB_NAMESPACE
25705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
25805436638acc7c010349a69c3395f1a57c642dc62Ying Wang    namespace GNULIB_NAMESPACE                          \
25905436638acc7c010349a69c3395f1a57c642dc62Ying Wang    {                                                   \
26005436638acc7c010349a69c3395f1a57c642dc62Ying Wang      static rettype (*func) parameters =               \
26105436638acc7c010349a69c3395f1a57c642dc62Ying Wang        reinterpret_cast<rettype(*)parameters>(::func); \
26205436638acc7c010349a69c3395f1a57c642dc62Ying Wang    }                                                   \
26305436638acc7c010349a69c3395f1a57c642dc62Ying Wang    _GL_EXTERN_C int _gl_cxxalias_dummy
26405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#else
26505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
26605436638acc7c010349a69c3395f1a57c642dc62Ying Wang    _GL_EXTERN_C int _gl_cxxalias_dummy
26705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
26805436638acc7c010349a69c3395f1a57c642dc62Ying Wang
26905436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
27005436638acc7c010349a69c3395f1a57c642dc62Ying Wang   is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
27105436638acc7c010349a69c3395f1a57c642dc62Ying Wang   except that the C function is picked among a set of overloaded functions,
27205436638acc7c010349a69c3395f1a57c642dc62Ying Wang   namely the one with rettype2 and parameters2.  Two consecutive casts
27305436638acc7c010349a69c3395f1a57c642dc62Ying Wang   are used to silence the "cannot find a match" and "invalid conversion"
27405436638acc7c010349a69c3395f1a57c642dc62Ying Wang   errors that would otherwise occur.  */
27505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if defined __cplusplus && defined GNULIB_NAMESPACE
27605436638acc7c010349a69c3395f1a57c642dc62Ying Wang  /* The outer cast must be a reinterpret_cast.
27705436638acc7c010349a69c3395f1a57c642dc62Ying Wang     The inner cast: When the function is defined as a set of overloaded
27805436638acc7c010349a69c3395f1a57c642dc62Ying Wang     functions, it works as a static_cast<>, choosing the designated variant.
27905436638acc7c010349a69c3395f1a57c642dc62Ying Wang     When the function is defined as a single variant, it works as a
28005436638acc7c010349a69c3395f1a57c642dc62Ying Wang     reinterpret_cast<>. The parenthesized cast syntax works both ways.  */
28105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
28205436638acc7c010349a69c3395f1a57c642dc62Ying Wang    namespace GNULIB_NAMESPACE                                                \
28305436638acc7c010349a69c3395f1a57c642dc62Ying Wang    {                                                                         \
28405436638acc7c010349a69c3395f1a57c642dc62Ying Wang      static rettype (*func) parameters =                                     \
28505436638acc7c010349a69c3395f1a57c642dc62Ying Wang        reinterpret_cast<rettype(*)parameters>(                               \
28605436638acc7c010349a69c3395f1a57c642dc62Ying Wang          (rettype2(*)parameters2)(::func));                                  \
28705436638acc7c010349a69c3395f1a57c642dc62Ying Wang    }                                                                         \
28805436638acc7c010349a69c3395f1a57c642dc62Ying Wang    _GL_EXTERN_C int _gl_cxxalias_dummy
28905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#else
29005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
29105436638acc7c010349a69c3395f1a57c642dc62Ying Wang    _GL_EXTERN_C int _gl_cxxalias_dummy
29205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
29305436638acc7c010349a69c3395f1a57c642dc62Ying Wang
29405436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* _GL_CXXALIASWARN (func);
29505436638acc7c010349a69c3395f1a57c642dc62Ying Wang   causes a warning to be emitted when ::func is used but not when
29605436638acc7c010349a69c3395f1a57c642dc62Ying Wang   GNULIB_NAMESPACE::func is used.  func must be defined without overloaded
29705436638acc7c010349a69c3395f1a57c642dc62Ying Wang   variants.  */
29805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if defined __cplusplus && defined GNULIB_NAMESPACE
29905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_CXXALIASWARN(func) \
30005436638acc7c010349a69c3395f1a57c642dc62Ying Wang   _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
30105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_CXXALIASWARN_1(func,namespace) \
30205436638acc7c010349a69c3395f1a57c642dc62Ying Wang   _GL_CXXALIASWARN_2 (func, namespace)
30305436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
30405436638acc7c010349a69c3395f1a57c642dc62Ying Wang   we enable the warning only when not optimizing.  */
30505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !__OPTIMIZE__
30605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define _GL_CXXALIASWARN_2(func,namespace) \
30705436638acc7c010349a69c3395f1a57c642dc62Ying Wang    _GL_WARN_ON_USE (func, \
30805436638acc7c010349a69c3395f1a57c642dc62Ying Wang                     "The symbol ::" #func " refers to the system function. " \
30905436638acc7c010349a69c3395f1a57c642dc62Ying Wang                     "Use " #namespace "::" #func " instead.")
31005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
31105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define _GL_CXXALIASWARN_2(func,namespace) \
31205436638acc7c010349a69c3395f1a57c642dc62Ying Wang     extern __typeof__ (func) func
31305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# else
31405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define _GL_CXXALIASWARN_2(func,namespace) \
31505436638acc7c010349a69c3395f1a57c642dc62Ying Wang     _GL_EXTERN_C int _gl_cxxalias_dummy
31605436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
31705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#else
31805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_CXXALIASWARN(func) \
31905436638acc7c010349a69c3395f1a57c642dc62Ying Wang    _GL_EXTERN_C int _gl_cxxalias_dummy
32005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
32105436638acc7c010349a69c3395f1a57c642dc62Ying Wang
32205436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
32305436638acc7c010349a69c3395f1a57c642dc62Ying Wang   causes a warning to be emitted when the given overloaded variant of ::func
32405436638acc7c010349a69c3395f1a57c642dc62Ying Wang   is used but not when GNULIB_NAMESPACE::func is used.  */
32505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if defined __cplusplus && defined GNULIB_NAMESPACE
32605436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
32705436638acc7c010349a69c3395f1a57c642dc62Ying Wang   _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
32805436638acc7c010349a69c3395f1a57c642dc62Ying Wang                        GNULIB_NAMESPACE)
32905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
33005436638acc7c010349a69c3395f1a57c642dc62Ying Wang   _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
33105436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
33205436638acc7c010349a69c3395f1a57c642dc62Ying Wang   we enable the warning only when not optimizing.  */
33305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !__OPTIMIZE__
33405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
33505436638acc7c010349a69c3395f1a57c642dc62Ying Wang    _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
33605436638acc7c010349a69c3395f1a57c642dc62Ying Wang                         "The symbol ::" #func " refers to the system function. " \
33705436638acc7c010349a69c3395f1a57c642dc62Ying Wang                         "Use " #namespace "::" #func " instead.")
33805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
33905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
34005436638acc7c010349a69c3395f1a57c642dc62Ying Wang     extern __typeof__ (func) func
34105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# else
34205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
34305436638acc7c010349a69c3395f1a57c642dc62Ying Wang     _GL_EXTERN_C int _gl_cxxalias_dummy
34405436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
34505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#else
34605436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
34705436638acc7c010349a69c3395f1a57c642dc62Ying Wang    _GL_EXTERN_C int _gl_cxxalias_dummy
34805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
34905436638acc7c010349a69c3395f1a57c642dc62Ying Wang
35005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif /* _GL_CXXDEFS_H */
35105436638acc7c010349a69c3395f1a57c642dc62Ying Wang
35205436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* The definition of _GL_ARG_NONNULL is copied here.  */
35305436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
35405436638acc7c010349a69c3395f1a57c642dc62Ying Wang   that the values passed as arguments n, ..., m must be non-NULL pointers.
35505436638acc7c010349a69c3395f1a57c642dc62Ying Wang   n = 1 stands for the first argument, n = 2 for the second argument etc.  */
35605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#ifndef _GL_ARG_NONNULL
35705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
35805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
35905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# else
36005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define _GL_ARG_NONNULL(params)
36105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
36205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
36305436638acc7c010349a69c3395f1a57c642dc62Ying Wang
36405436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* The definition of _GL_WARN_ON_USE is copied here.  */
36505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#ifndef _GL_WARN_ON_USE
36605436638acc7c010349a69c3395f1a57c642dc62Ying Wang
36705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
36805436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* A compiler attribute is available in gcc versions 4.3.0 and later.  */
36905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define _GL_WARN_ON_USE(function, message) \
37005436638acc7c010349a69c3395f1a57c642dc62Ying Wangextern __typeof__ (function) function __attribute__ ((__warning__ (message)))
37105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
37205436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Verify the existence of the function.  */
37305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define _GL_WARN_ON_USE(function, message) \
37405436638acc7c010349a69c3395f1a57c642dc62Ying Wangextern __typeof__ (function) function
37505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# else /* Unsupported.  */
37605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define _GL_WARN_ON_USE(function, message) \
37705436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_EXTERN_C int _gl_warn_on_use
37805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
37905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
38005436638acc7c010349a69c3395f1a57c642dc62Ying Wang
38105436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
38205436638acc7c010349a69c3395f1a57c642dc62Ying Wang   is like _GL_WARN_ON_USE (function, "string"), except that the function is
38305436638acc7c010349a69c3395f1a57c642dc62Ying Wang   declared with the given prototype, consisting of return type, parameters,
38405436638acc7c010349a69c3395f1a57c642dc62Ying Wang   and attributes.
38505436638acc7c010349a69c3395f1a57c642dc62Ying Wang   This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
38605436638acc7c010349a69c3395f1a57c642dc62Ying Wang   not work in this case.  */
38705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#ifndef _GL_WARN_ON_USE_CXX
38805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
38905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
39005436638acc7c010349a69c3395f1a57c642dc62Ying Wangextern rettype function parameters_and_attributes \
39105436638acc7c010349a69c3395f1a57c642dc62Ying Wang     __attribute__ ((__warning__ (msg)))
39205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
39305436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Verify the existence of the function.  */
39405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
39505436638acc7c010349a69c3395f1a57c642dc62Ying Wangextern rettype function parameters_and_attributes
39605436638acc7c010349a69c3395f1a57c642dc62Ying Wang# else /* Unsupported.  */
39705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
39805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_EXTERN_C int _gl_warn_on_use
39905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
40005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
40105436638acc7c010349a69c3395f1a57c642dc62Ying Wang
40205436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* _GL_WARN_EXTERN_C declaration;
40305436638acc7c010349a69c3395f1a57c642dc62Ying Wang   performs the declaration with C linkage.  */
40405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#ifndef _GL_WARN_EXTERN_C
40505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if defined __cplusplus
40605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define _GL_WARN_EXTERN_C extern "C"
40705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# else
40805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define _GL_WARN_EXTERN_C extern
40905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
41005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
41105436638acc7c010349a69c3395f1a57c642dc62Ying Wang
41205436638acc7c010349a69c3395f1a57c642dc62Ying Wang
41305436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Define wint_t and WEOF.  (Also done in wctype.in.h.)  */
41405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if !1 && !defined wint_t
41505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# define wint_t int
41605436638acc7c010349a69c3395f1a57c642dc62Ying Wang# ifndef WEOF
41705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define WEOF -1
41805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
41905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#else
42005436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* MSVC defines wint_t as 'unsigned short' in <crtdefs.h>.
42105436638acc7c010349a69c3395f1a57c642dc62Ying Wang   This is too small: ISO C 99 section 7.24.1.(2) says that wint_t must be
42205436638acc7c010349a69c3395f1a57c642dc62Ying Wang   "unchanged by default argument promotions".  Override it.  */
42305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if defined _MSC_VER
42405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !GNULIB_defined_wint_t
42505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   include <crtdefs.h>
42605436638acc7c010349a69c3395f1a57c642dc62Ying Wangtypedef unsigned int rpl_wint_t;
42705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   undef wint_t
42805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   define wint_t rpl_wint_t
42905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   define GNULIB_defined_wint_t 1
43005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
43105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
43205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# ifndef WEOF
43305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define WEOF ((wint_t) -1)
43405436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
43505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
43605436638acc7c010349a69c3395f1a57c642dc62Ying Wang
43705436638acc7c010349a69c3395f1a57c642dc62Ying Wang
43805436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Override mbstate_t if it is too small.
43905436638acc7c010349a69c3395f1a57c642dc62Ying Wang   On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for
44005436638acc7c010349a69c3395f1a57c642dc62Ying Wang   implementing mbrtowc for encodings like UTF-8.  */
44105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if !(1 && 1) || 0
44205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !GNULIB_defined_mbstate_t
44305436638acc7c010349a69c3395f1a57c642dc62Ying Wangtypedef int rpl_mbstate_t;
44405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  undef mbstate_t
44505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define mbstate_t rpl_mbstate_t
44605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  define GNULIB_defined_mbstate_t 1
44705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
44805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
44905436638acc7c010349a69c3395f1a57c642dc62Ying Wang
45005436638acc7c010349a69c3395f1a57c642dc62Ying Wang
45105436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Convert a single-byte character to a wide character.  */
45205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
45305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if 0
45405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
45505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   undef btowc
45605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   define btowc rpl_btowc
45705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
45805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_RPL (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE);
45905436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_RPL (btowc, wint_t, (int c));
46005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# else
46105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !1
46205436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE);
46305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
46405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (btowc, wint_t, (int c));
46505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
46605436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (btowc);
46705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
46805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef btowc
46905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_BTOWC
47005436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (btowc, "btowc is unportable - "
47105436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module btowc for portability");
47205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
47305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
47405436638acc7c010349a69c3395f1a57c642dc62Ying Wang
47505436638acc7c010349a69c3395f1a57c642dc62Ying Wang
47605436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Convert a wide character to a single-byte character.  */
47705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
47805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if 0
47905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
48005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   undef wctob
48105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   define wctob rpl_wctob
48205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
48305436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_RPL (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE);
48405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_RPL (wctob, int, (wint_t wc));
48505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# else
48605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !defined wctob && !1
48705436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* wctob is provided by gnulib, or wctob exists but is not declared.  */
48805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE);
48905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
49005436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (wctob, int, (wint_t wc));
49105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
49205436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (wctob);
49305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
49405436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef wctob
49505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_WCTOB
49605436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (wctob, "wctob is unportable - "
49705436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module wctob for portability");
49805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
49905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
50005436638acc7c010349a69c3395f1a57c642dc62Ying Wang
50105436638acc7c010349a69c3395f1a57c642dc62Ying Wang
50205436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Test whether *PS is in the initial state.  */
50305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 1
50405436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if 0
50505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
50605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   undef mbsinit
50705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   define mbsinit rpl_mbsinit
50805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
50905436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_RPL (mbsinit, int, (const mbstate_t *ps));
51005436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_RPL (mbsinit, int, (const mbstate_t *ps));
51105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# else
51205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !1
51305436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (mbsinit, int, (const mbstate_t *ps));
51405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
51505436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps));
51605436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
51705436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (mbsinit);
51805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
51905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef mbsinit
52005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_MBSINIT
52105436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - "
52205436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module mbsinit for portability");
52305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
52405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
52505436638acc7c010349a69c3395f1a57c642dc62Ying Wang
52605436638acc7c010349a69c3395f1a57c642dc62Ying Wang
52705436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Convert a multibyte character to a wide character.  */
52805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 1
52905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if 0
53005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
53105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   undef mbrtowc
53205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   define mbrtowc rpl_mbrtowc
53305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
53405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_RPL (mbrtowc, size_t,
53505436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
53605436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_RPL (mbrtowc, size_t,
53705436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
53805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# else
53905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !1
54005436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (mbrtowc, size_t,
54105436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
54205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
54305436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (mbrtowc, size_t,
54405436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
54505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
54605436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (mbrtowc);
54705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
54805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef mbrtowc
54905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_MBRTOWC
55005436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - "
55105436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module mbrtowc for portability");
55205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
55305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
55405436638acc7c010349a69c3395f1a57c642dc62Ying Wang
55505436638acc7c010349a69c3395f1a57c642dc62Ying Wang
55605436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Recognize a multibyte character.  */
55705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
55805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if 0
55905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
56005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   undef mbrlen
56105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   define mbrlen rpl_mbrlen
56205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
56305436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
56405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
56505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# else
56605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !1
56705436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
56805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
56905436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
57005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
57105436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (mbrlen);
57205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
57305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef mbrlen
57405436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_MBRLEN
57505436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - "
57605436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module mbrlen for portability");
57705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
57805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
57905436638acc7c010349a69c3395f1a57c642dc62Ying Wang
58005436638acc7c010349a69c3395f1a57c642dc62Ying Wang
58105436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Convert a string to a wide string.  */
58205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
58305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if 0
58405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
58505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   undef mbsrtowcs
58605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   define mbsrtowcs rpl_mbsrtowcs
58705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
58805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_RPL (mbsrtowcs, size_t,
58905436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps)
59005436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  _GL_ARG_NONNULL ((2)));
59105436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_RPL (mbsrtowcs, size_t,
59205436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (wchar_t *dest, const char **srcp, size_t len,
59305436638acc7c010349a69c3395f1a57c642dc62Ying Wang                   mbstate_t *ps));
59405436638acc7c010349a69c3395f1a57c642dc62Ying Wang# else
59505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !1
59605436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (mbsrtowcs, size_t,
59705436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps)
59805436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  _GL_ARG_NONNULL ((2)));
59905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
60005436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (mbsrtowcs, size_t,
60105436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (wchar_t *dest, const char **srcp, size_t len,
60205436638acc7c010349a69c3395f1a57c642dc62Ying Wang                   mbstate_t *ps));
60305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
60405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (mbsrtowcs);
60505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
60605436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef mbsrtowcs
60705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_MBSRTOWCS
60805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - "
60905436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module mbsrtowcs for portability");
61005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
61105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
61205436638acc7c010349a69c3395f1a57c642dc62Ying Wang
61305436638acc7c010349a69c3395f1a57c642dc62Ying Wang
61405436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Convert a string to a wide string.  */
61505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
61605436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if 0
61705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
61805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   undef mbsnrtowcs
61905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   define mbsnrtowcs rpl_mbsnrtowcs
62005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
62105436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_RPL (mbsnrtowcs, size_t,
62205436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
62305436638acc7c010349a69c3395f1a57c642dc62Ying Wang                   mbstate_t *ps)
62405436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  _GL_ARG_NONNULL ((2)));
62505436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_RPL (mbsnrtowcs, size_t,
62605436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
62705436638acc7c010349a69c3395f1a57c642dc62Ying Wang                   mbstate_t *ps));
62805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# else
62905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !1
63005436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (mbsnrtowcs, size_t,
63105436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
63205436638acc7c010349a69c3395f1a57c642dc62Ying Wang                   mbstate_t *ps)
63305436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  _GL_ARG_NONNULL ((2)));
63405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
63505436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (mbsnrtowcs, size_t,
63605436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
63705436638acc7c010349a69c3395f1a57c642dc62Ying Wang                   mbstate_t *ps));
63805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
63905436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (mbsnrtowcs);
64005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
64105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef mbsnrtowcs
64205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_MBSNRTOWCS
64305436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - "
64405436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module mbsnrtowcs for portability");
64505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
64605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
64705436638acc7c010349a69c3395f1a57c642dc62Ying Wang
64805436638acc7c010349a69c3395f1a57c642dc62Ying Wang
64905436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Convert a wide character to a multibyte character.  */
65005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
65105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if 0
65205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
65305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   undef wcrtomb
65405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   define wcrtomb rpl_wcrtomb
65505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
65605436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
65705436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
65805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# else
65905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !1
66005436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
66105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
66205436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
66305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
66405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (wcrtomb);
66505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
66605436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef wcrtomb
66705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_WCRTOMB
66805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - "
66905436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module wcrtomb for portability");
67005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
67105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
67205436638acc7c010349a69c3395f1a57c642dc62Ying Wang
67305436638acc7c010349a69c3395f1a57c642dc62Ying Wang
67405436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Convert a wide string to a string.  */
67505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
67605436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if 0
67705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
67805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   undef wcsrtombs
67905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   define wcsrtombs rpl_wcsrtombs
68005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
68105436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_RPL (wcsrtombs, size_t,
68205436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps)
68305436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  _GL_ARG_NONNULL ((2)));
68405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_RPL (wcsrtombs, size_t,
68505436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (char *dest, const wchar_t **srcp, size_t len,
68605436638acc7c010349a69c3395f1a57c642dc62Ying Wang                   mbstate_t *ps));
68705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# else
68805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !1
68905436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (wcsrtombs, size_t,
69005436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps)
69105436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  _GL_ARG_NONNULL ((2)));
69205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
69305436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (wcsrtombs, size_t,
69405436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (char *dest, const wchar_t **srcp, size_t len,
69505436638acc7c010349a69c3395f1a57c642dc62Ying Wang                   mbstate_t *ps));
69605436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
69705436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (wcsrtombs);
69805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
69905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef wcsrtombs
70005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_WCSRTOMBS
70105436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - "
70205436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module wcsrtombs for portability");
70305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
70405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
70505436638acc7c010349a69c3395f1a57c642dc62Ying Wang
70605436638acc7c010349a69c3395f1a57c642dc62Ying Wang
70705436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Convert a wide string to a string.  */
70805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
70905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if 0
71005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
71105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   undef wcsnrtombs
71205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   define wcsnrtombs rpl_wcsnrtombs
71305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
71405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_RPL (wcsnrtombs, size_t,
71505436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
71605436638acc7c010349a69c3395f1a57c642dc62Ying Wang                   mbstate_t *ps)
71705436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  _GL_ARG_NONNULL ((2)));
71805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_RPL (wcsnrtombs, size_t,
71905436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
72005436638acc7c010349a69c3395f1a57c642dc62Ying Wang                   mbstate_t *ps));
72105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# else
72205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !1
72305436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (wcsnrtombs, size_t,
72405436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
72505436638acc7c010349a69c3395f1a57c642dc62Ying Wang                   mbstate_t *ps)
72605436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  _GL_ARG_NONNULL ((2)));
72705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
72805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (wcsnrtombs, size_t,
72905436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
73005436638acc7c010349a69c3395f1a57c642dc62Ying Wang                   mbstate_t *ps));
73105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
73205436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (wcsnrtombs);
73305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
73405436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef wcsnrtombs
73505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_WCSNRTOMBS
73605436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - "
73705436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module wcsnrtombs for portability");
73805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
73905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
74005436638acc7c010349a69c3395f1a57c642dc62Ying Wang
74105436638acc7c010349a69c3395f1a57c642dc62Ying Wang
74205436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Return the number of screen columns needed for WC.  */
74305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 1
74405436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if 1
74505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
74605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   undef wcwidth
74705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#   define wcwidth rpl_wcwidth
74805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
74905436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_RPL (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE);
75005436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_RPL (wcwidth, int, (wchar_t));
75105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# else
75205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  if !1
75305436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* wcwidth exists but is not declared.  */
75405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE);
75505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#  endif
75605436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (wcwidth, int, (wchar_t));
75705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
75805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (wcwidth);
75905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
76005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef wcwidth
76105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_WCWIDTH
76205436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - "
76305436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module wcwidth for portability");
76405436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
76505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
76605436638acc7c010349a69c3395f1a57c642dc62Ying Wang
76705436638acc7c010349a69c3395f1a57c642dc62Ying Wang
76805436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Search N wide characters of S for C.  */
76905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
77005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !1
77105436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n)
77205436638acc7c010349a69c3395f1a57c642dc62Ying Wang                                      _GL_ATTRIBUTE_PURE);
77305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
77405436638acc7c010349a69c3395f1a57c642dc62Ying Wang  /* On some systems, this function is defined as an overloaded function:
77505436638acc7c010349a69c3395f1a57c642dc62Ying Wang       extern "C++" {
77605436638acc7c010349a69c3395f1a57c642dc62Ying Wang         const wchar_t * std::wmemchr (const wchar_t *, wchar_t, size_t);
77705436638acc7c010349a69c3395f1a57c642dc62Ying Wang         wchar_t * std::wmemchr (wchar_t *, wchar_t, size_t);
77805436638acc7c010349a69c3395f1a57c642dc62Ying Wang       }  */
77905436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS_CAST2 (wmemchr,
78005436638acc7c010349a69c3395f1a57c642dc62Ying Wang                        wchar_t *, (const wchar_t *, wchar_t, size_t),
78105436638acc7c010349a69c3395f1a57c642dc62Ying Wang                        const wchar_t *, (const wchar_t *, wchar_t, size_t));
78205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
78305436638acc7c010349a69c3395f1a57c642dc62Ying Wang     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
78405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
78505436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN1 (wmemchr, const wchar_t *,
78605436638acc7c010349a69c3395f1a57c642dc62Ying Wang                   (const wchar_t *s, wchar_t c, size_t n));
78705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# else
78805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (wmemchr);
78905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
79005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
79105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef wmemchr
79205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_WMEMCHR
79305436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - "
79405436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module wmemchr for portability");
79505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
79605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
79705436638acc7c010349a69c3395f1a57c642dc62Ying Wang
79805436638acc7c010349a69c3395f1a57c642dc62Ying Wang
79905436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Compare N wide characters of S1 and S2.  */
80005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
80105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !1
80205436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (wmemcmp, int,
80305436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (const wchar_t *s1, const wchar_t *s2, size_t n)
80405436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  _GL_ATTRIBUTE_PURE);
80505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
80605436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (wmemcmp, int,
80705436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (const wchar_t *s1, const wchar_t *s2, size_t n));
80805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (wmemcmp);
80905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
81005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef wmemcmp
81105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_WMEMCMP
81205436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - "
81305436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module wmemcmp for portability");
81405436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
81505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
81605436638acc7c010349a69c3395f1a57c642dc62Ying Wang
81705436638acc7c010349a69c3395f1a57c642dc62Ying Wang
81805436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Copy N wide characters of SRC to DEST.  */
81905436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
82005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !1
82105436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (wmemcpy, wchar_t *,
82205436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (wchar_t *dest, const wchar_t *src, size_t n));
82305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
82405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (wmemcpy, wchar_t *,
82505436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (wchar_t *dest, const wchar_t *src, size_t n));
82605436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (wmemcpy);
82705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
82805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef wmemcpy
82905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_WMEMCPY
83005436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (wmemcpy, "wmemcpy is unportable - "
83105436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module wmemcpy for portability");
83205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
83305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
83405436638acc7c010349a69c3395f1a57c642dc62Ying Wang
83505436638acc7c010349a69c3395f1a57c642dc62Ying Wang
83605436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Copy N wide characters of SRC to DEST, guaranteeing correct behavior for
83705436638acc7c010349a69c3395f1a57c642dc62Ying Wang   overlapping memory areas.  */
83805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
83905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !1
84005436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (wmemmove, wchar_t *,
84105436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (wchar_t *dest, const wchar_t *src, size_t n));
84205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
84305436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (wmemmove, wchar_t *,
84405436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (wchar_t *dest, const wchar_t *src, size_t n));
84505436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (wmemmove);
84605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
84705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef wmemmove
84805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_WMEMMOVE
84905436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - "
85005436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module wmemmove for portability");
85105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
85205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
85305436638acc7c010349a69c3395f1a57c642dc62Ying Wang
85405436638acc7c010349a69c3395f1a57c642dc62Ying Wang
85505436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Set N wide characters of S to C.  */
85605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
85705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !1
85805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
85905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
86005436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
86105436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (wmemset);
86205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
86305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef wmemset
86405436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_WMEMSET
86505436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (wmemset, "wmemset is unportable - "
86605436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module wmemset for portability");
86705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
86805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
86905436638acc7c010349a69c3395f1a57c642dc62Ying Wang
87005436638acc7c010349a69c3395f1a57c642dc62Ying Wang
87105436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Return the number of wide characters in S.  */
87205436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
87305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !1
87405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s) _GL_ATTRIBUTE_PURE);
87505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
87605436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s));
87705436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (wcslen);
87805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
87905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef wcslen
88005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_WCSLEN
88105436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (wcslen, "wcslen is unportable - "
88205436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module wcslen for portability");
88305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
88405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
88505436638acc7c010349a69c3395f1a57c642dc62Ying Wang
88605436638acc7c010349a69c3395f1a57c642dc62Ying Wang
88705436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Return the number of wide characters in S, but at most MAXLEN.  */
88805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
88905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !1
89005436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen)
89105436638acc7c010349a69c3395f1a57c642dc62Ying Wang                                   _GL_ATTRIBUTE_PURE);
89205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
89305436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen));
89405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (wcsnlen);
89505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
89605436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef wcsnlen
89705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_WCSNLEN
89805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - "
89905436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module wcsnlen for portability");
90005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
90105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
90205436638acc7c010349a69c3395f1a57c642dc62Ying Wang
90305436638acc7c010349a69c3395f1a57c642dc62Ying Wang
90405436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Copy SRC to DEST.  */
90505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
90605436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !1
90705436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
90805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
90905436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
91005436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (wcscpy);
91105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
91205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef wcscpy
91305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_WCSCPY
91405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - "
91505436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module wcscpy for portability");
91605436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
91705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
91805436638acc7c010349a69c3395f1a57c642dc62Ying Wang
91905436638acc7c010349a69c3395f1a57c642dc62Ying Wang
92005436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Copy SRC to DEST, returning the address of the terminating L'\0' in DEST.  */
92105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
92205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !1
92305436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
92405436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
92505436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
92605436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (wcpcpy);
92705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
92805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef wcpcpy
92905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_WCPCPY
93005436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - "
93105436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module wcpcpy for portability");
93205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
93305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
93405436638acc7c010349a69c3395f1a57c642dc62Ying Wang
93505436638acc7c010349a69c3395f1a57c642dc62Ying Wang
93605436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Copy no more than N wide characters of SRC to DEST.  */
93705436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
93805436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !1
93905436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (wcsncpy, wchar_t *,
94005436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (wchar_t *dest, const wchar_t *src, size_t n));
94105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
94205436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (wcsncpy, wchar_t *,
94305436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (wchar_t *dest, const wchar_t *src, size_t n));
94405436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (wcsncpy);
94505436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
94605436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef wcsncpy
94705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_WCSNCPY
94805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - "
94905436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module wcsncpy for portability");
95005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
95105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
95205436638acc7c010349a69c3395f1a57c642dc62Ying Wang
95305436638acc7c010349a69c3395f1a57c642dc62Ying Wang
95405436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Copy no more than N characters of SRC to DEST, returning the address of
95505436638acc7c010349a69c3395f1a57c642dc62Ying Wang   the last character written into DEST.  */
95605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
95705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !1
95805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (wcpncpy, wchar_t *,
95905436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (wchar_t *dest, const wchar_t *src, size_t n));
96005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
96105436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (wcpncpy, wchar_t *,
96205436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (wchar_t *dest, const wchar_t *src, size_t n));
96305436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (wcpncpy);
96405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
96505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef wcpncpy
96605436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_WCPNCPY
96705436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - "
96805436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module wcpncpy for portability");
96905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
97005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
97105436638acc7c010349a69c3395f1a57c642dc62Ying Wang
97205436638acc7c010349a69c3395f1a57c642dc62Ying Wang
97305436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Append SRC onto DEST.  */
97405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
97505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !1
97605436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src));
97705436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
97805436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src));
97905436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (wcscat);
98005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
98105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef wcscat
98205436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_WCSCAT
98305436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (wcscat, "wcscat is unportable - "
98405436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module wcscat for portability");
98505436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
98605436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
98705436638acc7c010349a69c3395f1a57c642dc62Ying Wang
98805436638acc7c010349a69c3395f1a57c642dc62Ying Wang
98905436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Append no more than N wide characters of SRC onto DEST.  */
99005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
99105436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !1
99205436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_FUNCDECL_SYS (wcsncat, wchar_t *,
99305436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (wchar_t *dest, const wchar_t *src, size_t n));
99405436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
99505436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIAS_SYS (wcsncat, wchar_t *,
99605436638acc7c010349a69c3395f1a57c642dc62Ying Wang                  (wchar_t *dest, const wchar_t *src, size_t n));
99705436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_CXXALIASWARN (wcsncat);
99805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#elif defined GNULIB_POSIXCHECK
99905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# undef wcsncat
100005436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if HAVE_RAW_DECL_WCSNCAT
100105436638acc7c010349a69c3395f1a57c642dc62Ying Wang_GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - "
100205436638acc7c010349a69c3395f1a57c642dc62Ying Wang                 "use gnulib module wcsncat for portability");
100305436638acc7c010349a69c3395f1a57c642dc62Ying Wang# endif
100405436638acc7c010349a69c3395f1a57c642dc62Ying Wang#endif
100505436638acc7c010349a69c3395f1a57c642dc62Ying Wang
100605436638acc7c010349a69c3395f1a57c642dc62Ying Wang
100705436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Compare S1 and S2.  */
100805436638acc7c010349a69c3395f1a57c642dc62Ying Wang#if 0
100905436638acc7c010349a69c3395f1a57c642dc62Ying Wang# if !1
1010