(root)/
findutils-4.9.0/
gl/
lib/
wchar.in.h
       1  /* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
       2  
       3     Copyright (C) 2007-2022 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  /* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
      88     that can be freed by passing them as the Ith argument to the
      89     function F.  */
      90  #ifndef _GL_ATTRIBUTE_DEALLOC
      91  # if __GNUC__ >= 11
      92  #  define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
      93  # else
      94  #  define _GL_ATTRIBUTE_DEALLOC(f, i)
      95  # endif
      96  #endif
      97  
      98  /* _GL_ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that
      99     can be freed via 'free'; it can be used only after declaring 'free'.  */
     100  /* Applies to: functions.  Cannot be used on inline functions.  */
     101  #ifndef _GL_ATTRIBUTE_DEALLOC_FREE
     102  # define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (free, 1)
     103  #endif
     104  
     105  /* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly
     106     allocated memory.  */
     107  /* Applies to: functions.  */
     108  #ifndef _GL_ATTRIBUTE_MALLOC
     109  # if __GNUC__ >= 3 || defined __clang__
     110  #  define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
     111  # else
     112  #  define _GL_ATTRIBUTE_MALLOC
     113  # endif
     114  #endif
     115  
     116  /* The __attribute__ feature is available in gcc versions 2.5 and later.
     117     The attribute __pure__ was added in gcc 2.96.  */
     118  #ifndef _GL_ATTRIBUTE_PURE
     119  # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
     120  #  define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
     121  # else
     122  #  define _GL_ATTRIBUTE_PURE /* empty */
     123  # endif
     124  #endif
     125  
     126  /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
     127  
     128  /* The definition of _GL_ARG_NONNULL is copied here.  */
     129  
     130  /* The definition of _GL_WARN_ON_USE is copied here.  */
     131  
     132  
     133  /* Define wint_t and WEOF.  (Also done in wctype.in.h.)  */
     134  #if !@HAVE_WINT_T@ && !defined wint_t
     135  # define wint_t int
     136  # ifndef WEOF
     137  #  define WEOF -1
     138  # endif
     139  #else
     140  /* mingw and MSVC define wint_t as 'unsigned short' in <crtdefs.h> or
     141     <stddef.h>.  This is too small: ISO C 99 section 7.24.1.(2) says that
     142     wint_t must be "unchanged by default argument promotions".  Override it.  */
     143  # if @GNULIBHEADERS_OVERRIDE_WINT_T@
     144  #  if !GNULIB_defined_wint_t
     145  #   if @HAVE_CRTDEFS_H@
     146  #    include <crtdefs.h>
     147  #   else
     148  #    include <stddef.h>
     149  #   endif
     150  typedef unsigned int rpl_wint_t;
     151  #   undef wint_t
     152  #   define wint_t rpl_wint_t
     153  #   define GNULIB_defined_wint_t 1
     154  #  endif
     155  # endif
     156  # ifndef WEOF
     157  #  define WEOF ((wint_t) -1)
     158  # endif
     159  #endif
     160  
     161  
     162  /* Override mbstate_t if it is too small.
     163     On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for
     164     implementing mbrtowc for encodings like UTF-8.
     165     On AIX and MSVC, mbrtowc needs to be overridden, but mbstate_t exists and is
     166     large enough and overriding it would cause problems in C++ mode.  */
     167  #if !(((defined _WIN32 && !defined __CYGWIN__) || @HAVE_MBSINIT@) && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@
     168  # if !GNULIB_defined_mbstate_t
     169  #  if !(defined _AIX || defined _MSC_VER)
     170  typedef int rpl_mbstate_t;
     171  #   undef mbstate_t
     172  #   define mbstate_t rpl_mbstate_t
     173  #  endif
     174  #  define GNULIB_defined_mbstate_t 1
     175  # endif
     176  #endif
     177  
     178  /* Make _GL_ATTRIBUTE_DEALLOC_FREE work, even though <stdlib.h> may not have
     179     been included yet.  */
     180  #if @GNULIB_FREE_POSIX@
     181  # if (@REPLACE_FREE@ && !defined free \
     182        && !(defined __cplusplus && defined GNULIB_NAMESPACE))
     183  /* We can't do '#define free rpl_free' here.  */
     184  _GL_EXTERN_C void rpl_free (void *);
     185  #  undef _GL_ATTRIBUTE_DEALLOC_FREE
     186  #  define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1)
     187  # else
     188  #  if defined _MSC_VER
     189  _GL_EXTERN_C void __cdecl free (void *);
     190  #  else
     191  _GL_EXTERN_C void free (void *);
     192  #  endif
     193  # endif
     194  #else
     195  # if defined _MSC_VER
     196  _GL_EXTERN_C void __cdecl free (void *);
     197  # else
     198  _GL_EXTERN_C void free (void *);
     199  # endif
     200  #endif
     201  
     202  /* Convert a single-byte character to a wide character.  */
     203  #if @GNULIB_BTOWC@
     204  # if @REPLACE_BTOWC@
     205  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     206  #   undef btowc
     207  #   define btowc rpl_btowc
     208  #  endif
     209  _GL_FUNCDECL_RPL (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE);
     210  _GL_CXXALIAS_RPL (btowc, wint_t, (int c));
     211  # else
     212  #  if !@HAVE_BTOWC@
     213  _GL_FUNCDECL_SYS (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE);
     214  #  endif
     215  /* Need to cast, because on mingw, the return type is 'unsigned short'.  */
     216  _GL_CXXALIAS_SYS_CAST (btowc, wint_t, (int c));
     217  # endif
     218  # if __GLIBC__ >= 2
     219  _GL_CXXALIASWARN (btowc);
     220  # endif
     221  #elif defined GNULIB_POSIXCHECK
     222  # undef btowc
     223  # if HAVE_RAW_DECL_BTOWC
     224  _GL_WARN_ON_USE (btowc, "btowc is unportable - "
     225                   "use gnulib module btowc for portability");
     226  # endif
     227  #endif
     228  
     229  
     230  /* Convert a wide character to a single-byte character.  */
     231  #if @GNULIB_WCTOB@
     232  # if @REPLACE_WCTOB@
     233  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     234  #   undef wctob
     235  #   define wctob rpl_wctob
     236  #  endif
     237  _GL_FUNCDECL_RPL (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE);
     238  _GL_CXXALIAS_RPL (wctob, int, (wint_t wc));
     239  # else
     240  #  if !defined wctob && !@HAVE_DECL_WCTOB@
     241  /* wctob is provided by gnulib, or wctob exists but is not declared.  */
     242  _GL_FUNCDECL_SYS (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE);
     243  #  endif
     244  _GL_CXXALIAS_SYS (wctob, int, (wint_t wc));
     245  # endif
     246  # if __GLIBC__ >= 2
     247  _GL_CXXALIASWARN (wctob);
     248  # endif
     249  #elif defined GNULIB_POSIXCHECK
     250  # undef wctob
     251  # if HAVE_RAW_DECL_WCTOB
     252  _GL_WARN_ON_USE (wctob, "wctob is unportable - "
     253                   "use gnulib module wctob for portability");
     254  # endif
     255  #endif
     256  
     257  
     258  /* Test whether *PS is in the initial state.  */
     259  #if @GNULIB_MBSINIT@
     260  # if @REPLACE_MBSINIT@
     261  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     262  #   undef mbsinit
     263  #   define mbsinit rpl_mbsinit
     264  #  endif
     265  _GL_FUNCDECL_RPL (mbsinit, int, (const mbstate_t *ps));
     266  _GL_CXXALIAS_RPL (mbsinit, int, (const mbstate_t *ps));
     267  # else
     268  #  if !@HAVE_MBSINIT@
     269  _GL_FUNCDECL_SYS (mbsinit, int, (const mbstate_t *ps));
     270  #  endif
     271  _GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps));
     272  # endif
     273  # if __GLIBC__ >= 2
     274  _GL_CXXALIASWARN (mbsinit);
     275  # endif
     276  #elif defined GNULIB_POSIXCHECK
     277  # undef mbsinit
     278  # if HAVE_RAW_DECL_MBSINIT
     279  _GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - "
     280                   "use gnulib module mbsinit for portability");
     281  # endif
     282  #endif
     283  
     284  
     285  /* Convert a multibyte character to a wide character.  */
     286  #if @GNULIB_MBRTOWC@
     287  # if @REPLACE_MBRTOWC@
     288  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     289  #   undef mbrtowc
     290  #   define mbrtowc rpl_mbrtowc
     291  #  endif
     292  _GL_FUNCDECL_RPL (mbrtowc, size_t,
     293                    (wchar_t *restrict pwc, const char *restrict s, size_t n,
     294                     mbstate_t *restrict ps));
     295  _GL_CXXALIAS_RPL (mbrtowc, size_t,
     296                    (wchar_t *restrict pwc, const char *restrict s, size_t n,
     297                     mbstate_t *restrict ps));
     298  # else
     299  #  if !@HAVE_MBRTOWC@
     300  _GL_FUNCDECL_SYS (mbrtowc, size_t,
     301                    (wchar_t *restrict pwc, const char *restrict s, size_t n,
     302                     mbstate_t *restrict ps));
     303  #  endif
     304  _GL_CXXALIAS_SYS (mbrtowc, size_t,
     305                    (wchar_t *restrict pwc, const char *restrict s, size_t n,
     306                     mbstate_t *restrict ps));
     307  # endif
     308  # if __GLIBC__ >= 2
     309  _GL_CXXALIASWARN (mbrtowc);
     310  # endif
     311  #elif defined GNULIB_POSIXCHECK
     312  # undef mbrtowc
     313  # if HAVE_RAW_DECL_MBRTOWC
     314  _GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - "
     315                   "use gnulib module mbrtowc for portability");
     316  # endif
     317  #endif
     318  
     319  
     320  /* Recognize a multibyte character.  */
     321  #if @GNULIB_MBRLEN@
     322  # if @REPLACE_MBRLEN@
     323  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     324  #   undef mbrlen
     325  #   define mbrlen rpl_mbrlen
     326  #  endif
     327  _GL_FUNCDECL_RPL (mbrlen, size_t,
     328                    (const char *restrict s, size_t n, mbstate_t *restrict ps));
     329  _GL_CXXALIAS_RPL (mbrlen, size_t,
     330                    (const char *restrict s, size_t n, mbstate_t *restrict ps));
     331  # else
     332  #  if !@HAVE_MBRLEN@
     333  _GL_FUNCDECL_SYS (mbrlen, size_t,
     334                    (const char *restrict s, size_t n, mbstate_t *restrict ps));
     335  #  endif
     336  _GL_CXXALIAS_SYS (mbrlen, size_t,
     337                    (const char *restrict s, size_t n, mbstate_t *restrict ps));
     338  # endif
     339  # if __GLIBC__ >= 2
     340  _GL_CXXALIASWARN (mbrlen);
     341  # endif
     342  #elif defined GNULIB_POSIXCHECK
     343  # undef mbrlen
     344  # if HAVE_RAW_DECL_MBRLEN
     345  _GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - "
     346                   "use gnulib module mbrlen for portability");
     347  # endif
     348  #endif
     349  
     350  
     351  /* Convert a string to a wide string.  */
     352  #if @GNULIB_MBSRTOWCS@
     353  # if @REPLACE_MBSRTOWCS@
     354  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     355  #   undef mbsrtowcs
     356  #   define mbsrtowcs rpl_mbsrtowcs
     357  #  endif
     358  _GL_FUNCDECL_RPL (mbsrtowcs, size_t,
     359                    (wchar_t *restrict dest,
     360                     const char **restrict srcp, size_t len,
     361                     mbstate_t *restrict ps)
     362                    _GL_ARG_NONNULL ((2)));
     363  _GL_CXXALIAS_RPL (mbsrtowcs, size_t,
     364                    (wchar_t *restrict dest,
     365                     const char **restrict srcp, size_t len,
     366                     mbstate_t *restrict ps));
     367  # else
     368  #  if !@HAVE_MBSRTOWCS@
     369  _GL_FUNCDECL_SYS (mbsrtowcs, size_t,
     370                    (wchar_t *restrict dest,
     371                     const char **restrict srcp, size_t len,
     372                     mbstate_t *restrict ps)
     373                    _GL_ARG_NONNULL ((2)));
     374  #  endif
     375  _GL_CXXALIAS_SYS (mbsrtowcs, size_t,
     376                    (wchar_t *restrict dest,
     377                     const char **restrict srcp, size_t len,
     378                     mbstate_t *restrict ps));
     379  # endif
     380  # if __GLIBC__ >= 2
     381  _GL_CXXALIASWARN (mbsrtowcs);
     382  # endif
     383  #elif defined GNULIB_POSIXCHECK
     384  # undef mbsrtowcs
     385  # if HAVE_RAW_DECL_MBSRTOWCS
     386  _GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - "
     387                   "use gnulib module mbsrtowcs for portability");
     388  # endif
     389  #endif
     390  
     391  
     392  /* Convert a string to a wide string.  */
     393  #if @GNULIB_MBSNRTOWCS@
     394  # if @REPLACE_MBSNRTOWCS@
     395  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     396  #   undef mbsnrtowcs
     397  #   define mbsnrtowcs rpl_mbsnrtowcs
     398  #  endif
     399  _GL_FUNCDECL_RPL (mbsnrtowcs, size_t,
     400                    (wchar_t *restrict dest,
     401                     const char **restrict srcp, size_t srclen, size_t len,
     402                     mbstate_t *restrict ps)
     403                    _GL_ARG_NONNULL ((2)));
     404  _GL_CXXALIAS_RPL (mbsnrtowcs, size_t,
     405                    (wchar_t *restrict dest,
     406                     const char **restrict srcp, size_t srclen, size_t len,
     407                     mbstate_t *restrict ps));
     408  # else
     409  #  if !@HAVE_MBSNRTOWCS@
     410  _GL_FUNCDECL_SYS (mbsnrtowcs, size_t,
     411                    (wchar_t *restrict dest,
     412                     const char **restrict srcp, size_t srclen, size_t len,
     413                     mbstate_t *restrict ps)
     414                    _GL_ARG_NONNULL ((2)));
     415  #  endif
     416  _GL_CXXALIAS_SYS (mbsnrtowcs, size_t,
     417                    (wchar_t *restrict dest,
     418                     const char **restrict srcp, size_t srclen, size_t len,
     419                     mbstate_t *restrict ps));
     420  # endif
     421  _GL_CXXALIASWARN (mbsnrtowcs);
     422  #elif defined GNULIB_POSIXCHECK
     423  # undef mbsnrtowcs
     424  # if HAVE_RAW_DECL_MBSNRTOWCS
     425  _GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - "
     426                   "use gnulib module mbsnrtowcs for portability");
     427  # endif
     428  #endif
     429  
     430  
     431  /* Convert a wide character to a multibyte character.  */
     432  #if @GNULIB_WCRTOMB@
     433  # if @REPLACE_WCRTOMB@
     434  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     435  #   undef wcrtomb
     436  #   define wcrtomb rpl_wcrtomb
     437  #  endif
     438  _GL_FUNCDECL_RPL (wcrtomb, size_t,
     439                    (char *restrict s, wchar_t wc, mbstate_t *restrict ps));
     440  _GL_CXXALIAS_RPL (wcrtomb, size_t,
     441                    (char *restrict s, wchar_t wc, mbstate_t *restrict ps));
     442  # else
     443  #  if !@HAVE_WCRTOMB@
     444  _GL_FUNCDECL_SYS (wcrtomb, size_t,
     445                    (char *restrict s, wchar_t wc, mbstate_t *restrict ps));
     446  #  endif
     447  _GL_CXXALIAS_SYS (wcrtomb, size_t,
     448                    (char *restrict s, wchar_t wc, mbstate_t *restrict ps));
     449  # endif
     450  # if __GLIBC__ >= 2
     451  _GL_CXXALIASWARN (wcrtomb);
     452  # endif
     453  #elif defined GNULIB_POSIXCHECK
     454  # undef wcrtomb
     455  # if HAVE_RAW_DECL_WCRTOMB
     456  _GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - "
     457                   "use gnulib module wcrtomb for portability");
     458  # endif
     459  #endif
     460  
     461  
     462  /* Convert a wide string to a string.  */
     463  #if @GNULIB_WCSRTOMBS@
     464  # if @REPLACE_WCSRTOMBS@
     465  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     466  #   undef wcsrtombs
     467  #   define wcsrtombs rpl_wcsrtombs
     468  #  endif
     469  _GL_FUNCDECL_RPL (wcsrtombs, size_t,
     470                    (char *restrict dest, const wchar_t **restrict srcp,
     471                     size_t len,
     472                     mbstate_t *restrict ps)
     473                    _GL_ARG_NONNULL ((2)));
     474  _GL_CXXALIAS_RPL (wcsrtombs, size_t,
     475                    (char *restrict dest, const wchar_t **restrict srcp,
     476                     size_t len,
     477                     mbstate_t *restrict ps));
     478  # else
     479  #  if !@HAVE_WCSRTOMBS@
     480  _GL_FUNCDECL_SYS (wcsrtombs, size_t,
     481                    (char *restrict dest, const wchar_t **restrict srcp,
     482                     size_t len,
     483                     mbstate_t *restrict ps)
     484                    _GL_ARG_NONNULL ((2)));
     485  #  endif
     486  _GL_CXXALIAS_SYS (wcsrtombs, size_t,
     487                    (char *restrict dest, const wchar_t **restrict srcp,
     488                     size_t len,
     489                     mbstate_t *restrict ps));
     490  # endif
     491  # if __GLIBC__ >= 2
     492  _GL_CXXALIASWARN (wcsrtombs);
     493  # endif
     494  #elif defined GNULIB_POSIXCHECK
     495  # undef wcsrtombs
     496  # if HAVE_RAW_DECL_WCSRTOMBS
     497  _GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - "
     498                   "use gnulib module wcsrtombs for portability");
     499  # endif
     500  #endif
     501  
     502  
     503  /* Convert a wide string to a string.  */
     504  #if @GNULIB_WCSNRTOMBS@
     505  # if @REPLACE_WCSNRTOMBS@
     506  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     507  #   undef wcsnrtombs
     508  #   define wcsnrtombs rpl_wcsnrtombs
     509  #  endif
     510  _GL_FUNCDECL_RPL (wcsnrtombs, size_t,
     511                    (char *restrict dest,
     512                     const wchar_t **restrict srcp, size_t srclen,
     513                     size_t len,
     514                     mbstate_t *restrict ps)
     515                    _GL_ARG_NONNULL ((2)));
     516  _GL_CXXALIAS_RPL (wcsnrtombs, size_t,
     517                    (char *restrict dest,
     518                     const wchar_t **restrict srcp, size_t srclen,
     519                     size_t len,
     520                     mbstate_t *restrict ps));
     521  # else
     522  #  if !@HAVE_WCSNRTOMBS@ || (defined __cplusplus && defined __sun)
     523  _GL_FUNCDECL_SYS (wcsnrtombs, size_t,
     524                    (char *restrict dest,
     525                     const wchar_t **restrict srcp, size_t srclen,
     526                     size_t len,
     527                     mbstate_t *restrict ps)
     528                    _GL_ARG_NONNULL ((2)));
     529  #  endif
     530  _GL_CXXALIAS_SYS (wcsnrtombs, size_t,
     531                    (char *restrict dest,
     532                     const wchar_t **restrict srcp, size_t srclen,
     533                     size_t len,
     534                     mbstate_t *restrict ps));
     535  # endif
     536  # if __GLIBC__ >= 2
     537  _GL_CXXALIASWARN (wcsnrtombs);
     538  # endif
     539  #elif defined GNULIB_POSIXCHECK
     540  # undef wcsnrtombs
     541  # if HAVE_RAW_DECL_WCSNRTOMBS
     542  _GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - "
     543                   "use gnulib module wcsnrtombs for portability");
     544  # endif
     545  #endif
     546  
     547  
     548  /* Return the number of screen columns needed for WC.  */
     549  #if @GNULIB_WCWIDTH@
     550  # if @REPLACE_WCWIDTH@
     551  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     552  #   undef wcwidth
     553  #   define wcwidth rpl_wcwidth
     554  #  endif
     555  _GL_FUNCDECL_RPL (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE);
     556  _GL_CXXALIAS_RPL (wcwidth, int, (wchar_t));
     557  # else
     558  #  if !@HAVE_DECL_WCWIDTH@
     559  /* wcwidth exists but is not declared.  */
     560  _GL_FUNCDECL_SYS (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE);
     561  #  endif
     562  _GL_CXXALIAS_SYS (wcwidth, int, (wchar_t));
     563  # endif
     564  # if __GLIBC__ >= 2
     565  _GL_CXXALIASWARN (wcwidth);
     566  # endif
     567  #elif defined GNULIB_POSIXCHECK
     568  # undef wcwidth
     569  # if HAVE_RAW_DECL_WCWIDTH
     570  _GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - "
     571                   "use gnulib module wcwidth for portability");
     572  # endif
     573  #endif
     574  
     575  
     576  /* Search N wide characters of S for C.  */
     577  #if @GNULIB_WMEMCHR@
     578  # if !@HAVE_WMEMCHR@
     579  _GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n)
     580                                        _GL_ATTRIBUTE_PURE);
     581  # endif
     582    /* On some systems, this function is defined as an overloaded function:
     583         extern "C++" {
     584           const wchar_t * std::wmemchr (const wchar_t *, wchar_t, size_t);
     585           wchar_t * std::wmemchr (wchar_t *, wchar_t, size_t);
     586         }  */
     587  _GL_CXXALIAS_SYS_CAST2 (wmemchr,
     588                          wchar_t *, (const wchar_t *, wchar_t, size_t),
     589                          const wchar_t *, (const wchar_t *, wchar_t, size_t));
     590  # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
     591       && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
     592  _GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
     593  _GL_CXXALIASWARN1 (wmemchr, const wchar_t *,
     594                     (const wchar_t *s, wchar_t c, size_t n));
     595  # elif __GLIBC__ >= 2
     596  _GL_CXXALIASWARN (wmemchr);
     597  # endif
     598  #elif defined GNULIB_POSIXCHECK
     599  # undef wmemchr
     600  # if HAVE_RAW_DECL_WMEMCHR
     601  _GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - "
     602                   "use gnulib module wmemchr for portability");
     603  # endif
     604  #endif
     605  
     606  
     607  /* Compare N wide characters of S1 and S2.  */
     608  #if @GNULIB_WMEMCMP@
     609  # if !@HAVE_WMEMCMP@
     610  _GL_FUNCDECL_SYS (wmemcmp, int,
     611                    (const wchar_t *s1, const wchar_t *s2, size_t n)
     612                    _GL_ATTRIBUTE_PURE);
     613  # endif
     614  _GL_CXXALIAS_SYS (wmemcmp, int,
     615                    (const wchar_t *s1, const wchar_t *s2, size_t n));
     616  # if __GLIBC__ >= 2
     617  _GL_CXXALIASWARN (wmemcmp);
     618  # endif
     619  #elif defined GNULIB_POSIXCHECK
     620  # undef wmemcmp
     621  # if HAVE_RAW_DECL_WMEMCMP
     622  _GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - "
     623                   "use gnulib module wmemcmp for portability");
     624  # endif
     625  #endif
     626  
     627  
     628  /* Copy N wide characters of SRC to DEST.  */
     629  #if @GNULIB_WMEMCPY@
     630  # if !@HAVE_WMEMCPY@
     631  _GL_FUNCDECL_SYS (wmemcpy, wchar_t *,
     632                    (wchar_t *restrict dest,
     633                     const wchar_t *restrict src, size_t n));
     634  # endif
     635  _GL_CXXALIAS_SYS (wmemcpy, wchar_t *,
     636                    (wchar_t *restrict dest,
     637                     const wchar_t *restrict src, size_t n));
     638  # if __GLIBC__ >= 2
     639  _GL_CXXALIASWARN (wmemcpy);
     640  # endif
     641  #elif defined GNULIB_POSIXCHECK
     642  # undef wmemcpy
     643  # if HAVE_RAW_DECL_WMEMCPY
     644  _GL_WARN_ON_USE (wmemcpy, "wmemcpy is unportable - "
     645                   "use gnulib module wmemcpy for portability");
     646  # endif
     647  #endif
     648  
     649  
     650  /* Copy N wide characters of SRC to DEST, guaranteeing correct behavior for
     651     overlapping memory areas.  */
     652  #if @GNULIB_WMEMMOVE@
     653  # if !@HAVE_WMEMMOVE@
     654  _GL_FUNCDECL_SYS (wmemmove, wchar_t *,
     655                    (wchar_t *dest, const wchar_t *src, size_t n));
     656  # endif
     657  _GL_CXXALIAS_SYS (wmemmove, wchar_t *,
     658                    (wchar_t *dest, const wchar_t *src, size_t n));
     659  # if __GLIBC__ >= 2
     660  _GL_CXXALIASWARN (wmemmove);
     661  # endif
     662  #elif defined GNULIB_POSIXCHECK
     663  # undef wmemmove
     664  # if HAVE_RAW_DECL_WMEMMOVE
     665  _GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - "
     666                   "use gnulib module wmemmove for portability");
     667  # endif
     668  #endif
     669  
     670  
     671  /* Copy N wide characters of SRC to DEST.
     672     Return pointer to wide characters after the last written wide character.  */
     673  #if @GNULIB_WMEMPCPY@
     674  # if !@HAVE_WMEMPCPY@
     675  _GL_FUNCDECL_SYS (wmempcpy, wchar_t *,
     676                    (wchar_t *restrict dest,
     677                     const wchar_t *restrict src, size_t n));
     678  # endif
     679  _GL_CXXALIAS_SYS (wmempcpy, wchar_t *,
     680                    (wchar_t *restrict dest,
     681                     const wchar_t *restrict src, size_t n));
     682  # if __GLIBC__ >= 2
     683  _GL_CXXALIASWARN (wmempcpy);
     684  # endif
     685  #elif defined GNULIB_POSIXCHECK
     686  # undef wmempcpy
     687  # if HAVE_RAW_DECL_WMEMPCPY
     688  _GL_WARN_ON_USE (wmempcpy, "wmempcpy is unportable - "
     689                   "use gnulib module wmempcpy for portability");
     690  # endif
     691  #endif
     692  
     693  
     694  /* Set N wide characters of S to C.  */
     695  #if @GNULIB_WMEMSET@
     696  # if !@HAVE_WMEMSET@
     697  _GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
     698  # endif
     699  _GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
     700  # if __GLIBC__ >= 2
     701  _GL_CXXALIASWARN (wmemset);
     702  # endif
     703  #elif defined GNULIB_POSIXCHECK
     704  # undef wmemset
     705  # if HAVE_RAW_DECL_WMEMSET
     706  _GL_WARN_ON_USE (wmemset, "wmemset is unportable - "
     707                   "use gnulib module wmemset for portability");
     708  # endif
     709  #endif
     710  
     711  
     712  /* Return the number of wide characters in S.  */
     713  #if @GNULIB_WCSLEN@
     714  # if !@HAVE_WCSLEN@
     715  _GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s) _GL_ATTRIBUTE_PURE);
     716  # endif
     717  _GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s));
     718  # if __GLIBC__ >= 2
     719  _GL_CXXALIASWARN (wcslen);
     720  # endif
     721  #elif defined GNULIB_POSIXCHECK
     722  # undef wcslen
     723  # if HAVE_RAW_DECL_WCSLEN
     724  _GL_WARN_ON_USE (wcslen, "wcslen is unportable - "
     725                   "use gnulib module wcslen for portability");
     726  # endif
     727  #endif
     728  
     729  
     730  /* Return the number of wide characters in S, but at most MAXLEN.  */
     731  #if @GNULIB_WCSNLEN@
     732  # if !@HAVE_WCSNLEN@
     733  _GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen)
     734                                     _GL_ATTRIBUTE_PURE);
     735  # endif
     736  _GL_CXXALIAS_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen));
     737  _GL_CXXALIASWARN (wcsnlen);
     738  #elif defined GNULIB_POSIXCHECK
     739  # undef wcsnlen
     740  # if HAVE_RAW_DECL_WCSNLEN
     741  _GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - "
     742                   "use gnulib module wcsnlen for portability");
     743  # endif
     744  #endif
     745  
     746  
     747  /* Copy SRC to DEST.  */
     748  #if @GNULIB_WCSCPY@
     749  # if !@HAVE_WCSCPY@
     750  _GL_FUNCDECL_SYS (wcscpy, wchar_t *,
     751                    (wchar_t *restrict dest, const wchar_t *restrict src));
     752  # endif
     753  _GL_CXXALIAS_SYS (wcscpy, wchar_t *,
     754                    (wchar_t *restrict dest, const wchar_t *restrict src));
     755  # if __GLIBC__ >= 2
     756  _GL_CXXALIASWARN (wcscpy);
     757  # endif
     758  #elif defined GNULIB_POSIXCHECK
     759  # undef wcscpy
     760  # if HAVE_RAW_DECL_WCSCPY
     761  _GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - "
     762                   "use gnulib module wcscpy for portability");
     763  # endif
     764  #endif
     765  
     766  
     767  /* Copy SRC to DEST, returning the address of the terminating L'\0' in DEST.  */
     768  #if @GNULIB_WCPCPY@
     769  # if !@HAVE_WCPCPY@
     770  _GL_FUNCDECL_SYS (wcpcpy, wchar_t *,
     771                    (wchar_t *restrict dest, const wchar_t *restrict src));
     772  # endif
     773  _GL_CXXALIAS_SYS (wcpcpy, wchar_t *,
     774                    (wchar_t *restrict dest, const wchar_t *restrict src));
     775  _GL_CXXALIASWARN (wcpcpy);
     776  #elif defined GNULIB_POSIXCHECK
     777  # undef wcpcpy
     778  # if HAVE_RAW_DECL_WCPCPY
     779  _GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - "
     780                   "use gnulib module wcpcpy for portability");
     781  # endif
     782  #endif
     783  
     784  
     785  /* Copy no more than N wide characters of SRC to DEST.  */
     786  #if @GNULIB_WCSNCPY@
     787  # if !@HAVE_WCSNCPY@
     788  _GL_FUNCDECL_SYS (wcsncpy, wchar_t *,
     789                    (wchar_t *restrict dest,
     790                     const wchar_t *restrict src, size_t n));
     791  # endif
     792  _GL_CXXALIAS_SYS (wcsncpy, wchar_t *,
     793                    (wchar_t *restrict dest,
     794                     const wchar_t *restrict src, size_t n));
     795  # if __GLIBC__ >= 2
     796  _GL_CXXALIASWARN (wcsncpy);
     797  # endif
     798  #elif defined GNULIB_POSIXCHECK
     799  # undef wcsncpy
     800  # if HAVE_RAW_DECL_WCSNCPY
     801  _GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - "
     802                   "use gnulib module wcsncpy for portability");
     803  # endif
     804  #endif
     805  
     806  
     807  /* Copy no more than N characters of SRC to DEST, returning the address of
     808     the last character written into DEST.  */
     809  #if @GNULIB_WCPNCPY@
     810  # if !@HAVE_WCPNCPY@
     811  _GL_FUNCDECL_SYS (wcpncpy, wchar_t *,
     812                    (wchar_t *restrict dest,
     813                     const wchar_t *restrict src, size_t n));
     814  # endif
     815  _GL_CXXALIAS_SYS (wcpncpy, wchar_t *,
     816                    (wchar_t *restrict dest,
     817                     const wchar_t *restrict src, size_t n));
     818  _GL_CXXALIASWARN (wcpncpy);
     819  #elif defined GNULIB_POSIXCHECK
     820  # undef wcpncpy
     821  # if HAVE_RAW_DECL_WCPNCPY
     822  _GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - "
     823                   "use gnulib module wcpncpy for portability");
     824  # endif
     825  #endif
     826  
     827  
     828  /* Append SRC onto DEST.  */
     829  #if @GNULIB_WCSCAT@
     830  # if !@HAVE_WCSCAT@
     831  _GL_FUNCDECL_SYS (wcscat, wchar_t *,
     832                    (wchar_t *restrict dest, const wchar_t *restrict src));
     833  # endif
     834  _GL_CXXALIAS_SYS (wcscat, wchar_t *,
     835                    (wchar_t *restrict dest, const wchar_t *restrict src));
     836  # if __GLIBC__ >= 2
     837  _GL_CXXALIASWARN (wcscat);
     838  # endif
     839  #elif defined GNULIB_POSIXCHECK
     840  # undef wcscat
     841  # if HAVE_RAW_DECL_WCSCAT
     842  _GL_WARN_ON_USE (wcscat, "wcscat is unportable - "
     843                   "use gnulib module wcscat for portability");
     844  # endif
     845  #endif
     846  
     847  
     848  /* Append no more than N wide characters of SRC onto DEST.  */
     849  #if @GNULIB_WCSNCAT@
     850  # if !@HAVE_WCSNCAT@
     851  _GL_FUNCDECL_SYS (wcsncat, wchar_t *,
     852                    (wchar_t *restrict dest, const wchar_t *restrict src,
     853                     size_t n));
     854  # endif
     855  _GL_CXXALIAS_SYS (wcsncat, wchar_t *,
     856                    (wchar_t *restrict dest, const wchar_t *restrict src,
     857                     size_t n));
     858  # if __GLIBC__ >= 2
     859  _GL_CXXALIASWARN (wcsncat);
     860  # endif
     861  #elif defined GNULIB_POSIXCHECK
     862  # undef wcsncat
     863  # if HAVE_RAW_DECL_WCSNCAT
     864  _GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - "
     865                   "use gnulib module wcsncat for portability");
     866  # endif
     867  #endif
     868  
     869  
     870  /* Compare S1 and S2.  */
     871  #if @GNULIB_WCSCMP@
     872  # if !@HAVE_WCSCMP@
     873  _GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)
     874                                 _GL_ATTRIBUTE_PURE);
     875  # endif
     876  _GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
     877  # if __GLIBC__ >= 2
     878  _GL_CXXALIASWARN (wcscmp);
     879  # endif
     880  #elif defined GNULIB_POSIXCHECK
     881  # undef wcscmp
     882  # if HAVE_RAW_DECL_WCSCMP
     883  _GL_WARN_ON_USE (wcscmp, "wcscmp is unportable - "
     884                   "use gnulib module wcscmp for portability");
     885  # endif
     886  #endif
     887  
     888  
     889  /* Compare no more than N wide characters of S1 and S2.  */
     890  #if @GNULIB_WCSNCMP@
     891  # if !@HAVE_WCSNCMP@
     892  _GL_FUNCDECL_SYS (wcsncmp, int,
     893                    (const wchar_t *s1, const wchar_t *s2, size_t n)
     894                    _GL_ATTRIBUTE_PURE);
     895  # endif
     896  _GL_CXXALIAS_SYS (wcsncmp, int,
     897                    (const wchar_t *s1, const wchar_t *s2, size_t n));
     898  # if __GLIBC__ >= 2
     899  _GL_CXXALIASWARN (wcsncmp);
     900  # endif
     901  #elif defined GNULIB_POSIXCHECK
     902  # undef wcsncmp
     903  # if HAVE_RAW_DECL_WCSNCMP
     904  _GL_WARN_ON_USE (wcsncmp, "wcsncmp is unportable - "
     905                   "use gnulib module wcsncmp for portability");
     906  # endif
     907  #endif
     908  
     909  
     910  /* Compare S1 and S2, ignoring case.  */
     911  #if @GNULIB_WCSCASECMP@
     912  # if !@HAVE_WCSCASECMP@
     913  _GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2)
     914                                     _GL_ATTRIBUTE_PURE);
     915  # endif
     916  _GL_CXXALIAS_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2));
     917  _GL_CXXALIASWARN (wcscasecmp);
     918  #elif defined GNULIB_POSIXCHECK
     919  # undef wcscasecmp
     920  # if HAVE_RAW_DECL_WCSCASECMP
     921  _GL_WARN_ON_USE (wcscasecmp, "wcscasecmp is unportable - "
     922                   "use gnulib module wcscasecmp for portability");
     923  # endif
     924  #endif
     925  
     926  
     927  /* Compare no more than N chars of S1 and S2, ignoring case.  */
     928  #if @GNULIB_WCSNCASECMP@
     929  # if !@HAVE_WCSNCASECMP@
     930  _GL_FUNCDECL_SYS (wcsncasecmp, int,
     931                    (const wchar_t *s1, const wchar_t *s2, size_t n)
     932                    _GL_ATTRIBUTE_PURE);
     933  # endif
     934  _GL_CXXALIAS_SYS (wcsncasecmp, int,
     935                    (const wchar_t *s1, const wchar_t *s2, size_t n));
     936  _GL_CXXALIASWARN (wcsncasecmp);
     937  #elif defined GNULIB_POSIXCHECK
     938  # undef wcsncasecmp
     939  # if HAVE_RAW_DECL_WCSNCASECMP
     940  _GL_WARN_ON_USE (wcsncasecmp, "wcsncasecmp is unportable - "
     941                   "use gnulib module wcsncasecmp for portability");
     942  # endif
     943  #endif
     944  
     945  
     946  /* Compare S1 and S2, both interpreted as appropriate to the LC_COLLATE
     947     category of the current locale.  */
     948  #if @GNULIB_WCSCOLL@
     949  # if !@HAVE_WCSCOLL@
     950  _GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
     951  # endif
     952  _GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
     953  # if __GLIBC__ >= 2
     954  _GL_CXXALIASWARN (wcscoll);
     955  # endif
     956  #elif defined GNULIB_POSIXCHECK
     957  # undef wcscoll
     958  # if HAVE_RAW_DECL_WCSCOLL
     959  _GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - "
     960                   "use gnulib module wcscoll for portability");
     961  # endif
     962  #endif
     963  
     964  
     965  /* Transform S2 into array pointed to by S1 such that if wcscmp is applied
     966     to two transformed strings the result is the as applying 'wcscoll' to the
     967     original strings.  */
     968  #if @GNULIB_WCSXFRM@
     969  # if !@HAVE_WCSXFRM@
     970  _GL_FUNCDECL_SYS (wcsxfrm, size_t,
     971                    (wchar_t *restrict s1, const wchar_t *restrict s2, size_t n));
     972  # endif
     973  _GL_CXXALIAS_SYS (wcsxfrm, size_t,
     974                    (wchar_t *restrict s1, const wchar_t *restrict s2, size_t n));
     975  # if __GLIBC__ >= 2
     976  _GL_CXXALIASWARN (wcsxfrm);
     977  # endif
     978  #elif defined GNULIB_POSIXCHECK
     979  # undef wcsxfrm
     980  # if HAVE_RAW_DECL_WCSXFRM
     981  _GL_WARN_ON_USE (wcsxfrm, "wcsxfrm is unportable - "
     982                   "use gnulib module wcsxfrm for portability");
     983  # endif
     984  #endif
     985  
     986  
     987  /* Duplicate S, returning an identical malloc'd string.  */
     988  #if @GNULIB_WCSDUP@
     989  # if defined _WIN32 && !defined __CYGWIN__
     990  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     991  #   undef wcsdup
     992  #   define wcsdup _wcsdup
     993  #  endif
     994  _GL_CXXALIAS_MDA (wcsdup, wchar_t *, (const wchar_t *s));
     995  # else
     996  #  if !@HAVE_WCSDUP@ || __GNUC__ >= 11
     997  _GL_FUNCDECL_SYS (wcsdup, wchar_t *,
     998                    (const wchar_t *s)
     999                    _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
    1000  #  endif
    1001  _GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s));
    1002  # endif
    1003  _GL_CXXALIASWARN (wcsdup);
    1004  #else
    1005  # if __GNUC__ >= 11 && !defined wcsdup
    1006  /* For -Wmismatched-dealloc: Associate wcsdup with free or rpl_free.  */
    1007  _GL_FUNCDECL_SYS (wcsdup, wchar_t *,
    1008                    (const wchar_t *s)
    1009                    _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
    1010  # endif
    1011  # if defined GNULIB_POSIXCHECK
    1012  #  undef wcsdup
    1013  #  if HAVE_RAW_DECL_WCSDUP
    1014  _GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - "
    1015                   "use gnulib module wcsdup for portability");
    1016  #  endif
    1017  # elif @GNULIB_MDA_WCSDUP@
    1018  /* On native Windows, map 'wcsdup' to '_wcsdup', so that -loldnames is not
    1019     required.  In C++ with GNULIB_NAMESPACE, avoid differences between
    1020     platforms by defining GNULIB_NAMESPACE::wcsdup always.  */
    1021  #  if defined _WIN32 && !defined __CYGWIN__
    1022  #   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1023  #    undef wcsdup
    1024  #    define wcsdup _wcsdup
    1025  #   endif
    1026  _GL_CXXALIAS_MDA (wcsdup, wchar_t *, (const wchar_t *s));
    1027  #  else
    1028  _GL_FUNCDECL_SYS (wcsdup, wchar_t *,
    1029                    (const wchar_t *s)
    1030                    _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
    1031  #   if @HAVE_DECL_WCSDUP@
    1032  _GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s));
    1033  #   endif
    1034  #  endif
    1035  #  if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_WCSDUP@
    1036  _GL_CXXALIASWARN (wcsdup);
    1037  #  endif
    1038  # endif
    1039  #endif
    1040  
    1041  
    1042  /* Find the first occurrence of WC in WCS.  */
    1043  #if @GNULIB_WCSCHR@
    1044  # if !@HAVE_WCSCHR@
    1045  _GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc)
    1046                                       _GL_ATTRIBUTE_PURE);
    1047  # endif
    1048    /* On some systems, this function is defined as an overloaded function:
    1049         extern "C++" {
    1050           const wchar_t * std::wcschr (const wchar_t *, wchar_t);
    1051           wchar_t * std::wcschr (wchar_t *, wchar_t);
    1052         }  */
    1053  _GL_CXXALIAS_SYS_CAST2 (wcschr,
    1054                          wchar_t *, (const wchar_t *, wchar_t),
    1055                          const wchar_t *, (const wchar_t *, wchar_t));
    1056  # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
    1057       && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
    1058  _GL_CXXALIASWARN1 (wcschr, wchar_t *, (wchar_t *wcs, wchar_t wc));
    1059  _GL_CXXALIASWARN1 (wcschr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
    1060  # elif __GLIBC__ >= 2
    1061  _GL_CXXALIASWARN (wcschr);
    1062  # endif
    1063  #elif defined GNULIB_POSIXCHECK
    1064  # undef wcschr
    1065  # if HAVE_RAW_DECL_WCSCHR
    1066  _GL_WARN_ON_USE (wcschr, "wcschr is unportable - "
    1067                   "use gnulib module wcschr for portability");
    1068  # endif
    1069  #endif
    1070  
    1071  
    1072  /* Find the last occurrence of WC in WCS.  */
    1073  #if @GNULIB_WCSRCHR@
    1074  # if !@HAVE_WCSRCHR@
    1075  _GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc)
    1076                                        _GL_ATTRIBUTE_PURE);
    1077  # endif
    1078    /* On some systems, this function is defined as an overloaded function:
    1079         extern "C++" {
    1080           const wchar_t * std::wcsrchr (const wchar_t *, wchar_t);
    1081           wchar_t * std::wcsrchr (wchar_t *, wchar_t);
    1082         }  */
    1083  _GL_CXXALIAS_SYS_CAST2 (wcsrchr,
    1084                          wchar_t *, (const wchar_t *, wchar_t),
    1085                          const wchar_t *, (const wchar_t *, wchar_t));
    1086  # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
    1087       && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
    1088  _GL_CXXALIASWARN1 (wcsrchr, wchar_t *, (wchar_t *wcs, wchar_t wc));
    1089  _GL_CXXALIASWARN1 (wcsrchr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
    1090  # elif __GLIBC__ >= 2
    1091  _GL_CXXALIASWARN (wcsrchr);
    1092  # endif
    1093  #elif defined GNULIB_POSIXCHECK
    1094  # undef wcsrchr
    1095  # if HAVE_RAW_DECL_WCSRCHR
    1096  _GL_WARN_ON_USE (wcsrchr, "wcsrchr is unportable - "
    1097                   "use gnulib module wcsrchr for portability");
    1098  # endif
    1099  #endif
    1100  
    1101  
    1102  /* Return the length of the initial segmet of WCS which consists entirely
    1103     of wide characters not in REJECT.  */
    1104  #if @GNULIB_WCSCSPN@
    1105  # if !@HAVE_WCSCSPN@
    1106  _GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject)
    1107                                     _GL_ATTRIBUTE_PURE);
    1108  # endif
    1109  _GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject));
    1110  # if __GLIBC__ >= 2
    1111  _GL_CXXALIASWARN (wcscspn);
    1112  # endif
    1113  #elif defined GNULIB_POSIXCHECK
    1114  # undef wcscspn
    1115  # if HAVE_RAW_DECL_WCSCSPN
    1116  _GL_WARN_ON_USE (wcscspn, "wcscspn is unportable - "
    1117                   "use gnulib module wcscspn for portability");
    1118  # endif
    1119  #endif
    1120  
    1121  
    1122  /* Return the length of the initial segmet of WCS which consists entirely
    1123     of wide characters in ACCEPT.  */
    1124  #if @GNULIB_WCSSPN@
    1125  # if !@HAVE_WCSSPN@
    1126  _GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept)
    1127                                    _GL_ATTRIBUTE_PURE);
    1128  # endif
    1129  _GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept));
    1130  # if __GLIBC__ >= 2
    1131  _GL_CXXALIASWARN (wcsspn);
    1132  # endif
    1133  #elif defined GNULIB_POSIXCHECK
    1134  # undef wcsspn
    1135  # if HAVE_RAW_DECL_WCSSPN
    1136  _GL_WARN_ON_USE (wcsspn, "wcsspn is unportable - "
    1137                   "use gnulib module wcsspn for portability");
    1138  # endif
    1139  #endif
    1140  
    1141  
    1142  /* Find the first occurrence in WCS of any character in ACCEPT.  */
    1143  #if @GNULIB_WCSPBRK@
    1144  # if !@HAVE_WCSPBRK@
    1145  _GL_FUNCDECL_SYS (wcspbrk, wchar_t *,
    1146                    (const wchar_t *wcs, const wchar_t *accept)
    1147                    _GL_ATTRIBUTE_PURE);
    1148  # endif
    1149    /* On some systems, this function is defined as an overloaded function:
    1150         extern "C++" {
    1151           const wchar_t * std::wcspbrk (const wchar_t *, const wchar_t *);
    1152           wchar_t * std::wcspbrk (wchar_t *, const wchar_t *);
    1153         }  */
    1154  _GL_CXXALIAS_SYS_CAST2 (wcspbrk,
    1155                          wchar_t *, (const wchar_t *, const wchar_t *),
    1156                          const wchar_t *, (const wchar_t *, const wchar_t *));
    1157  # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
    1158       && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
    1159  _GL_CXXALIASWARN1 (wcspbrk, wchar_t *,
    1160                     (wchar_t *wcs, const wchar_t *accept));
    1161  _GL_CXXALIASWARN1 (wcspbrk, const wchar_t *,
    1162                     (const wchar_t *wcs, const wchar_t *accept));
    1163  # elif __GLIBC__ >= 2
    1164  _GL_CXXALIASWARN (wcspbrk);
    1165  # endif
    1166  #elif defined GNULIB_POSIXCHECK
    1167  # undef wcspbrk
    1168  # if HAVE_RAW_DECL_WCSPBRK
    1169  _GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - "
    1170                   "use gnulib module wcspbrk for portability");
    1171  # endif
    1172  #endif
    1173  
    1174  
    1175  /* Find the first occurrence of NEEDLE in HAYSTACK.  */
    1176  #if @GNULIB_WCSSTR@
    1177  # if !@HAVE_WCSSTR@
    1178  _GL_FUNCDECL_SYS (wcsstr, wchar_t *,
    1179                    (const wchar_t *restrict haystack,
    1180                     const wchar_t *restrict needle)
    1181                    _GL_ATTRIBUTE_PURE);
    1182  # endif
    1183    /* On some systems, this function is defined as an overloaded function:
    1184         extern "C++" {
    1185           const wchar_t * std::wcsstr (const wchar_t *, const wchar_t *);
    1186           wchar_t * std::wcsstr (wchar_t *, const wchar_t *);
    1187         }  */
    1188  _GL_CXXALIAS_SYS_CAST2 (wcsstr,
    1189                          wchar_t *,
    1190                          (const wchar_t *restrict, const wchar_t *restrict),
    1191                          const wchar_t *,
    1192                          (const wchar_t *restrict, const wchar_t *restrict));
    1193  # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
    1194       && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
    1195  _GL_CXXALIASWARN1 (wcsstr, wchar_t *,
    1196                     (wchar_t *restrict haystack,
    1197                      const wchar_t *restrict needle));
    1198  _GL_CXXALIASWARN1 (wcsstr, const wchar_t *,
    1199                     (const wchar_t *restrict haystack,
    1200                      const wchar_t *restrict needle));
    1201  # elif __GLIBC__ >= 2
    1202  _GL_CXXALIASWARN (wcsstr);
    1203  # endif
    1204  #elif defined GNULIB_POSIXCHECK
    1205  # undef wcsstr
    1206  # if HAVE_RAW_DECL_WCSSTR
    1207  _GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - "
    1208                   "use gnulib module wcsstr for portability");
    1209  # endif
    1210  #endif
    1211  
    1212  
    1213  /* Divide WCS into tokens separated by characters in DELIM.  */
    1214  #if @GNULIB_WCSTOK@
    1215  # if @REPLACE_WCSTOK@
    1216  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1217  #   undef wcstok
    1218  #   define wcstok rpl_wcstok
    1219  #  endif
    1220  _GL_FUNCDECL_RPL (wcstok, wchar_t *,
    1221                    (wchar_t *restrict wcs, const wchar_t *restrict delim,
    1222                     wchar_t **restrict ptr));
    1223  _GL_CXXALIAS_RPL (wcstok, wchar_t *,
    1224                    (wchar_t *restrict wcs, const wchar_t *restrict delim,
    1225                     wchar_t **restrict ptr));
    1226  # else
    1227  #  if !@HAVE_WCSTOK@
    1228  _GL_FUNCDECL_SYS (wcstok, wchar_t *,
    1229                    (wchar_t *restrict wcs, const wchar_t *restrict delim,
    1230                     wchar_t **restrict ptr));
    1231  #  endif
    1232  _GL_CXXALIAS_SYS (wcstok, wchar_t *,
    1233                    (wchar_t *restrict wcs, const wchar_t *restrict delim,
    1234                     wchar_t **restrict ptr));
    1235  # endif
    1236  # if __GLIBC__ >= 2
    1237  _GL_CXXALIASWARN (wcstok);
    1238  # endif
    1239  #elif defined GNULIB_POSIXCHECK
    1240  # undef wcstok
    1241  # if HAVE_RAW_DECL_WCSTOK
    1242  _GL_WARN_ON_USE (wcstok, "wcstok is unportable - "
    1243                   "use gnulib module wcstok for portability");
    1244  # endif
    1245  #endif
    1246  
    1247  
    1248  /* Determine number of column positions required for first N wide
    1249     characters (or fewer if S ends before this) in S.  */
    1250  #if @GNULIB_WCSWIDTH@
    1251  # if @REPLACE_WCSWIDTH@
    1252  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1253  #   undef wcswidth
    1254  #   define wcswidth rpl_wcswidth
    1255  #  endif
    1256  _GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n)
    1257                                   _GL_ATTRIBUTE_PURE);
    1258  _GL_CXXALIAS_RPL (wcswidth, int, (const wchar_t *s, size_t n));
    1259  # else
    1260  #  if !@HAVE_WCSWIDTH@
    1261  _GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n)
    1262                                   _GL_ATTRIBUTE_PURE);
    1263  #  endif
    1264  _GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n));
    1265  # endif
    1266  # if __GLIBC__ >= 2
    1267  _GL_CXXALIASWARN (wcswidth);
    1268  # endif
    1269  #elif defined GNULIB_POSIXCHECK
    1270  # undef wcswidth
    1271  # if HAVE_RAW_DECL_WCSWIDTH
    1272  _GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - "
    1273                   "use gnulib module wcswidth for portability");
    1274  # endif
    1275  #endif
    1276  
    1277  
    1278  /* Convert *TP to a date and time wide string.  See
    1279     <https://pubs.opengroup.org/onlinepubs/9699919799/functions/wcsftime.html>.  */
    1280  #if @GNULIB_WCSFTIME@
    1281  # if @REPLACE_WCSFTIME@
    1282  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1283  #   undef wcsftime
    1284  #   define wcsftime rpl_wcsftime
    1285  #  endif
    1286  _GL_FUNCDECL_RPL (wcsftime, size_t,
    1287                    (wchar_t *restrict __buf, size_t __bufsize,
    1288                     const wchar_t *restrict __fmt,
    1289                     const struct tm *restrict __tp)
    1290                    _GL_ARG_NONNULL ((1, 3, 4)));
    1291  _GL_CXXALIAS_RPL (wcsftime, size_t,
    1292                    (wchar_t *restrict __buf, size_t __bufsize,
    1293                     const wchar_t *restrict __fmt,
    1294                     const struct tm *restrict __tp));
    1295  # else
    1296  #  if !@HAVE_WCSFTIME@
    1297  _GL_FUNCDECL_SYS (wcsftime, size_t,
    1298                    (wchar_t *restrict __buf, size_t __bufsize,
    1299                     const wchar_t *restrict __fmt,
    1300                     const struct tm *restrict __tp)
    1301                    _GL_ARG_NONNULL ((1, 3, 4)));
    1302  #  endif
    1303  _GL_CXXALIAS_SYS (wcsftime, size_t,
    1304                    (wchar_t *restrict __buf, size_t __bufsize,
    1305                     const wchar_t *restrict __fmt,
    1306                     const struct tm *restrict __tp));
    1307  # endif
    1308  # if __GLIBC__ >= 2
    1309  _GL_CXXALIASWARN (wcsftime);
    1310  # endif
    1311  #elif defined GNULIB_POSIXCHECK
    1312  # undef wcsftime
    1313  # if HAVE_RAW_DECL_WCSFTIME
    1314  _GL_WARN_ON_USE (wcsftime, "wcsftime is unportable - "
    1315                   "use gnulib module wcsftime for portability");
    1316  # endif
    1317  #endif
    1318  
    1319  
    1320  #endif /* _@GUARD_PREFIX@_WCHAR_H */
    1321  #endif /* _@GUARD_PREFIX@_WCHAR_H */
    1322  #endif