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