diff options
Diffstat (limited to 'lib/wchar.in.h')
| -rw-r--r-- | lib/wchar.in.h | 207 |
1 files changed, 126 insertions, 81 deletions
diff --git a/lib/wchar.in.h b/lib/wchar.in.h index 54354559..a60a4dfc 100644 --- a/lib/wchar.in.h +++ b/lib/wchar.in.h @@ -1,6 +1,6 @@ /* A substitute for ISO C99 <wchar.h>, for platforms that have issues. - Copyright (C) 2007-2024 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -36,8 +36,7 @@ && ((defined _INTTYPES_INCLUDED \ && !defined _GL_FINISHED_INCLUDING_SYSTEM_INTTYPES_H) \ || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) \ - || (defined __MINGW32__ && defined __STRING_H_SOURCED__) \ - || defined _GL_ALREADY_INCLUDING_WCHAR_H) + || (defined __MINGW32__ && defined __STRING_H_SOURCED__)) /* Special invocation convention: - Inside glibc and uClibc header files, but not MinGW. - On HP-UX 11.00 we have a sequence of nested includes @@ -47,20 +46,18 @@ therefore we cannot provide the function overrides; instead include only the system's <wchar.h>. - With MinGW 3.22, when <string.h> includes <wchar.h>, only some part of - <wchar.h> is actually processed, and that doesn't include 'mbstate_t'. - - On IRIX 6.5, similarly, we have an include <wchar.h> -> <wctype.h>, and - the latter includes <wchar.h>. But here, we have no way to detect whether - <wctype.h> is completely included or is still being included. */ + <wchar.h> is actually processed, and that doesn't include 'mbstate_t'. */ #@INCLUDE_NEXT@ @NEXT_WCHAR_H@ +/* The glibc 2.5 /usr/include/wchar.h defines __need_wint_t but never undefines + it. We need to do that here. */ +#undef __need_wint_t #else /* Normal invocation convention. */ #ifndef _@GUARD_PREFIX@_WCHAR_H -#define _GL_ALREADY_INCLUDING_WCHAR_H - #if @HAVE_FEATURES_H@ # include <features.h> /* for __GLIBC__ */ #endif @@ -79,8 +76,6 @@ # @INCLUDE_NEXT@ @NEXT_WCHAR_H@ #endif -#undef _GL_ALREADY_INCLUDING_WCHAR_H - #ifndef _@GUARD_PREFIX@_WCHAR_H #define _@GUARD_PREFIX@_WCHAR_H @@ -107,7 +102,7 @@ /* Applies to: functions. Cannot be used on inline functions. */ #ifndef _GL_ATTRIBUTE_DEALLOC_FREE # if defined __cplusplus && defined __GNUC__ && !defined __clang__ -/* Work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108231> */ +/* Work around GCC bug <https://gcc.gnu.org/PR108231> */ # define _GL_ATTRIBUTE_DEALLOC_FREE \ _GL_ATTRIBUTE_DEALLOC ((void (*) (void *)) free, 1) # else @@ -137,6 +132,18 @@ # endif #endif +/* _GL_ATTRIBUTE_NONNULL_IF_NONZERO (NP, NI) declares that the argument NP + (a pointer) must not be NULL if the argument NI (an integer) is != 0. */ +/* Applies to: functions. */ +#ifndef _GL_ATTRIBUTE_NONNULL_IF_NONZERO +# if __GNUC__ >= 15 && !defined __clang__ +# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni) \ + __attribute__ ((__nonnull_if_nonzero__ (np, ni))) +# else +# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni) +# endif +#endif + /* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions. */ #ifndef _GL_ATTRIBUTE_NOTHROW @@ -196,17 +203,11 @@ typedef unsigned int rpl_wint_t; /* Override mbstate_t if it is too small. - On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for - implementing mbrtowc for encodings like UTF-8. - On AIX and MSVC, mbrtowc needs to be overridden, but mbstate_t exists and is - large enough and overriding it would cause problems in C++ mode. */ + On AIX, MSVC, and OpenBSD 6.0, mbrtowc needs to be overridden, but + mbstate_t exists and is large enough and overriding it would cause problems + in C++ mode. */ #if !(((defined _WIN32 && !defined __CYGWIN__) || @HAVE_MBSINIT@) && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@ # if !GNULIB_defined_mbstate_t -# if !(defined _AIX || defined _MSC_VER) -typedef int rpl_mbstate_t; -# undef mbstate_t -# define mbstate_t rpl_mbstate_t -# endif # define GNULIB_defined_mbstate_t 1 # endif #endif @@ -262,6 +263,55 @@ _GL_EXTERN_C void free (void *); #endif +/* Declarations for ISO C N3322. */ +#if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__ +_GL_EXTERN_C wchar_t *wmemcpy (wchar_t *__dest, const wchar_t *__src, size_t __n) +# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 + _GL_ATTRIBUTE_NOTHROW +# endif + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3); +_GL_EXTERN_C wchar_t *wmemmove (wchar_t *__dest, const wchar_t *__src, size_t __n) +# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 + _GL_ATTRIBUTE_NOTHROW +# endif + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3); +_GL_EXTERN_C wchar_t *wcsncpy (wchar_t *__dest, const wchar_t *__src, size_t __n) +# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 + _GL_ATTRIBUTE_NOTHROW +# endif + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3); +_GL_EXTERN_C wchar_t *wcsncat (wchar_t *__dest, const wchar_t *__src, size_t __n) +# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 + _GL_ATTRIBUTE_NOTHROW +# endif + _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3); +_GL_EXTERN_C int wmemcmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n) +# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 + _GL_ATTRIBUTE_NOTHROW +# endif + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3); +_GL_EXTERN_C int wcsncmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n) +# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 + _GL_ATTRIBUTE_NOTHROW +# endif + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3); +# ifndef __cplusplus +_GL_EXTERN_C wchar_t *(wmemchr) (const wchar_t *__s, wchar_t __wc, size_t __n) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3); +# endif +_GL_EXTERN_C wchar_t *wmemset (wchar_t *__s, wchar_t __wc, size_t __n) +# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 + _GL_ATTRIBUTE_NOTHROW +# endif + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3); +#endif + + /* Convert a single-byte character to a wide character. */ #if @GNULIB_BTOWC@ # if @REPLACE_BTOWC@ @@ -282,7 +332,6 @@ _GL_CXXALIAS_SYS_CAST (btowc, wint_t, (int c)); _GL_CXXALIASWARN (btowc); # endif #elif defined GNULIB_POSIXCHECK -# undef btowc # if HAVE_RAW_DECL_BTOWC _GL_WARN_ON_USE (btowc, "btowc is unportable - " "use gnulib module btowc for portability"); @@ -300,8 +349,8 @@ _GL_WARN_ON_USE (btowc, "btowc is unportable - " _GL_FUNCDECL_RPL (wctob, int, (wint_t wc), _GL_ATTRIBUTE_PURE); _GL_CXXALIAS_RPL (wctob, int, (wint_t wc)); # else -# if !defined wctob && !@HAVE_DECL_WCTOB@ -/* wctob is provided by gnulib, or wctob exists but is not declared. */ +# if !defined wctob && !@HAVE_WCTOB@ +/* wctob is provided by gnulib. */ _GL_FUNCDECL_SYS (wctob, int, (wint_t wc), _GL_ATTRIBUTE_PURE); # endif _GL_CXXALIAS_SYS (wctob, int, (wint_t wc)); @@ -310,7 +359,6 @@ _GL_CXXALIAS_SYS (wctob, int, (wint_t wc)); _GL_CXXALIASWARN (wctob); # endif #elif defined GNULIB_POSIXCHECK -# undef wctob # if HAVE_RAW_DECL_WCTOB _GL_WARN_ON_USE (wctob, "wctob is unportable - " "use gnulib module wctob for portability"); @@ -337,7 +385,6 @@ _GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps)); _GL_CXXALIASWARN (mbsinit); # endif #elif defined GNULIB_POSIXCHECK -# undef mbsinit # if HAVE_RAW_DECL_MBSINIT _GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - " "use gnulib module mbsinit for portability"); @@ -378,7 +425,7 @@ _GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - " without considering what mbsinit() does, we get test failures such as assertion "mbsinit (&iter->state)" failed */ -# if GNULIB_defined_mbstate_t /* AIX, IRIX */ +# if GNULIB_defined_mbstate_t /* AIX */ /* mbstate_t has at least 4 bytes. They are used as coded in gnulib/lib/mbrtowc.c. */ # define _GL_MBSTATE_INIT_SIZE 1 @@ -531,16 +578,19 @@ _GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - " # define _GL_MBSTATE_ZERO_SIZE sizeof (mbstate_t) # endif _GL_BEGIN_C_LINKAGE -# if defined IN_MBSZERO +# if !GNULIB_defined_mbszero +# if defined IN_MBSZERO _GL_EXTERN_INLINE -# else +# else _GL_INLINE -# endif +# endif _GL_ARG_NONNULL ((1)) void mbszero (mbstate_t *ps) { memset (ps, 0, _GL_MBSTATE_ZERO_SIZE); } +# define GNULIB_defined_mbszero 1 +# endif _GL_END_C_LINKAGE _GL_CXXALIAS_SYS (mbszero, void, (mbstate_t *ps)); _GL_CXXALIASWARN (mbszero); @@ -574,7 +624,6 @@ _GL_CXXALIAS_SYS (mbrtowc, size_t, _GL_CXXALIASWARN (mbrtowc); # endif #elif defined GNULIB_POSIXCHECK -# undef mbrtowc # if HAVE_RAW_DECL_MBRTOWC _GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - " "use gnulib module mbrtowc for portability"); @@ -605,7 +654,6 @@ _GL_CXXALIAS_SYS (mbrlen, size_t, _GL_CXXALIASWARN (mbrlen); # endif #elif defined GNULIB_POSIXCHECK -# undef mbrlen # if HAVE_RAW_DECL_MBRLEN _GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - " "use gnulib module mbrlen for portability"); @@ -646,7 +694,6 @@ _GL_CXXALIAS_SYS (mbsrtowcs, size_t, _GL_CXXALIASWARN (mbsrtowcs); # endif #elif defined GNULIB_POSIXCHECK -# undef mbsrtowcs # if HAVE_RAW_DECL_MBSRTOWCS _GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - " "use gnulib module mbsrtowcs for portability"); @@ -687,7 +734,6 @@ _GL_CXXALIAS_SYS (mbsnrtowcs, size_t, _GL_CXXALIASWARN (mbsnrtowcs); # endif #elif defined GNULIB_POSIXCHECK -# undef mbsnrtowcs # if HAVE_RAW_DECL_MBSNRTOWCS _GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - " "use gnulib module mbsnrtowcs for portability"); @@ -718,7 +764,6 @@ _GL_CXXALIAS_SYS (wcrtomb, size_t, _GL_CXXALIASWARN (wcrtomb); # endif #elif defined GNULIB_POSIXCHECK -# undef wcrtomb # if HAVE_RAW_DECL_WCRTOMB _GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - " "use gnulib module wcrtomb for portability"); @@ -759,7 +804,6 @@ _GL_CXXALIAS_SYS (wcsrtombs, size_t, _GL_CXXALIASWARN (wcsrtombs); # endif #elif defined GNULIB_POSIXCHECK -# undef wcsrtombs # if HAVE_RAW_DECL_WCSRTOMBS _GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - " "use gnulib module wcsrtombs for portability"); @@ -804,7 +848,6 @@ _GL_CXXALIAS_SYS (wcsnrtombs, size_t, _GL_CXXALIASWARN (wcsnrtombs); # endif #elif defined GNULIB_POSIXCHECK -# undef wcsnrtombs # if HAVE_RAW_DECL_WCSNRTOMBS _GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - " "use gnulib module wcsnrtombs for portability"); @@ -832,7 +875,6 @@ _GL_CXXALIAS_SYS (wcwidth, int, (wchar_t)); _GL_CXXALIASWARN (wcwidth); # endif #elif defined GNULIB_POSIXCHECK -# undef wcwidth # if HAVE_RAW_DECL_WCWIDTH _GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - " "use gnulib module wcwidth for portability"); @@ -843,8 +885,9 @@ _GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - " /* Search N wide characters of S for C. */ #if @GNULIB_WMEMCHR@ # if !@HAVE_WMEMCHR@ -_GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n), - _GL_ATTRIBUTE_PURE); +_GL_FUNCDECL_SYS (wmemchr, wchar_t *, + (const wchar_t *s, wchar_t c, size_t n), + _GL_ATTRIBUTE_PURE _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)); # endif /* On some systems, this function is defined as an overloaded function: extern "C++" { @@ -864,7 +907,6 @@ _GL_CXXALIASWARN1 (wmemchr, const wchar_t *, _GL_CXXALIASWARN (wmemchr); # endif #elif defined GNULIB_POSIXCHECK -# undef wmemchr # if HAVE_RAW_DECL_WMEMCHR _GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - " "use gnulib module wmemchr for portability"); @@ -881,14 +923,18 @@ _GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - " # endif _GL_FUNCDECL_RPL (wmemcmp, int, (const wchar_t *s1, const wchar_t *s2, size_t n), - _GL_ATTRIBUTE_PURE); + _GL_ATTRIBUTE_PURE + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3)); _GL_CXXALIAS_RPL (wmemcmp, int, (const wchar_t *s1, const wchar_t *s2, size_t n)); # else # if !@HAVE_WMEMCMP@ _GL_FUNCDECL_SYS (wmemcmp, int, (const wchar_t *s1, const wchar_t *s2, size_t n), - _GL_ATTRIBUTE_PURE); + _GL_ATTRIBUTE_PURE + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3)); # endif _GL_CXXALIAS_SYS (wmemcmp, int, (const wchar_t *s1, const wchar_t *s2, size_t n)); @@ -897,7 +943,6 @@ _GL_CXXALIAS_SYS (wmemcmp, int, _GL_CXXALIASWARN (wmemcmp); # endif #elif defined GNULIB_POSIXCHECK -# undef wmemcmp # if HAVE_RAW_DECL_WMEMCMP _GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - " "use gnulib module wmemcmp for portability"); @@ -910,7 +955,9 @@ _GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - " # if !@HAVE_WMEMCPY@ _GL_FUNCDECL_SYS (wmemcpy, wchar_t *, (wchar_t *restrict dest, - const wchar_t *restrict src, size_t n), ); + const wchar_t *restrict src, size_t n), + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3)); # endif _GL_CXXALIAS_SYS (wmemcpy, wchar_t *, (wchar_t *restrict dest, @@ -919,7 +966,6 @@ _GL_CXXALIAS_SYS (wmemcpy, wchar_t *, _GL_CXXALIASWARN (wmemcpy); # endif #elif defined GNULIB_POSIXCHECK -# undef wmemcpy # if HAVE_RAW_DECL_WMEMCPY _GL_WARN_ON_USE (wmemcpy, "wmemcpy is unportable - " "use gnulib module wmemcpy for portability"); @@ -932,7 +978,9 @@ _GL_WARN_ON_USE (wmemcpy, "wmemcpy is unportable - " #if @GNULIB_WMEMMOVE@ # if !@HAVE_WMEMMOVE@ _GL_FUNCDECL_SYS (wmemmove, wchar_t *, - (wchar_t *dest, const wchar_t *src, size_t n), ); + (wchar_t *dest, const wchar_t *src, size_t n), + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3)); # endif _GL_CXXALIAS_SYS (wmemmove, wchar_t *, (wchar_t *dest, const wchar_t *src, size_t n)); @@ -940,7 +988,6 @@ _GL_CXXALIAS_SYS (wmemmove, wchar_t *, _GL_CXXALIASWARN (wmemmove); # endif #elif defined GNULIB_POSIXCHECK -# undef wmemmove # if HAVE_RAW_DECL_WMEMMOVE _GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - " "use gnulib module wmemmove for portability"); @@ -976,7 +1023,6 @@ _GL_CXXALIAS_SYS (wmempcpy, wchar_t *, _GL_CXXALIASWARN (wmempcpy); # endif #elif defined GNULIB_POSIXCHECK -# undef wmempcpy # if HAVE_RAW_DECL_WMEMPCPY _GL_WARN_ON_USE (wmempcpy, "wmempcpy is unportable - " "use gnulib module wmempcpy for portability"); @@ -987,14 +1033,14 @@ _GL_WARN_ON_USE (wmempcpy, "wmempcpy is unportable - " /* Set N wide characters of S to C. */ #if @GNULIB_WMEMSET@ # if !@HAVE_WMEMSET@ -_GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n), ); +_GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n), + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)); # endif _GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wmemset); # endif #elif defined GNULIB_POSIXCHECK -# undef wmemset # if HAVE_RAW_DECL_WMEMSET _GL_WARN_ON_USE (wmemset, "wmemset is unportable - " "use gnulib module wmemset for portability"); @@ -1012,7 +1058,6 @@ _GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s)); _GL_CXXALIASWARN (wcslen); # endif #elif defined GNULIB_POSIXCHECK -# undef wcslen # if HAVE_RAW_DECL_WCSLEN _GL_WARN_ON_USE (wcslen, "wcslen is unportable - " "use gnulib module wcslen for portability"); @@ -1032,7 +1077,6 @@ _GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen), _GL_CXXALIAS_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen)); _GL_CXXALIASWARN (wcsnlen); #elif defined GNULIB_POSIXCHECK -# undef wcsnlen # if HAVE_RAW_DECL_WCSNLEN _GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - " "use gnulib module wcsnlen for portability"); @@ -1052,7 +1096,6 @@ _GL_CXXALIAS_SYS (wcscpy, wchar_t *, _GL_CXXALIASWARN (wcscpy); # endif #elif defined GNULIB_POSIXCHECK -# undef wcscpy # if HAVE_RAW_DECL_WCSCPY _GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - " "use gnulib module wcscpy for portability"); @@ -1073,7 +1116,6 @@ _GL_CXXALIAS_SYS (wcpcpy, wchar_t *, (wchar_t *restrict dest, const wchar_t *restrict src)); _GL_CXXALIASWARN (wcpcpy); #elif defined GNULIB_POSIXCHECK -# undef wcpcpy # if HAVE_RAW_DECL_WCPCPY _GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - " "use gnulib module wcpcpy for portability"); @@ -1086,7 +1128,9 @@ _GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - " # if !@HAVE_WCSNCPY@ _GL_FUNCDECL_SYS (wcsncpy, wchar_t *, (wchar_t *restrict dest, - const wchar_t *restrict src, size_t n), ); + const wchar_t *restrict src, size_t n), + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3)); # endif _GL_CXXALIAS_SYS (wcsncpy, wchar_t *, (wchar_t *restrict dest, @@ -1095,7 +1139,6 @@ _GL_CXXALIAS_SYS (wcsncpy, wchar_t *, _GL_CXXALIASWARN (wcsncpy); # endif #elif defined GNULIB_POSIXCHECK -# undef wcsncpy # if HAVE_RAW_DECL_WCSNCPY _GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - " "use gnulib module wcsncpy for portability"); @@ -1119,7 +1162,6 @@ _GL_CXXALIAS_SYS (wcpncpy, wchar_t *, const wchar_t *restrict src, size_t n)); _GL_CXXALIASWARN (wcpncpy); #elif defined GNULIB_POSIXCHECK -# undef wcpncpy # if HAVE_RAW_DECL_WCPNCPY _GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - " "use gnulib module wcpncpy for portability"); @@ -1139,7 +1181,6 @@ _GL_CXXALIAS_SYS (wcscat, wchar_t *, _GL_CXXALIASWARN (wcscat); # endif #elif defined GNULIB_POSIXCHECK -# undef wcscat # if HAVE_RAW_DECL_WCSCAT _GL_WARN_ON_USE (wcscat, "wcscat is unportable - " "use gnulib module wcscat for portability"); @@ -1149,19 +1190,35 @@ _GL_WARN_ON_USE (wcscat, "wcscat is unportable - " /* Append no more than N wide characters of SRC onto DEST. */ #if @GNULIB_WCSNCAT@ -# if !@HAVE_WCSNCAT@ +# if @REPLACE_WCSNCAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef wcsncat +# define wcsncat rpl_wcsncat +# endif +_GL_FUNCDECL_RPL (wcsncat, wchar_t *, + (wchar_t *restrict dest, const wchar_t *restrict src, + size_t n), + _GL_ARG_NONNULL ((1)) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3)); +_GL_CXXALIAS_RPL (wcsncat, wchar_t *, + (wchar_t *restrict dest, const wchar_t *restrict src, + size_t n)); +# else +# if !@HAVE_WCSNCAT@ _GL_FUNCDECL_SYS (wcsncat, wchar_t *, (wchar_t *restrict dest, const wchar_t *restrict src, - size_t n), ); -# endif + size_t n), + _GL_ARG_NONNULL ((1)) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3)); +# endif _GL_CXXALIAS_SYS (wcsncat, wchar_t *, (wchar_t *restrict dest, const wchar_t *restrict src, size_t n)); +# endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcsncat); # endif #elif defined GNULIB_POSIXCHECK -# undef wcsncat # if HAVE_RAW_DECL_WCSNCAT _GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - " "use gnulib module wcsncat for portability"); @@ -1190,7 +1247,6 @@ _GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)); _GL_CXXALIASWARN (wcscmp); # endif #elif defined GNULIB_POSIXCHECK -# undef wcscmp # if HAVE_RAW_DECL_WCSCMP _GL_WARN_ON_USE (wcscmp, "wcscmp is unportable - " "use gnulib module wcscmp for portability"); @@ -1207,14 +1263,18 @@ _GL_WARN_ON_USE (wcscmp, "wcscmp is unportable - " # endif _GL_FUNCDECL_RPL (wcsncmp, int, (const wchar_t *s1, const wchar_t *s2, size_t n), - _GL_ATTRIBUTE_PURE); + _GL_ATTRIBUTE_PURE + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3)); _GL_CXXALIAS_RPL (wcsncmp, int, (const wchar_t *s1, const wchar_t *s2, size_t n)); # else # if !@HAVE_WCSNCMP@ _GL_FUNCDECL_SYS (wcsncmp, int, (const wchar_t *s1, const wchar_t *s2, size_t n), - _GL_ATTRIBUTE_PURE); + _GL_ATTRIBUTE_PURE + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3) + _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3)); # endif _GL_CXXALIAS_SYS (wcsncmp, int, (const wchar_t *s1, const wchar_t *s2, size_t n)); @@ -1223,7 +1283,6 @@ _GL_CXXALIAS_SYS (wcsncmp, int, _GL_CXXALIASWARN (wcsncmp); # endif #elif defined GNULIB_POSIXCHECK -# undef wcsncmp # if HAVE_RAW_DECL_WCSNCMP _GL_WARN_ON_USE (wcsncmp, "wcsncmp is unportable - " "use gnulib module wcsncmp for portability"); @@ -1243,7 +1302,6 @@ _GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2), _GL_CXXALIAS_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2)); _GL_CXXALIASWARN (wcscasecmp); #elif defined GNULIB_POSIXCHECK -# undef wcscasecmp # if HAVE_RAW_DECL_WCSCASECMP _GL_WARN_ON_USE (wcscasecmp, "wcscasecmp is unportable - " "use gnulib module wcscasecmp for portability"); @@ -1265,7 +1323,6 @@ _GL_CXXALIAS_SYS (wcsncasecmp, int, (const wchar_t *s1, const wchar_t *s2, size_t n)); _GL_CXXALIASWARN (wcsncasecmp); #elif defined GNULIB_POSIXCHECK -# undef wcsncasecmp # if HAVE_RAW_DECL_WCSNCASECMP _GL_WARN_ON_USE (wcsncasecmp, "wcsncasecmp is unportable - " "use gnulib module wcsncasecmp for portability"); @@ -1284,7 +1341,6 @@ _GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2)); _GL_CXXALIASWARN (wcscoll); # endif #elif defined GNULIB_POSIXCHECK -# undef wcscoll # if HAVE_RAW_DECL_WCSCOLL _GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - " "use gnulib module wcscoll for portability"); @@ -1306,7 +1362,6 @@ _GL_CXXALIAS_SYS (wcsxfrm, size_t, _GL_CXXALIASWARN (wcsxfrm); # endif #elif defined GNULIB_POSIXCHECK -# undef wcsxfrm # if HAVE_RAW_DECL_WCSXFRM _GL_WARN_ON_USE (wcsxfrm, "wcsxfrm is unportable - " "use gnulib module wcsxfrm for portability"); @@ -1357,7 +1412,6 @@ _GL_FUNCDECL_SYS (wcsdup, wchar_t *, # endif # endif # if defined GNULIB_POSIXCHECK -# undef wcsdup # if HAVE_RAW_DECL_WCSDUP _GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - " "use gnulib module wcsdup for portability"); @@ -1417,7 +1471,6 @@ _GL_CXXALIASWARN1 (wcschr, const wchar_t *, (const wchar_t *wcs, wchar_t wc)); _GL_CXXALIASWARN (wcschr); # endif #elif defined GNULIB_POSIXCHECK -# undef wcschr # if HAVE_RAW_DECL_WCSCHR _GL_WARN_ON_USE (wcschr, "wcschr is unportable - " "use gnulib module wcschr for portability"); @@ -1448,7 +1501,6 @@ _GL_CXXALIASWARN1 (wcsrchr, const wchar_t *, (const wchar_t *wcs, wchar_t wc)); _GL_CXXALIASWARN (wcsrchr); # endif #elif defined GNULIB_POSIXCHECK -# undef wcsrchr # if HAVE_RAW_DECL_WCSRCHR _GL_WARN_ON_USE (wcsrchr, "wcsrchr is unportable - " "use gnulib module wcsrchr for portability"); @@ -1468,7 +1520,6 @@ _GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject)); _GL_CXXALIASWARN (wcscspn); # endif #elif defined GNULIB_POSIXCHECK -# undef wcscspn # if HAVE_RAW_DECL_WCSCSPN _GL_WARN_ON_USE (wcscspn, "wcscspn is unportable - " "use gnulib module wcscspn for portability"); @@ -1488,7 +1539,6 @@ _GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept)); _GL_CXXALIASWARN (wcsspn); # endif #elif defined GNULIB_POSIXCHECK -# undef wcsspn # if HAVE_RAW_DECL_WCSSPN _GL_WARN_ON_USE (wcsspn, "wcsspn is unportable - " "use gnulib module wcsspn for portability"); @@ -1522,7 +1572,6 @@ _GL_CXXALIASWARN1 (wcspbrk, const wchar_t *, _GL_CXXALIASWARN (wcspbrk); # endif #elif defined GNULIB_POSIXCHECK -# undef wcspbrk # if HAVE_RAW_DECL_WCSPBRK _GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - " "use gnulib module wcspbrk for portability"); @@ -1575,7 +1624,6 @@ _GL_CXXALIASWARN1 (wcsstr, const wchar_t *, _GL_CXXALIASWARN (wcsstr); # endif #elif defined GNULIB_POSIXCHECK -# undef wcsstr # if HAVE_RAW_DECL_WCSSTR _GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - " "use gnulib module wcsstr for portability"); @@ -1610,7 +1658,6 @@ _GL_CXXALIAS_SYS (wcstok, wchar_t *, _GL_CXXALIASWARN (wcstok); # endif #elif defined GNULIB_POSIXCHECK -# undef wcstok # if HAVE_RAW_DECL_WCSTOK _GL_WARN_ON_USE (wcstok, "wcstok is unportable - " "use gnulib module wcstok for portability"); @@ -1640,7 +1687,6 @@ _GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n)); _GL_CXXALIASWARN (wcswidth); # endif #elif defined GNULIB_POSIXCHECK -# undef wcswidth # if HAVE_RAW_DECL_WCSWIDTH _GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - " "use gnulib module wcswidth for portability"); @@ -1682,7 +1728,6 @@ _GL_CXXALIAS_SYS (wcsftime, size_t, _GL_CXXALIASWARN (wcsftime); # endif #elif defined GNULIB_POSIXCHECK -# undef wcsftime # if HAVE_RAW_DECL_WCSFTIME _GL_WARN_ON_USE (wcsftime, "wcsftime is unportable - " "use gnulib module wcsftime for portability"); |
