(root)/
gzip-1.13/
lib/
wchar.in.h
       1  /* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
       2  
       3     Copyright (C) 2007-2023 Free Software Foundation, Inc.
       4  
       5     This file is free software: you can redistribute it and/or modify
       6     it under the terms of the GNU Lesser General Public License as
       7     published by the Free Software Foundation; either version 2.1 of the
       8     License, or (at your option) any later version.
       9  
      10     This file is distributed in the hope that it will be useful,
      11     but WITHOUT ANY WARRANTY; without even the implied warranty of
      12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      13     GNU Lesser General Public License for more details.
      14  
      15     You should have received a copy of the GNU Lesser General Public License
      16     along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
      17  
      18  /* Written by Eric Blake.  */
      19  
      20  /*
      21   * ISO C 99 <wchar.h> for platforms that have issues.
      22   * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/wchar.h.html>
      23   *
      24   * For now, this just ensures proper prerequisite inclusion order and
      25   * the declaration of wcwidth().
      26   */
      27  
      28  #if __GNUC__ >= 3
      29  @PRAGMA_SYSTEM_HEADER@
      30  #endif
      31  @PRAGMA_COLUMNS@
      32  
      33  #if (((defined __need_mbstate_t || defined __need_wint_t)               \
      34        && !defined __MINGW32__)                                          \
      35       || (defined __hpux                                                 \
      36           && ((defined _INTTYPES_INCLUDED                                \
      37                && !defined _GL_FINISHED_INCLUDING_SYSTEM_INTTYPES_H)     \
      38               || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H))               \
      39       || (defined __MINGW32__ && defined __STRING_H_SOURCED__)           \
      40       || defined _GL_ALREADY_INCLUDING_WCHAR_H)
      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.  */
      54  
      55  #@INCLUDE_NEXT@ @NEXT_WCHAR_H@
      56  
      57  #else
      58  /* Normal invocation convention.  */
      59  
      60  #ifndef _@GUARD_PREFIX@_WCHAR_H
      61  
      62  #define _GL_ALREADY_INCLUDING_WCHAR_H
      63  
      64  #if @HAVE_FEATURES_H@
      65  # include <features.h> /* for __GLIBC__ */
      66  #endif
      67  
      68  /* In some builds of uClibc, <wchar.h> is nonexistent and wchar_t is defined
      69     by <stddef.h>.
      70     But avoid namespace pollution on glibc systems.  */
      71  #if !(defined __GLIBC__ && !defined __UCLIBC__)
      72  # include <stddef.h>
      73  #endif
      74  
      75  /* Include the original <wchar.h> if it exists.
      76     Some builds of uClibc lack it.  */
      77  /* The include_next requires a split double-inclusion guard.  */
      78  #if @HAVE_WCHAR_H@
      79  # @INCLUDE_NEXT@ @NEXT_WCHAR_H@
      80  #endif
      81  
      82  #undef _GL_ALREADY_INCLUDING_WCHAR_H
      83  
      84  #ifndef _@GUARD_PREFIX@_WCHAR_H
      85  #define _@GUARD_PREFIX@_WCHAR_H
      86  
      87  /* This file uses _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_MALLOC,
      88     _GL_ATTRIBUTE_PURE, GNULIB_POSIXCHECK, HAVE_RAW_DECL_*.  */
      89  #if !_GL_CONFIG_H_INCLUDED
      90   #error "Please include config.h first."
      91  #endif
      92  
      93  /* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
      94     that can be freed by passing them as the Ith argument to the
      95     function F.  */
      96  #ifndef _GL_ATTRIBUTE_DEALLOC
      97  # if __GNUC__ >= 11
      98  #  define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
      99  # else
     100  #  define _GL_ATTRIBUTE_DEALLOC(f, i)
     101  # endif
     102  #endif
     103  
     104  /* _GL_ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that
     105     can be freed via 'free'; it can be used only after declaring 'free'.  */
     106  /* Applies to: functions.  Cannot be used on inline functions.  */
     107  #ifndef _GL_ATTRIBUTE_DEALLOC_FREE
     108  # if defined __cplusplus && defined __GNUC__ && !defined __clang__
     109  /* Work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108231> */
     110  #  define _GL_ATTRIBUTE_DEALLOC_FREE \
     111       _GL_ATTRIBUTE_DEALLOC ((void (*) (void *)) free, 1)
     112  # else
     113  #  define _GL_ATTRIBUTE_DEALLOC_FREE \
     114       _GL_ATTRIBUTE_DEALLOC (free, 1)
     115  # endif
     116  #endif
     117  
     118  /* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly
     119     allocated memory.  */
     120  /* Applies to: functions.  */
     121  #ifndef _GL_ATTRIBUTE_MALLOC
     122  # if __GNUC__ >= 3 || defined __clang__
     123  #  define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
     124  # else
     125  #  define _GL_ATTRIBUTE_MALLOC
     126  # endif
     127  #endif
     128  
     129  /* The __attribute__ feature is available in gcc versions 2.5 and later.
     130     The attribute __pure__ was added in gcc 2.96.  */
     131  #ifndef _GL_ATTRIBUTE_PURE
     132  # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
     133  #  define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
     134  # else
     135  #  define _GL_ATTRIBUTE_PURE /* empty */
     136  # endif
     137  #endif
     138  
     139  /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
     140  
     141  /* The definition of _GL_ARG_NONNULL is copied here.  */
     142  
     143  /* The definition of _GL_WARN_ON_USE is copied here.  */
     144  
     145  
     146  /* Define wint_t and WEOF.  (Also done in wctype.in.h.)  */
     147  #if !@HAVE_WINT_T@ && !defined wint_t
     148  # define wint_t int
     149  # ifndef WEOF
     150  #  define WEOF -1
     151  # endif
     152  #else
     153  /* mingw and MSVC define wint_t as 'unsigned short' in <crtdefs.h> or
     154     <stddef.h>.  This is too small: ISO C 99 section 7.24.1.(2) says that
     155     wint_t must be "unchanged by default argument promotions".  Override it.  */
     156  # if @GNULIBHEADERS_OVERRIDE_WINT_T@
     157  #  if !GNULIB_defined_wint_t
     158  #   if @HAVE_CRTDEFS_H@
     159  #    include <crtdefs.h>
     160  #   else
     161  #    include <stddef.h>
     162  #   endif
     163  typedef unsigned int rpl_wint_t;
     164  #   undef wint_t
     165  #   define wint_t rpl_wint_t
     166  #   define GNULIB_defined_wint_t 1
     167  #  endif
     168  # endif
     169  # ifndef WEOF
     170  #  define WEOF ((wint_t) -1)
     171  # endif
     172  #endif
     173  
     174  
     175  /* Override mbstate_t if it is too small.
     176     On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for
     177     implementing mbrtowc for encodings like UTF-8.
     178     On AIX and MSVC, mbrtowc needs to be overridden, but mbstate_t exists and is
     179     large enough and overriding it would cause problems in C++ mode.  */
     180  #if !(((defined _WIN32 && !defined __CYGWIN__) || @HAVE_MBSINIT@) && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@
     181  # if !GNULIB_defined_mbstate_t
     182  #  if !(defined _AIX || defined _MSC_VER)
     183  typedef int rpl_mbstate_t;
     184  #   undef mbstate_t
     185  #   define mbstate_t rpl_mbstate_t
     186  #  endif
     187  #  define GNULIB_defined_mbstate_t 1
     188  # endif
     189  #endif
     190  
     191  /* Make _GL_ATTRIBUTE_DEALLOC_FREE work, even though <stdlib.h> may not have
     192     been included yet.  */
     193  #if @GNULIB_FREE_POSIX@
     194  # if (@REPLACE_FREE@ && !defined free \
     195        && !(defined __cplusplus && defined GNULIB_NAMESPACE))
     196  /* We can't do '#define free rpl_free' here.  */
     197  #  if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
     198  _GL_EXTERN_C void rpl_free (void *) throw ();
     199  #  else
     200  _GL_EXTERN_C void rpl_free (void *);
     201  #  endif
     202  #  undef _GL_ATTRIBUTE_DEALLOC_FREE
     203  #  define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1)
     204  # else
     205  #  if defined _MSC_VER && !defined free
     206  _GL_EXTERN_C
     207  #   if defined _DLL
     208       __declspec (dllimport)
     209  #   endif
     210       void __cdecl free (void *);
     211  #  else
     212  #   if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
     213  _GL_EXTERN_C void free (void *) throw ();
     214  #   else
     215  _GL_EXTERN_C void free (void *);
     216  #   endif
     217  #  endif
     218  # endif
     219  #else
     220  # if defined _MSC_VER && !defined free
     221  _GL_EXTERN_C
     222  #   if defined _DLL
     223       __declspec (dllimport)
     224  #   endif
     225       void __cdecl free (void *);
     226  # else
     227  #  if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
     228  _GL_EXTERN_C void free (void *) throw ();
     229  #  else
     230  _GL_EXTERN_C void free (void *);
     231  #  endif
     232  # endif
     233  #endif
     234  
     235  
     236  #if @GNULIB_MBSZERO@
     237  /* Get memset().  */
     238  # include <string.h>
     239  #endif
     240  
     241  
     242  /* Convert a single-byte character to a wide character.  */
     243  #if @GNULIB_BTOWC@
     244  # if @REPLACE_BTOWC@
     245  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     246  #   undef btowc
     247  #   define btowc rpl_btowc
     248  #  endif
     249  _GL_FUNCDECL_RPL (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE);
     250  _GL_CXXALIAS_RPL (btowc, wint_t, (int c));
     251  # else
     252  #  if !@HAVE_BTOWC@
     253  _GL_FUNCDECL_SYS (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE);
     254  #  endif
     255  /* Need to cast, because on mingw, the return type is 'unsigned short'.  */
     256  _GL_CXXALIAS_SYS_CAST (btowc, wint_t, (int c));
     257  # endif
     258  # if __GLIBC__ >= 2
     259  _GL_CXXALIASWARN (btowc);
     260  # endif
     261  #elif defined GNULIB_POSIXCHECK
     262  # undef btowc
     263  # if HAVE_RAW_DECL_BTOWC
     264  _GL_WARN_ON_USE (btowc, "btowc is unportable - "
     265                   "use gnulib module btowc for portability");
     266  # endif
     267  #endif
     268  
     269  
     270  /* Convert a wide character to a single-byte character.  */
     271  #if @GNULIB_WCTOB@
     272  # if @REPLACE_WCTOB@
     273  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     274  #   undef wctob
     275  #   define wctob rpl_wctob
     276  #  endif
     277  _GL_FUNCDECL_RPL (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE);
     278  _GL_CXXALIAS_RPL (wctob, int, (wint_t wc));
     279  # else
     280  #  if !defined wctob && !@HAVE_DECL_WCTOB@
     281  /* wctob is provided by gnulib, or wctob exists but is not declared.  */
     282  _GL_FUNCDECL_SYS (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE);
     283  #  endif
     284  _GL_CXXALIAS_SYS (wctob, int, (wint_t wc));
     285  # endif
     286  # if __GLIBC__ >= 2
     287  _GL_CXXALIASWARN (wctob);
     288  # endif
     289  #elif defined GNULIB_POSIXCHECK
     290  # undef wctob
     291  # if HAVE_RAW_DECL_WCTOB
     292  _GL_WARN_ON_USE (wctob, "wctob is unportable - "
     293                   "use gnulib module wctob for portability");
     294  # endif
     295  #endif
     296  
     297  
     298  /* Test whether *PS is in an initial state.  */
     299  #if @GNULIB_MBSINIT@
     300  # if @REPLACE_MBSINIT@
     301  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     302  #   undef mbsinit
     303  #   define mbsinit rpl_mbsinit
     304  #  endif
     305  _GL_FUNCDECL_RPL (mbsinit, int, (const mbstate_t *ps));
     306  _GL_CXXALIAS_RPL (mbsinit, int, (const mbstate_t *ps));
     307  # else
     308  #  if !@HAVE_MBSINIT@
     309  _GL_FUNCDECL_SYS (mbsinit, int, (const mbstate_t *ps));
     310  #  endif
     311  _GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps));
     312  # endif
     313  # if __GLIBC__ >= 2
     314  _GL_CXXALIASWARN (mbsinit);
     315  # endif
     316  #elif defined GNULIB_POSIXCHECK
     317  # undef mbsinit
     318  # if HAVE_RAW_DECL_MBSINIT
     319  _GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - "
     320                   "use gnulib module mbsinit for portability");
     321  # endif
     322  #endif
     323  
     324  
     325  /* Put *PS into an initial state.  */
     326  #if @GNULIB_MBSZERO@
     327  /* ISO C 23 ยง 7.31.6.(3) says that zeroing an mbstate_t is a way to put the
     328     mbstate_t into an initial state.  However, on many platforms an mbstate_t
     329     is large, and it is possible - as an optimization - to get away with zeroing
     330     only part of it.  So, instead of
     331  
     332          mbstate_t state = { 0 };
     333  
     334     or
     335  
     336          mbstate_t state;
     337          memset (&state, 0, sizeof (mbstate_t));
     338  
     339     we can write this faster code:
     340  
     341          mbstate_t state;
     342          mbszero (&state);
     343   */
     344  /* _GL_MBSTATE_INIT_SIZE describes how mbsinit() behaves: It is the number of
     345     bytes at the beginning of an mbstate_t that need to be zero, for mbsinit()
     346     to return true.
     347     _GL_MBSTATE_ZERO_SIZE is the number of bytes at the beginning of an mbstate_t
     348     that need to be zero,
     349       - for mbsinit() to return true, and
     350       - for all other multibyte-aware functions to operate properly.
     351     0 < _GL_MBSTATE_INIT_SIZE <= _GL_MBSTATE_ZERO_SIZE <= sizeof (mbstate_t).
     352     These values are determined by source code inspection, where possible, and
     353     by running the gnulib unit tests.
     354     We need _GL_MBSTATE_INIT_SIZE because if we define _GL_MBSTATE_ZERO_SIZE
     355     without considering what mbsinit() does, we get test failures such as
     356       assertion "mbsinit (&iter->state)" failed
     357   */
     358  # if GNULIB_defined_mbstate_t                             /* AIX, IRIX */
     359  /* mbstate_t has at least 4 bytes.  They are used as coded in
     360     gnulib/lib/mbrtowc.c.  */
     361  #  define _GL_MBSTATE_INIT_SIZE 1
     362  /* define _GL_MBSTATE_ZERO_SIZE 4
     363     does not work: it causes test failures.
     364     So, use the safe fallback value, below.  */
     365  # elif __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2             /* glibc */
     366  /* mbstate_t is defined in <bits/types/__mbstate_t.h>.
     367     For more details, see glibc/iconv/skeleton.c.  */
     368  #  define _GL_MBSTATE_INIT_SIZE 4 /* sizeof (((mbstate_t) {0}).__count) */
     369  #  define _GL_MBSTATE_ZERO_SIZE /* 8 */ sizeof (mbstate_t)
     370  # elif defined MUSL_LIBC                                  /* musl libc */
     371  /* mbstate_t is defined in <bits/alltypes.h>.
     372     It is an opaque aligned 8-byte struct, of which at most the first
     373     4 bytes are used.
     374     For more details, see src/multibyte/mbrtowc.c.  */
     375  #  define _GL_MBSTATE_INIT_SIZE 4 /* sizeof (unsigned) */
     376  #  define _GL_MBSTATE_ZERO_SIZE 4
     377  # elif defined __APPLE__ && defined __MACH__              /* macOS */
     378  /* On macOS, mbstate_t is defined in <machine/_types.h>.
     379     It is an opaque aligned 128-byte struct, of which at most the first
     380     12 bytes are used.
     381     For more details, see the __mbsinit implementations in
     382     Libc-<version>/locale/FreeBSD/
     383     {ascii,none,euc,mskanji,big5,gb2312,gbk,gb18030,utf8,utf2}.c.  */
     384  /* File       INIT_SIZE  ZERO_SIZE
     385     ascii.c        0          0
     386     none.c         0          0
     387     euc.c         12         12
     388     mskanji.c      4          4
     389     big5.c         4          4
     390     gb2312.c       4          6
     391     gbk.c          4          4
     392     gb18030.c      4          8
     393     utf8.c         8         10
     394     utf2.c         8         12 */
     395  #  define _GL_MBSTATE_INIT_SIZE 12
     396  #  define _GL_MBSTATE_ZERO_SIZE 12
     397  # elif defined __FreeBSD__                                /* FreeBSD */
     398  /* On FreeBSD, mbstate_t is defined in src/sys/sys/_types.h.
     399     It is an opaque aligned 128-byte struct, of which at most the first
     400     12 bytes are used.
     401     For more details, see the __mbsinit implementations in
     402     src/lib/libc/locale/
     403     {ascii,none,euc,mskanji,big5,gb2312,gbk,gb18030,utf8}.c.  */
     404  /* File       INIT_SIZE  ZERO_SIZE
     405     ascii.c        0          0
     406     none.c         0          0
     407     euc.c         12         12
     408     mskanji.c      4          4
     409     big5.c         4          4
     410     gb2312.c       4          6
     411     gbk.c          4          4
     412     gb18030.c      4          8
     413     utf8.c         8         12 */
     414  #  define _GL_MBSTATE_INIT_SIZE 12
     415  #  define _GL_MBSTATE_ZERO_SIZE 12
     416  # elif defined __NetBSD__                                 /* NetBSD */
     417  /* On NetBSD, mbstate_t is defined in src/sys/sys/ansi.h.
     418     It is an opaque aligned 128-byte struct, of which at most the first
     419     28 bytes are used.
     420     For more details, see the *State types in
     421     src/lib/libc/citrus/modules/citrus_*.c
     422     (ignoring citrus_{hz,iso2022,utf7,viqr,zw}.c, since these implement
     423     stateful encodings, not usable as locale encodings).  */
     424  /* File                                ZERO_SIZE
     425     citrus/citrus_none.c                    0
     426     citrus/modules/citrus_euc.c             8
     427     citrus/modules/citrus_euctw.c           8
     428     citrus/modules/citrus_mskanji.c         8
     429     citrus/modules/citrus_big5.c            8
     430     citrus/modules/citrus_gbk2k.c           8
     431     citrus/modules/citrus_dechanyu.c        8
     432     citrus/modules/citrus_johab.c           6
     433     citrus/modules/citrus_utf8.c           12 */
     434  /* But 12 is not the correct value for _GL_MBSTATE_ZERO_SIZE: we get test
     435     failures for values < 28.  */
     436  #  define _GL_MBSTATE_ZERO_SIZE 28
     437  # elif defined __OpenBSD__                                /* OpenBSD */
     438  /* On OpenBSD, mbstate_t is defined in src/sys/sys/_types.h.
     439     It is an opaque aligned 128-byte struct, of which at most the first
     440     12 bytes are used.
     441     For more details, see src/lib/libc/citrus/citrus_*.c.  */
     442  /* File           INIT_SIZE  ZERO_SIZE
     443     citrus_none.c      0          0
     444     citrus_utf8.c     12         12 */
     445  #  define _GL_MBSTATE_INIT_SIZE 12
     446  #  define _GL_MBSTATE_ZERO_SIZE 12
     447  # elif defined __minix                                    /* Minix */
     448  /* On Minix, mbstate_t is defined in sys/sys/ansi.h.
     449     It is an opaque aligned 128-byte struct.
     450     For more details, see the *State types in
     451     lib/libc/citrus/citrus_*.c.  */
     452  /* File           INIT_SIZE  ZERO_SIZE
     453     citrus_none.c      0          0 */
     454  /* But 1 is not the correct value for _GL_MBSTATE_ZERO_SIZE: we get test
     455     failures for values < 4.  */
     456  #  define _GL_MBSTATE_ZERO_SIZE 4
     457  # elif defined __sun                                      /* Solaris */
     458  /* On Solaris, mbstate_t is defined in <wchar_impl.h>.
     459     It is an opaque aligned 24-byte or 32-byte struct, of which at most the first
     460     20 or 28 bytes are used.
     461     For more details on OpenSolaris derivatives, see the *State types in
     462     illumos-gate/usr/src/lib/libc/port/locale/
     463     {none,euc,mskanji,big5,gb2312,gbk,gb18030,utf8}.c.  */
     464  /* File       INIT_SIZE  ZERO_SIZE
     465     none.c         0          0
     466     euc.c         12         12
     467     mskanji.c      4          4
     468     big5.c         4          4
     469     gb2312.c       4          6
     470     gbk.c          4          4
     471     gb18030.c      4          8
     472     utf8.c        12         12 */
     473  /* But 12 is not the correct value for _GL_MBSTATE_ZERO_SIZE: we get test
     474     failures
     475       - in OpenIndiana and OmniOS: for values < 16,
     476       - in Solaris 10 and 11: for values < 20 (in 32-bit mode)
     477         or < 28 (in 64-bit mode).
     478     Since we don't have a good way to distinguish the OpenSolaris derivatives
     479     from the proprietary Solaris versions, and can't inspect the Solaris source
     480     code, use the safe fallback values, below.  */
     481  # elif defined __CYGWIN__                                 /* Cygwin */
     482  /* On Cygwin, mbstate_t is defined in <sys/_types.h>.
     483     For more details, see newlib/libc/stdlib/mbtowc_r.c and
     484     winsup/cygwin/strfuncs.cc.  */
     485  #  define _GL_MBSTATE_INIT_SIZE 4 /* sizeof (int) */
     486  #  define _GL_MBSTATE_ZERO_SIZE 8
     487  # elif defined _WIN32 && !defined __CYGWIN__              /* Native Windows.  */
     488  /* MSVC defines 'mbstate_t' as an aligned 8-byte struct.
     489     On mingw, 'mbstate_t' is sometimes defined as 'int', sometimes defined
     490     as an aligned 8-byte struct, of which the first 4 bytes matter.
     491     Use the safe values, below.  */
     492  # elif defined __ANDROID__                                /* Android */
     493  /* Android defines 'mbstate_t' in <bits/mbstate_t.h>.
     494     It is an opaque 4-byte or 8-byte struct.
     495     For more details, see
     496     bionic/libc/private/bionic_mbstate.h
     497     bionic/libc/bionic/mbrtoc32.cpp
     498     bionic/libc/bionic/mbrtoc16.cpp
     499   */
     500  #  define _GL_MBSTATE_INIT_SIZE 4
     501  #  define _GL_MBSTATE_ZERO_SIZE 4
     502  # endif
     503  /* Use safe values as defaults.  */
     504  # ifndef _GL_MBSTATE_INIT_SIZE
     505  #  define _GL_MBSTATE_INIT_SIZE sizeof (mbstate_t)
     506  # endif
     507  # ifndef _GL_MBSTATE_ZERO_SIZE
     508  #  define _GL_MBSTATE_ZERO_SIZE sizeof (mbstate_t)
     509  # endif
     510  _GL_BEGIN_C_LINKAGE
     511  # if defined IN_MBSZERO
     512  _GL_EXTERN_INLINE
     513  # else
     514  _GL_INLINE
     515  # endif
     516  _GL_ARG_NONNULL ((1)) void
     517  mbszero (mbstate_t *ps)
     518  {
     519    memset (ps, 0, _GL_MBSTATE_ZERO_SIZE);
     520  }
     521  _GL_END_C_LINKAGE
     522  _GL_CXXALIAS_SYS (mbszero, void, (mbstate_t *ps));
     523  _GL_CXXALIASWARN (mbszero);
     524  #endif
     525  
     526  
     527  /* Convert a multibyte character to a wide character.  */
     528  #if @GNULIB_MBRTOWC@
     529  # if @REPLACE_MBRTOWC@
     530  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     531  #   undef mbrtowc
     532  #   define mbrtowc rpl_mbrtowc
     533  #  endif
     534  _GL_FUNCDECL_RPL (mbrtowc, size_t,
     535                    (wchar_t *restrict pwc, const char *restrict s, size_t n,
     536                     mbstate_t *restrict ps));
     537  _GL_CXXALIAS_RPL (mbrtowc, size_t,
     538                    (wchar_t *restrict pwc, const char *restrict s, size_t n,
     539                     mbstate_t *restrict ps));
     540  # else
     541  #  if !@HAVE_MBRTOWC@
     542  _GL_FUNCDECL_SYS (mbrtowc, size_t,
     543                    (wchar_t *restrict pwc, const char *restrict s, size_t n,
     544                     mbstate_t *restrict ps));
     545  #  endif
     546  _GL_CXXALIAS_SYS (mbrtowc, size_t,
     547                    (wchar_t *restrict pwc, const char *restrict s, size_t n,
     548                     mbstate_t *restrict ps));
     549  # endif
     550  # if __GLIBC__ >= 2
     551  _GL_CXXALIASWARN (mbrtowc);
     552  # endif
     553  #elif defined GNULIB_POSIXCHECK
     554  # undef mbrtowc
     555  # if HAVE_RAW_DECL_MBRTOWC
     556  _GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - "
     557                   "use gnulib module mbrtowc for portability");
     558  # endif
     559  #endif
     560  
     561  
     562  /* Recognize a multibyte character.  */
     563  #if @GNULIB_MBRLEN@
     564  # if @REPLACE_MBRLEN@
     565  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     566  #   undef mbrlen
     567  #   define mbrlen rpl_mbrlen
     568  #  endif
     569  _GL_FUNCDECL_RPL (mbrlen, size_t,
     570                    (const char *restrict s, size_t n, mbstate_t *restrict ps));
     571  _GL_CXXALIAS_RPL (mbrlen, size_t,
     572                    (const char *restrict s, size_t n, mbstate_t *restrict ps));
     573  # else
     574  #  if !@HAVE_MBRLEN@
     575  _GL_FUNCDECL_SYS (mbrlen, size_t,
     576                    (const char *restrict s, size_t n, mbstate_t *restrict ps));
     577  #  endif
     578  _GL_CXXALIAS_SYS (mbrlen, size_t,
     579                    (const char *restrict s, size_t n, mbstate_t *restrict ps));
     580  # endif
     581  # if __GLIBC__ >= 2
     582  _GL_CXXALIASWARN (mbrlen);
     583  # endif
     584  #elif defined GNULIB_POSIXCHECK
     585  # undef mbrlen
     586  # if HAVE_RAW_DECL_MBRLEN
     587  _GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - "
     588                   "use gnulib module mbrlen for portability");
     589  # endif
     590  #endif
     591  
     592  
     593  /* Convert a string to a wide string.  */
     594  #if @GNULIB_MBSRTOWCS@
     595  # if @REPLACE_MBSRTOWCS@
     596  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     597  #   undef mbsrtowcs
     598  #   define mbsrtowcs rpl_mbsrtowcs
     599  #  endif
     600  _GL_FUNCDECL_RPL (mbsrtowcs, size_t,
     601                    (wchar_t *restrict dest,
     602                     const char **restrict srcp, size_t len,
     603                     mbstate_t *restrict ps)
     604                    _GL_ARG_NONNULL ((2)));
     605  _GL_CXXALIAS_RPL (mbsrtowcs, size_t,
     606                    (wchar_t *restrict dest,
     607                     const char **restrict srcp, size_t len,
     608                     mbstate_t *restrict ps));
     609  # else
     610  #  if !@HAVE_MBSRTOWCS@
     611  _GL_FUNCDECL_SYS (mbsrtowcs, size_t,
     612                    (wchar_t *restrict dest,
     613                     const char **restrict srcp, size_t len,
     614                     mbstate_t *restrict ps)
     615                    _GL_ARG_NONNULL ((2)));
     616  #  endif
     617  _GL_CXXALIAS_SYS (mbsrtowcs, size_t,
     618                    (wchar_t *restrict dest,
     619                     const char **restrict srcp, size_t len,
     620                     mbstate_t *restrict ps));
     621  # endif
     622  # if __GLIBC__ >= 2
     623  _GL_CXXALIASWARN (mbsrtowcs);
     624  # endif
     625  #elif defined GNULIB_POSIXCHECK
     626  # undef mbsrtowcs
     627  # if HAVE_RAW_DECL_MBSRTOWCS
     628  _GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - "
     629                   "use gnulib module mbsrtowcs for portability");
     630  # endif
     631  #endif
     632  
     633  
     634  /* Convert a string to a wide string.  */
     635  #if @GNULIB_MBSNRTOWCS@
     636  # if @REPLACE_MBSNRTOWCS@
     637  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     638  #   undef mbsnrtowcs
     639  #   define mbsnrtowcs rpl_mbsnrtowcs
     640  #  endif
     641  _GL_FUNCDECL_RPL (mbsnrtowcs, size_t,
     642                    (wchar_t *restrict dest,
     643                     const char **restrict srcp, size_t srclen, size_t len,
     644                     mbstate_t *restrict ps)
     645                    _GL_ARG_NONNULL ((2)));
     646  _GL_CXXALIAS_RPL (mbsnrtowcs, size_t,
     647                    (wchar_t *restrict dest,
     648                     const char **restrict srcp, size_t srclen, size_t len,
     649                     mbstate_t *restrict ps));
     650  # else
     651  #  if !@HAVE_MBSNRTOWCS@
     652  _GL_FUNCDECL_SYS (mbsnrtowcs, size_t,
     653                    (wchar_t *restrict dest,
     654                     const char **restrict srcp, size_t srclen, size_t len,
     655                     mbstate_t *restrict ps)
     656                    _GL_ARG_NONNULL ((2)));
     657  #  endif
     658  _GL_CXXALIAS_SYS (mbsnrtowcs, size_t,
     659                    (wchar_t *restrict dest,
     660                     const char **restrict srcp, size_t srclen, size_t len,
     661                     mbstate_t *restrict ps));
     662  # endif
     663  # if __GLIBC__ >= 2
     664  _GL_CXXALIASWARN (mbsnrtowcs);
     665  # endif
     666  #elif defined GNULIB_POSIXCHECK
     667  # undef mbsnrtowcs
     668  # if HAVE_RAW_DECL_MBSNRTOWCS
     669  _GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - "
     670                   "use gnulib module mbsnrtowcs for portability");
     671  # endif
     672  #endif
     673  
     674  
     675  /* Convert a wide character to a multibyte character.  */
     676  #if @GNULIB_WCRTOMB@
     677  # if @REPLACE_WCRTOMB@
     678  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     679  #   undef wcrtomb
     680  #   define wcrtomb rpl_wcrtomb
     681  #  endif
     682  _GL_FUNCDECL_RPL (wcrtomb, size_t,
     683                    (char *restrict s, wchar_t wc, mbstate_t *restrict ps));
     684  _GL_CXXALIAS_RPL (wcrtomb, size_t,
     685                    (char *restrict s, wchar_t wc, mbstate_t *restrict ps));
     686  # else
     687  #  if !@HAVE_WCRTOMB@
     688  _GL_FUNCDECL_SYS (wcrtomb, size_t,
     689                    (char *restrict s, wchar_t wc, mbstate_t *restrict ps));
     690  #  endif
     691  _GL_CXXALIAS_SYS (wcrtomb, size_t,
     692                    (char *restrict s, wchar_t wc, mbstate_t *restrict ps));
     693  # endif
     694  # if __GLIBC__ >= 2
     695  _GL_CXXALIASWARN (wcrtomb);
     696  # endif
     697  #elif defined GNULIB_POSIXCHECK
     698  # undef wcrtomb
     699  # if HAVE_RAW_DECL_WCRTOMB
     700  _GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - "
     701                   "use gnulib module wcrtomb for portability");
     702  # endif
     703  #endif
     704  
     705  
     706  /* Convert a wide string to a string.  */
     707  #if @GNULIB_WCSRTOMBS@
     708  # if @REPLACE_WCSRTOMBS@
     709  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     710  #   undef wcsrtombs
     711  #   define wcsrtombs rpl_wcsrtombs
     712  #  endif
     713  _GL_FUNCDECL_RPL (wcsrtombs, size_t,
     714                    (char *restrict dest, const wchar_t **restrict srcp,
     715                     size_t len,
     716                     mbstate_t *restrict ps)
     717                    _GL_ARG_NONNULL ((2)));
     718  _GL_CXXALIAS_RPL (wcsrtombs, size_t,
     719                    (char *restrict dest, const wchar_t **restrict srcp,
     720                     size_t len,
     721                     mbstate_t *restrict ps));
     722  # else
     723  #  if !@HAVE_WCSRTOMBS@
     724  _GL_FUNCDECL_SYS (wcsrtombs, size_t,
     725                    (char *restrict dest, const wchar_t **restrict srcp,
     726                     size_t len,
     727                     mbstate_t *restrict ps)
     728                    _GL_ARG_NONNULL ((2)));
     729  #  endif
     730  _GL_CXXALIAS_SYS (wcsrtombs, size_t,
     731                    (char *restrict dest, const wchar_t **restrict srcp,
     732                     size_t len,
     733                     mbstate_t *restrict ps));
     734  # endif
     735  # if __GLIBC__ >= 2
     736  _GL_CXXALIASWARN (wcsrtombs);
     737  # endif
     738  #elif defined GNULIB_POSIXCHECK
     739  # undef wcsrtombs
     740  # if HAVE_RAW_DECL_WCSRTOMBS
     741  _GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - "
     742                   "use gnulib module wcsrtombs for portability");
     743  # endif
     744  #endif
     745  
     746  
     747  /* Convert a wide string to a string.  */
     748  #if @GNULIB_WCSNRTOMBS@
     749  # if @REPLACE_WCSNRTOMBS@
     750  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     751  #   undef wcsnrtombs
     752  #   define wcsnrtombs rpl_wcsnrtombs
     753  #  endif
     754  _GL_FUNCDECL_RPL (wcsnrtombs, size_t,
     755                    (char *restrict dest,
     756                     const wchar_t **restrict srcp, size_t srclen,
     757                     size_t len,
     758                     mbstate_t *restrict ps)
     759                    _GL_ARG_NONNULL ((2)));
     760  _GL_CXXALIAS_RPL (wcsnrtombs, size_t,
     761                    (char *restrict dest,
     762                     const wchar_t **restrict srcp, size_t srclen,
     763                     size_t len,
     764                     mbstate_t *restrict ps));
     765  # else
     766  #  if !@HAVE_WCSNRTOMBS@ || (defined __cplusplus && defined __sun)
     767  _GL_FUNCDECL_SYS (wcsnrtombs, size_t,
     768                    (char *restrict dest,
     769                     const wchar_t **restrict srcp, size_t srclen,
     770                     size_t len,
     771                     mbstate_t *restrict ps)
     772                    _GL_ARG_NONNULL ((2)));
     773  #  endif
     774  _GL_CXXALIAS_SYS (wcsnrtombs, size_t,
     775                    (char *restrict dest,
     776                     const wchar_t **restrict srcp, size_t srclen,
     777                     size_t len,
     778                     mbstate_t *restrict ps));
     779  # endif
     780  # if __GLIBC__ >= 2
     781  _GL_CXXALIASWARN (wcsnrtombs);
     782  # endif
     783  #elif defined GNULIB_POSIXCHECK
     784  # undef wcsnrtombs
     785  # if HAVE_RAW_DECL_WCSNRTOMBS
     786  _GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - "
     787                   "use gnulib module wcsnrtombs for portability");
     788  # endif
     789  #endif
     790  
     791  
     792  /* Return the number of screen columns needed for WC.  */
     793  #if @GNULIB_WCWIDTH@
     794  # if @REPLACE_WCWIDTH@
     795  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     796  #   undef wcwidth
     797  #   define wcwidth rpl_wcwidth
     798  #  endif
     799  _GL_FUNCDECL_RPL (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE);
     800  _GL_CXXALIAS_RPL (wcwidth, int, (wchar_t));
     801  # else
     802  #  if !@HAVE_DECL_WCWIDTH@
     803  /* wcwidth exists but is not declared.  */
     804  _GL_FUNCDECL_SYS (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE);
     805  #  endif
     806  _GL_CXXALIAS_SYS (wcwidth, int, (wchar_t));
     807  # endif
     808  # if __GLIBC__ >= 2
     809  _GL_CXXALIASWARN (wcwidth);
     810  # endif
     811  #elif defined GNULIB_POSIXCHECK
     812  # undef wcwidth
     813  # if HAVE_RAW_DECL_WCWIDTH
     814  _GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - "
     815                   "use gnulib module wcwidth for portability");
     816  # endif
     817  #endif
     818  
     819  
     820  /* Search N wide characters of S for C.  */
     821  #if @GNULIB_WMEMCHR@
     822  # if !@HAVE_WMEMCHR@
     823  _GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n)
     824                                        _GL_ATTRIBUTE_PURE);
     825  # endif
     826    /* On some systems, this function is defined as an overloaded function:
     827         extern "C++" {
     828           const wchar_t * std::wmemchr (const wchar_t *, wchar_t, size_t);
     829           wchar_t * std::wmemchr (wchar_t *, wchar_t, size_t);
     830         }  */
     831  _GL_CXXALIAS_SYS_CAST2 (wmemchr,
     832                          wchar_t *, (const wchar_t *, wchar_t, size_t),
     833                          const wchar_t *, (const wchar_t *, wchar_t, size_t));
     834  # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
     835       && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
     836  _GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
     837  _GL_CXXALIASWARN1 (wmemchr, const wchar_t *,
     838                     (const wchar_t *s, wchar_t c, size_t n));
     839  # elif __GLIBC__ >= 2
     840  _GL_CXXALIASWARN (wmemchr);
     841  # endif
     842  #elif defined GNULIB_POSIXCHECK
     843  # undef wmemchr
     844  # if HAVE_RAW_DECL_WMEMCHR
     845  _GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - "
     846                   "use gnulib module wmemchr for portability");
     847  # endif
     848  #endif
     849  
     850  
     851  /* Compare N wide characters of S1 and S2.  */
     852  #if @GNULIB_WMEMCMP@
     853  # if @REPLACE_WMEMCMP@
     854  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     855  #   undef wmemcmp
     856  #   define wmemcmp rpl_wmemcmp
     857  #  endif
     858  _GL_FUNCDECL_RPL (wmemcmp, int,
     859                    (const wchar_t *s1, const wchar_t *s2, size_t n)
     860                    _GL_ATTRIBUTE_PURE);
     861  _GL_CXXALIAS_RPL (wmemcmp, int,
     862                    (const wchar_t *s1, const wchar_t *s2, size_t n));
     863  # else
     864  #  if !@HAVE_WMEMCMP@
     865  _GL_FUNCDECL_SYS (wmemcmp, int,
     866                    (const wchar_t *s1, const wchar_t *s2, size_t n)
     867                    _GL_ATTRIBUTE_PURE);
     868  #  endif
     869  _GL_CXXALIAS_SYS (wmemcmp, int,
     870                    (const wchar_t *s1, const wchar_t *s2, size_t n));
     871  # endif
     872  # if __GLIBC__ >= 2
     873  _GL_CXXALIASWARN (wmemcmp);
     874  # endif
     875  #elif defined GNULIB_POSIXCHECK
     876  # undef wmemcmp
     877  # if HAVE_RAW_DECL_WMEMCMP
     878  _GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - "
     879                   "use gnulib module wmemcmp for portability");
     880  # endif
     881  #endif
     882  
     883  
     884  /* Copy N wide characters of SRC to DEST.  */
     885  #if @GNULIB_WMEMCPY@
     886  # if !@HAVE_WMEMCPY@
     887  _GL_FUNCDECL_SYS (wmemcpy, wchar_t *,
     888                    (wchar_t *restrict dest,
     889                     const wchar_t *restrict src, size_t n));
     890  # endif
     891  _GL_CXXALIAS_SYS (wmemcpy, wchar_t *,
     892                    (wchar_t *restrict dest,
     893                     const wchar_t *restrict src, size_t n));
     894  # if __GLIBC__ >= 2
     895  _GL_CXXALIASWARN (wmemcpy);
     896  # endif
     897  #elif defined GNULIB_POSIXCHECK
     898  # undef wmemcpy
     899  # if HAVE_RAW_DECL_WMEMCPY
     900  _GL_WARN_ON_USE (wmemcpy, "wmemcpy is unportable - "
     901                   "use gnulib module wmemcpy for portability");
     902  # endif
     903  #endif
     904  
     905  
     906  /* Copy N wide characters of SRC to DEST, guaranteeing correct behavior for
     907     overlapping memory areas.  */
     908  #if @GNULIB_WMEMMOVE@
     909  # if !@HAVE_WMEMMOVE@
     910  _GL_FUNCDECL_SYS (wmemmove, wchar_t *,
     911                    (wchar_t *dest, const wchar_t *src, size_t n));
     912  # endif
     913  _GL_CXXALIAS_SYS (wmemmove, wchar_t *,
     914                    (wchar_t *dest, const wchar_t *src, size_t n));
     915  # if __GLIBC__ >= 2
     916  _GL_CXXALIASWARN (wmemmove);
     917  # endif
     918  #elif defined GNULIB_POSIXCHECK
     919  # undef wmemmove
     920  # if HAVE_RAW_DECL_WMEMMOVE
     921  _GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - "
     922                   "use gnulib module wmemmove for portability");
     923  # endif
     924  #endif
     925  
     926  
     927  /* Copy N wide characters of SRC to DEST.
     928     Return pointer to wide characters after the last written wide character.  */
     929  #if @GNULIB_WMEMPCPY@
     930  # if @REPLACE_WMEMPCPY@
     931  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     932  #   undef wmempcpy
     933  #   define wmempcpy rpl_wmempcpy
     934  #  endif
     935  _GL_FUNCDECL_RPL (wmempcpy, wchar_t *,
     936                    (wchar_t *restrict dest,
     937                     const wchar_t *restrict src, size_t n));
     938  _GL_CXXALIAS_RPL (wmempcpy, wchar_t *,
     939                    (wchar_t *restrict dest,
     940                     const wchar_t *restrict src, size_t n));
     941  # else
     942  #  if !@HAVE_WMEMPCPY@
     943  _GL_FUNCDECL_SYS (wmempcpy, wchar_t *,
     944                    (wchar_t *restrict dest,
     945                     const wchar_t *restrict src, size_t n));
     946  #  endif
     947  _GL_CXXALIAS_SYS (wmempcpy, wchar_t *,
     948                    (wchar_t *restrict dest,
     949                     const wchar_t *restrict src, size_t n));
     950  # endif
     951  # if __GLIBC__ >= 2
     952  _GL_CXXALIASWARN (wmempcpy);
     953  # endif
     954  #elif defined GNULIB_POSIXCHECK
     955  # undef wmempcpy
     956  # if HAVE_RAW_DECL_WMEMPCPY
     957  _GL_WARN_ON_USE (wmempcpy, "wmempcpy is unportable - "
     958                   "use gnulib module wmempcpy for portability");
     959  # endif
     960  #endif
     961  
     962  
     963  /* Set N wide characters of S to C.  */
     964  #if @GNULIB_WMEMSET@
     965  # if !@HAVE_WMEMSET@
     966  _GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
     967  # endif
     968  _GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
     969  # if __GLIBC__ >= 2
     970  _GL_CXXALIASWARN (wmemset);
     971  # endif
     972  #elif defined GNULIB_POSIXCHECK
     973  # undef wmemset
     974  # if HAVE_RAW_DECL_WMEMSET
     975  _GL_WARN_ON_USE (wmemset, "wmemset is unportable - "
     976                   "use gnulib module wmemset for portability");
     977  # endif
     978  #endif
     979  
     980  
     981  /* Return the number of wide characters in S.  */
     982  #if @GNULIB_WCSLEN@
     983  # if !@HAVE_WCSLEN@
     984  _GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s) _GL_ATTRIBUTE_PURE);
     985  # endif
     986  _GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s));
     987  # if __GLIBC__ >= 2
     988  _GL_CXXALIASWARN (wcslen);
     989  # endif
     990  #elif defined GNULIB_POSIXCHECK
     991  # undef wcslen
     992  # if HAVE_RAW_DECL_WCSLEN
     993  _GL_WARN_ON_USE (wcslen, "wcslen is unportable - "
     994                   "use gnulib module wcslen for portability");
     995  # endif
     996  #endif
     997  
     998  
     999  /* Return the number of wide characters in S, but at most MAXLEN.  */
    1000  #if @GNULIB_WCSNLEN@
    1001  /* On Solaris 11.3, the header files declare the function in the std::
    1002     namespace, not in the global namespace.  So, force a declaration in
    1003     the global namespace.  */
    1004  # if !@HAVE_WCSNLEN@ || (defined __sun && defined __cplusplus)
    1005  _GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen)
    1006                                     _GL_ATTRIBUTE_PURE);
    1007  # endif
    1008  _GL_CXXALIAS_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen));
    1009  _GL_CXXALIASWARN (wcsnlen);
    1010  #elif defined GNULIB_POSIXCHECK
    1011  # undef wcsnlen
    1012  # if HAVE_RAW_DECL_WCSNLEN
    1013  _GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - "
    1014                   "use gnulib module wcsnlen for portability");
    1015  # endif
    1016  #endif
    1017  
    1018  
    1019  /* Copy SRC to DEST.  */
    1020  #if @GNULIB_WCSCPY@
    1021  # if !@HAVE_WCSCPY@
    1022  _GL_FUNCDECL_SYS (wcscpy, wchar_t *,
    1023                    (wchar_t *restrict dest, const wchar_t *restrict src));
    1024  # endif
    1025  _GL_CXXALIAS_SYS (wcscpy, wchar_t *,
    1026                    (wchar_t *restrict dest, const wchar_t *restrict src));
    1027  # if __GLIBC__ >= 2
    1028  _GL_CXXALIASWARN (wcscpy);
    1029  # endif
    1030  #elif defined GNULIB_POSIXCHECK
    1031  # undef wcscpy
    1032  # if HAVE_RAW_DECL_WCSCPY
    1033  _GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - "
    1034                   "use gnulib module wcscpy for portability");
    1035  # endif
    1036  #endif
    1037  
    1038  
    1039  /* Copy SRC to DEST, returning the address of the terminating L'\0' in DEST.  */
    1040  #if @GNULIB_WCPCPY@
    1041  /* On Solaris 11.3, the header files declare the function in the std::
    1042     namespace, not in the global namespace.  So, force a declaration in
    1043     the global namespace.  */
    1044  # if !@HAVE_WCPCPY@ || (defined __sun && defined __cplusplus)
    1045  _GL_FUNCDECL_SYS (wcpcpy, wchar_t *,
    1046                    (wchar_t *restrict dest, const wchar_t *restrict src));
    1047  # endif
    1048  _GL_CXXALIAS_SYS (wcpcpy, wchar_t *,
    1049                    (wchar_t *restrict dest, const wchar_t *restrict src));
    1050  _GL_CXXALIASWARN (wcpcpy);
    1051  #elif defined GNULIB_POSIXCHECK
    1052  # undef wcpcpy
    1053  # if HAVE_RAW_DECL_WCPCPY
    1054  _GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - "
    1055                   "use gnulib module wcpcpy for portability");
    1056  # endif
    1057  #endif
    1058  
    1059  
    1060  /* Copy no more than N wide characters of SRC to DEST.  */
    1061  #if @GNULIB_WCSNCPY@
    1062  # if !@HAVE_WCSNCPY@
    1063  _GL_FUNCDECL_SYS (wcsncpy, wchar_t *,
    1064                    (wchar_t *restrict dest,
    1065                     const wchar_t *restrict src, size_t n));
    1066  # endif
    1067  _GL_CXXALIAS_SYS (wcsncpy, wchar_t *,
    1068                    (wchar_t *restrict dest,
    1069                     const wchar_t *restrict src, size_t n));
    1070  # if __GLIBC__ >= 2
    1071  _GL_CXXALIASWARN (wcsncpy);
    1072  # endif
    1073  #elif defined GNULIB_POSIXCHECK
    1074  # undef wcsncpy
    1075  # if HAVE_RAW_DECL_WCSNCPY
    1076  _GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - "
    1077                   "use gnulib module wcsncpy for portability");
    1078  # endif
    1079  #endif
    1080  
    1081  
    1082  /* Copy no more than N characters of SRC to DEST, returning the address of
    1083     the last character written into DEST.  */
    1084  #if @GNULIB_WCPNCPY@
    1085  /* On Solaris 11.3, the header files declare the function in the std::
    1086     namespace, not in the global namespace.  So, force a declaration in
    1087     the global namespace.  */
    1088  # if !@HAVE_WCPNCPY@ || (defined __sun && defined __cplusplus)
    1089  _GL_FUNCDECL_SYS (wcpncpy, wchar_t *,
    1090                    (wchar_t *restrict dest,
    1091                     const wchar_t *restrict src, size_t n));
    1092  # endif
    1093  _GL_CXXALIAS_SYS (wcpncpy, wchar_t *,
    1094                    (wchar_t *restrict dest,
    1095                     const wchar_t *restrict src, size_t n));
    1096  _GL_CXXALIASWARN (wcpncpy);
    1097  #elif defined GNULIB_POSIXCHECK
    1098  # undef wcpncpy
    1099  # if HAVE_RAW_DECL_WCPNCPY
    1100  _GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - "
    1101                   "use gnulib module wcpncpy for portability");
    1102  # endif
    1103  #endif
    1104  
    1105  
    1106  /* Append SRC onto DEST.  */
    1107  #if @GNULIB_WCSCAT@
    1108  # if !@HAVE_WCSCAT@
    1109  _GL_FUNCDECL_SYS (wcscat, wchar_t *,
    1110                    (wchar_t *restrict dest, const wchar_t *restrict src));
    1111  # endif
    1112  _GL_CXXALIAS_SYS (wcscat, wchar_t *,
    1113                    (wchar_t *restrict dest, const wchar_t *restrict src));
    1114  # if __GLIBC__ >= 2
    1115  _GL_CXXALIASWARN (wcscat);
    1116  # endif
    1117  #elif defined GNULIB_POSIXCHECK
    1118  # undef wcscat
    1119  # if HAVE_RAW_DECL_WCSCAT
    1120  _GL_WARN_ON_USE (wcscat, "wcscat is unportable - "
    1121                   "use gnulib module wcscat for portability");
    1122  # endif
    1123  #endif
    1124  
    1125  
    1126  /* Append no more than N wide characters of SRC onto DEST.  */
    1127  #if @GNULIB_WCSNCAT@
    1128  # if !@HAVE_WCSNCAT@
    1129  _GL_FUNCDECL_SYS (wcsncat, wchar_t *,
    1130                    (wchar_t *restrict dest, const wchar_t *restrict src,
    1131                     size_t n));
    1132  # endif
    1133  _GL_CXXALIAS_SYS (wcsncat, wchar_t *,
    1134                    (wchar_t *restrict dest, const wchar_t *restrict src,
    1135                     size_t n));
    1136  # if __GLIBC__ >= 2
    1137  _GL_CXXALIASWARN (wcsncat);
    1138  # endif
    1139  #elif defined GNULIB_POSIXCHECK
    1140  # undef wcsncat
    1141  # if HAVE_RAW_DECL_WCSNCAT
    1142  _GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - "
    1143                   "use gnulib module wcsncat for portability");
    1144  # endif
    1145  #endif
    1146  
    1147  
    1148  /* Compare S1 and S2.  */
    1149  #if @GNULIB_WCSCMP@
    1150  # if @REPLACE_WCSCMP@
    1151  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1152  #   undef wcscmp
    1153  #   define wcscmp rpl_wcscmp
    1154  #  endif
    1155  _GL_FUNCDECL_RPL (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)
    1156                                 _GL_ATTRIBUTE_PURE);
    1157  _GL_CXXALIAS_RPL (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
    1158  # else
    1159  #  if !@HAVE_WCSCMP@
    1160  _GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)
    1161                                 _GL_ATTRIBUTE_PURE);
    1162  #  endif
    1163  _GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
    1164  # endif
    1165  # if __GLIBC__ >= 2
    1166  _GL_CXXALIASWARN (wcscmp);
    1167  # endif
    1168  #elif defined GNULIB_POSIXCHECK
    1169  # undef wcscmp
    1170  # if HAVE_RAW_DECL_WCSCMP
    1171  _GL_WARN_ON_USE (wcscmp, "wcscmp is unportable - "
    1172                   "use gnulib module wcscmp for portability");
    1173  # endif
    1174  #endif
    1175  
    1176  
    1177  /* Compare no more than N wide characters of S1 and S2.  */
    1178  #if @GNULIB_WCSNCMP@
    1179  # if @REPLACE_WCSNCMP@
    1180  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1181  #   undef wcsncmp
    1182  #   define wcsncmp rpl_wcsncmp
    1183  #  endif
    1184  _GL_FUNCDECL_RPL (wcsncmp, int,
    1185                    (const wchar_t *s1, const wchar_t *s2, size_t n)
    1186                    _GL_ATTRIBUTE_PURE);
    1187  _GL_CXXALIAS_RPL (wcsncmp, int,
    1188                    (const wchar_t *s1, const wchar_t *s2, size_t n));
    1189  # else
    1190  #  if !@HAVE_WCSNCMP@
    1191  _GL_FUNCDECL_SYS (wcsncmp, int,
    1192                    (const wchar_t *s1, const wchar_t *s2, size_t n)
    1193                    _GL_ATTRIBUTE_PURE);
    1194  #  endif
    1195  _GL_CXXALIAS_SYS (wcsncmp, int,
    1196                    (const wchar_t *s1, const wchar_t *s2, size_t n));
    1197  # endif
    1198  # if __GLIBC__ >= 2
    1199  _GL_CXXALIASWARN (wcsncmp);
    1200  # endif
    1201  #elif defined GNULIB_POSIXCHECK
    1202  # undef wcsncmp
    1203  # if HAVE_RAW_DECL_WCSNCMP
    1204  _GL_WARN_ON_USE (wcsncmp, "wcsncmp is unportable - "
    1205                   "use gnulib module wcsncmp for portability");
    1206  # endif
    1207  #endif
    1208  
    1209  
    1210  /* Compare S1 and S2, ignoring case.  */
    1211  #if @GNULIB_WCSCASECMP@
    1212  /* On Solaris 11.3, the header files declare the function in the std::
    1213     namespace, not in the global namespace.  So, force a declaration in
    1214     the global namespace.  */
    1215  # if !@HAVE_WCSCASECMP@ || (defined __sun && defined __cplusplus)
    1216  _GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2)
    1217                                     _GL_ATTRIBUTE_PURE);
    1218  # endif
    1219  _GL_CXXALIAS_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2));
    1220  _GL_CXXALIASWARN (wcscasecmp);
    1221  #elif defined GNULIB_POSIXCHECK
    1222  # undef wcscasecmp
    1223  # if HAVE_RAW_DECL_WCSCASECMP
    1224  _GL_WARN_ON_USE (wcscasecmp, "wcscasecmp is unportable - "
    1225                   "use gnulib module wcscasecmp for portability");
    1226  # endif
    1227  #endif
    1228  
    1229  
    1230  /* Compare no more than N chars of S1 and S2, ignoring case.  */
    1231  #if @GNULIB_WCSNCASECMP@
    1232  /* On Solaris 11.3, the header files declare the function in the std::
    1233     namespace, not in the global namespace.  So, force a declaration in
    1234     the global namespace.  */
    1235  # if !@HAVE_WCSNCASECMP@ || (defined __sun && defined __cplusplus)
    1236  _GL_FUNCDECL_SYS (wcsncasecmp, int,
    1237                    (const wchar_t *s1, const wchar_t *s2, size_t n)
    1238                    _GL_ATTRIBUTE_PURE);
    1239  # endif
    1240  _GL_CXXALIAS_SYS (wcsncasecmp, int,
    1241                    (const wchar_t *s1, const wchar_t *s2, size_t n));
    1242  _GL_CXXALIASWARN (wcsncasecmp);
    1243  #elif defined GNULIB_POSIXCHECK
    1244  # undef wcsncasecmp
    1245  # if HAVE_RAW_DECL_WCSNCASECMP
    1246  _GL_WARN_ON_USE (wcsncasecmp, "wcsncasecmp is unportable - "
    1247                   "use gnulib module wcsncasecmp for portability");
    1248  # endif
    1249  #endif
    1250  
    1251  
    1252  /* Compare S1 and S2, both interpreted as appropriate to the LC_COLLATE
    1253     category of the current locale.  */
    1254  #if @GNULIB_WCSCOLL@
    1255  # if !@HAVE_WCSCOLL@
    1256  _GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
    1257  # endif
    1258  _GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
    1259  # if __GLIBC__ >= 2
    1260  _GL_CXXALIASWARN (wcscoll);
    1261  # endif
    1262  #elif defined GNULIB_POSIXCHECK
    1263  # undef wcscoll
    1264  # if HAVE_RAW_DECL_WCSCOLL
    1265  _GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - "
    1266                   "use gnulib module wcscoll for portability");
    1267  # endif
    1268  #endif
    1269  
    1270  
    1271  /* Transform S2 into array pointed to by S1 such that if wcscmp is applied
    1272     to two transformed strings the result is the as applying 'wcscoll' to the
    1273     original strings.  */
    1274  #if @GNULIB_WCSXFRM@
    1275  # if !@HAVE_WCSXFRM@
    1276  _GL_FUNCDECL_SYS (wcsxfrm, size_t,
    1277                    (wchar_t *restrict s1, const wchar_t *restrict s2, size_t n));
    1278  # endif
    1279  _GL_CXXALIAS_SYS (wcsxfrm, size_t,
    1280                    (wchar_t *restrict s1, const wchar_t *restrict s2, size_t n));
    1281  # if __GLIBC__ >= 2
    1282  _GL_CXXALIASWARN (wcsxfrm);
    1283  # endif
    1284  #elif defined GNULIB_POSIXCHECK
    1285  # undef wcsxfrm
    1286  # if HAVE_RAW_DECL_WCSXFRM
    1287  _GL_WARN_ON_USE (wcsxfrm, "wcsxfrm is unportable - "
    1288                   "use gnulib module wcsxfrm for portability");
    1289  # endif
    1290  #endif
    1291  
    1292  
    1293  /* Duplicate S, returning an identical malloc'd string.  */
    1294  #if @GNULIB_WCSDUP@
    1295  # if defined _WIN32 && !defined __CYGWIN__
    1296  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1297  #   undef wcsdup
    1298  #   define wcsdup _wcsdup
    1299  #  endif
    1300  _GL_CXXALIAS_MDA (wcsdup, wchar_t *, (const wchar_t *s));
    1301  # else
    1302  /* On Solaris 11.3, the header files declare the function in the std::
    1303     namespace, not in the global namespace.  So, force a declaration in
    1304     the global namespace.  */
    1305  #  if !@HAVE_WCSDUP@ || (defined __sun && defined __cplusplus) || __GNUC__ >= 11
    1306  _GL_FUNCDECL_SYS (wcsdup, wchar_t *,
    1307                    (const wchar_t *s)
    1308                    _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
    1309  #  endif
    1310  _GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s));
    1311  # endif
    1312  _GL_CXXALIASWARN (wcsdup);
    1313  #else
    1314  # if __GNUC__ >= 11 && !defined wcsdup
    1315  /* For -Wmismatched-dealloc: Associate wcsdup with free or rpl_free.  */
    1316  _GL_FUNCDECL_SYS (wcsdup, wchar_t *,
    1317                    (const wchar_t *s)
    1318                    _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
    1319  # endif
    1320  # if defined GNULIB_POSIXCHECK
    1321  #  undef wcsdup
    1322  #  if HAVE_RAW_DECL_WCSDUP
    1323  _GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - "
    1324                   "use gnulib module wcsdup for portability");
    1325  #  endif
    1326  # elif @GNULIB_MDA_WCSDUP@
    1327  /* On native Windows, map 'wcsdup' to '_wcsdup', so that -loldnames is not
    1328     required.  In C++ with GNULIB_NAMESPACE, avoid differences between
    1329     platforms by defining GNULIB_NAMESPACE::wcsdup always.  */
    1330  #  if defined _WIN32 && !defined __CYGWIN__
    1331  #   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1332  #    undef wcsdup
    1333  #    define wcsdup _wcsdup
    1334  #   endif
    1335  _GL_CXXALIAS_MDA (wcsdup, wchar_t *, (const wchar_t *s));
    1336  #  else
    1337  _GL_FUNCDECL_SYS (wcsdup, wchar_t *,
    1338                    (const wchar_t *s)
    1339                    _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
    1340  #   if @HAVE_DECL_WCSDUP@
    1341  _GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s));
    1342  #   endif
    1343  #  endif
    1344  #  if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_WCSDUP@
    1345  _GL_CXXALIASWARN (wcsdup);
    1346  #  endif
    1347  # endif
    1348  #endif
    1349  
    1350  
    1351  /* Find the first occurrence of WC in WCS.  */
    1352  #if @GNULIB_WCSCHR@
    1353  # if !@HAVE_WCSCHR@
    1354  _GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc)
    1355                                       _GL_ATTRIBUTE_PURE);
    1356  # endif
    1357    /* On some systems, this function is defined as an overloaded function:
    1358         extern "C++" {
    1359           const wchar_t * std::wcschr (const wchar_t *, wchar_t);
    1360           wchar_t * std::wcschr (wchar_t *, wchar_t);
    1361         }  */
    1362  _GL_CXXALIAS_SYS_CAST2 (wcschr,
    1363                          wchar_t *, (const wchar_t *, wchar_t),
    1364                          const wchar_t *, (const wchar_t *, wchar_t));
    1365  # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
    1366       && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
    1367  _GL_CXXALIASWARN1 (wcschr, wchar_t *, (wchar_t *wcs, wchar_t wc));
    1368  _GL_CXXALIASWARN1 (wcschr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
    1369  # elif __GLIBC__ >= 2
    1370  _GL_CXXALIASWARN (wcschr);
    1371  # endif
    1372  #elif defined GNULIB_POSIXCHECK
    1373  # undef wcschr
    1374  # if HAVE_RAW_DECL_WCSCHR
    1375  _GL_WARN_ON_USE (wcschr, "wcschr is unportable - "
    1376                   "use gnulib module wcschr for portability");
    1377  # endif
    1378  #endif
    1379  
    1380  
    1381  /* Find the last occurrence of WC in WCS.  */
    1382  #if @GNULIB_WCSRCHR@
    1383  # if !@HAVE_WCSRCHR@
    1384  _GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc)
    1385                                        _GL_ATTRIBUTE_PURE);
    1386  # endif
    1387    /* On some systems, this function is defined as an overloaded function:
    1388         extern "C++" {
    1389           const wchar_t * std::wcsrchr (const wchar_t *, wchar_t);
    1390           wchar_t * std::wcsrchr (wchar_t *, wchar_t);
    1391         }  */
    1392  _GL_CXXALIAS_SYS_CAST2 (wcsrchr,
    1393                          wchar_t *, (const wchar_t *, wchar_t),
    1394                          const wchar_t *, (const wchar_t *, wchar_t));
    1395  # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
    1396       && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
    1397  _GL_CXXALIASWARN1 (wcsrchr, wchar_t *, (wchar_t *wcs, wchar_t wc));
    1398  _GL_CXXALIASWARN1 (wcsrchr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
    1399  # elif __GLIBC__ >= 2
    1400  _GL_CXXALIASWARN (wcsrchr);
    1401  # endif
    1402  #elif defined GNULIB_POSIXCHECK
    1403  # undef wcsrchr
    1404  # if HAVE_RAW_DECL_WCSRCHR
    1405  _GL_WARN_ON_USE (wcsrchr, "wcsrchr is unportable - "
    1406                   "use gnulib module wcsrchr for portability");
    1407  # endif
    1408  #endif
    1409  
    1410  
    1411  /* Return the length of the initial segment of WCS which consists entirely
    1412     of wide characters not in REJECT.  */
    1413  #if @GNULIB_WCSCSPN@
    1414  # if !@HAVE_WCSCSPN@
    1415  _GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject)
    1416                                     _GL_ATTRIBUTE_PURE);
    1417  # endif
    1418  _GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject));
    1419  # if __GLIBC__ >= 2
    1420  _GL_CXXALIASWARN (wcscspn);
    1421  # endif
    1422  #elif defined GNULIB_POSIXCHECK
    1423  # undef wcscspn
    1424  # if HAVE_RAW_DECL_WCSCSPN
    1425  _GL_WARN_ON_USE (wcscspn, "wcscspn is unportable - "
    1426                   "use gnulib module wcscspn for portability");
    1427  # endif
    1428  #endif
    1429  
    1430  
    1431  /* Return the length of the initial segment of WCS which consists entirely
    1432     of wide characters in ACCEPT.  */
    1433  #if @GNULIB_WCSSPN@
    1434  # if !@HAVE_WCSSPN@
    1435  _GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept)
    1436                                    _GL_ATTRIBUTE_PURE);
    1437  # endif
    1438  _GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept));
    1439  # if __GLIBC__ >= 2
    1440  _GL_CXXALIASWARN (wcsspn);
    1441  # endif
    1442  #elif defined GNULIB_POSIXCHECK
    1443  # undef wcsspn
    1444  # if HAVE_RAW_DECL_WCSSPN
    1445  _GL_WARN_ON_USE (wcsspn, "wcsspn is unportable - "
    1446                   "use gnulib module wcsspn for portability");
    1447  # endif
    1448  #endif
    1449  
    1450  
    1451  /* Find the first occurrence in WCS of any character in ACCEPT.  */
    1452  #if @GNULIB_WCSPBRK@
    1453  # if !@HAVE_WCSPBRK@
    1454  _GL_FUNCDECL_SYS (wcspbrk, wchar_t *,
    1455                    (const wchar_t *wcs, const wchar_t *accept)
    1456                    _GL_ATTRIBUTE_PURE);
    1457  # endif
    1458    /* On some systems, this function is defined as an overloaded function:
    1459         extern "C++" {
    1460           const wchar_t * std::wcspbrk (const wchar_t *, const wchar_t *);
    1461           wchar_t * std::wcspbrk (wchar_t *, const wchar_t *);
    1462         }  */
    1463  _GL_CXXALIAS_SYS_CAST2 (wcspbrk,
    1464                          wchar_t *, (const wchar_t *, const wchar_t *),
    1465                          const wchar_t *, (const wchar_t *, const wchar_t *));
    1466  # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
    1467       && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
    1468  _GL_CXXALIASWARN1 (wcspbrk, wchar_t *,
    1469                     (wchar_t *wcs, const wchar_t *accept));
    1470  _GL_CXXALIASWARN1 (wcspbrk, const wchar_t *,
    1471                     (const wchar_t *wcs, const wchar_t *accept));
    1472  # elif __GLIBC__ >= 2
    1473  _GL_CXXALIASWARN (wcspbrk);
    1474  # endif
    1475  #elif defined GNULIB_POSIXCHECK
    1476  # undef wcspbrk
    1477  # if HAVE_RAW_DECL_WCSPBRK
    1478  _GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - "
    1479                   "use gnulib module wcspbrk for portability");
    1480  # endif
    1481  #endif
    1482  
    1483  
    1484  /* Find the first occurrence of NEEDLE in HAYSTACK.  */
    1485  #if @GNULIB_WCSSTR@
    1486  # if @REPLACE_WCSSTR@
    1487  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1488  #   undef wcsstr
    1489  #   define wcsstr rpl_wcsstr
    1490  #  endif
    1491  _GL_FUNCDECL_RPL (wcsstr, wchar_t *,
    1492                    (const wchar_t *restrict haystack,
    1493                     const wchar_t *restrict needle)
    1494                    _GL_ATTRIBUTE_PURE);
    1495  _GL_CXXALIAS_RPL (wcsstr, wchar_t *,
    1496                    (const wchar_t *restrict haystack,
    1497                     const wchar_t *restrict needle));
    1498  # else
    1499  #  if !@HAVE_WCSSTR@
    1500  _GL_FUNCDECL_SYS (wcsstr, wchar_t *,
    1501                    (const wchar_t *restrict haystack,
    1502                     const wchar_t *restrict needle)
    1503                    _GL_ATTRIBUTE_PURE);
    1504  #  endif
    1505    /* On some systems, this function is defined as an overloaded function:
    1506         extern "C++" {
    1507           const wchar_t * std::wcsstr (const wchar_t *, const wchar_t *);
    1508           wchar_t * std::wcsstr (wchar_t *, const wchar_t *);
    1509         }  */
    1510  _GL_CXXALIAS_SYS_CAST2 (wcsstr,
    1511                          wchar_t *,
    1512                          (const wchar_t *restrict, const wchar_t *restrict),
    1513                          const wchar_t *,
    1514                          (const wchar_t *restrict, const wchar_t *restrict));
    1515  # endif
    1516  # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
    1517       && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
    1518  _GL_CXXALIASWARN1 (wcsstr, wchar_t *,
    1519                     (wchar_t *restrict haystack,
    1520                      const wchar_t *restrict needle));
    1521  _GL_CXXALIASWARN1 (wcsstr, const wchar_t *,
    1522                     (const wchar_t *restrict haystack,
    1523                      const wchar_t *restrict needle));
    1524  # elif __GLIBC__ >= 2
    1525  _GL_CXXALIASWARN (wcsstr);
    1526  # endif
    1527  #elif defined GNULIB_POSIXCHECK
    1528  # undef wcsstr
    1529  # if HAVE_RAW_DECL_WCSSTR
    1530  _GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - "
    1531                   "use gnulib module wcsstr for portability");
    1532  # endif
    1533  #endif
    1534  
    1535  
    1536  /* Divide WCS into tokens separated by characters in DELIM.  */
    1537  #if @GNULIB_WCSTOK@
    1538  # if @REPLACE_WCSTOK@
    1539  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1540  #   undef wcstok
    1541  #   define wcstok rpl_wcstok
    1542  #  endif
    1543  _GL_FUNCDECL_RPL (wcstok, wchar_t *,
    1544                    (wchar_t *restrict wcs, const wchar_t *restrict delim,
    1545                     wchar_t **restrict ptr));
    1546  _GL_CXXALIAS_RPL (wcstok, wchar_t *,
    1547                    (wchar_t *restrict wcs, const wchar_t *restrict delim,
    1548                     wchar_t **restrict ptr));
    1549  # else
    1550  #  if !@HAVE_WCSTOK@
    1551  _GL_FUNCDECL_SYS (wcstok, wchar_t *,
    1552                    (wchar_t *restrict wcs, const wchar_t *restrict delim,
    1553                     wchar_t **restrict ptr));
    1554  #  endif
    1555  _GL_CXXALIAS_SYS (wcstok, wchar_t *,
    1556                    (wchar_t *restrict wcs, const wchar_t *restrict delim,
    1557                     wchar_t **restrict ptr));
    1558  # endif
    1559  # if __GLIBC__ >= 2
    1560  _GL_CXXALIASWARN (wcstok);
    1561  # endif
    1562  #elif defined GNULIB_POSIXCHECK
    1563  # undef wcstok
    1564  # if HAVE_RAW_DECL_WCSTOK
    1565  _GL_WARN_ON_USE (wcstok, "wcstok is unportable - "
    1566                   "use gnulib module wcstok for portability");
    1567  # endif
    1568  #endif
    1569  
    1570  
    1571  /* Determine number of column positions required for first N wide
    1572     characters (or fewer if S ends before this) in S.  */
    1573  #if @GNULIB_WCSWIDTH@
    1574  # if @REPLACE_WCSWIDTH@
    1575  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1576  #   undef wcswidth
    1577  #   define wcswidth rpl_wcswidth
    1578  #  endif
    1579  _GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n)
    1580                                   _GL_ATTRIBUTE_PURE);
    1581  _GL_CXXALIAS_RPL (wcswidth, int, (const wchar_t *s, size_t n));
    1582  # else
    1583  #  if !@HAVE_WCSWIDTH@
    1584  _GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n)
    1585                                   _GL_ATTRIBUTE_PURE);
    1586  #  endif
    1587  _GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n));
    1588  # endif
    1589  # if __GLIBC__ >= 2
    1590  _GL_CXXALIASWARN (wcswidth);
    1591  # endif
    1592  #elif defined GNULIB_POSIXCHECK
    1593  # undef wcswidth
    1594  # if HAVE_RAW_DECL_WCSWIDTH
    1595  _GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - "
    1596                   "use gnulib module wcswidth for portability");
    1597  # endif
    1598  #endif
    1599  
    1600  
    1601  /* Convert *TP to a date and time wide string.  See
    1602     <https://pubs.opengroup.org/onlinepubs/9699919799/functions/wcsftime.html>.  */
    1603  #if @GNULIB_WCSFTIME@
    1604  # if @REPLACE_WCSFTIME@
    1605  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1606  #   undef wcsftime
    1607  #   define wcsftime rpl_wcsftime
    1608  #  endif
    1609  _GL_FUNCDECL_RPL (wcsftime, size_t,
    1610                    (wchar_t *restrict __buf, size_t __bufsize,
    1611                     const wchar_t *restrict __fmt,
    1612                     const struct tm *restrict __tp)
    1613                    _GL_ARG_NONNULL ((1, 3, 4)));
    1614  _GL_CXXALIAS_RPL (wcsftime, size_t,
    1615                    (wchar_t *restrict __buf, size_t __bufsize,
    1616                     const wchar_t *restrict __fmt,
    1617                     const struct tm *restrict __tp));
    1618  # else
    1619  #  if !@HAVE_WCSFTIME@
    1620  _GL_FUNCDECL_SYS (wcsftime, size_t,
    1621                    (wchar_t *restrict __buf, size_t __bufsize,
    1622                     const wchar_t *restrict __fmt,
    1623                     const struct tm *restrict __tp)
    1624                    _GL_ARG_NONNULL ((1, 3, 4)));
    1625  #  endif
    1626  _GL_CXXALIAS_SYS (wcsftime, size_t,
    1627                    (wchar_t *restrict __buf, size_t __bufsize,
    1628                     const wchar_t *restrict __fmt,
    1629                     const struct tm *restrict __tp));
    1630  # endif
    1631  # if __GLIBC__ >= 2
    1632  _GL_CXXALIASWARN (wcsftime);
    1633  # endif
    1634  #elif defined GNULIB_POSIXCHECK
    1635  # undef wcsftime
    1636  # if HAVE_RAW_DECL_WCSFTIME
    1637  _GL_WARN_ON_USE (wcsftime, "wcsftime is unportable - "
    1638                   "use gnulib module wcsftime for portability");
    1639  # endif
    1640  #endif
    1641  
    1642  
    1643  #endif /* _@GUARD_PREFIX@_WCHAR_H */
    1644  #endif /* _@GUARD_PREFIX@_WCHAR_H */
    1645  #endif