X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fwchar.in.h;h=8534acb789447985cf4ddabea9b552a1b3160dde;hb=2408f02086a20c0a02241cd4a1cf11f126a95fe3;hp=b175ab7ec59e87d7cb5f2bf30c96900b6d76da53;hpb=8e5e25f79c3ff689fc3a3aab0fe439064ef76d02;p=gnulib.git diff --git a/lib/wchar.in.h b/lib/wchar.in.h index b175ab7ec..8534acb78 100644 --- a/lib/wchar.in.h +++ b/lib/wchar.in.h @@ -49,7 +49,7 @@ #else /* Normal invocation convention. */ -#ifndef _GL_WCHAR_H +#ifndef _@GUARD_PREFIX@_WCHAR_H #define _GL_ALREADY_INCLUDING_WCHAR_H @@ -61,9 +61,13 @@ . BSD/OS 4.0.1 has a bug: , and must be included before . + In some builds of uClibc, is nonexistent and wchar_t is defined + by . But avoid namespace pollution on glibc systems. */ -#ifndef __GLIBC__ +#if !(defined __GLIBC__ && !defined __UCLIBC__) # include +#endif +#ifndef __GLIBC__ # include # include #endif @@ -77,8 +81,8 @@ #undef _GL_ALREADY_INCLUDING_WCHAR_H -#ifndef _GL_WCHAR_H -#define _GL_WCHAR_H +#ifndef _@GUARD_PREFIX@_WCHAR_H +#define _@GUARD_PREFIX@_WCHAR_H /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ @@ -94,6 +98,18 @@ # define WEOF -1 # endif #else +/* MSVC defines wint_t as 'unsigned short' in . + This is too small: ISO C 99 section 7.24.1.(2) says that wint_t must be + "unchanged by default argument promotions". Override it. */ +# if defined _MSC_VER +# if !GNULIB_defined_wint_t +# include +typedef unsigned int rpl_wint_t; +# undef wint_t +# define wint_t rpl_wint_t +# define GNULIB_defined_wint_t 1 +# endif +# endif # ifndef WEOF # define WEOF ((wint_t) -1) # endif @@ -435,8 +451,22 @@ _GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - " # if !@HAVE_WMEMCHR@ _GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n)); # endif -_GL_CXXALIAS_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n)); + /* On some systems, this function is defined as an overloaded function: + extern "C++" { + const wchar_t * std::wmemchr (const wchar_t *, wchar_t, size_t); + wchar_t * std::wmemchr (wchar_t *, wchar_t, size_t); + } */ +_GL_CXXALIAS_SYS_CAST2 (wmemchr, + wchar_t *, (const wchar_t *, wchar_t, size_t), + const wchar_t *, (const wchar_t *, wchar_t, size_t)); +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) +_GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); +_GL_CXXALIASWARN1 (wmemchr, const wchar_t *, + (const wchar_t *s, wchar_t c, size_t n)); +# else _GL_CXXALIASWARN (wmemchr); +# endif #elif defined GNULIB_POSIXCHECK # undef wmemchr # if HAVE_RAW_DECL_WMEMCHR @@ -776,8 +806,21 @@ _GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - " # if !@HAVE_WCSCHR@ _GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc)); # endif -_GL_CXXALIAS_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc)); + /* On some systems, this function is defined as an overloaded function: + extern "C++" { + const wchar_t * std::wcschr (const wchar_t *, wchar_t); + wchar_t * std::wcschr (wchar_t *, wchar_t); + } */ +_GL_CXXALIAS_SYS_CAST2 (wcschr, + wchar_t *, (const wchar_t *, wchar_t), + const wchar_t *, (const wchar_t *, wchar_t)); +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) +_GL_CXXALIASWARN1 (wcschr, wchar_t *, (wchar_t *wcs, wchar_t wc)); +_GL_CXXALIASWARN1 (wcschr, const wchar_t *, (const wchar_t *wcs, wchar_t wc)); +# else _GL_CXXALIASWARN (wcschr); +# endif #elif defined GNULIB_POSIXCHECK # undef wcschr # if HAVE_RAW_DECL_WCSCHR @@ -792,8 +835,21 @@ _GL_WARN_ON_USE (wcschr, "wcschr is unportable - " # if !@HAVE_WCSRCHR@ _GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc)); # endif -_GL_CXXALIAS_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc)); + /* On some systems, this function is defined as an overloaded function: + extern "C++" { + const wchar_t * std::wcsrchr (const wchar_t *, wchar_t); + wchar_t * std::wcsrchr (wchar_t *, wchar_t); + } */ +_GL_CXXALIAS_SYS_CAST2 (wcsrchr, + wchar_t *, (const wchar_t *, wchar_t), + const wchar_t *, (const wchar_t *, wchar_t)); +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) +_GL_CXXALIASWARN1 (wcsrchr, wchar_t *, (wchar_t *wcs, wchar_t wc)); +_GL_CXXALIASWARN1 (wcsrchr, const wchar_t *, (const wchar_t *wcs, wchar_t wc)); +# else _GL_CXXALIASWARN (wcsrchr); +# endif #elif defined GNULIB_POSIXCHECK # undef wcsrchr # if HAVE_RAW_DECL_WCSRCHR @@ -843,9 +899,23 @@ _GL_WARN_ON_USE (wcsspn, "wcsspn is unportable - " _GL_FUNCDECL_SYS (wcspbrk, wchar_t *, (const wchar_t *wcs, const wchar_t *accept)); # endif -_GL_CXXALIAS_SYS (wcspbrk, wchar_t *, - (const wchar_t *wcs, const wchar_t *accept)); + /* On some systems, this function is defined as an overloaded function: + extern "C++" { + const wchar_t * std::wcspbrk (const wchar_t *, const wchar_t *); + wchar_t * std::wcspbrk (wchar_t *, const wchar_t *); + } */ +_GL_CXXALIAS_SYS_CAST2 (wcspbrk, + wchar_t *, (const wchar_t *, const wchar_t *), + const wchar_t *, (const wchar_t *, const wchar_t *)); +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) +_GL_CXXALIASWARN1 (wcspbrk, wchar_t *, + (wchar_t *wcs, const wchar_t *accept)); +_GL_CXXALIASWARN1 (wcspbrk, const wchar_t *, + (const wchar_t *wcs, const wchar_t *accept)); +# else _GL_CXXALIASWARN (wcspbrk); +# endif #elif defined GNULIB_POSIXCHECK # undef wcspbrk # if HAVE_RAW_DECL_WCSPBRK @@ -861,9 +931,23 @@ _GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - " _GL_FUNCDECL_SYS (wcsstr, wchar_t *, (const wchar_t *haystack, const wchar_t *needle)); # endif -_GL_CXXALIAS_SYS (wcsstr, wchar_t *, - (const wchar_t *haystack, const wchar_t *needle)); + /* On some systems, this function is defined as an overloaded function: + extern "C++" { + const wchar_t * std::wcsstr (const wchar_t *, const wchar_t *); + wchar_t * std::wcsstr (wchar_t *, const wchar_t *); + } */ +_GL_CXXALIAS_SYS_CAST2 (wcsstr, + wchar_t *, (const wchar_t *, const wchar_t *), + const wchar_t *, (const wchar_t *, const wchar_t *)); +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) +_GL_CXXALIASWARN1 (wcsstr, wchar_t *, + (wchar_t *haystack, const wchar_t *needle)); +_GL_CXXALIASWARN1 (wcsstr, const wchar_t *, + (const wchar_t *haystack, const wchar_t *needle)); +# else _GL_CXXALIASWARN (wcsstr); +# endif #elif defined GNULIB_POSIXCHECK # undef wcsstr # if HAVE_RAW_DECL_WCSSTR @@ -873,6 +957,50 @@ _GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - " #endif -#endif /* _GL_WCHAR_H */ -#endif /* _GL_WCHAR_H */ +/* Divide WCS into tokens separated by characters in DELIM. */ +#if @GNULIB_WCSTOK@ +# if !@HAVE_WCSTOK@ +_GL_FUNCDECL_SYS (wcstok, wchar_t *, + (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)); +# endif +_GL_CXXALIAS_SYS (wcstok, wchar_t *, + (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)); +_GL_CXXALIASWARN (wcstok); +#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"); +# endif +#endif + + +/* Determine number of column positions required for first N wide + characters (or fewer if S ends before this) in S. */ +#if @GNULIB_WCSWIDTH@ +# if @REPLACE_WCSWIDTH@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef wcswidth +# define wcswidth rpl_wcswidth +# endif +_GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n)); +_GL_CXXALIAS_RPL (wcswidth, int, (const wchar_t *s, size_t n)); +# else +# if !@HAVE_WCSWIDTH@ +_GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n)); +# endif +_GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n)); +# endif +_GL_CXXALIASWARN (wcswidth); +#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"); +# endif +#endif + + +#endif /* _@GUARD_PREFIX@_WCHAR_H */ +#endif /* _@GUARD_PREFIX@_WCHAR_H */ #endif