151ddd709SJohn Marino /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ 251ddd709SJohn Marino /* A substitute for ISO C99 <wchar.h>, for platforms that have issues. 351ddd709SJohn Marino 4*4ce1b016SDaniel Fojt Copyright (C) 2007-2020 Free Software Foundation, Inc. 551ddd709SJohn Marino 651ddd709SJohn Marino This program is free software; you can redistribute it and/or modify 751ddd709SJohn Marino it under the terms of the GNU General Public License as published by 851ddd709SJohn Marino the Free Software Foundation; either version 3, or (at your option) 951ddd709SJohn Marino any later version. 1051ddd709SJohn Marino 1151ddd709SJohn Marino This program is distributed in the hope that it will be useful, 1251ddd709SJohn Marino but WITHOUT ANY WARRANTY; without even the implied warranty of 1351ddd709SJohn Marino MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1451ddd709SJohn Marino GNU General Public License for more details. 1551ddd709SJohn Marino 1651ddd709SJohn Marino You should have received a copy of the GNU General Public License 17*4ce1b016SDaniel Fojt along with this program; if not, see <https://www.gnu.org/licenses/>. */ 1851ddd709SJohn Marino 1951ddd709SJohn Marino /* Written by Eric Blake. */ 2051ddd709SJohn Marino 2151ddd709SJohn Marino /* 2251ddd709SJohn Marino * ISO C 99 <wchar.h> for platforms that have issues. 23*4ce1b016SDaniel Fojt * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/wchar.h.html> 2451ddd709SJohn Marino * 2551ddd709SJohn Marino * For now, this just ensures proper prerequisite inclusion order and 2651ddd709SJohn Marino * the declaration of wcwidth(). 2751ddd709SJohn Marino */ 2851ddd709SJohn Marino 2951ddd709SJohn Marino #if __GNUC__ >= 3 3051ddd709SJohn Marino #pragma GCC system_header 3151ddd709SJohn Marino #endif 3251ddd709SJohn Marino 3351ddd709SJohn Marino 34cf51209aSJohn Marino #if (((defined __need_mbstate_t || defined __need_wint_t) \ 35cf51209aSJohn Marino && !defined __MINGW32__) \ 36cf51209aSJohn Marino || (defined __hpux \ 37*4ce1b016SDaniel Fojt && ((defined _INTTYPES_INCLUDED \ 38*4ce1b016SDaniel Fojt && !defined _GL_FINISHED_INCLUDING_SYSTEM_INTTYPES_H) \ 39cf51209aSJohn Marino || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) \ 40*4ce1b016SDaniel Fojt || (defined __MINGW32__ && defined __STRING_H_SOURCED__) \ 41cf51209aSJohn Marino || defined _GL_ALREADY_INCLUDING_WCHAR_H) 4251ddd709SJohn Marino /* Special invocation convention: 43cf51209aSJohn Marino - Inside glibc and uClibc header files, but not MinGW. 4451ddd709SJohn Marino - On HP-UX 11.00 we have a sequence of nested includes 4551ddd709SJohn Marino <wchar.h> -> <stdlib.h> -> <stdint.h>, and the latter includes <wchar.h>, 4651ddd709SJohn Marino once indirectly <stdint.h> -> <sys/types.h> -> <inttypes.h> -> <wchar.h> 4751ddd709SJohn Marino and once directly. In both situations 'wint_t' is not yet defined, 4851ddd709SJohn Marino therefore we cannot provide the function overrides; instead include only 4951ddd709SJohn Marino the system's <wchar.h>. 50*4ce1b016SDaniel Fojt - With MinGW 3.22, when <string.h> includes <wchar.h>, only some part of 51*4ce1b016SDaniel Fojt <wchar.h> is actually processed, and that doesn't include 'mbstate_t'. 5251ddd709SJohn Marino - On IRIX 6.5, similarly, we have an include <wchar.h> -> <wctype.h>, and 5351ddd709SJohn Marino the latter includes <wchar.h>. But here, we have no way to detect whether 5451ddd709SJohn Marino <wctype.h> is completely included or is still being included. */ 5551ddd709SJohn Marino 5651ddd709SJohn Marino #include_next <wchar.h> 5751ddd709SJohn Marino 5851ddd709SJohn Marino #else 5951ddd709SJohn Marino /* Normal invocation convention. */ 6051ddd709SJohn Marino 6151ddd709SJohn Marino #ifndef _GL_WCHAR_H 6251ddd709SJohn Marino 6351ddd709SJohn Marino #define _GL_ALREADY_INCLUDING_WCHAR_H 6451ddd709SJohn Marino 6551ddd709SJohn Marino #if 0 6651ddd709SJohn Marino # include <features.h> /* for __GLIBC__ */ 6751ddd709SJohn Marino #endif 6851ddd709SJohn Marino 6951ddd709SJohn Marino /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before 7051ddd709SJohn Marino <wchar.h>. 7151ddd709SJohn Marino BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be 7251ddd709SJohn Marino included before <wchar.h>. 7351ddd709SJohn Marino In some builds of uClibc, <wchar.h> is nonexistent and wchar_t is defined 7451ddd709SJohn Marino by <stddef.h>. 7551ddd709SJohn Marino But avoid namespace pollution on glibc systems. */ 7651ddd709SJohn Marino #if !(defined __GLIBC__ && !defined __UCLIBC__) 7751ddd709SJohn Marino # include <stddef.h> 7851ddd709SJohn Marino #endif 7951ddd709SJohn Marino #ifndef __GLIBC__ 8051ddd709SJohn Marino # include <stdio.h> 8151ddd709SJohn Marino # include <time.h> 8251ddd709SJohn Marino #endif 8351ddd709SJohn Marino 8451ddd709SJohn Marino /* Include the original <wchar.h> if it exists. 8551ddd709SJohn Marino Some builds of uClibc lack it. */ 8651ddd709SJohn Marino /* The include_next requires a split double-inclusion guard. */ 8751ddd709SJohn Marino #if 1 8851ddd709SJohn Marino # include_next <wchar.h> 8951ddd709SJohn Marino #endif 9051ddd709SJohn Marino 9151ddd709SJohn Marino #undef _GL_ALREADY_INCLUDING_WCHAR_H 9251ddd709SJohn Marino 9351ddd709SJohn Marino #ifndef _GL_WCHAR_H 9451ddd709SJohn Marino #define _GL_WCHAR_H 9551ddd709SJohn Marino 9651ddd709SJohn Marino /* The __attribute__ feature is available in gcc versions 2.5 and later. 9751ddd709SJohn Marino The attribute __pure__ was added in gcc 2.96. */ 9851ddd709SJohn Marino #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) 9951ddd709SJohn Marino # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) 10051ddd709SJohn Marino #else 10151ddd709SJohn Marino # define _GL_ATTRIBUTE_PURE /* empty */ 10251ddd709SJohn Marino #endif 10351ddd709SJohn Marino 10451ddd709SJohn Marino /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 105*4ce1b016SDaniel Fojt /* C++ compatible function declaration macros. 106*4ce1b016SDaniel Fojt Copyright (C) 2010-2020 Free Software Foundation, Inc. 107*4ce1b016SDaniel Fojt 108*4ce1b016SDaniel Fojt This program is free software: you can redistribute it and/or modify it 109*4ce1b016SDaniel Fojt under the terms of the GNU General Public License as published 110*4ce1b016SDaniel Fojt by the Free Software Foundation; either version 3 of the License, or 111*4ce1b016SDaniel Fojt (at your option) any later version. 112*4ce1b016SDaniel Fojt 113*4ce1b016SDaniel Fojt This program is distributed in the hope that it will be useful, 114*4ce1b016SDaniel Fojt but WITHOUT ANY WARRANTY; without even the implied warranty of 115*4ce1b016SDaniel Fojt MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 116*4ce1b016SDaniel Fojt General Public License for more details. 117*4ce1b016SDaniel Fojt 118*4ce1b016SDaniel Fojt You should have received a copy of the GNU General Public License 119*4ce1b016SDaniel Fojt along with this program. If not, see <https://www.gnu.org/licenses/>. */ 120*4ce1b016SDaniel Fojt 12151ddd709SJohn Marino #ifndef _GL_CXXDEFS_H 12251ddd709SJohn Marino #define _GL_CXXDEFS_H 12351ddd709SJohn Marino 124*4ce1b016SDaniel Fojt /* Begin/end the GNULIB_NAMESPACE namespace. */ 125*4ce1b016SDaniel Fojt #if defined __cplusplus && defined GNULIB_NAMESPACE 126*4ce1b016SDaniel Fojt # define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE { 127*4ce1b016SDaniel Fojt # define _GL_END_NAMESPACE } 128*4ce1b016SDaniel Fojt #else 129*4ce1b016SDaniel Fojt # define _GL_BEGIN_NAMESPACE 130*4ce1b016SDaniel Fojt # define _GL_END_NAMESPACE 131*4ce1b016SDaniel Fojt #endif 132*4ce1b016SDaniel Fojt 13351ddd709SJohn Marino /* The three most frequent use cases of these macros are: 13451ddd709SJohn Marino 13551ddd709SJohn Marino * For providing a substitute for a function that is missing on some 13651ddd709SJohn Marino platforms, but is declared and works fine on the platforms on which 13751ddd709SJohn Marino it exists: 13851ddd709SJohn Marino 13951ddd709SJohn Marino #if @GNULIB_FOO@ 14051ddd709SJohn Marino # if !@HAVE_FOO@ 14151ddd709SJohn Marino _GL_FUNCDECL_SYS (foo, ...); 14251ddd709SJohn Marino # endif 14351ddd709SJohn Marino _GL_CXXALIAS_SYS (foo, ...); 14451ddd709SJohn Marino _GL_CXXALIASWARN (foo); 14551ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 14651ddd709SJohn Marino ... 14751ddd709SJohn Marino #endif 14851ddd709SJohn Marino 14951ddd709SJohn Marino * For providing a replacement for a function that exists on all platforms, 15051ddd709SJohn Marino but is broken/insufficient and needs to be replaced on some platforms: 15151ddd709SJohn Marino 15251ddd709SJohn Marino #if @GNULIB_FOO@ 15351ddd709SJohn Marino # if @REPLACE_FOO@ 15451ddd709SJohn Marino # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 15551ddd709SJohn Marino # undef foo 15651ddd709SJohn Marino # define foo rpl_foo 15751ddd709SJohn Marino # endif 15851ddd709SJohn Marino _GL_FUNCDECL_RPL (foo, ...); 15951ddd709SJohn Marino _GL_CXXALIAS_RPL (foo, ...); 16051ddd709SJohn Marino # else 16151ddd709SJohn Marino _GL_CXXALIAS_SYS (foo, ...); 16251ddd709SJohn Marino # endif 16351ddd709SJohn Marino _GL_CXXALIASWARN (foo); 16451ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 16551ddd709SJohn Marino ... 16651ddd709SJohn Marino #endif 16751ddd709SJohn Marino 16851ddd709SJohn Marino * For providing a replacement for a function that exists on some platforms 16951ddd709SJohn Marino but is broken/insufficient and needs to be replaced on some of them and 17051ddd709SJohn Marino is additionally either missing or undeclared on some other platforms: 17151ddd709SJohn Marino 17251ddd709SJohn Marino #if @GNULIB_FOO@ 17351ddd709SJohn Marino # if @REPLACE_FOO@ 17451ddd709SJohn Marino # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 17551ddd709SJohn Marino # undef foo 17651ddd709SJohn Marino # define foo rpl_foo 17751ddd709SJohn Marino # endif 17851ddd709SJohn Marino _GL_FUNCDECL_RPL (foo, ...); 17951ddd709SJohn Marino _GL_CXXALIAS_RPL (foo, ...); 18051ddd709SJohn Marino # else 18151ddd709SJohn Marino # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ 18251ddd709SJohn Marino _GL_FUNCDECL_SYS (foo, ...); 18351ddd709SJohn Marino # endif 18451ddd709SJohn Marino _GL_CXXALIAS_SYS (foo, ...); 18551ddd709SJohn Marino # endif 18651ddd709SJohn Marino _GL_CXXALIASWARN (foo); 18751ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 18851ddd709SJohn Marino ... 18951ddd709SJohn Marino #endif 19051ddd709SJohn Marino */ 19151ddd709SJohn Marino 19251ddd709SJohn Marino /* _GL_EXTERN_C declaration; 19351ddd709SJohn Marino performs the declaration with C linkage. */ 19451ddd709SJohn Marino #if defined __cplusplus 19551ddd709SJohn Marino # define _GL_EXTERN_C extern "C" 19651ddd709SJohn Marino #else 19751ddd709SJohn Marino # define _GL_EXTERN_C extern 19851ddd709SJohn Marino #endif 19951ddd709SJohn Marino 20051ddd709SJohn Marino /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); 20151ddd709SJohn Marino declares a replacement function, named rpl_func, with the given prototype, 20251ddd709SJohn Marino consisting of return type, parameters, and attributes. 20351ddd709SJohn Marino Example: 20451ddd709SJohn Marino _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) 20551ddd709SJohn Marino _GL_ARG_NONNULL ((1))); 20651ddd709SJohn Marino */ 20751ddd709SJohn Marino #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ 20851ddd709SJohn Marino _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) 20951ddd709SJohn Marino #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ 21051ddd709SJohn Marino _GL_EXTERN_C rettype rpl_func parameters_and_attributes 21151ddd709SJohn Marino 21251ddd709SJohn Marino /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); 21351ddd709SJohn Marino declares the system function, named func, with the given prototype, 21451ddd709SJohn Marino consisting of return type, parameters, and attributes. 21551ddd709SJohn Marino Example: 21651ddd709SJohn Marino _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) 21751ddd709SJohn Marino _GL_ARG_NONNULL ((1))); 21851ddd709SJohn Marino */ 21951ddd709SJohn Marino #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ 22051ddd709SJohn Marino _GL_EXTERN_C rettype func parameters_and_attributes 22151ddd709SJohn Marino 22251ddd709SJohn Marino /* _GL_CXXALIAS_RPL (func, rettype, parameters); 22351ddd709SJohn Marino declares a C++ alias called GNULIB_NAMESPACE::func 22451ddd709SJohn Marino that redirects to rpl_func, if GNULIB_NAMESPACE is defined. 22551ddd709SJohn Marino Example: 22651ddd709SJohn Marino _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); 227*4ce1b016SDaniel Fojt 228*4ce1b016SDaniel Fojt Wrapping rpl_func in an object with an inline conversion operator 229*4ce1b016SDaniel Fojt avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is 230*4ce1b016SDaniel Fojt actually used in the program. */ 23151ddd709SJohn Marino #define _GL_CXXALIAS_RPL(func,rettype,parameters) \ 23251ddd709SJohn Marino _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) 23351ddd709SJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE 23451ddd709SJohn Marino # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 23551ddd709SJohn Marino namespace GNULIB_NAMESPACE \ 23651ddd709SJohn Marino { \ 237*4ce1b016SDaniel Fojt static const struct _gl_ ## func ## _wrapper \ 238*4ce1b016SDaniel Fojt { \ 239*4ce1b016SDaniel Fojt typedef rettype (*type) parameters; \ 240*4ce1b016SDaniel Fojt \ 241*4ce1b016SDaniel Fojt inline operator type () const \ 242*4ce1b016SDaniel Fojt { \ 243*4ce1b016SDaniel Fojt return ::rpl_func; \ 244*4ce1b016SDaniel Fojt } \ 245*4ce1b016SDaniel Fojt } func = {}; \ 24651ddd709SJohn Marino } \ 24751ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 24851ddd709SJohn Marino #else 24951ddd709SJohn Marino # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 25051ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 25151ddd709SJohn Marino #endif 25251ddd709SJohn Marino 25351ddd709SJohn Marino /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); 25451ddd709SJohn Marino is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); 25551ddd709SJohn Marino except that the C function rpl_func may have a slightly different 25651ddd709SJohn Marino declaration. A cast is used to silence the "invalid conversion" error 25751ddd709SJohn Marino that would otherwise occur. */ 25851ddd709SJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE 25951ddd709SJohn Marino # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 26051ddd709SJohn Marino namespace GNULIB_NAMESPACE \ 26151ddd709SJohn Marino { \ 262*4ce1b016SDaniel Fojt static const struct _gl_ ## func ## _wrapper \ 263*4ce1b016SDaniel Fojt { \ 264*4ce1b016SDaniel Fojt typedef rettype (*type) parameters; \ 265*4ce1b016SDaniel Fojt \ 266*4ce1b016SDaniel Fojt inline operator type () const \ 267*4ce1b016SDaniel Fojt { \ 268*4ce1b016SDaniel Fojt return reinterpret_cast<type>(::rpl_func); \ 269*4ce1b016SDaniel Fojt } \ 270*4ce1b016SDaniel Fojt } func = {}; \ 27151ddd709SJohn Marino } \ 27251ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 27351ddd709SJohn Marino #else 27451ddd709SJohn Marino # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 27551ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 27651ddd709SJohn Marino #endif 27751ddd709SJohn Marino 27851ddd709SJohn Marino /* _GL_CXXALIAS_SYS (func, rettype, parameters); 27951ddd709SJohn Marino declares a C++ alias called GNULIB_NAMESPACE::func 28051ddd709SJohn Marino that redirects to the system provided function func, if GNULIB_NAMESPACE 28151ddd709SJohn Marino is defined. 28251ddd709SJohn Marino Example: 28351ddd709SJohn Marino _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); 284*4ce1b016SDaniel Fojt 285*4ce1b016SDaniel Fojt Wrapping func in an object with an inline conversion operator 286*4ce1b016SDaniel Fojt avoids a reference to func unless GNULIB_NAMESPACE::func is 287*4ce1b016SDaniel Fojt actually used in the program. */ 28851ddd709SJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE 28951ddd709SJohn Marino # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 29051ddd709SJohn Marino namespace GNULIB_NAMESPACE \ 29151ddd709SJohn Marino { \ 292*4ce1b016SDaniel Fojt static const struct _gl_ ## func ## _wrapper \ 293*4ce1b016SDaniel Fojt { \ 294*4ce1b016SDaniel Fojt typedef rettype (*type) parameters; \ 295*4ce1b016SDaniel Fojt \ 296*4ce1b016SDaniel Fojt inline operator type () const \ 297*4ce1b016SDaniel Fojt { \ 298*4ce1b016SDaniel Fojt return ::func; \ 299*4ce1b016SDaniel Fojt } \ 300*4ce1b016SDaniel Fojt } func = {}; \ 30151ddd709SJohn Marino } \ 30251ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 30351ddd709SJohn Marino #else 30451ddd709SJohn Marino # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 30551ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 30651ddd709SJohn Marino #endif 30751ddd709SJohn Marino 30851ddd709SJohn Marino /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); 30951ddd709SJohn Marino is like _GL_CXXALIAS_SYS (func, rettype, parameters); 31051ddd709SJohn Marino except that the C function func may have a slightly different declaration. 31151ddd709SJohn Marino A cast is used to silence the "invalid conversion" error that would 31251ddd709SJohn Marino otherwise occur. */ 31351ddd709SJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE 31451ddd709SJohn Marino # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 31551ddd709SJohn Marino namespace GNULIB_NAMESPACE \ 31651ddd709SJohn Marino { \ 317*4ce1b016SDaniel Fojt static const struct _gl_ ## func ## _wrapper \ 318*4ce1b016SDaniel Fojt { \ 319*4ce1b016SDaniel Fojt typedef rettype (*type) parameters; \ 320*4ce1b016SDaniel Fojt \ 321*4ce1b016SDaniel Fojt inline operator type () const \ 322*4ce1b016SDaniel Fojt { \ 323*4ce1b016SDaniel Fojt return reinterpret_cast<type>(::func); \ 324*4ce1b016SDaniel Fojt } \ 325*4ce1b016SDaniel Fojt } func = {}; \ 32651ddd709SJohn Marino } \ 32751ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 32851ddd709SJohn Marino #else 32951ddd709SJohn Marino # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 33051ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 33151ddd709SJohn Marino #endif 33251ddd709SJohn Marino 33351ddd709SJohn Marino /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); 33451ddd709SJohn Marino is like _GL_CXXALIAS_SYS (func, rettype, parameters); 33551ddd709SJohn Marino except that the C function is picked among a set of overloaded functions, 33651ddd709SJohn Marino namely the one with rettype2 and parameters2. Two consecutive casts 33751ddd709SJohn Marino are used to silence the "cannot find a match" and "invalid conversion" 33851ddd709SJohn Marino errors that would otherwise occur. */ 33951ddd709SJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE 34051ddd709SJohn Marino /* The outer cast must be a reinterpret_cast. 34151ddd709SJohn Marino The inner cast: When the function is defined as a set of overloaded 34251ddd709SJohn Marino functions, it works as a static_cast<>, choosing the designated variant. 34351ddd709SJohn Marino When the function is defined as a single variant, it works as a 34451ddd709SJohn Marino reinterpret_cast<>. The parenthesized cast syntax works both ways. */ 34551ddd709SJohn Marino # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 34651ddd709SJohn Marino namespace GNULIB_NAMESPACE \ 34751ddd709SJohn Marino { \ 348*4ce1b016SDaniel Fojt static const struct _gl_ ## func ## _wrapper \ 349*4ce1b016SDaniel Fojt { \ 350*4ce1b016SDaniel Fojt typedef rettype (*type) parameters; \ 351*4ce1b016SDaniel Fojt \ 352*4ce1b016SDaniel Fojt inline operator type () const \ 353*4ce1b016SDaniel Fojt { \ 354*4ce1b016SDaniel Fojt return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \ 355*4ce1b016SDaniel Fojt } \ 356*4ce1b016SDaniel Fojt } func = {}; \ 35751ddd709SJohn Marino } \ 35851ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 35951ddd709SJohn Marino #else 36051ddd709SJohn Marino # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 36151ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 36251ddd709SJohn Marino #endif 36351ddd709SJohn Marino 36451ddd709SJohn Marino /* _GL_CXXALIASWARN (func); 36551ddd709SJohn Marino causes a warning to be emitted when ::func is used but not when 36651ddd709SJohn Marino GNULIB_NAMESPACE::func is used. func must be defined without overloaded 36751ddd709SJohn Marino variants. */ 36851ddd709SJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE 36951ddd709SJohn Marino # define _GL_CXXALIASWARN(func) \ 37051ddd709SJohn Marino _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) 37151ddd709SJohn Marino # define _GL_CXXALIASWARN_1(func,namespace) \ 37251ddd709SJohn Marino _GL_CXXALIASWARN_2 (func, namespace) 373*4ce1b016SDaniel Fojt /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 37451ddd709SJohn Marino we enable the warning only when not optimizing. */ 37551ddd709SJohn Marino # if !__OPTIMIZE__ 37651ddd709SJohn Marino # define _GL_CXXALIASWARN_2(func,namespace) \ 37751ddd709SJohn Marino _GL_WARN_ON_USE (func, \ 37851ddd709SJohn Marino "The symbol ::" #func " refers to the system function. " \ 37951ddd709SJohn Marino "Use " #namespace "::" #func " instead.") 38051ddd709SJohn Marino # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 38151ddd709SJohn Marino # define _GL_CXXALIASWARN_2(func,namespace) \ 38251ddd709SJohn Marino extern __typeof__ (func) func 38351ddd709SJohn Marino # else 38451ddd709SJohn Marino # define _GL_CXXALIASWARN_2(func,namespace) \ 38551ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 38651ddd709SJohn Marino # endif 38751ddd709SJohn Marino #else 38851ddd709SJohn Marino # define _GL_CXXALIASWARN(func) \ 38951ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 39051ddd709SJohn Marino #endif 39151ddd709SJohn Marino 39251ddd709SJohn Marino /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); 39351ddd709SJohn Marino causes a warning to be emitted when the given overloaded variant of ::func 39451ddd709SJohn Marino is used but not when GNULIB_NAMESPACE::func is used. */ 39551ddd709SJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE 39651ddd709SJohn Marino # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 39751ddd709SJohn Marino _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ 39851ddd709SJohn Marino GNULIB_NAMESPACE) 39951ddd709SJohn Marino # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ 40051ddd709SJohn Marino _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) 401*4ce1b016SDaniel Fojt /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 40251ddd709SJohn Marino we enable the warning only when not optimizing. */ 40351ddd709SJohn Marino # if !__OPTIMIZE__ 40451ddd709SJohn Marino # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 40551ddd709SJohn Marino _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \ 40651ddd709SJohn Marino "The symbol ::" #func " refers to the system function. " \ 40751ddd709SJohn Marino "Use " #namespace "::" #func " instead.") 40851ddd709SJohn Marino # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 40951ddd709SJohn Marino # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 41051ddd709SJohn Marino extern __typeof__ (func) func 41151ddd709SJohn Marino # else 41251ddd709SJohn Marino # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 41351ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 41451ddd709SJohn Marino # endif 41551ddd709SJohn Marino #else 41651ddd709SJohn Marino # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 41751ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 41851ddd709SJohn Marino #endif 41951ddd709SJohn Marino 42051ddd709SJohn Marino #endif /* _GL_CXXDEFS_H */ 42151ddd709SJohn Marino 42251ddd709SJohn Marino /* The definition of _GL_ARG_NONNULL is copied here. */ 423*4ce1b016SDaniel Fojt /* A C macro for declaring that specific arguments must not be NULL. 424*4ce1b016SDaniel Fojt Copyright (C) 2009-2020 Free Software Foundation, Inc. 425*4ce1b016SDaniel Fojt 426*4ce1b016SDaniel Fojt This program is free software: you can redistribute it and/or modify it 427*4ce1b016SDaniel Fojt under the terms of the GNU General Public License as published 428*4ce1b016SDaniel Fojt by the Free Software Foundation; either version 3 of the License, or 429*4ce1b016SDaniel Fojt (at your option) any later version. 430*4ce1b016SDaniel Fojt 431*4ce1b016SDaniel Fojt This program is distributed in the hope that it will be useful, 432*4ce1b016SDaniel Fojt but WITHOUT ANY WARRANTY; without even the implied warranty of 433*4ce1b016SDaniel Fojt MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 434*4ce1b016SDaniel Fojt General Public License for more details. 435*4ce1b016SDaniel Fojt 436*4ce1b016SDaniel Fojt You should have received a copy of the GNU General Public License 437*4ce1b016SDaniel Fojt along with this program. If not, see <https://www.gnu.org/licenses/>. */ 438*4ce1b016SDaniel Fojt 43951ddd709SJohn Marino /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools 44051ddd709SJohn Marino that the values passed as arguments n, ..., m must be non-NULL pointers. 44151ddd709SJohn Marino n = 1 stands for the first argument, n = 2 for the second argument etc. */ 44251ddd709SJohn Marino #ifndef _GL_ARG_NONNULL 44351ddd709SJohn Marino # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3 44451ddd709SJohn Marino # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) 44551ddd709SJohn Marino # else 44651ddd709SJohn Marino # define _GL_ARG_NONNULL(params) 44751ddd709SJohn Marino # endif 44851ddd709SJohn Marino #endif 44951ddd709SJohn Marino 45051ddd709SJohn Marino /* The definition of _GL_WARN_ON_USE is copied here. */ 451*4ce1b016SDaniel Fojt /* A C macro for emitting warnings if a function is used. 452*4ce1b016SDaniel Fojt Copyright (C) 2010-2020 Free Software Foundation, Inc. 453*4ce1b016SDaniel Fojt 454*4ce1b016SDaniel Fojt This program is free software: you can redistribute it and/or modify it 455*4ce1b016SDaniel Fojt under the terms of the GNU General Public License as published 456*4ce1b016SDaniel Fojt by the Free Software Foundation; either version 3 of the License, or 457*4ce1b016SDaniel Fojt (at your option) any later version. 458*4ce1b016SDaniel Fojt 459*4ce1b016SDaniel Fojt This program is distributed in the hope that it will be useful, 460*4ce1b016SDaniel Fojt but WITHOUT ANY WARRANTY; without even the implied warranty of 461*4ce1b016SDaniel Fojt MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 462*4ce1b016SDaniel Fojt General Public License for more details. 463*4ce1b016SDaniel Fojt 464*4ce1b016SDaniel Fojt You should have received a copy of the GNU General Public License 465*4ce1b016SDaniel Fojt along with this program. If not, see <https://www.gnu.org/licenses/>. */ 466*4ce1b016SDaniel Fojt 467*4ce1b016SDaniel Fojt /* _GL_WARN_ON_USE (function, "literal string") issues a declaration 468*4ce1b016SDaniel Fojt for FUNCTION which will then trigger a compiler warning containing 469*4ce1b016SDaniel Fojt the text of "literal string" anywhere that function is called, if 470*4ce1b016SDaniel Fojt supported by the compiler. If the compiler does not support this 471*4ce1b016SDaniel Fojt feature, the macro expands to an unused extern declaration. 472*4ce1b016SDaniel Fojt 473*4ce1b016SDaniel Fojt _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the 474*4ce1b016SDaniel Fojt attribute used in _GL_WARN_ON_USE. If the compiler does not support 475*4ce1b016SDaniel Fojt this feature, it expands to empty. 476*4ce1b016SDaniel Fojt 477*4ce1b016SDaniel Fojt These macros are useful for marking a function as a potential 478*4ce1b016SDaniel Fojt portability trap, with the intent that "literal string" include 479*4ce1b016SDaniel Fojt instructions on the replacement function that should be used 480*4ce1b016SDaniel Fojt instead. 481*4ce1b016SDaniel Fojt _GL_WARN_ON_USE is for functions with 'extern' linkage. 482*4ce1b016SDaniel Fojt _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline' 483*4ce1b016SDaniel Fojt linkage. 484*4ce1b016SDaniel Fojt 485*4ce1b016SDaniel Fojt However, one of the reasons that a function is a portability trap is 486*4ce1b016SDaniel Fojt if it has the wrong signature. Declaring FUNCTION with a different 487*4ce1b016SDaniel Fojt signature in C is a compilation error, so this macro must use the 488*4ce1b016SDaniel Fojt same type as any existing declaration so that programs that avoid 489*4ce1b016SDaniel Fojt the problematic FUNCTION do not fail to compile merely because they 490*4ce1b016SDaniel Fojt included a header that poisoned the function. But this implies that 491*4ce1b016SDaniel Fojt _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already 492*4ce1b016SDaniel Fojt have a declaration. Use of this macro implies that there must not 493*4ce1b016SDaniel Fojt be any other macro hiding the declaration of FUNCTION; but 494*4ce1b016SDaniel Fojt undefining FUNCTION first is part of the poisoning process anyway 495*4ce1b016SDaniel Fojt (although for symbols that are provided only via a macro, the result 496*4ce1b016SDaniel Fojt is a compilation error rather than a warning containing 497*4ce1b016SDaniel Fojt "literal string"). Also note that in C++, it is only safe to use if 498*4ce1b016SDaniel Fojt FUNCTION has no overloads. 499*4ce1b016SDaniel Fojt 500*4ce1b016SDaniel Fojt For an example, it is possible to poison 'getline' by: 501*4ce1b016SDaniel Fojt - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]], 502*4ce1b016SDaniel Fojt [getline]) in configure.ac, which potentially defines 503*4ce1b016SDaniel Fojt HAVE_RAW_DECL_GETLINE 504*4ce1b016SDaniel Fojt - adding this code to a header that wraps the system <stdio.h>: 505*4ce1b016SDaniel Fojt #undef getline 506*4ce1b016SDaniel Fojt #if HAVE_RAW_DECL_GETLINE 507*4ce1b016SDaniel Fojt _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but" 508*4ce1b016SDaniel Fojt "not universally present; use the gnulib module getline"); 509*4ce1b016SDaniel Fojt #endif 510*4ce1b016SDaniel Fojt 511*4ce1b016SDaniel Fojt It is not possible to directly poison global variables. But it is 512*4ce1b016SDaniel Fojt possible to write a wrapper accessor function, and poison that 513*4ce1b016SDaniel Fojt (less common usage, like &environ, will cause a compilation error 514*4ce1b016SDaniel Fojt rather than issue the nice warning, but the end result of informing 515*4ce1b016SDaniel Fojt the developer about their portability problem is still achieved): 516*4ce1b016SDaniel Fojt #if HAVE_RAW_DECL_ENVIRON 517*4ce1b016SDaniel Fojt static char *** 518*4ce1b016SDaniel Fojt rpl_environ (void) { return &environ; } 519*4ce1b016SDaniel Fojt _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared"); 520*4ce1b016SDaniel Fojt # undef environ 521*4ce1b016SDaniel Fojt # define environ (*rpl_environ ()) 522*4ce1b016SDaniel Fojt #endif 523*4ce1b016SDaniel Fojt or better (avoiding contradictory use of 'static' and 'extern'): 524*4ce1b016SDaniel Fojt #if HAVE_RAW_DECL_ENVIRON 525*4ce1b016SDaniel Fojt static char *** 526*4ce1b016SDaniel Fojt _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared") 527*4ce1b016SDaniel Fojt rpl_environ (void) { return &environ; } 528*4ce1b016SDaniel Fojt # undef environ 529*4ce1b016SDaniel Fojt # define environ (*rpl_environ ()) 530*4ce1b016SDaniel Fojt #endif 531*4ce1b016SDaniel Fojt */ 53251ddd709SJohn Marino #ifndef _GL_WARN_ON_USE 53351ddd709SJohn Marino 53451ddd709SJohn Marino # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 53551ddd709SJohn Marino /* A compiler attribute is available in gcc versions 4.3.0 and later. */ 53651ddd709SJohn Marino # define _GL_WARN_ON_USE(function, message) \ 53751ddd709SJohn Marino extern __typeof__ (function) function __attribute__ ((__warning__ (message))) 538*4ce1b016SDaniel Fojt # define _GL_WARN_ON_USE_ATTRIBUTE(message) \ 539*4ce1b016SDaniel Fojt __attribute__ ((__warning__ (message))) 54051ddd709SJohn Marino # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 54151ddd709SJohn Marino /* Verify the existence of the function. */ 54251ddd709SJohn Marino # define _GL_WARN_ON_USE(function, message) \ 54351ddd709SJohn Marino extern __typeof__ (function) function 544*4ce1b016SDaniel Fojt # define _GL_WARN_ON_USE_ATTRIBUTE(message) 54551ddd709SJohn Marino # else /* Unsupported. */ 54651ddd709SJohn Marino # define _GL_WARN_ON_USE(function, message) \ 54751ddd709SJohn Marino _GL_WARN_EXTERN_C int _gl_warn_on_use 548*4ce1b016SDaniel Fojt # define _GL_WARN_ON_USE_ATTRIBUTE(message) 54951ddd709SJohn Marino # endif 55051ddd709SJohn Marino #endif 55151ddd709SJohn Marino 55251ddd709SJohn Marino /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string") 55351ddd709SJohn Marino is like _GL_WARN_ON_USE (function, "string"), except that the function is 55451ddd709SJohn Marino declared with the given prototype, consisting of return type, parameters, 55551ddd709SJohn Marino and attributes. 55651ddd709SJohn Marino This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does 55751ddd709SJohn Marino not work in this case. */ 55851ddd709SJohn Marino #ifndef _GL_WARN_ON_USE_CXX 55951ddd709SJohn Marino # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 56051ddd709SJohn Marino # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 56151ddd709SJohn Marino extern rettype function parameters_and_attributes \ 56251ddd709SJohn Marino __attribute__ ((__warning__ (msg))) 56351ddd709SJohn Marino # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 56451ddd709SJohn Marino /* Verify the existence of the function. */ 56551ddd709SJohn Marino # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 56651ddd709SJohn Marino extern rettype function parameters_and_attributes 56751ddd709SJohn Marino # else /* Unsupported. */ 56851ddd709SJohn Marino # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 56951ddd709SJohn Marino _GL_WARN_EXTERN_C int _gl_warn_on_use 57051ddd709SJohn Marino # endif 57151ddd709SJohn Marino #endif 57251ddd709SJohn Marino 57351ddd709SJohn Marino /* _GL_WARN_EXTERN_C declaration; 57451ddd709SJohn Marino performs the declaration with C linkage. */ 57551ddd709SJohn Marino #ifndef _GL_WARN_EXTERN_C 57651ddd709SJohn Marino # if defined __cplusplus 57751ddd709SJohn Marino # define _GL_WARN_EXTERN_C extern "C" 57851ddd709SJohn Marino # else 57951ddd709SJohn Marino # define _GL_WARN_EXTERN_C extern 58051ddd709SJohn Marino # endif 58151ddd709SJohn Marino #endif 58251ddd709SJohn Marino 58351ddd709SJohn Marino 58451ddd709SJohn Marino /* Define wint_t and WEOF. (Also done in wctype.in.h.) */ 58551ddd709SJohn Marino #if !1 && !defined wint_t 58651ddd709SJohn Marino # define wint_t int 58751ddd709SJohn Marino # ifndef WEOF 58851ddd709SJohn Marino # define WEOF -1 58951ddd709SJohn Marino # endif 59051ddd709SJohn Marino #else 591*4ce1b016SDaniel Fojt /* mingw and MSVC define wint_t as 'unsigned short' in <crtdefs.h> or 592*4ce1b016SDaniel Fojt <stddef.h>. This is too small: ISO C 99 section 7.24.1.(2) says that 593*4ce1b016SDaniel Fojt wint_t must be "unchanged by default argument promotions". Override it. */ 594*4ce1b016SDaniel Fojt # if 0 59551ddd709SJohn Marino # if !GNULIB_defined_wint_t 596*4ce1b016SDaniel Fojt # if 0 59751ddd709SJohn Marino # include <crtdefs.h> 598*4ce1b016SDaniel Fojt # else 599*4ce1b016SDaniel Fojt # include <stddef.h> 600*4ce1b016SDaniel Fojt # endif 60151ddd709SJohn Marino typedef unsigned int rpl_wint_t; 60251ddd709SJohn Marino # undef wint_t 60351ddd709SJohn Marino # define wint_t rpl_wint_t 60451ddd709SJohn Marino # define GNULIB_defined_wint_t 1 60551ddd709SJohn Marino # endif 60651ddd709SJohn Marino # endif 60751ddd709SJohn Marino # ifndef WEOF 60851ddd709SJohn Marino # define WEOF ((wint_t) -1) 60951ddd709SJohn Marino # endif 61051ddd709SJohn Marino #endif 61151ddd709SJohn Marino 61251ddd709SJohn Marino 61351ddd709SJohn Marino /* Override mbstate_t if it is too small. 61451ddd709SJohn Marino On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for 615*4ce1b016SDaniel Fojt implementing mbrtowc for encodings like UTF-8. 616*4ce1b016SDaniel Fojt On AIX and MSVC, mbrtowc needs to be overridden, but mbstate_t exists and is 617*4ce1b016SDaniel Fojt large enough and overriding it would cause problems in C++ mode. */ 618*4ce1b016SDaniel Fojt #if !(((defined _WIN32 && !defined __CYGWIN__) || 1) && 1) || 0 61951ddd709SJohn Marino # if !GNULIB_defined_mbstate_t 620*4ce1b016SDaniel Fojt # if !(defined _AIX || defined _MSC_VER) 62151ddd709SJohn Marino typedef int rpl_mbstate_t; 62251ddd709SJohn Marino # undef mbstate_t 62351ddd709SJohn Marino # define mbstate_t rpl_mbstate_t 624*4ce1b016SDaniel Fojt # endif 62551ddd709SJohn Marino # define GNULIB_defined_mbstate_t 1 62651ddd709SJohn Marino # endif 62751ddd709SJohn Marino #endif 62851ddd709SJohn Marino 62951ddd709SJohn Marino 63051ddd709SJohn Marino /* Convert a single-byte character to a wide character. */ 63151ddd709SJohn Marino #if 1 63251ddd709SJohn Marino # if 0 63351ddd709SJohn Marino # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 63451ddd709SJohn Marino # undef btowc 63551ddd709SJohn Marino # define btowc rpl_btowc 63651ddd709SJohn Marino # endif 63751ddd709SJohn Marino _GL_FUNCDECL_RPL (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE); 63851ddd709SJohn Marino _GL_CXXALIAS_RPL (btowc, wint_t, (int c)); 63951ddd709SJohn Marino # else 64051ddd709SJohn Marino # if !1 64151ddd709SJohn Marino _GL_FUNCDECL_SYS (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE); 64251ddd709SJohn Marino # endif 643*4ce1b016SDaniel Fojt /* Need to cast, because on mingw, the return type is 'unsigned short'. */ 644*4ce1b016SDaniel Fojt _GL_CXXALIAS_SYS_CAST (btowc, wint_t, (int c)); 64551ddd709SJohn Marino # endif 646*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2 64751ddd709SJohn Marino _GL_CXXALIASWARN (btowc); 648*4ce1b016SDaniel Fojt # endif 64951ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 65051ddd709SJohn Marino # undef btowc 65151ddd709SJohn Marino # if HAVE_RAW_DECL_BTOWC 65251ddd709SJohn Marino _GL_WARN_ON_USE (btowc, "btowc is unportable - " 65351ddd709SJohn Marino "use gnulib module btowc for portability"); 65451ddd709SJohn Marino # endif 65551ddd709SJohn Marino #endif 65651ddd709SJohn Marino 65751ddd709SJohn Marino 65851ddd709SJohn Marino /* Convert a wide character to a single-byte character. */ 65951ddd709SJohn Marino #if 1 66051ddd709SJohn Marino # if 0 66151ddd709SJohn Marino # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 66251ddd709SJohn Marino # undef wctob 66351ddd709SJohn Marino # define wctob rpl_wctob 66451ddd709SJohn Marino # endif 66551ddd709SJohn Marino _GL_FUNCDECL_RPL (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE); 66651ddd709SJohn Marino _GL_CXXALIAS_RPL (wctob, int, (wint_t wc)); 66751ddd709SJohn Marino # else 66851ddd709SJohn Marino # if !defined wctob && !1 66951ddd709SJohn Marino /* wctob is provided by gnulib, or wctob exists but is not declared. */ 67051ddd709SJohn Marino _GL_FUNCDECL_SYS (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE); 67151ddd709SJohn Marino # endif 67251ddd709SJohn Marino _GL_CXXALIAS_SYS (wctob, int, (wint_t wc)); 67351ddd709SJohn Marino # endif 674*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2 67551ddd709SJohn Marino _GL_CXXALIASWARN (wctob); 676*4ce1b016SDaniel Fojt # endif 67751ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 67851ddd709SJohn Marino # undef wctob 67951ddd709SJohn Marino # if HAVE_RAW_DECL_WCTOB 68051ddd709SJohn Marino _GL_WARN_ON_USE (wctob, "wctob is unportable - " 68151ddd709SJohn Marino "use gnulib module wctob for portability"); 68251ddd709SJohn Marino # endif 68351ddd709SJohn Marino #endif 68451ddd709SJohn Marino 68551ddd709SJohn Marino 68651ddd709SJohn Marino /* Test whether *PS is in the initial state. */ 68751ddd709SJohn Marino #if 1 68851ddd709SJohn Marino # if 0 68951ddd709SJohn Marino # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 69051ddd709SJohn Marino # undef mbsinit 69151ddd709SJohn Marino # define mbsinit rpl_mbsinit 69251ddd709SJohn Marino # endif 69351ddd709SJohn Marino _GL_FUNCDECL_RPL (mbsinit, int, (const mbstate_t *ps)); 69451ddd709SJohn Marino _GL_CXXALIAS_RPL (mbsinit, int, (const mbstate_t *ps)); 69551ddd709SJohn Marino # else 69651ddd709SJohn Marino # if !1 69751ddd709SJohn Marino _GL_FUNCDECL_SYS (mbsinit, int, (const mbstate_t *ps)); 69851ddd709SJohn Marino # endif 69951ddd709SJohn Marino _GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps)); 70051ddd709SJohn Marino # endif 701*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2 70251ddd709SJohn Marino _GL_CXXALIASWARN (mbsinit); 703*4ce1b016SDaniel Fojt # endif 70451ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 70551ddd709SJohn Marino # undef mbsinit 70651ddd709SJohn Marino # if HAVE_RAW_DECL_MBSINIT 70751ddd709SJohn Marino _GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - " 70851ddd709SJohn Marino "use gnulib module mbsinit for portability"); 70951ddd709SJohn Marino # endif 71051ddd709SJohn Marino #endif 71151ddd709SJohn Marino 71251ddd709SJohn Marino 71351ddd709SJohn Marino /* Convert a multibyte character to a wide character. */ 71451ddd709SJohn Marino #if 1 71551ddd709SJohn Marino # if 0 71651ddd709SJohn Marino # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 71751ddd709SJohn Marino # undef mbrtowc 71851ddd709SJohn Marino # define mbrtowc rpl_mbrtowc 71951ddd709SJohn Marino # endif 72051ddd709SJohn Marino _GL_FUNCDECL_RPL (mbrtowc, size_t, 72151ddd709SJohn Marino (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); 72251ddd709SJohn Marino _GL_CXXALIAS_RPL (mbrtowc, size_t, 72351ddd709SJohn Marino (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); 72451ddd709SJohn Marino # else 72551ddd709SJohn Marino # if !1 72651ddd709SJohn Marino _GL_FUNCDECL_SYS (mbrtowc, size_t, 72751ddd709SJohn Marino (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); 72851ddd709SJohn Marino # endif 72951ddd709SJohn Marino _GL_CXXALIAS_SYS (mbrtowc, size_t, 73051ddd709SJohn Marino (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); 73151ddd709SJohn Marino # endif 732*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2 73351ddd709SJohn Marino _GL_CXXALIASWARN (mbrtowc); 734*4ce1b016SDaniel Fojt # endif 73551ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 73651ddd709SJohn Marino # undef mbrtowc 73751ddd709SJohn Marino # if HAVE_RAW_DECL_MBRTOWC 73851ddd709SJohn Marino _GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - " 73951ddd709SJohn Marino "use gnulib module mbrtowc for portability"); 74051ddd709SJohn Marino # endif 74151ddd709SJohn Marino #endif 74251ddd709SJohn Marino 74351ddd709SJohn Marino 74451ddd709SJohn Marino /* Recognize a multibyte character. */ 74551ddd709SJohn Marino #if 1 74651ddd709SJohn Marino # if 0 74751ddd709SJohn Marino # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 74851ddd709SJohn Marino # undef mbrlen 74951ddd709SJohn Marino # define mbrlen rpl_mbrlen 75051ddd709SJohn Marino # endif 75151ddd709SJohn Marino _GL_FUNCDECL_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); 75251ddd709SJohn Marino _GL_CXXALIAS_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); 75351ddd709SJohn Marino # else 75451ddd709SJohn Marino # if !1 75551ddd709SJohn Marino _GL_FUNCDECL_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); 75651ddd709SJohn Marino # endif 75751ddd709SJohn Marino _GL_CXXALIAS_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); 75851ddd709SJohn Marino # endif 759*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2 76051ddd709SJohn Marino _GL_CXXALIASWARN (mbrlen); 761*4ce1b016SDaniel Fojt # endif 76251ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 76351ddd709SJohn Marino # undef mbrlen 76451ddd709SJohn Marino # if HAVE_RAW_DECL_MBRLEN 76551ddd709SJohn Marino _GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - " 76651ddd709SJohn Marino "use gnulib module mbrlen for portability"); 76751ddd709SJohn Marino # endif 76851ddd709SJohn Marino #endif 76951ddd709SJohn Marino 77051ddd709SJohn Marino 77151ddd709SJohn Marino /* Convert a string to a wide string. */ 77251ddd709SJohn Marino #if 1 77351ddd709SJohn Marino # if 0 77451ddd709SJohn Marino # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 77551ddd709SJohn Marino # undef mbsrtowcs 77651ddd709SJohn Marino # define mbsrtowcs rpl_mbsrtowcs 77751ddd709SJohn Marino # endif 77851ddd709SJohn Marino _GL_FUNCDECL_RPL (mbsrtowcs, size_t, 77951ddd709SJohn Marino (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps) 78051ddd709SJohn Marino _GL_ARG_NONNULL ((2))); 78151ddd709SJohn Marino _GL_CXXALIAS_RPL (mbsrtowcs, size_t, 78251ddd709SJohn Marino (wchar_t *dest, const char **srcp, size_t len, 78351ddd709SJohn Marino mbstate_t *ps)); 78451ddd709SJohn Marino # else 78551ddd709SJohn Marino # if !1 78651ddd709SJohn Marino _GL_FUNCDECL_SYS (mbsrtowcs, size_t, 78751ddd709SJohn Marino (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps) 78851ddd709SJohn Marino _GL_ARG_NONNULL ((2))); 78951ddd709SJohn Marino # endif 79051ddd709SJohn Marino _GL_CXXALIAS_SYS (mbsrtowcs, size_t, 79151ddd709SJohn Marino (wchar_t *dest, const char **srcp, size_t len, 79251ddd709SJohn Marino mbstate_t *ps)); 79351ddd709SJohn Marino # endif 794*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2 79551ddd709SJohn Marino _GL_CXXALIASWARN (mbsrtowcs); 796*4ce1b016SDaniel Fojt # endif 79751ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 79851ddd709SJohn Marino # undef mbsrtowcs 79951ddd709SJohn Marino # if HAVE_RAW_DECL_MBSRTOWCS 80051ddd709SJohn Marino _GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - " 80151ddd709SJohn Marino "use gnulib module mbsrtowcs for portability"); 80251ddd709SJohn Marino # endif 80351ddd709SJohn Marino #endif 80451ddd709SJohn Marino 80551ddd709SJohn Marino 80651ddd709SJohn Marino /* Convert a string to a wide string. */ 80751ddd709SJohn Marino #if 0 80851ddd709SJohn Marino # if 0 80951ddd709SJohn Marino # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 81051ddd709SJohn Marino # undef mbsnrtowcs 81151ddd709SJohn Marino # define mbsnrtowcs rpl_mbsnrtowcs 81251ddd709SJohn Marino # endif 81351ddd709SJohn Marino _GL_FUNCDECL_RPL (mbsnrtowcs, size_t, 81451ddd709SJohn Marino (wchar_t *dest, const char **srcp, size_t srclen, size_t len, 81551ddd709SJohn Marino mbstate_t *ps) 81651ddd709SJohn Marino _GL_ARG_NONNULL ((2))); 81751ddd709SJohn Marino _GL_CXXALIAS_RPL (mbsnrtowcs, size_t, 81851ddd709SJohn Marino (wchar_t *dest, const char **srcp, size_t srclen, size_t len, 81951ddd709SJohn Marino mbstate_t *ps)); 82051ddd709SJohn Marino # else 82151ddd709SJohn Marino # if !1 82251ddd709SJohn Marino _GL_FUNCDECL_SYS (mbsnrtowcs, size_t, 82351ddd709SJohn Marino (wchar_t *dest, const char **srcp, size_t srclen, size_t len, 82451ddd709SJohn Marino mbstate_t *ps) 82551ddd709SJohn Marino _GL_ARG_NONNULL ((2))); 82651ddd709SJohn Marino # endif 82751ddd709SJohn Marino _GL_CXXALIAS_SYS (mbsnrtowcs, size_t, 82851ddd709SJohn Marino (wchar_t *dest, const char **srcp, size_t srclen, size_t len, 82951ddd709SJohn Marino mbstate_t *ps)); 83051ddd709SJohn Marino # endif 83151ddd709SJohn Marino _GL_CXXALIASWARN (mbsnrtowcs); 83251ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 83351ddd709SJohn Marino # undef mbsnrtowcs 83451ddd709SJohn Marino # if HAVE_RAW_DECL_MBSNRTOWCS 83551ddd709SJohn Marino _GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - " 83651ddd709SJohn Marino "use gnulib module mbsnrtowcs for portability"); 83751ddd709SJohn Marino # endif 83851ddd709SJohn Marino #endif 83951ddd709SJohn Marino 84051ddd709SJohn Marino 84151ddd709SJohn Marino /* Convert a wide character to a multibyte character. */ 84251ddd709SJohn Marino #if 1 84351ddd709SJohn Marino # if 0 84451ddd709SJohn Marino # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 84551ddd709SJohn Marino # undef wcrtomb 84651ddd709SJohn Marino # define wcrtomb rpl_wcrtomb 84751ddd709SJohn Marino # endif 84851ddd709SJohn Marino _GL_FUNCDECL_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); 84951ddd709SJohn Marino _GL_CXXALIAS_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); 85051ddd709SJohn Marino # else 85151ddd709SJohn Marino # if !1 85251ddd709SJohn Marino _GL_FUNCDECL_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); 85351ddd709SJohn Marino # endif 85451ddd709SJohn Marino _GL_CXXALIAS_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); 85551ddd709SJohn Marino # endif 856*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2 85751ddd709SJohn Marino _GL_CXXALIASWARN (wcrtomb); 858*4ce1b016SDaniel Fojt # endif 85951ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 86051ddd709SJohn Marino # undef wcrtomb 86151ddd709SJohn Marino # if HAVE_RAW_DECL_WCRTOMB 86251ddd709SJohn Marino _GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - " 86351ddd709SJohn Marino "use gnulib module wcrtomb for portability"); 86451ddd709SJohn Marino # endif 86551ddd709SJohn Marino #endif 86651ddd709SJohn Marino 86751ddd709SJohn Marino 86851ddd709SJohn Marino /* Convert a wide string to a string. */ 86951ddd709SJohn Marino #if 0 87051ddd709SJohn Marino # if 0 87151ddd709SJohn Marino # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 87251ddd709SJohn Marino # undef wcsrtombs 87351ddd709SJohn Marino # define wcsrtombs rpl_wcsrtombs 87451ddd709SJohn Marino # endif 87551ddd709SJohn Marino _GL_FUNCDECL_RPL (wcsrtombs, size_t, 87651ddd709SJohn Marino (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps) 87751ddd709SJohn Marino _GL_ARG_NONNULL ((2))); 87851ddd709SJohn Marino _GL_CXXALIAS_RPL (wcsrtombs, size_t, 87951ddd709SJohn Marino (char *dest, const wchar_t **srcp, size_t len, 88051ddd709SJohn Marino mbstate_t *ps)); 88151ddd709SJohn Marino # else 88251ddd709SJohn Marino # if !1 88351ddd709SJohn Marino _GL_FUNCDECL_SYS (wcsrtombs, size_t, 88451ddd709SJohn Marino (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps) 88551ddd709SJohn Marino _GL_ARG_NONNULL ((2))); 88651ddd709SJohn Marino # endif 88751ddd709SJohn Marino _GL_CXXALIAS_SYS (wcsrtombs, size_t, 88851ddd709SJohn Marino (char *dest, const wchar_t **srcp, size_t len, 88951ddd709SJohn Marino mbstate_t *ps)); 89051ddd709SJohn Marino # endif 891*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2 89251ddd709SJohn Marino _GL_CXXALIASWARN (wcsrtombs); 893*4ce1b016SDaniel Fojt # endif 89451ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 89551ddd709SJohn Marino # undef wcsrtombs 89651ddd709SJohn Marino # if HAVE_RAW_DECL_WCSRTOMBS 89751ddd709SJohn Marino _GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - " 89851ddd709SJohn Marino "use gnulib module wcsrtombs for portability"); 89951ddd709SJohn Marino # endif 90051ddd709SJohn Marino #endif 90151ddd709SJohn Marino 90251ddd709SJohn Marino 90351ddd709SJohn Marino /* Convert a wide string to a string. */ 90451ddd709SJohn Marino #if 0 90551ddd709SJohn Marino # if 0 90651ddd709SJohn Marino # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 90751ddd709SJohn Marino # undef wcsnrtombs 90851ddd709SJohn Marino # define wcsnrtombs rpl_wcsnrtombs 90951ddd709SJohn Marino # endif 91051ddd709SJohn Marino _GL_FUNCDECL_RPL (wcsnrtombs, size_t, 91151ddd709SJohn Marino (char *dest, const wchar_t **srcp, size_t srclen, size_t len, 91251ddd709SJohn Marino mbstate_t *ps) 91351ddd709SJohn Marino _GL_ARG_NONNULL ((2))); 91451ddd709SJohn Marino _GL_CXXALIAS_RPL (wcsnrtombs, size_t, 91551ddd709SJohn Marino (char *dest, const wchar_t **srcp, size_t srclen, size_t len, 91651ddd709SJohn Marino mbstate_t *ps)); 91751ddd709SJohn Marino # else 918*4ce1b016SDaniel Fojt # if !1 || (defined __cplusplus && defined __sun) 91951ddd709SJohn Marino _GL_FUNCDECL_SYS (wcsnrtombs, size_t, 92051ddd709SJohn Marino (char *dest, const wchar_t **srcp, size_t srclen, size_t len, 92151ddd709SJohn Marino mbstate_t *ps) 92251ddd709SJohn Marino _GL_ARG_NONNULL ((2))); 92351ddd709SJohn Marino # endif 92451ddd709SJohn Marino _GL_CXXALIAS_SYS (wcsnrtombs, size_t, 92551ddd709SJohn Marino (char *dest, const wchar_t **srcp, size_t srclen, size_t len, 92651ddd709SJohn Marino mbstate_t *ps)); 92751ddd709SJohn Marino # endif 928*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2 92951ddd709SJohn Marino _GL_CXXALIASWARN (wcsnrtombs); 930*4ce1b016SDaniel Fojt # endif 93151ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 93251ddd709SJohn Marino # undef wcsnrtombs 93351ddd709SJohn Marino # if HAVE_RAW_DECL_WCSNRTOMBS 93451ddd709SJohn Marino _GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - " 93551ddd709SJohn Marino "use gnulib module wcsnrtombs for portability"); 93651ddd709SJohn Marino # endif 93751ddd709SJohn Marino #endif 93851ddd709SJohn Marino 93951ddd709SJohn Marino 94051ddd709SJohn Marino /* Return the number of screen columns needed for WC. */ 94151ddd709SJohn Marino #if 1 942cf51209aSJohn Marino # if 0 94351ddd709SJohn Marino # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 94451ddd709SJohn Marino # undef wcwidth 94551ddd709SJohn Marino # define wcwidth rpl_wcwidth 94651ddd709SJohn Marino # endif 94751ddd709SJohn Marino _GL_FUNCDECL_RPL (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE); 94851ddd709SJohn Marino _GL_CXXALIAS_RPL (wcwidth, int, (wchar_t)); 94951ddd709SJohn Marino # else 95051ddd709SJohn Marino # if !1 95151ddd709SJohn Marino /* wcwidth exists but is not declared. */ 95251ddd709SJohn Marino _GL_FUNCDECL_SYS (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE); 95351ddd709SJohn Marino # endif 95451ddd709SJohn Marino _GL_CXXALIAS_SYS (wcwidth, int, (wchar_t)); 95551ddd709SJohn Marino # endif 956*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2 95751ddd709SJohn Marino _GL_CXXALIASWARN (wcwidth); 958*4ce1b016SDaniel Fojt # endif 95951ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 96051ddd709SJohn Marino # undef wcwidth 96151ddd709SJohn Marino # if HAVE_RAW_DECL_WCWIDTH 96251ddd709SJohn Marino _GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - " 96351ddd709SJohn Marino "use gnulib module wcwidth for portability"); 96451ddd709SJohn Marino # endif 96551ddd709SJohn Marino #endif 96651ddd709SJohn Marino 96751ddd709SJohn Marino 96851ddd709SJohn Marino /* Search N wide characters of S for C. */ 96951ddd709SJohn Marino #if 0 97051ddd709SJohn Marino # if !1 97151ddd709SJohn Marino _GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n) 97251ddd709SJohn Marino _GL_ATTRIBUTE_PURE); 97351ddd709SJohn Marino # endif 97451ddd709SJohn Marino /* On some systems, this function is defined as an overloaded function: 97551ddd709SJohn Marino extern "C++" { 97651ddd709SJohn Marino const wchar_t * std::wmemchr (const wchar_t *, wchar_t, size_t); 97751ddd709SJohn Marino wchar_t * std::wmemchr (wchar_t *, wchar_t, size_t); 97851ddd709SJohn Marino } */ 97951ddd709SJohn Marino _GL_CXXALIAS_SYS_CAST2 (wmemchr, 98051ddd709SJohn Marino wchar_t *, (const wchar_t *, wchar_t, size_t), 98151ddd709SJohn Marino const wchar_t *, (const wchar_t *, wchar_t, size_t)); 98251ddd709SJohn Marino # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 98351ddd709SJohn Marino && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 98451ddd709SJohn Marino _GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); 98551ddd709SJohn Marino _GL_CXXALIASWARN1 (wmemchr, const wchar_t *, 98651ddd709SJohn Marino (const wchar_t *s, wchar_t c, size_t n)); 987*4ce1b016SDaniel Fojt # elif __GLIBC__ >= 2 98851ddd709SJohn Marino _GL_CXXALIASWARN (wmemchr); 98951ddd709SJohn Marino # endif 99051ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 99151ddd709SJohn Marino # undef wmemchr 99251ddd709SJohn Marino # if HAVE_RAW_DECL_WMEMCHR 99351ddd709SJohn Marino _GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - " 99451ddd709SJohn Marino "use gnulib module wmemchr for portability"); 99551ddd709SJohn Marino # endif 99651ddd709SJohn Marino #endif 99751ddd709SJohn Marino 99851ddd709SJohn Marino 99951ddd709SJohn Marino /* Compare N wide characters of S1 and S2. */ 100051ddd709SJohn Marino #if 0 100151ddd709SJohn Marino # if !1 100251ddd709SJohn Marino _GL_FUNCDECL_SYS (wmemcmp, int, 100351ddd709SJohn Marino (const wchar_t *s1, const wchar_t *s2, size_t n) 100451ddd709SJohn Marino _GL_ATTRIBUTE_PURE); 100551ddd709SJohn Marino # endif 100651ddd709SJohn Marino _GL_CXXALIAS_SYS (wmemcmp, int, 100751ddd709SJohn Marino (const wchar_t *s1, const wchar_t *s2, size_t n)); 1008*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2 100951ddd709SJohn Marino _GL_CXXALIASWARN (wmemcmp); 1010*4ce1b016SDaniel Fojt # endif 101151ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 101251ddd709SJohn Marino # undef wmemcmp 101351ddd709SJohn Marino # if HAVE_RAW_DECL_WMEMCMP 101451ddd709SJohn Marino _GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - " 101551ddd709SJohn Marino "use gnulib module wmemcmp for portability"); 101651ddd709SJohn Marino # endif 101751ddd709SJohn Marino #endif 101851ddd709SJohn Marino 101951ddd709SJohn Marino 102051ddd709SJohn Marino /* Copy N wide characters of SRC to DEST. */ 102151ddd709SJohn Marino #if 0 102251ddd709SJohn Marino # if !1 102351ddd709SJohn Marino _GL_FUNCDECL_SYS (wmemcpy, wchar_t *, 102451ddd709SJohn Marino (wchar_t *dest, const wchar_t *src, size_t n)); 102551ddd709SJohn Marino # endif 102651ddd709SJohn Marino _GL_CXXALIAS_SYS (wmemcpy, wchar_t *, 102751ddd709SJohn Marino (wchar_t *dest, const wchar_t *src, size_t n)); 1028*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2 102951ddd709SJohn Marino _GL_CXXALIASWARN (wmemcpy); 1030*4ce1b016SDaniel Fojt # endif 103151ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 103251ddd709SJohn Marino # undef wmemcpy 103351ddd709SJohn Marino # if HAVE_RAW_DECL_WMEMCPY 103451ddd709SJohn Marino _GL_WARN_ON_USE (wmemcpy, "wmemcpy is unportable - " 103551ddd709SJohn Marino "use gnulib module wmemcpy for portability"); 103651ddd709SJohn Marino # endif 103751ddd709SJohn Marino #endif 103851ddd709SJohn Marino 103951ddd709SJohn Marino 104051ddd709SJohn Marino /* Copy N wide characters of SRC to DEST, guaranteeing correct behavior for 104151ddd709SJohn Marino overlapping memory areas. */ 104251ddd709SJohn Marino #if 0 104351ddd709SJohn Marino # if !1 104451ddd709SJohn Marino _GL_FUNCDECL_SYS (wmemmove, wchar_t *, 104551ddd709SJohn Marino (wchar_t *dest, const wchar_t *src, size_t n)); 104651ddd709SJohn Marino # endif 104751ddd709SJohn Marino _GL_CXXALIAS_SYS (wmemmove, wchar_t *, 104851ddd709SJohn Marino (wchar_t *dest, const wchar_t *src, size_t n)); 1049*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2 105051ddd709SJohn Marino _GL_CXXALIASWARN (wmemmove); 1051*4ce1b016SDaniel Fojt # endif 105251ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 105351ddd709SJohn Marino # undef wmemmove 105451ddd709SJohn Marino # if HAVE_RAW_DECL_WMEMMOVE 105551ddd709SJohn Marino _GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - " 105651ddd709SJohn Marino "use gnulib module wmemmove for portability"); 105751ddd709SJohn Marino # endif 105851ddd709SJohn Marino #endif 105951ddd709SJohn Marino 106051ddd709SJohn Marino 106151ddd709SJohn Marino /* Set N wide characters of S to C. */ 106251ddd709SJohn Marino #if 0 106351ddd709SJohn Marino # if !1 106451ddd709SJohn Marino _GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); 106551ddd709SJohn Marino # endif 106651ddd709SJohn Marino _GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); 1067*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2 106851ddd709SJohn Marino _GL_CXXALIASWARN (wmemset); 1069*4ce1b016SDaniel Fojt # endif 107051ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 107151ddd709SJohn Marino # undef wmemset 107251ddd709SJohn Marino # if HAVE_RAW_DECL_WMEMSET 107351ddd709SJohn Marino _GL_WARN_ON_USE (wmemset, "wmemset is unportable - " 107451ddd709SJohn Marino "use gnulib module wmemset for portability"); 107551ddd709SJohn Marino # endif 107651ddd709SJohn Marino #endif 107751ddd709SJohn Marino 107851ddd709SJohn Marino 107951ddd709SJohn Marino /* Return the number of wide characters in S. */ 108051ddd709SJohn Marino #if 0 108151ddd709SJohn Marino # if !1 108251ddd709SJohn Marino _GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s) _GL_ATTRIBUTE_PURE); 108351ddd709SJohn Marino # endif 108451ddd709SJohn Marino _GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s)); 1085*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2 108651ddd709SJohn Marino _GL_CXXALIASWARN (wcslen); 1087*4ce1b016SDaniel Fojt # endif 108851ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 108951ddd709SJohn Marino # undef wcslen 109051ddd709SJohn Marino # if HAVE_RAW_DECL_WCSLEN 109151ddd709SJohn Marino _GL_WARN_ON_USE (wcslen, "wcslen is unportable - " 109251ddd709SJohn Marino "use gnulib module wcslen for portability"); 109351ddd709SJohn Marino # endif 109451ddd709SJohn Marino #endif 109551ddd709SJohn Marino 109651ddd709SJohn Marino 109751ddd709SJohn Marino /* Return the number of wide characters in S, but at most MAXLEN. */ 109851ddd709SJohn Marino #if 0 109951ddd709SJohn Marino # if !1 110051ddd709SJohn Marino _GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen) 110151ddd709SJohn Marino _GL_ATTRIBUTE_PURE); 110251ddd709SJohn Marino # endif 110351ddd709SJohn Marino _GL_CXXALIAS_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen)); 110451ddd709SJohn Marino _GL_CXXALIASWARN (wcsnlen); 110551ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 110651ddd709SJohn Marino # undef wcsnlen 110751ddd709SJohn Marino # if HAVE_RAW_DECL_WCSNLEN 110851ddd709SJohn Marino _GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - " 110951ddd709SJohn Marino "use gnulib module wcsnlen for portability"); 111051ddd709SJohn Marino # endif 111151ddd709SJohn Marino #endif 111251ddd709SJohn Marino 111351ddd709SJohn Marino 111451ddd709SJohn Marino /* Copy SRC to DEST. */ 111551ddd709SJohn Marino #if 0 111651ddd709SJohn Marino # if !1 111751ddd709SJohn Marino _GL_FUNCDECL_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src)); 111851ddd709SJohn Marino # endif 111951ddd709SJohn Marino _GL_CXXALIAS_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src)); 1120*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2 112151ddd709SJohn Marino _GL_CXXALIASWARN (wcscpy); 1122*4ce1b016SDaniel Fojt # endif 112351ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 112451ddd709SJohn Marino # undef wcscpy 112551ddd709SJohn Marino # if HAVE_RAW_DECL_WCSCPY 112651ddd709SJohn Marino _GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - " 112751ddd709SJohn Marino "use gnulib module wcscpy for portability"); 112851ddd709SJohn Marino # endif 112951ddd709SJohn Marino #endif 113051ddd709SJohn Marino 113151ddd709SJohn Marino 113251ddd709SJohn Marino /* Copy SRC to DEST, returning the address of the terminating L'\0' in DEST. */ 113351ddd709SJohn Marino #if 0 113451ddd709SJohn Marino # if !1 113551ddd709SJohn Marino _GL_FUNCDECL_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src)); 113651ddd709SJohn Marino # endif 113751ddd709SJohn Marino _GL_CXXALIAS_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src)); 113851ddd709SJohn Marino _GL_CXXALIASWARN (wcpcpy); 113951ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 114051ddd709SJohn Marino # undef wcpcpy 114151ddd709SJohn Marino # if HAVE_RAW_DECL_WCPCPY 114251ddd709SJohn Marino _GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - " 114351ddd709SJohn Marino "use gnulib module wcpcpy for portability"); 114451ddd709SJohn Marino # endif 114551ddd709SJohn Marino #endif 114651ddd709SJohn Marino 114751ddd709SJohn Marino 114851ddd709SJohn Marino /* Copy no more than N wide characters of SRC to DEST. */ 114951ddd709SJohn Marino #if 0 115051ddd709SJohn Marino # if !1 115151ddd709SJohn Marino _GL_FUNCDECL_SYS (wcsncpy, wchar_t *, 115251ddd709SJohn Marino (wchar_t *dest, const wchar_t *src, size_t n)); 115351ddd709SJohn Marino # endif 115451ddd709SJohn Marino _GL_CXXALIAS_SYS (wcsncpy, wchar_t *, 115551ddd709SJohn Marino (wchar_t *dest, const wchar_t *src, size_t n)); 1156*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2 115751ddd709SJohn Marino _GL_CXXALIASWARN (wcsncpy); 1158*4ce1b016SDaniel Fojt # endif 115951ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 116051ddd709SJohn Marino # undef wcsncpy 116151ddd709SJohn Marino # if HAVE_RAW_DECL_WCSNCPY 116251ddd709SJohn Marino _GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - " 116351ddd709SJohn Marino "use gnulib module wcsncpy for portability"); 116451ddd709SJohn Marino # endif 116551ddd709SJohn Marino #endif 116651ddd709SJohn Marino 116751ddd709SJohn Marino 116851ddd709SJohn Marino /* Copy no more than N characters of SRC to DEST, returning the address of 116951ddd709SJohn Marino the last character written into DEST. */ 117051ddd709SJohn Marino #if 0 117151ddd709SJohn Marino # if !1 117251ddd709SJohn Marino _GL_FUNCDECL_SYS (wcpncpy, wchar_t *, 117351ddd709SJohn Marino (wchar_t *dest, const wchar_t *src, size_t n)); 117451ddd709SJohn Marino # endif 117551ddd709SJohn Marino _GL_CXXALIAS_SYS (wcpncpy, wchar_t *, 117651ddd709SJohn Marino (wchar_t *dest, const wchar_t *src, size_t n)); 117751ddd709SJohn Marino _GL_CXXALIASWARN (wcpncpy); 117851ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 117951ddd709SJohn Marino # undef wcpncpy 118051ddd709SJohn Marino # if HAVE_RAW_DECL_WCPNCPY 118151ddd709SJohn Marino _GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - " 118251ddd709SJohn Marino "use gnulib module wcpncpy for portability"); 118351ddd709SJohn Marino # endif 118451ddd709SJohn Marino #endif 118551ddd709SJohn Marino 118651ddd709SJohn Marino 118751ddd709SJohn Marino /* Append SRC onto DEST. */ 118851ddd709SJohn Marino #if 0 118951ddd709SJohn Marino # if !1 119051ddd709SJohn Marino _GL_FUNCDECL_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src)); 119151ddd709SJohn Marino # endif 119251ddd709SJohn Marino _GL_CXXALIAS_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src)); 1193*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2 119451ddd709SJohn Marino _GL_CXXALIASWARN (wcscat); 1195*4ce1b016SDaniel Fojt # endif 119651ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 119751ddd709SJohn Marino # undef wcscat 119851ddd709SJohn Marino # if HAVE_RAW_DECL_WCSCAT 119951ddd709SJohn Marino _GL_WARN_ON_USE (wcscat, "wcscat is unportable - " 120051ddd709SJohn Marino "use gnulib module wcscat for portability"); 120151ddd709SJohn Marino # endif 120251ddd709SJohn Marino #endif 120351ddd709SJohn Marino 120451ddd709SJohn Marino 120551ddd709SJohn Marino /* Append no more than N wide characters of SRC onto DEST. */ 120651ddd709SJohn Marino #if 0 120751ddd709SJohn Marino # if !1 120851ddd709SJohn Marino _GL_FUNCDECL_SYS (wcsncat, wchar_t *, 120951ddd709SJohn Marino (wchar_t *dest, const wchar_t *src, size_t n)); 121051ddd709SJohn Marino # endif 121151ddd709SJohn Marino _GL_CXXALIAS_SYS (wcsncat, wchar_t *, 121251ddd709SJohn Marino (wchar_t *dest, const wchar_t *src, size_t n)); 1213*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2 121451ddd709SJohn Marino _GL_CXXALIASWARN (wcsncat); 1215*4ce1b016SDaniel Fojt # endif 121651ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 121751ddd709SJohn Marino # undef wcsncat 121851ddd709SJohn Marino # if HAVE_RAW_DECL_WCSNCAT 121951ddd709SJohn Marino _GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - " 122051ddd709SJohn Marino "use gnulib module wcsncat for portability"); 122151ddd709SJohn Marino # endif 122251ddd709SJohn Marino #endif 122351ddd709SJohn Marino 122451ddd709SJohn Marino 122551ddd709SJohn Marino /* Compare S1 and S2. */ 122651ddd709SJohn Marino #if 0 122751ddd709SJohn Marino # if !1 122851ddd709SJohn Marino _GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2) 122951ddd709SJohn Marino _GL_ATTRIBUTE_PURE); 123051ddd709SJohn Marino # endif 123151ddd709SJohn Marino _GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)); 1232*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2 123351ddd709SJohn Marino _GL_CXXALIASWARN (wcscmp); 1234*4ce1b016SDaniel Fojt # endif 123551ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 123651ddd709SJohn Marino # undef wcscmp 123751ddd709SJohn Marino # if HAVE_RAW_DECL_WCSCMP 123851ddd709SJohn Marino _GL_WARN_ON_USE (wcscmp, "wcscmp is unportable - " 123951ddd709SJohn Marino "use gnulib module wcscmp for portability"); 124051ddd709SJohn Marino # endif 124151ddd709SJohn Marino #endif 124251ddd709SJohn Marino 124351ddd709SJohn Marino 124451ddd709SJohn Marino /* Compare no more than N wide characters of S1 and S2. */ 124551ddd709SJohn Marino #if 0 124651ddd709SJohn Marino # if !1 124751ddd709SJohn Marino _GL_FUNCDECL_SYS (wcsncmp, int, 124851ddd709SJohn Marino (const wchar_t *s1, const wchar_t *s2, size_t n) 124951ddd709SJohn Marino _GL_ATTRIBUTE_PURE); 125051ddd709SJohn Marino # endif 125151ddd709SJohn Marino _GL_CXXALIAS_SYS (wcsncmp, int, 125251ddd709SJohn Marino (const wchar_t *s1, const wchar_t *s2, size_t n)); 1253*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2 125451ddd709SJohn Marino _GL_CXXALIASWARN (wcsncmp); 1255*4ce1b016SDaniel Fojt # endif 125651ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 125751ddd709SJohn Marino # undef wcsncmp 125851ddd709SJohn Marino # if HAVE_RAW_DECL_WCSNCMP 125951ddd709SJohn Marino _GL_WARN_ON_USE (wcsncmp, "wcsncmp is unportable - " 126051ddd709SJohn Marino "use gnulib module wcsncmp for portability"); 126151ddd709SJohn Marino # endif 126251ddd709SJohn Marino #endif 126351ddd709SJohn Marino 126451ddd709SJohn Marino 126551ddd709SJohn Marino /* Compare S1 and S2, ignoring case. */ 126651ddd709SJohn Marino #if 0 126751ddd709SJohn Marino # if !1 126851ddd709SJohn Marino _GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2) 126951ddd709SJohn Marino _GL_ATTRIBUTE_PURE); 127051ddd709SJohn Marino # endif 127151ddd709SJohn Marino _GL_CXXALIAS_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2)); 127251ddd709SJohn Marino _GL_CXXALIASWARN (wcscasecmp); 127351ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 127451ddd709SJohn Marino # undef wcscasecmp 127551ddd709SJohn Marino # if HAVE_RAW_DECL_WCSCASECMP 127651ddd709SJohn Marino _GL_WARN_ON_USE (wcscasecmp, "wcscasecmp is unportable - " 127751ddd709SJohn Marino "use gnulib module wcscasecmp for portability"); 127851ddd709SJohn Marino # endif 127951ddd709SJohn Marino #endif 128051ddd709SJohn Marino 128151ddd709SJohn Marino 128251ddd709SJohn Marino /* Compare no more than N chars of S1 and S2, ignoring case. */ 128351ddd709SJohn Marino #if 0 128451ddd709SJohn Marino # if !1 128551ddd709SJohn Marino _GL_FUNCDECL_SYS (wcsncasecmp, int, 128651ddd709SJohn Marino (const wchar_t *s1, const wchar_t *s2, size_t n) 128751ddd709SJohn Marino _GL_ATTRIBUTE_PURE); 128851ddd709SJohn Marino # endif 128951ddd709SJohn Marino _GL_CXXALIAS_SYS (wcsncasecmp, int, 129051ddd709SJohn Marino (const wchar_t *s1, const wchar_t *s2, size_t n)); 129151ddd709SJohn Marino _GL_CXXALIASWARN (wcsncasecmp); 129251ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 129351ddd709SJohn Marino # undef wcsncasecmp 129451ddd709SJohn Marino # if HAVE_RAW_DECL_WCSNCASECMP 129551ddd709SJohn Marino _GL_WARN_ON_USE (wcsncasecmp, "wcsncasecmp is unportable - " 129651ddd709SJohn Marino "use gnulib module wcsncasecmp for portability"); 129751ddd709SJohn Marino # endif 129851ddd709SJohn Marino #endif 129951ddd709SJohn Marino 130051ddd709SJohn Marino 130151ddd709SJohn Marino /* Compare S1 and S2, both interpreted as appropriate to the LC_COLLATE 130251ddd709SJohn Marino category of the current locale. */ 130351ddd709SJohn Marino #if 0 130451ddd709SJohn Marino # if !1 130551ddd709SJohn Marino _GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2)); 130651ddd709SJohn Marino # endif 130751ddd709SJohn Marino _GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2)); 1308*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2 130951ddd709SJohn Marino _GL_CXXALIASWARN (wcscoll); 1310*4ce1b016SDaniel Fojt # endif 131151ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 131251ddd709SJohn Marino # undef wcscoll 131351ddd709SJohn Marino # if HAVE_RAW_DECL_WCSCOLL 131451ddd709SJohn Marino _GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - " 131551ddd709SJohn Marino "use gnulib module wcscoll for portability"); 131651ddd709SJohn Marino # endif 131751ddd709SJohn Marino #endif 131851ddd709SJohn Marino 131951ddd709SJohn Marino 132051ddd709SJohn Marino /* Transform S2 into array pointed to by S1 such that if wcscmp is applied 132151ddd709SJohn Marino to two transformed strings the result is the as applying 'wcscoll' to the 132251ddd709SJohn Marino original strings. */ 132351ddd709SJohn Marino #if 0 132451ddd709SJohn Marino # if !1 132551ddd709SJohn Marino _GL_FUNCDECL_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n)); 132651ddd709SJohn Marino # endif 132751ddd709SJohn Marino _GL_CXXALIAS_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n)); 1328*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2 132951ddd709SJohn Marino _GL_CXXALIASWARN (wcsxfrm); 1330*4ce1b016SDaniel Fojt # endif 133151ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 133251ddd709SJohn Marino # undef wcsxfrm 133351ddd709SJohn Marino # if HAVE_RAW_DECL_WCSXFRM 133451ddd709SJohn Marino _GL_WARN_ON_USE (wcsxfrm, "wcsxfrm is unportable - " 133551ddd709SJohn Marino "use gnulib module wcsxfrm for portability"); 133651ddd709SJohn Marino # endif 133751ddd709SJohn Marino #endif 133851ddd709SJohn Marino 133951ddd709SJohn Marino 134051ddd709SJohn Marino /* Duplicate S, returning an identical malloc'd string. */ 134151ddd709SJohn Marino #if 0 134251ddd709SJohn Marino # if !1 134351ddd709SJohn Marino _GL_FUNCDECL_SYS (wcsdup, wchar_t *, (const wchar_t *s)); 134451ddd709SJohn Marino # endif 134551ddd709SJohn Marino _GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s)); 134651ddd709SJohn Marino _GL_CXXALIASWARN (wcsdup); 134751ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 134851ddd709SJohn Marino # undef wcsdup 134951ddd709SJohn Marino # if HAVE_RAW_DECL_WCSDUP 135051ddd709SJohn Marino _GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - " 135151ddd709SJohn Marino "use gnulib module wcsdup for portability"); 135251ddd709SJohn Marino # endif 135351ddd709SJohn Marino #endif 135451ddd709SJohn Marino 135551ddd709SJohn Marino 135651ddd709SJohn Marino /* Find the first occurrence of WC in WCS. */ 135751ddd709SJohn Marino #if 0 135851ddd709SJohn Marino # if !1 135951ddd709SJohn Marino _GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc) 136051ddd709SJohn Marino _GL_ATTRIBUTE_PURE); 136151ddd709SJohn Marino # endif 136251ddd709SJohn Marino /* On some systems, this function is defined as an overloaded function: 136351ddd709SJohn Marino extern "C++" { 136451ddd709SJohn Marino const wchar_t * std::wcschr (const wchar_t *, wchar_t); 136551ddd709SJohn Marino wchar_t * std::wcschr (wchar_t *, wchar_t); 136651ddd709SJohn Marino } */ 136751ddd709SJohn Marino _GL_CXXALIAS_SYS_CAST2 (wcschr, 136851ddd709SJohn Marino wchar_t *, (const wchar_t *, wchar_t), 136951ddd709SJohn Marino const wchar_t *, (const wchar_t *, wchar_t)); 137051ddd709SJohn Marino # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 137151ddd709SJohn Marino && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 137251ddd709SJohn Marino _GL_CXXALIASWARN1 (wcschr, wchar_t *, (wchar_t *wcs, wchar_t wc)); 137351ddd709SJohn Marino _GL_CXXALIASWARN1 (wcschr, const wchar_t *, (const wchar_t *wcs, wchar_t wc)); 1374*4ce1b016SDaniel Fojt # elif __GLIBC__ >= 2 137551ddd709SJohn Marino _GL_CXXALIASWARN (wcschr); 137651ddd709SJohn Marino # endif 137751ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 137851ddd709SJohn Marino # undef wcschr 137951ddd709SJohn Marino # if HAVE_RAW_DECL_WCSCHR 138051ddd709SJohn Marino _GL_WARN_ON_USE (wcschr, "wcschr is unportable - " 138151ddd709SJohn Marino "use gnulib module wcschr for portability"); 138251ddd709SJohn Marino # endif 138351ddd709SJohn Marino #endif 138451ddd709SJohn Marino 138551ddd709SJohn Marino 138651ddd709SJohn Marino /* Find the last occurrence of WC in WCS. */ 138751ddd709SJohn Marino #if 0 138851ddd709SJohn Marino # if !1 138951ddd709SJohn Marino _GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc) 139051ddd709SJohn Marino _GL_ATTRIBUTE_PURE); 139151ddd709SJohn Marino # endif 139251ddd709SJohn Marino /* On some systems, this function is defined as an overloaded function: 139351ddd709SJohn Marino extern "C++" { 139451ddd709SJohn Marino const wchar_t * std::wcsrchr (const wchar_t *, wchar_t); 139551ddd709SJohn Marino wchar_t * std::wcsrchr (wchar_t *, wchar_t); 139651ddd709SJohn Marino } */ 139751ddd709SJohn Marino _GL_CXXALIAS_SYS_CAST2 (wcsrchr, 139851ddd709SJohn Marino wchar_t *, (const wchar_t *, wchar_t), 139951ddd709SJohn Marino const wchar_t *, (const wchar_t *, wchar_t)); 140051ddd709SJohn Marino # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 140151ddd709SJohn Marino && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 140251ddd709SJohn Marino _GL_CXXALIASWARN1 (wcsrchr, wchar_t *, (wchar_t *wcs, wchar_t wc)); 140351ddd709SJohn Marino _GL_CXXALIASWARN1 (wcsrchr, const wchar_t *, (const wchar_t *wcs, wchar_t wc)); 1404*4ce1b016SDaniel Fojt # elif __GLIBC__ >= 2 140551ddd709SJohn Marino _GL_CXXALIASWARN (wcsrchr); 140651ddd709SJohn Marino # endif 140751ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 140851ddd709SJohn Marino # undef wcsrchr 140951ddd709SJohn Marino # if HAVE_RAW_DECL_WCSRCHR 141051ddd709SJohn Marino _GL_WARN_ON_USE (wcsrchr, "wcsrchr is unportable - " 141151ddd709SJohn Marino "use gnulib module wcsrchr for portability"); 141251ddd709SJohn Marino # endif 141351ddd709SJohn Marino #endif 141451ddd709SJohn Marino 141551ddd709SJohn Marino 141651ddd709SJohn Marino /* Return the length of the initial segmet of WCS which consists entirely 141751ddd709SJohn Marino of wide characters not in REJECT. */ 141851ddd709SJohn Marino #if 0 141951ddd709SJohn Marino # if !1 142051ddd709SJohn Marino _GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject) 142151ddd709SJohn Marino _GL_ATTRIBUTE_PURE); 142251ddd709SJohn Marino # endif 142351ddd709SJohn Marino _GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject)); 1424*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2 142551ddd709SJohn Marino _GL_CXXALIASWARN (wcscspn); 1426*4ce1b016SDaniel Fojt # endif 142751ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 142851ddd709SJohn Marino # undef wcscspn 142951ddd709SJohn Marino # if HAVE_RAW_DECL_WCSCSPN 143051ddd709SJohn Marino _GL_WARN_ON_USE (wcscspn, "wcscspn is unportable - " 143151ddd709SJohn Marino "use gnulib module wcscspn for portability"); 143251ddd709SJohn Marino # endif 143351ddd709SJohn Marino #endif 143451ddd709SJohn Marino 143551ddd709SJohn Marino 143651ddd709SJohn Marino /* Return the length of the initial segmet of WCS which consists entirely 143751ddd709SJohn Marino of wide characters in ACCEPT. */ 143851ddd709SJohn Marino #if 0 143951ddd709SJohn Marino # if !1 144051ddd709SJohn Marino _GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept) 144151ddd709SJohn Marino _GL_ATTRIBUTE_PURE); 144251ddd709SJohn Marino # endif 144351ddd709SJohn Marino _GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept)); 1444*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2 144551ddd709SJohn Marino _GL_CXXALIASWARN (wcsspn); 1446*4ce1b016SDaniel Fojt # endif 144751ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 144851ddd709SJohn Marino # undef wcsspn 144951ddd709SJohn Marino # if HAVE_RAW_DECL_WCSSPN 145051ddd709SJohn Marino _GL_WARN_ON_USE (wcsspn, "wcsspn is unportable - " 145151ddd709SJohn Marino "use gnulib module wcsspn for portability"); 145251ddd709SJohn Marino # endif 145351ddd709SJohn Marino #endif 145451ddd709SJohn Marino 145551ddd709SJohn Marino 145651ddd709SJohn Marino /* Find the first occurrence in WCS of any character in ACCEPT. */ 145751ddd709SJohn Marino #if 0 145851ddd709SJohn Marino # if !1 145951ddd709SJohn Marino _GL_FUNCDECL_SYS (wcspbrk, wchar_t *, 146051ddd709SJohn Marino (const wchar_t *wcs, const wchar_t *accept) 146151ddd709SJohn Marino _GL_ATTRIBUTE_PURE); 146251ddd709SJohn Marino # endif 146351ddd709SJohn Marino /* On some systems, this function is defined as an overloaded function: 146451ddd709SJohn Marino extern "C++" { 146551ddd709SJohn Marino const wchar_t * std::wcspbrk (const wchar_t *, const wchar_t *); 146651ddd709SJohn Marino wchar_t * std::wcspbrk (wchar_t *, const wchar_t *); 146751ddd709SJohn Marino } */ 146851ddd709SJohn Marino _GL_CXXALIAS_SYS_CAST2 (wcspbrk, 146951ddd709SJohn Marino wchar_t *, (const wchar_t *, const wchar_t *), 147051ddd709SJohn Marino const wchar_t *, (const wchar_t *, const wchar_t *)); 147151ddd709SJohn Marino # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 147251ddd709SJohn Marino && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 147351ddd709SJohn Marino _GL_CXXALIASWARN1 (wcspbrk, wchar_t *, 147451ddd709SJohn Marino (wchar_t *wcs, const wchar_t *accept)); 147551ddd709SJohn Marino _GL_CXXALIASWARN1 (wcspbrk, const wchar_t *, 147651ddd709SJohn Marino (const wchar_t *wcs, const wchar_t *accept)); 1477*4ce1b016SDaniel Fojt # elif __GLIBC__ >= 2 147851ddd709SJohn Marino _GL_CXXALIASWARN (wcspbrk); 147951ddd709SJohn Marino # endif 148051ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 148151ddd709SJohn Marino # undef wcspbrk 148251ddd709SJohn Marino # if HAVE_RAW_DECL_WCSPBRK 148351ddd709SJohn Marino _GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - " 148451ddd709SJohn Marino "use gnulib module wcspbrk for portability"); 148551ddd709SJohn Marino # endif 148651ddd709SJohn Marino #endif 148751ddd709SJohn Marino 148851ddd709SJohn Marino 148951ddd709SJohn Marino /* Find the first occurrence of NEEDLE in HAYSTACK. */ 149051ddd709SJohn Marino #if 0 149151ddd709SJohn Marino # if !1 149251ddd709SJohn Marino _GL_FUNCDECL_SYS (wcsstr, wchar_t *, 149351ddd709SJohn Marino (const wchar_t *haystack, const wchar_t *needle) 149451ddd709SJohn Marino _GL_ATTRIBUTE_PURE); 149551ddd709SJohn Marino # endif 149651ddd709SJohn Marino /* On some systems, this function is defined as an overloaded function: 149751ddd709SJohn Marino extern "C++" { 149851ddd709SJohn Marino const wchar_t * std::wcsstr (const wchar_t *, const wchar_t *); 149951ddd709SJohn Marino wchar_t * std::wcsstr (wchar_t *, const wchar_t *); 150051ddd709SJohn Marino } */ 150151ddd709SJohn Marino _GL_CXXALIAS_SYS_CAST2 (wcsstr, 150251ddd709SJohn Marino wchar_t *, (const wchar_t *, const wchar_t *), 150351ddd709SJohn Marino const wchar_t *, (const wchar_t *, const wchar_t *)); 150451ddd709SJohn Marino # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 150551ddd709SJohn Marino && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 150651ddd709SJohn Marino _GL_CXXALIASWARN1 (wcsstr, wchar_t *, 150751ddd709SJohn Marino (wchar_t *haystack, const wchar_t *needle)); 150851ddd709SJohn Marino _GL_CXXALIASWARN1 (wcsstr, const wchar_t *, 150951ddd709SJohn Marino (const wchar_t *haystack, const wchar_t *needle)); 1510*4ce1b016SDaniel Fojt # elif __GLIBC__ >= 2 151151ddd709SJohn Marino _GL_CXXALIASWARN (wcsstr); 151251ddd709SJohn Marino # endif 151351ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 151451ddd709SJohn Marino # undef wcsstr 151551ddd709SJohn Marino # if HAVE_RAW_DECL_WCSSTR 151651ddd709SJohn Marino _GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - " 151751ddd709SJohn Marino "use gnulib module wcsstr for portability"); 151851ddd709SJohn Marino # endif 151951ddd709SJohn Marino #endif 152051ddd709SJohn Marino 152151ddd709SJohn Marino 152251ddd709SJohn Marino /* Divide WCS into tokens separated by characters in DELIM. */ 152351ddd709SJohn Marino #if 0 1524*4ce1b016SDaniel Fojt # if 0 1525*4ce1b016SDaniel Fojt # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1526*4ce1b016SDaniel Fojt # undef wcstok 1527*4ce1b016SDaniel Fojt # define wcstok rpl_wcstok 1528*4ce1b016SDaniel Fojt # endif 1529*4ce1b016SDaniel Fojt _GL_FUNCDECL_RPL (wcstok, wchar_t *, 1530*4ce1b016SDaniel Fojt (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)); 1531*4ce1b016SDaniel Fojt _GL_CXXALIAS_RPL (wcstok, wchar_t *, 1532*4ce1b016SDaniel Fojt (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)); 1533*4ce1b016SDaniel Fojt # else 153451ddd709SJohn Marino # if !1 153551ddd709SJohn Marino _GL_FUNCDECL_SYS (wcstok, wchar_t *, 153651ddd709SJohn Marino (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)); 153751ddd709SJohn Marino # endif 153851ddd709SJohn Marino _GL_CXXALIAS_SYS (wcstok, wchar_t *, 153951ddd709SJohn Marino (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)); 1540*4ce1b016SDaniel Fojt # endif 1541*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2 154251ddd709SJohn Marino _GL_CXXALIASWARN (wcstok); 1543*4ce1b016SDaniel Fojt # endif 154451ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 154551ddd709SJohn Marino # undef wcstok 154651ddd709SJohn Marino # if HAVE_RAW_DECL_WCSTOK 154751ddd709SJohn Marino _GL_WARN_ON_USE (wcstok, "wcstok is unportable - " 154851ddd709SJohn Marino "use gnulib module wcstok for portability"); 154951ddd709SJohn Marino # endif 155051ddd709SJohn Marino #endif 155151ddd709SJohn Marino 155251ddd709SJohn Marino 155351ddd709SJohn Marino /* Determine number of column positions required for first N wide 155451ddd709SJohn Marino characters (or fewer if S ends before this) in S. */ 155551ddd709SJohn Marino #if 0 155651ddd709SJohn Marino # if 0 155751ddd709SJohn Marino # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 155851ddd709SJohn Marino # undef wcswidth 155951ddd709SJohn Marino # define wcswidth rpl_wcswidth 156051ddd709SJohn Marino # endif 156151ddd709SJohn Marino _GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n) 156251ddd709SJohn Marino _GL_ATTRIBUTE_PURE); 156351ddd709SJohn Marino _GL_CXXALIAS_RPL (wcswidth, int, (const wchar_t *s, size_t n)); 156451ddd709SJohn Marino # else 156551ddd709SJohn Marino # if !1 156651ddd709SJohn Marino _GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n) 156751ddd709SJohn Marino _GL_ATTRIBUTE_PURE); 156851ddd709SJohn Marino # endif 156951ddd709SJohn Marino _GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n)); 157051ddd709SJohn Marino # endif 1571*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2 157251ddd709SJohn Marino _GL_CXXALIASWARN (wcswidth); 1573*4ce1b016SDaniel Fojt # endif 157451ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 157551ddd709SJohn Marino # undef wcswidth 157651ddd709SJohn Marino # if HAVE_RAW_DECL_WCSWIDTH 157751ddd709SJohn Marino _GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - " 157851ddd709SJohn Marino "use gnulib module wcswidth for portability"); 157951ddd709SJohn Marino # endif 158051ddd709SJohn Marino #endif 158151ddd709SJohn Marino 158251ddd709SJohn Marino 1583*4ce1b016SDaniel Fojt /* Convert *TP to a date and time wide string. See 1584*4ce1b016SDaniel Fojt <https://pubs.opengroup.org/onlinepubs/9699919799/functions/wcsftime.html>. */ 1585*4ce1b016SDaniel Fojt #if 0 1586*4ce1b016SDaniel Fojt # if 0 1587*4ce1b016SDaniel Fojt # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1588*4ce1b016SDaniel Fojt # undef wcsftime 1589*4ce1b016SDaniel Fojt # define wcsftime rpl_wcsftime 1590*4ce1b016SDaniel Fojt # endif 1591*4ce1b016SDaniel Fojt _GL_FUNCDECL_RPL (wcsftime, size_t, (wchar_t *__buf, size_t __bufsize, 1592*4ce1b016SDaniel Fojt const wchar_t *__fmt, const struct tm *__tp) 1593*4ce1b016SDaniel Fojt _GL_ARG_NONNULL ((1, 3, 4))); 1594*4ce1b016SDaniel Fojt _GL_CXXALIAS_RPL (wcsftime, size_t, (wchar_t *__buf, size_t __bufsize, 1595*4ce1b016SDaniel Fojt const wchar_t *__fmt, const struct tm *__tp)); 1596*4ce1b016SDaniel Fojt # else 1597*4ce1b016SDaniel Fojt # if !1 1598*4ce1b016SDaniel Fojt _GL_FUNCDECL_SYS (wcsftime, size_t, (wchar_t *__buf, size_t __bufsize, 1599*4ce1b016SDaniel Fojt const wchar_t *__fmt, const struct tm *__tp) 1600*4ce1b016SDaniel Fojt _GL_ARG_NONNULL ((1, 3, 4))); 1601*4ce1b016SDaniel Fojt # endif 1602*4ce1b016SDaniel Fojt _GL_CXXALIAS_SYS (wcsftime, size_t, (wchar_t *__buf, size_t __bufsize, 1603*4ce1b016SDaniel Fojt const wchar_t *__fmt, const struct tm *__tp)); 1604*4ce1b016SDaniel Fojt # endif 1605*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2 1606*4ce1b016SDaniel Fojt _GL_CXXALIASWARN (wcsftime); 1607*4ce1b016SDaniel Fojt # endif 1608*4ce1b016SDaniel Fojt #elif defined GNULIB_POSIXCHECK 1609*4ce1b016SDaniel Fojt # undef wcsftime 1610*4ce1b016SDaniel Fojt # if HAVE_RAW_DECL_WCSFTIME 1611*4ce1b016SDaniel Fojt _GL_WARN_ON_USE (wcsftime, "wcsftime is unportable - " 1612*4ce1b016SDaniel Fojt "use gnulib module wcsftime for portability"); 1613*4ce1b016SDaniel Fojt # endif 1614*4ce1b016SDaniel Fojt #endif 1615*4ce1b016SDaniel Fojt 1616*4ce1b016SDaniel Fojt 161751ddd709SJohn Marino #endif /* _GL_WCHAR_H */ 161851ddd709SJohn Marino #endif /* _GL_WCHAR_H */ 161951ddd709SJohn Marino #endif 1620