1*88e42b0fSchristos /* This file is automatically generated. DO NOT EDIT! */ 2*88e42b0fSchristos /* Generated from: NetBSD: mknative-gdb,v 1.14 2020/09/24 14:53:17 christos Exp */ 3*88e42b0fSchristos /* Generated from: NetBSD: mknative.common,v 1.16 2018/04/15 15:13:37 christos Exp */ 4*88e42b0fSchristos 5*88e42b0fSchristos /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ 6*88e42b0fSchristos /* A substitute for ISO C99 <wchar.h>, for platforms that have issues. 7*88e42b0fSchristos 8*88e42b0fSchristos Copyright (C) 2007-2020 Free Software Foundation, Inc. 9*88e42b0fSchristos 10*88e42b0fSchristos This program is free software; you can redistribute it and/or modify 11*88e42b0fSchristos it under the terms of the GNU General Public License as published by 12*88e42b0fSchristos the Free Software Foundation; either version 3, or (at your option) 13*88e42b0fSchristos any later version. 14*88e42b0fSchristos 15*88e42b0fSchristos This program is distributed in the hope that it will be useful, 16*88e42b0fSchristos but WITHOUT ANY WARRANTY; without even the implied warranty of 17*88e42b0fSchristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*88e42b0fSchristos GNU General Public License for more details. 19*88e42b0fSchristos 20*88e42b0fSchristos You should have received a copy of the GNU General Public License 21*88e42b0fSchristos along with this program; if not, see <https://www.gnu.org/licenses/>. */ 22*88e42b0fSchristos 23*88e42b0fSchristos /* Written by Eric Blake. */ 24*88e42b0fSchristos 25*88e42b0fSchristos /* 26*88e42b0fSchristos * ISO C 99 <wchar.h> for platforms that have issues. 27*88e42b0fSchristos * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/wchar.h.html> 28*88e42b0fSchristos * 29*88e42b0fSchristos * For now, this just ensures proper prerequisite inclusion order and 30*88e42b0fSchristos * the declaration of wcwidth(). 31*88e42b0fSchristos */ 32*88e42b0fSchristos 33*88e42b0fSchristos #if __GNUC__ >= 3 34*88e42b0fSchristos #pragma GCC system_header 35*88e42b0fSchristos #endif 36*88e42b0fSchristos 37*88e42b0fSchristos 38*88e42b0fSchristos #if (((defined __need_mbstate_t || defined __need_wint_t) \ 39*88e42b0fSchristos && !defined __MINGW32__) \ 40*88e42b0fSchristos || (defined __hpux \ 41*88e42b0fSchristos && ((defined _INTTYPES_INCLUDED \ 42*88e42b0fSchristos && !defined _GL_FINISHED_INCLUDING_SYSTEM_INTTYPES_H) \ 43*88e42b0fSchristos || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) \ 44*88e42b0fSchristos || (defined __MINGW32__ && defined __STRING_H_SOURCED__) \ 45*88e42b0fSchristos || defined _GL_ALREADY_INCLUDING_WCHAR_H) 46*88e42b0fSchristos /* Special invocation convention: 47*88e42b0fSchristos - Inside glibc and uClibc header files, but not MinGW. 48*88e42b0fSchristos - On HP-UX 11.00 we have a sequence of nested includes 49*88e42b0fSchristos <wchar.h> -> <stdlib.h> -> <stdint.h>, and the latter includes <wchar.h>, 50*88e42b0fSchristos once indirectly <stdint.h> -> <sys/types.h> -> <inttypes.h> -> <wchar.h> 51*88e42b0fSchristos and once directly. In both situations 'wint_t' is not yet defined, 52*88e42b0fSchristos therefore we cannot provide the function overrides; instead include only 53*88e42b0fSchristos the system's <wchar.h>. 54*88e42b0fSchristos - With MinGW 3.22, when <string.h> includes <wchar.h>, only some part of 55*88e42b0fSchristos <wchar.h> is actually processed, and that doesn't include 'mbstate_t'. 56*88e42b0fSchristos - On IRIX 6.5, similarly, we have an include <wchar.h> -> <wctype.h>, and 57*88e42b0fSchristos the latter includes <wchar.h>. But here, we have no way to detect whether 58*88e42b0fSchristos <wctype.h> is completely included or is still being included. */ 59*88e42b0fSchristos 60*88e42b0fSchristos #include_next <wchar.h> 61*88e42b0fSchristos 62*88e42b0fSchristos #else 63*88e42b0fSchristos /* Normal invocation convention. */ 64*88e42b0fSchristos 65*88e42b0fSchristos #ifndef _GL_WCHAR_H 66*88e42b0fSchristos 67*88e42b0fSchristos #define _GL_ALREADY_INCLUDING_WCHAR_H 68*88e42b0fSchristos 69*88e42b0fSchristos #if 0 70*88e42b0fSchristos # include <features.h> /* for __GLIBC__ */ 71*88e42b0fSchristos #endif 72*88e42b0fSchristos 73*88e42b0fSchristos /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before 74*88e42b0fSchristos <wchar.h>. 75*88e42b0fSchristos BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be 76*88e42b0fSchristos included before <wchar.h>. 77*88e42b0fSchristos In some builds of uClibc, <wchar.h> is nonexistent and wchar_t is defined 78*88e42b0fSchristos by <stddef.h>. 79*88e42b0fSchristos But avoid namespace pollution on glibc systems. */ 80*88e42b0fSchristos #if !(defined __GLIBC__ && !defined __UCLIBC__) 81*88e42b0fSchristos # include <stddef.h> 82*88e42b0fSchristos #endif 83*88e42b0fSchristos #ifndef __GLIBC__ 84*88e42b0fSchristos # include <stdio.h> 85*88e42b0fSchristos # include <time.h> 86*88e42b0fSchristos #endif 87*88e42b0fSchristos 88*88e42b0fSchristos /* Include the original <wchar.h> if it exists. 89*88e42b0fSchristos Some builds of uClibc lack it. */ 90*88e42b0fSchristos /* The include_next requires a split double-inclusion guard. */ 91*88e42b0fSchristos #if 1 92*88e42b0fSchristos # include_next <wchar.h> 93*88e42b0fSchristos #endif 94*88e42b0fSchristos 95*88e42b0fSchristos #undef _GL_ALREADY_INCLUDING_WCHAR_H 96*88e42b0fSchristos 97*88e42b0fSchristos #ifndef _GL_WCHAR_H 98*88e42b0fSchristos #define _GL_WCHAR_H 99*88e42b0fSchristos 100*88e42b0fSchristos /* The __attribute__ feature is available in gcc versions 2.5 and later. 101*88e42b0fSchristos The attribute __pure__ was added in gcc 2.96. */ 102*88e42b0fSchristos #ifndef _GL_ATTRIBUTE_PURE 103*88e42b0fSchristos # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) 104*88e42b0fSchristos # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) 105*88e42b0fSchristos # else 106*88e42b0fSchristos # define _GL_ATTRIBUTE_PURE /* empty */ 107*88e42b0fSchristos # endif 108*88e42b0fSchristos #endif 109*88e42b0fSchristos 110*88e42b0fSchristos /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 111*88e42b0fSchristos /* C++ compatible function declaration macros. 112*88e42b0fSchristos Copyright (C) 2010-2020 Free Software Foundation, Inc. 113*88e42b0fSchristos 114*88e42b0fSchristos This program is free software: you can redistribute it and/or modify it 115*88e42b0fSchristos under the terms of the GNU General Public License as published 116*88e42b0fSchristos by the Free Software Foundation; either version 3 of the License, or 117*88e42b0fSchristos (at your option) any later version. 118*88e42b0fSchristos 119*88e42b0fSchristos This program is distributed in the hope that it will be useful, 120*88e42b0fSchristos but WITHOUT ANY WARRANTY; without even the implied warranty of 121*88e42b0fSchristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 122*88e42b0fSchristos General Public License for more details. 123*88e42b0fSchristos 124*88e42b0fSchristos You should have received a copy of the GNU General Public License 125*88e42b0fSchristos along with this program. If not, see <https://www.gnu.org/licenses/>. */ 126*88e42b0fSchristos 127*88e42b0fSchristos #ifndef _GL_CXXDEFS_H 128*88e42b0fSchristos #define _GL_CXXDEFS_H 129*88e42b0fSchristos 130*88e42b0fSchristos /* Begin/end the GNULIB_NAMESPACE namespace. */ 131*88e42b0fSchristos #if defined __cplusplus && defined GNULIB_NAMESPACE 132*88e42b0fSchristos # define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE { 133*88e42b0fSchristos # define _GL_END_NAMESPACE } 134*88e42b0fSchristos #else 135*88e42b0fSchristos # define _GL_BEGIN_NAMESPACE 136*88e42b0fSchristos # define _GL_END_NAMESPACE 137*88e42b0fSchristos #endif 138*88e42b0fSchristos 139*88e42b0fSchristos /* The three most frequent use cases of these macros are: 140*88e42b0fSchristos 141*88e42b0fSchristos * For providing a substitute for a function that is missing on some 142*88e42b0fSchristos platforms, but is declared and works fine on the platforms on which 143*88e42b0fSchristos it exists: 144*88e42b0fSchristos 145*88e42b0fSchristos #if @GNULIB_FOO@ 146*88e42b0fSchristos # if !@HAVE_FOO@ 147*88e42b0fSchristos _GL_FUNCDECL_SYS (foo, ...); 148*88e42b0fSchristos # endif 149*88e42b0fSchristos _GL_CXXALIAS_SYS (foo, ...); 150*88e42b0fSchristos _GL_CXXALIASWARN (foo); 151*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 152*88e42b0fSchristos ... 153*88e42b0fSchristos #endif 154*88e42b0fSchristos 155*88e42b0fSchristos * For providing a replacement for a function that exists on all platforms, 156*88e42b0fSchristos but is broken/insufficient and needs to be replaced on some platforms: 157*88e42b0fSchristos 158*88e42b0fSchristos #if @GNULIB_FOO@ 159*88e42b0fSchristos # if @REPLACE_FOO@ 160*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 161*88e42b0fSchristos # undef foo 162*88e42b0fSchristos # define foo rpl_foo 163*88e42b0fSchristos # endif 164*88e42b0fSchristos _GL_FUNCDECL_RPL (foo, ...); 165*88e42b0fSchristos _GL_CXXALIAS_RPL (foo, ...); 166*88e42b0fSchristos # else 167*88e42b0fSchristos _GL_CXXALIAS_SYS (foo, ...); 168*88e42b0fSchristos # endif 169*88e42b0fSchristos _GL_CXXALIASWARN (foo); 170*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 171*88e42b0fSchristos ... 172*88e42b0fSchristos #endif 173*88e42b0fSchristos 174*88e42b0fSchristos * For providing a replacement for a function that exists on some platforms 175*88e42b0fSchristos but is broken/insufficient and needs to be replaced on some of them and 176*88e42b0fSchristos is additionally either missing or undeclared on some other platforms: 177*88e42b0fSchristos 178*88e42b0fSchristos #if @GNULIB_FOO@ 179*88e42b0fSchristos # if @REPLACE_FOO@ 180*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 181*88e42b0fSchristos # undef foo 182*88e42b0fSchristos # define foo rpl_foo 183*88e42b0fSchristos # endif 184*88e42b0fSchristos _GL_FUNCDECL_RPL (foo, ...); 185*88e42b0fSchristos _GL_CXXALIAS_RPL (foo, ...); 186*88e42b0fSchristos # else 187*88e42b0fSchristos # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ 188*88e42b0fSchristos _GL_FUNCDECL_SYS (foo, ...); 189*88e42b0fSchristos # endif 190*88e42b0fSchristos _GL_CXXALIAS_SYS (foo, ...); 191*88e42b0fSchristos # endif 192*88e42b0fSchristos _GL_CXXALIASWARN (foo); 193*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 194*88e42b0fSchristos ... 195*88e42b0fSchristos #endif 196*88e42b0fSchristos */ 197*88e42b0fSchristos 198*88e42b0fSchristos /* _GL_EXTERN_C declaration; 199*88e42b0fSchristos performs the declaration with C linkage. */ 200*88e42b0fSchristos #if defined __cplusplus 201*88e42b0fSchristos # define _GL_EXTERN_C extern "C" 202*88e42b0fSchristos #else 203*88e42b0fSchristos # define _GL_EXTERN_C extern 204*88e42b0fSchristos #endif 205*88e42b0fSchristos 206*88e42b0fSchristos /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); 207*88e42b0fSchristos declares a replacement function, named rpl_func, with the given prototype, 208*88e42b0fSchristos consisting of return type, parameters, and attributes. 209*88e42b0fSchristos Example: 210*88e42b0fSchristos _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) 211*88e42b0fSchristos _GL_ARG_NONNULL ((1))); 212*88e42b0fSchristos */ 213*88e42b0fSchristos #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ 214*88e42b0fSchristos _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) 215*88e42b0fSchristos #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ 216*88e42b0fSchristos _GL_EXTERN_C rettype rpl_func parameters_and_attributes 217*88e42b0fSchristos 218*88e42b0fSchristos /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); 219*88e42b0fSchristos declares the system function, named func, with the given prototype, 220*88e42b0fSchristos consisting of return type, parameters, and attributes. 221*88e42b0fSchristos Example: 222*88e42b0fSchristos _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) 223*88e42b0fSchristos _GL_ARG_NONNULL ((1))); 224*88e42b0fSchristos */ 225*88e42b0fSchristos #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ 226*88e42b0fSchristos _GL_EXTERN_C rettype func parameters_and_attributes 227*88e42b0fSchristos 228*88e42b0fSchristos /* _GL_CXXALIAS_RPL (func, rettype, parameters); 229*88e42b0fSchristos declares a C++ alias called GNULIB_NAMESPACE::func 230*88e42b0fSchristos that redirects to rpl_func, if GNULIB_NAMESPACE is defined. 231*88e42b0fSchristos Example: 232*88e42b0fSchristos _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); 233*88e42b0fSchristos 234*88e42b0fSchristos Wrapping rpl_func in an object with an inline conversion operator 235*88e42b0fSchristos avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is 236*88e42b0fSchristos actually used in the program. */ 237*88e42b0fSchristos #define _GL_CXXALIAS_RPL(func,rettype,parameters) \ 238*88e42b0fSchristos _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) 239*88e42b0fSchristos #if defined __cplusplus && defined GNULIB_NAMESPACE 240*88e42b0fSchristos # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 241*88e42b0fSchristos namespace GNULIB_NAMESPACE \ 242*88e42b0fSchristos { \ 243*88e42b0fSchristos static const struct _gl_ ## func ## _wrapper \ 244*88e42b0fSchristos { \ 245*88e42b0fSchristos typedef rettype (*type) parameters; \ 246*88e42b0fSchristos \ 247*88e42b0fSchristos inline operator type () const \ 248*88e42b0fSchristos { \ 249*88e42b0fSchristos return ::rpl_func; \ 250*88e42b0fSchristos } \ 251*88e42b0fSchristos } func = {}; \ 252*88e42b0fSchristos } \ 253*88e42b0fSchristos _GL_EXTERN_C int _gl_cxxalias_dummy 254*88e42b0fSchristos #else 255*88e42b0fSchristos # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 256*88e42b0fSchristos _GL_EXTERN_C int _gl_cxxalias_dummy 257*88e42b0fSchristos #endif 258*88e42b0fSchristos 259*88e42b0fSchristos /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); 260*88e42b0fSchristos is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); 261*88e42b0fSchristos except that the C function rpl_func may have a slightly different 262*88e42b0fSchristos declaration. A cast is used to silence the "invalid conversion" error 263*88e42b0fSchristos that would otherwise occur. */ 264*88e42b0fSchristos #if defined __cplusplus && defined GNULIB_NAMESPACE 265*88e42b0fSchristos # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 266*88e42b0fSchristos namespace GNULIB_NAMESPACE \ 267*88e42b0fSchristos { \ 268*88e42b0fSchristos static const struct _gl_ ## func ## _wrapper \ 269*88e42b0fSchristos { \ 270*88e42b0fSchristos typedef rettype (*type) parameters; \ 271*88e42b0fSchristos \ 272*88e42b0fSchristos inline operator type () const \ 273*88e42b0fSchristos { \ 274*88e42b0fSchristos return reinterpret_cast<type>(::rpl_func); \ 275*88e42b0fSchristos } \ 276*88e42b0fSchristos } func = {}; \ 277*88e42b0fSchristos } \ 278*88e42b0fSchristos _GL_EXTERN_C int _gl_cxxalias_dummy 279*88e42b0fSchristos #else 280*88e42b0fSchristos # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 281*88e42b0fSchristos _GL_EXTERN_C int _gl_cxxalias_dummy 282*88e42b0fSchristos #endif 283*88e42b0fSchristos 284*88e42b0fSchristos /* _GL_CXXALIAS_SYS (func, rettype, parameters); 285*88e42b0fSchristos declares a C++ alias called GNULIB_NAMESPACE::func 286*88e42b0fSchristos that redirects to the system provided function func, if GNULIB_NAMESPACE 287*88e42b0fSchristos is defined. 288*88e42b0fSchristos Example: 289*88e42b0fSchristos _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); 290*88e42b0fSchristos 291*88e42b0fSchristos Wrapping func in an object with an inline conversion operator 292*88e42b0fSchristos avoids a reference to func unless GNULIB_NAMESPACE::func is 293*88e42b0fSchristos actually used in the program. */ 294*88e42b0fSchristos #if defined __cplusplus && defined GNULIB_NAMESPACE 295*88e42b0fSchristos # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 296*88e42b0fSchristos namespace GNULIB_NAMESPACE \ 297*88e42b0fSchristos { \ 298*88e42b0fSchristos static const struct _gl_ ## func ## _wrapper \ 299*88e42b0fSchristos { \ 300*88e42b0fSchristos typedef rettype (*type) parameters; \ 301*88e42b0fSchristos \ 302*88e42b0fSchristos inline operator type () const \ 303*88e42b0fSchristos { \ 304*88e42b0fSchristos return ::func; \ 305*88e42b0fSchristos } \ 306*88e42b0fSchristos } func = {}; \ 307*88e42b0fSchristos } \ 308*88e42b0fSchristos _GL_EXTERN_C int _gl_cxxalias_dummy 309*88e42b0fSchristos #else 310*88e42b0fSchristos # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 311*88e42b0fSchristos _GL_EXTERN_C int _gl_cxxalias_dummy 312*88e42b0fSchristos #endif 313*88e42b0fSchristos 314*88e42b0fSchristos /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); 315*88e42b0fSchristos is like _GL_CXXALIAS_SYS (func, rettype, parameters); 316*88e42b0fSchristos except that the C function func may have a slightly different declaration. 317*88e42b0fSchristos A cast is used to silence the "invalid conversion" error that would 318*88e42b0fSchristos otherwise occur. */ 319*88e42b0fSchristos #if defined __cplusplus && defined GNULIB_NAMESPACE 320*88e42b0fSchristos # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 321*88e42b0fSchristos namespace GNULIB_NAMESPACE \ 322*88e42b0fSchristos { \ 323*88e42b0fSchristos static const struct _gl_ ## func ## _wrapper \ 324*88e42b0fSchristos { \ 325*88e42b0fSchristos typedef rettype (*type) parameters; \ 326*88e42b0fSchristos \ 327*88e42b0fSchristos inline operator type () const \ 328*88e42b0fSchristos { \ 329*88e42b0fSchristos return reinterpret_cast<type>(::func); \ 330*88e42b0fSchristos } \ 331*88e42b0fSchristos } func = {}; \ 332*88e42b0fSchristos } \ 333*88e42b0fSchristos _GL_EXTERN_C int _gl_cxxalias_dummy 334*88e42b0fSchristos #else 335*88e42b0fSchristos # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 336*88e42b0fSchristos _GL_EXTERN_C int _gl_cxxalias_dummy 337*88e42b0fSchristos #endif 338*88e42b0fSchristos 339*88e42b0fSchristos /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); 340*88e42b0fSchristos is like _GL_CXXALIAS_SYS (func, rettype, parameters); 341*88e42b0fSchristos except that the C function is picked among a set of overloaded functions, 342*88e42b0fSchristos namely the one with rettype2 and parameters2. Two consecutive casts 343*88e42b0fSchristos are used to silence the "cannot find a match" and "invalid conversion" 344*88e42b0fSchristos errors that would otherwise occur. */ 345*88e42b0fSchristos #if defined __cplusplus && defined GNULIB_NAMESPACE 346*88e42b0fSchristos /* The outer cast must be a reinterpret_cast. 347*88e42b0fSchristos The inner cast: When the function is defined as a set of overloaded 348*88e42b0fSchristos functions, it works as a static_cast<>, choosing the designated variant. 349*88e42b0fSchristos When the function is defined as a single variant, it works as a 350*88e42b0fSchristos reinterpret_cast<>. The parenthesized cast syntax works both ways. */ 351*88e42b0fSchristos # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 352*88e42b0fSchristos namespace GNULIB_NAMESPACE \ 353*88e42b0fSchristos { \ 354*88e42b0fSchristos static const struct _gl_ ## func ## _wrapper \ 355*88e42b0fSchristos { \ 356*88e42b0fSchristos typedef rettype (*type) parameters; \ 357*88e42b0fSchristos \ 358*88e42b0fSchristos inline operator type () const \ 359*88e42b0fSchristos { \ 360*88e42b0fSchristos return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \ 361*88e42b0fSchristos } \ 362*88e42b0fSchristos } func = {}; \ 363*88e42b0fSchristos } \ 364*88e42b0fSchristos _GL_EXTERN_C int _gl_cxxalias_dummy 365*88e42b0fSchristos #else 366*88e42b0fSchristos # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 367*88e42b0fSchristos _GL_EXTERN_C int _gl_cxxalias_dummy 368*88e42b0fSchristos #endif 369*88e42b0fSchristos 370*88e42b0fSchristos /* _GL_CXXALIASWARN (func); 371*88e42b0fSchristos causes a warning to be emitted when ::func is used but not when 372*88e42b0fSchristos GNULIB_NAMESPACE::func is used. func must be defined without overloaded 373*88e42b0fSchristos variants. */ 374*88e42b0fSchristos #if defined __cplusplus && defined GNULIB_NAMESPACE 375*88e42b0fSchristos # define _GL_CXXALIASWARN(func) \ 376*88e42b0fSchristos _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) 377*88e42b0fSchristos # define _GL_CXXALIASWARN_1(func,namespace) \ 378*88e42b0fSchristos _GL_CXXALIASWARN_2 (func, namespace) 379*88e42b0fSchristos /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 380*88e42b0fSchristos we enable the warning only when not optimizing. */ 381*88e42b0fSchristos # if !__OPTIMIZE__ 382*88e42b0fSchristos # define _GL_CXXALIASWARN_2(func,namespace) \ 383*88e42b0fSchristos _GL_WARN_ON_USE (func, \ 384*88e42b0fSchristos "The symbol ::" #func " refers to the system function. " \ 385*88e42b0fSchristos "Use " #namespace "::" #func " instead.") 386*88e42b0fSchristos # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 387*88e42b0fSchristos # define _GL_CXXALIASWARN_2(func,namespace) \ 388*88e42b0fSchristos extern __typeof__ (func) func 389*88e42b0fSchristos # else 390*88e42b0fSchristos # define _GL_CXXALIASWARN_2(func,namespace) \ 391*88e42b0fSchristos _GL_EXTERN_C int _gl_cxxalias_dummy 392*88e42b0fSchristos # endif 393*88e42b0fSchristos #else 394*88e42b0fSchristos # define _GL_CXXALIASWARN(func) \ 395*88e42b0fSchristos _GL_EXTERN_C int _gl_cxxalias_dummy 396*88e42b0fSchristos #endif 397*88e42b0fSchristos 398*88e42b0fSchristos /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); 399*88e42b0fSchristos causes a warning to be emitted when the given overloaded variant of ::func 400*88e42b0fSchristos is used but not when GNULIB_NAMESPACE::func is used. */ 401*88e42b0fSchristos #if defined __cplusplus && defined GNULIB_NAMESPACE 402*88e42b0fSchristos # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 403*88e42b0fSchristos _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ 404*88e42b0fSchristos GNULIB_NAMESPACE) 405*88e42b0fSchristos # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ 406*88e42b0fSchristos _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) 407*88e42b0fSchristos /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 408*88e42b0fSchristos we enable the warning only when not optimizing. */ 409*88e42b0fSchristos # if !__OPTIMIZE__ 410*88e42b0fSchristos # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 411*88e42b0fSchristos _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \ 412*88e42b0fSchristos "The symbol ::" #func " refers to the system function. " \ 413*88e42b0fSchristos "Use " #namespace "::" #func " instead.") 414*88e42b0fSchristos # else 415*88e42b0fSchristos # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 416*88e42b0fSchristos _GL_EXTERN_C int _gl_cxxalias_dummy 417*88e42b0fSchristos # endif 418*88e42b0fSchristos #else 419*88e42b0fSchristos # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 420*88e42b0fSchristos _GL_EXTERN_C int _gl_cxxalias_dummy 421*88e42b0fSchristos #endif 422*88e42b0fSchristos 423*88e42b0fSchristos #endif /* _GL_CXXDEFS_H */ 424*88e42b0fSchristos 425*88e42b0fSchristos /* The definition of _GL_ARG_NONNULL is copied here. */ 426*88e42b0fSchristos /* A C macro for declaring that specific arguments must not be NULL. 427*88e42b0fSchristos Copyright (C) 2009-2020 Free Software Foundation, Inc. 428*88e42b0fSchristos 429*88e42b0fSchristos This program is free software: you can redistribute it and/or modify it 430*88e42b0fSchristos under the terms of the GNU General Public License as published 431*88e42b0fSchristos by the Free Software Foundation; either version 3 of the License, or 432*88e42b0fSchristos (at your option) any later version. 433*88e42b0fSchristos 434*88e42b0fSchristos This program is distributed in the hope that it will be useful, 435*88e42b0fSchristos but WITHOUT ANY WARRANTY; without even the implied warranty of 436*88e42b0fSchristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 437*88e42b0fSchristos General Public License for more details. 438*88e42b0fSchristos 439*88e42b0fSchristos You should have received a copy of the GNU General Public License 440*88e42b0fSchristos along with this program. If not, see <https://www.gnu.org/licenses/>. */ 441*88e42b0fSchristos 442*88e42b0fSchristos /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools 443*88e42b0fSchristos that the values passed as arguments n, ..., m must be non-NULL pointers. 444*88e42b0fSchristos n = 1 stands for the first argument, n = 2 for the second argument etc. */ 445*88e42b0fSchristos #ifndef _GL_ARG_NONNULL 446*88e42b0fSchristos # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3 447*88e42b0fSchristos # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) 448*88e42b0fSchristos # else 449*88e42b0fSchristos # define _GL_ARG_NONNULL(params) 450*88e42b0fSchristos # endif 451*88e42b0fSchristos #endif 452*88e42b0fSchristos 453*88e42b0fSchristos /* The definition of _GL_WARN_ON_USE is copied here. */ 454*88e42b0fSchristos /* A C macro for emitting warnings if a function is used. 455*88e42b0fSchristos Copyright (C) 2010-2020 Free Software Foundation, Inc. 456*88e42b0fSchristos 457*88e42b0fSchristos This program is free software: you can redistribute it and/or modify it 458*88e42b0fSchristos under the terms of the GNU General Public License as published 459*88e42b0fSchristos by the Free Software Foundation; either version 3 of the License, or 460*88e42b0fSchristos (at your option) any later version. 461*88e42b0fSchristos 462*88e42b0fSchristos This program is distributed in the hope that it will be useful, 463*88e42b0fSchristos but WITHOUT ANY WARRANTY; without even the implied warranty of 464*88e42b0fSchristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 465*88e42b0fSchristos General Public License for more details. 466*88e42b0fSchristos 467*88e42b0fSchristos You should have received a copy of the GNU General Public License 468*88e42b0fSchristos along with this program. If not, see <https://www.gnu.org/licenses/>. */ 469*88e42b0fSchristos 470*88e42b0fSchristos /* _GL_WARN_ON_USE (function, "literal string") issues a declaration 471*88e42b0fSchristos for FUNCTION which will then trigger a compiler warning containing 472*88e42b0fSchristos the text of "literal string" anywhere that function is called, if 473*88e42b0fSchristos supported by the compiler. If the compiler does not support this 474*88e42b0fSchristos feature, the macro expands to an unused extern declaration. 475*88e42b0fSchristos 476*88e42b0fSchristos _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the 477*88e42b0fSchristos attribute used in _GL_WARN_ON_USE. If the compiler does not support 478*88e42b0fSchristos this feature, it expands to empty. 479*88e42b0fSchristos 480*88e42b0fSchristos These macros are useful for marking a function as a potential 481*88e42b0fSchristos portability trap, with the intent that "literal string" include 482*88e42b0fSchristos instructions on the replacement function that should be used 483*88e42b0fSchristos instead. 484*88e42b0fSchristos _GL_WARN_ON_USE is for functions with 'extern' linkage. 485*88e42b0fSchristos _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline' 486*88e42b0fSchristos linkage. 487*88e42b0fSchristos 488*88e42b0fSchristos However, one of the reasons that a function is a portability trap is 489*88e42b0fSchristos if it has the wrong signature. Declaring FUNCTION with a different 490*88e42b0fSchristos signature in C is a compilation error, so this macro must use the 491*88e42b0fSchristos same type as any existing declaration so that programs that avoid 492*88e42b0fSchristos the problematic FUNCTION do not fail to compile merely because they 493*88e42b0fSchristos included a header that poisoned the function. But this implies that 494*88e42b0fSchristos _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already 495*88e42b0fSchristos have a declaration. Use of this macro implies that there must not 496*88e42b0fSchristos be any other macro hiding the declaration of FUNCTION; but 497*88e42b0fSchristos undefining FUNCTION first is part of the poisoning process anyway 498*88e42b0fSchristos (although for symbols that are provided only via a macro, the result 499*88e42b0fSchristos is a compilation error rather than a warning containing 500*88e42b0fSchristos "literal string"). Also note that in C++, it is only safe to use if 501*88e42b0fSchristos FUNCTION has no overloads. 502*88e42b0fSchristos 503*88e42b0fSchristos For an example, it is possible to poison 'getline' by: 504*88e42b0fSchristos - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]], 505*88e42b0fSchristos [getline]) in configure.ac, which potentially defines 506*88e42b0fSchristos HAVE_RAW_DECL_GETLINE 507*88e42b0fSchristos - adding this code to a header that wraps the system <stdio.h>: 508*88e42b0fSchristos #undef getline 509*88e42b0fSchristos #if HAVE_RAW_DECL_GETLINE 510*88e42b0fSchristos _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but" 511*88e42b0fSchristos "not universally present; use the gnulib module getline"); 512*88e42b0fSchristos #endif 513*88e42b0fSchristos 514*88e42b0fSchristos It is not possible to directly poison global variables. But it is 515*88e42b0fSchristos possible to write a wrapper accessor function, and poison that 516*88e42b0fSchristos (less common usage, like &environ, will cause a compilation error 517*88e42b0fSchristos rather than issue the nice warning, but the end result of informing 518*88e42b0fSchristos the developer about their portability problem is still achieved): 519*88e42b0fSchristos #if HAVE_RAW_DECL_ENVIRON 520*88e42b0fSchristos static char *** 521*88e42b0fSchristos rpl_environ (void) { return &environ; } 522*88e42b0fSchristos _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared"); 523*88e42b0fSchristos # undef environ 524*88e42b0fSchristos # define environ (*rpl_environ ()) 525*88e42b0fSchristos #endif 526*88e42b0fSchristos or better (avoiding contradictory use of 'static' and 'extern'): 527*88e42b0fSchristos #if HAVE_RAW_DECL_ENVIRON 528*88e42b0fSchristos static char *** 529*88e42b0fSchristos _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared") 530*88e42b0fSchristos rpl_environ (void) { return &environ; } 531*88e42b0fSchristos # undef environ 532*88e42b0fSchristos # define environ (*rpl_environ ()) 533*88e42b0fSchristos #endif 534*88e42b0fSchristos */ 535*88e42b0fSchristos #ifndef _GL_WARN_ON_USE 536*88e42b0fSchristos 537*88e42b0fSchristos # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 538*88e42b0fSchristos /* A compiler attribute is available in gcc versions 4.3.0 and later. */ 539*88e42b0fSchristos # define _GL_WARN_ON_USE(function, message) \ 540*88e42b0fSchristos extern __typeof__ (function) function __attribute__ ((__warning__ (message))) 541*88e42b0fSchristos # define _GL_WARN_ON_USE_ATTRIBUTE(message) \ 542*88e42b0fSchristos __attribute__ ((__warning__ (message))) 543*88e42b0fSchristos # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 544*88e42b0fSchristos /* Verify the existence of the function. */ 545*88e42b0fSchristos # define _GL_WARN_ON_USE(function, message) \ 546*88e42b0fSchristos extern __typeof__ (function) function 547*88e42b0fSchristos # define _GL_WARN_ON_USE_ATTRIBUTE(message) 548*88e42b0fSchristos # else /* Unsupported. */ 549*88e42b0fSchristos # define _GL_WARN_ON_USE(function, message) \ 550*88e42b0fSchristos _GL_WARN_EXTERN_C int _gl_warn_on_use 551*88e42b0fSchristos # define _GL_WARN_ON_USE_ATTRIBUTE(message) 552*88e42b0fSchristos # endif 553*88e42b0fSchristos #endif 554*88e42b0fSchristos 555*88e42b0fSchristos /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string") 556*88e42b0fSchristos is like _GL_WARN_ON_USE (function, "string"), except that in C++ mode the 557*88e42b0fSchristos function is declared with the given prototype, consisting of return type, 558*88e42b0fSchristos parameters, and attributes. 559*88e42b0fSchristos This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does 560*88e42b0fSchristos not work in this case. */ 561*88e42b0fSchristos #ifndef _GL_WARN_ON_USE_CXX 562*88e42b0fSchristos # if !defined __cplusplus 563*88e42b0fSchristos # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 564*88e42b0fSchristos _GL_WARN_ON_USE (function, msg) 565*88e42b0fSchristos # else 566*88e42b0fSchristos # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 567*88e42b0fSchristos # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 568*88e42b0fSchristos extern rettype function parameters_and_attributes \ 569*88e42b0fSchristos __attribute__ ((__warning__ (msg))) 570*88e42b0fSchristos # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 571*88e42b0fSchristos /* Verify the existence of the function. */ 572*88e42b0fSchristos # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 573*88e42b0fSchristos extern rettype function parameters_and_attributes 574*88e42b0fSchristos # else /* Unsupported. */ 575*88e42b0fSchristos # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 576*88e42b0fSchristos _GL_WARN_EXTERN_C int _gl_warn_on_use 577*88e42b0fSchristos # endif 578*88e42b0fSchristos # endif 579*88e42b0fSchristos #endif 580*88e42b0fSchristos 581*88e42b0fSchristos /* _GL_WARN_EXTERN_C declaration; 582*88e42b0fSchristos performs the declaration with C linkage. */ 583*88e42b0fSchristos #ifndef _GL_WARN_EXTERN_C 584*88e42b0fSchristos # if defined __cplusplus 585*88e42b0fSchristos # define _GL_WARN_EXTERN_C extern "C" 586*88e42b0fSchristos # else 587*88e42b0fSchristos # define _GL_WARN_EXTERN_C extern 588*88e42b0fSchristos # endif 589*88e42b0fSchristos #endif 590*88e42b0fSchristos 591*88e42b0fSchristos 592*88e42b0fSchristos /* Define wint_t and WEOF. (Also done in wctype.in.h.) */ 593*88e42b0fSchristos #if !1 && !defined wint_t 594*88e42b0fSchristos # define wint_t int 595*88e42b0fSchristos # ifndef WEOF 596*88e42b0fSchristos # define WEOF -1 597*88e42b0fSchristos # endif 598*88e42b0fSchristos #else 599*88e42b0fSchristos /* mingw and MSVC define wint_t as 'unsigned short' in <crtdefs.h> or 600*88e42b0fSchristos <stddef.h>. This is too small: ISO C 99 section 7.24.1.(2) says that 601*88e42b0fSchristos wint_t must be "unchanged by default argument promotions". Override it. */ 602*88e42b0fSchristos # if 0 603*88e42b0fSchristos # if !GNULIB_defined_wint_t 604*88e42b0fSchristos # if 0 605*88e42b0fSchristos # include <crtdefs.h> 606*88e42b0fSchristos # else 607*88e42b0fSchristos # include <stddef.h> 608*88e42b0fSchristos # endif 609*88e42b0fSchristos typedef unsigned int rpl_wint_t; 610*88e42b0fSchristos # undef wint_t 611*88e42b0fSchristos # define wint_t rpl_wint_t 612*88e42b0fSchristos # define GNULIB_defined_wint_t 1 613*88e42b0fSchristos # endif 614*88e42b0fSchristos # endif 615*88e42b0fSchristos # ifndef WEOF 616*88e42b0fSchristos # define WEOF ((wint_t) -1) 617*88e42b0fSchristos # endif 618*88e42b0fSchristos #endif 619*88e42b0fSchristos 620*88e42b0fSchristos 621*88e42b0fSchristos /* Override mbstate_t if it is too small. 622*88e42b0fSchristos On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for 623*88e42b0fSchristos implementing mbrtowc for encodings like UTF-8. 624*88e42b0fSchristos On AIX and MSVC, mbrtowc needs to be overridden, but mbstate_t exists and is 625*88e42b0fSchristos large enough and overriding it would cause problems in C++ mode. */ 626*88e42b0fSchristos #if !(((defined _WIN32 && !defined __CYGWIN__) || 1) && 1) || 1 627*88e42b0fSchristos # if !GNULIB_defined_mbstate_t 628*88e42b0fSchristos # if !(defined _AIX || defined _MSC_VER) 629*88e42b0fSchristos typedef int rpl_mbstate_t; 630*88e42b0fSchristos # undef mbstate_t 631*88e42b0fSchristos # define mbstate_t rpl_mbstate_t 632*88e42b0fSchristos # endif 633*88e42b0fSchristos # define GNULIB_defined_mbstate_t 1 634*88e42b0fSchristos # endif 635*88e42b0fSchristos #endif 636*88e42b0fSchristos 637*88e42b0fSchristos 638*88e42b0fSchristos /* Convert a single-byte character to a wide character. */ 639*88e42b0fSchristos #if 1 640*88e42b0fSchristos # if 0 641*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 642*88e42b0fSchristos # undef btowc 643*88e42b0fSchristos # define btowc rpl_btowc 644*88e42b0fSchristos # endif 645*88e42b0fSchristos _GL_FUNCDECL_RPL (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE); 646*88e42b0fSchristos _GL_CXXALIAS_RPL (btowc, wint_t, (int c)); 647*88e42b0fSchristos # else 648*88e42b0fSchristos # if !1 649*88e42b0fSchristos _GL_FUNCDECL_SYS (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE); 650*88e42b0fSchristos # endif 651*88e42b0fSchristos /* Need to cast, because on mingw, the return type is 'unsigned short'. */ 652*88e42b0fSchristos _GL_CXXALIAS_SYS_CAST (btowc, wint_t, (int c)); 653*88e42b0fSchristos # endif 654*88e42b0fSchristos # if __GLIBC__ >= 2 655*88e42b0fSchristos _GL_CXXALIASWARN (btowc); 656*88e42b0fSchristos # endif 657*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 658*88e42b0fSchristos # undef btowc 659*88e42b0fSchristos # if HAVE_RAW_DECL_BTOWC 660*88e42b0fSchristos _GL_WARN_ON_USE (btowc, "btowc is unportable - " 661*88e42b0fSchristos "use gnulib module btowc for portability"); 662*88e42b0fSchristos # endif 663*88e42b0fSchristos #endif 664*88e42b0fSchristos 665*88e42b0fSchristos 666*88e42b0fSchristos /* Convert a wide character to a single-byte character. */ 667*88e42b0fSchristos #if 0 668*88e42b0fSchristos # if 0 669*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 670*88e42b0fSchristos # undef wctob 671*88e42b0fSchristos # define wctob rpl_wctob 672*88e42b0fSchristos # endif 673*88e42b0fSchristos _GL_FUNCDECL_RPL (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE); 674*88e42b0fSchristos _GL_CXXALIAS_RPL (wctob, int, (wint_t wc)); 675*88e42b0fSchristos # else 676*88e42b0fSchristos # if !defined wctob && !1 677*88e42b0fSchristos /* wctob is provided by gnulib, or wctob exists but is not declared. */ 678*88e42b0fSchristos _GL_FUNCDECL_SYS (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE); 679*88e42b0fSchristos # endif 680*88e42b0fSchristos _GL_CXXALIAS_SYS (wctob, int, (wint_t wc)); 681*88e42b0fSchristos # endif 682*88e42b0fSchristos # if __GLIBC__ >= 2 683*88e42b0fSchristos _GL_CXXALIASWARN (wctob); 684*88e42b0fSchristos # endif 685*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 686*88e42b0fSchristos # undef wctob 687*88e42b0fSchristos # if HAVE_RAW_DECL_WCTOB 688*88e42b0fSchristos _GL_WARN_ON_USE (wctob, "wctob is unportable - " 689*88e42b0fSchristos "use gnulib module wctob for portability"); 690*88e42b0fSchristos # endif 691*88e42b0fSchristos #endif 692*88e42b0fSchristos 693*88e42b0fSchristos 694*88e42b0fSchristos /* Test whether *PS is in the initial state. */ 695*88e42b0fSchristos #if 1 696*88e42b0fSchristos # if 1 697*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 698*88e42b0fSchristos # undef mbsinit 699*88e42b0fSchristos # define mbsinit rpl_mbsinit 700*88e42b0fSchristos # endif 701*88e42b0fSchristos _GL_FUNCDECL_RPL (mbsinit, int, (const mbstate_t *ps)); 702*88e42b0fSchristos _GL_CXXALIAS_RPL (mbsinit, int, (const mbstate_t *ps)); 703*88e42b0fSchristos # else 704*88e42b0fSchristos # if !1 705*88e42b0fSchristos _GL_FUNCDECL_SYS (mbsinit, int, (const mbstate_t *ps)); 706*88e42b0fSchristos # endif 707*88e42b0fSchristos _GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps)); 708*88e42b0fSchristos # endif 709*88e42b0fSchristos # if __GLIBC__ >= 2 710*88e42b0fSchristos _GL_CXXALIASWARN (mbsinit); 711*88e42b0fSchristos # endif 712*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 713*88e42b0fSchristos # undef mbsinit 714*88e42b0fSchristos # if HAVE_RAW_DECL_MBSINIT 715*88e42b0fSchristos _GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - " 716*88e42b0fSchristos "use gnulib module mbsinit for portability"); 717*88e42b0fSchristos # endif 718*88e42b0fSchristos #endif 719*88e42b0fSchristos 720*88e42b0fSchristos 721*88e42b0fSchristos /* Convert a multibyte character to a wide character. */ 722*88e42b0fSchristos #if 1 723*88e42b0fSchristos # if 1 724*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 725*88e42b0fSchristos # undef mbrtowc 726*88e42b0fSchristos # define mbrtowc rpl_mbrtowc 727*88e42b0fSchristos # endif 728*88e42b0fSchristos _GL_FUNCDECL_RPL (mbrtowc, size_t, 729*88e42b0fSchristos (wchar_t *restrict pwc, const char *restrict s, size_t n, 730*88e42b0fSchristos mbstate_t *restrict ps)); 731*88e42b0fSchristos _GL_CXXALIAS_RPL (mbrtowc, size_t, 732*88e42b0fSchristos (wchar_t *restrict pwc, const char *restrict s, size_t n, 733*88e42b0fSchristos mbstate_t *restrict ps)); 734*88e42b0fSchristos # else 735*88e42b0fSchristos # if !1 736*88e42b0fSchristos _GL_FUNCDECL_SYS (mbrtowc, size_t, 737*88e42b0fSchristos (wchar_t *restrict pwc, const char *restrict s, size_t n, 738*88e42b0fSchristos mbstate_t *restrict ps)); 739*88e42b0fSchristos # endif 740*88e42b0fSchristos _GL_CXXALIAS_SYS (mbrtowc, size_t, 741*88e42b0fSchristos (wchar_t *restrict pwc, const char *restrict s, size_t n, 742*88e42b0fSchristos mbstate_t *restrict ps)); 743*88e42b0fSchristos # endif 744*88e42b0fSchristos # if __GLIBC__ >= 2 745*88e42b0fSchristos _GL_CXXALIASWARN (mbrtowc); 746*88e42b0fSchristos # endif 747*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 748*88e42b0fSchristos # undef mbrtowc 749*88e42b0fSchristos # if HAVE_RAW_DECL_MBRTOWC 750*88e42b0fSchristos _GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - " 751*88e42b0fSchristos "use gnulib module mbrtowc for portability"); 752*88e42b0fSchristos # endif 753*88e42b0fSchristos #endif 754*88e42b0fSchristos 755*88e42b0fSchristos 756*88e42b0fSchristos /* Recognize a multibyte character. */ 757*88e42b0fSchristos #if 0 758*88e42b0fSchristos # if 0 759*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 760*88e42b0fSchristos # undef mbrlen 761*88e42b0fSchristos # define mbrlen rpl_mbrlen 762*88e42b0fSchristos # endif 763*88e42b0fSchristos _GL_FUNCDECL_RPL (mbrlen, size_t, 764*88e42b0fSchristos (const char *restrict s, size_t n, mbstate_t *restrict ps)); 765*88e42b0fSchristos _GL_CXXALIAS_RPL (mbrlen, size_t, 766*88e42b0fSchristos (const char *restrict s, size_t n, mbstate_t *restrict ps)); 767*88e42b0fSchristos # else 768*88e42b0fSchristos # if !1 769*88e42b0fSchristos _GL_FUNCDECL_SYS (mbrlen, size_t, 770*88e42b0fSchristos (const char *restrict s, size_t n, mbstate_t *restrict ps)); 771*88e42b0fSchristos # endif 772*88e42b0fSchristos _GL_CXXALIAS_SYS (mbrlen, size_t, 773*88e42b0fSchristos (const char *restrict s, size_t n, mbstate_t *restrict ps)); 774*88e42b0fSchristos # endif 775*88e42b0fSchristos # if __GLIBC__ >= 2 776*88e42b0fSchristos _GL_CXXALIASWARN (mbrlen); 777*88e42b0fSchristos # endif 778*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 779*88e42b0fSchristos # undef mbrlen 780*88e42b0fSchristos # if HAVE_RAW_DECL_MBRLEN 781*88e42b0fSchristos _GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - " 782*88e42b0fSchristos "use gnulib module mbrlen for portability"); 783*88e42b0fSchristos # endif 784*88e42b0fSchristos #endif 785*88e42b0fSchristos 786*88e42b0fSchristos 787*88e42b0fSchristos /* Convert a string to a wide string. */ 788*88e42b0fSchristos #if 1 789*88e42b0fSchristos # if 1 790*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 791*88e42b0fSchristos # undef mbsrtowcs 792*88e42b0fSchristos # define mbsrtowcs rpl_mbsrtowcs 793*88e42b0fSchristos # endif 794*88e42b0fSchristos _GL_FUNCDECL_RPL (mbsrtowcs, size_t, 795*88e42b0fSchristos (wchar_t *restrict dest, 796*88e42b0fSchristos const char **restrict srcp, size_t len, 797*88e42b0fSchristos mbstate_t *restrict ps) 798*88e42b0fSchristos _GL_ARG_NONNULL ((2))); 799*88e42b0fSchristos _GL_CXXALIAS_RPL (mbsrtowcs, size_t, 800*88e42b0fSchristos (wchar_t *restrict dest, 801*88e42b0fSchristos const char **restrict srcp, size_t len, 802*88e42b0fSchristos mbstate_t *restrict ps)); 803*88e42b0fSchristos # else 804*88e42b0fSchristos # if !1 805*88e42b0fSchristos _GL_FUNCDECL_SYS (mbsrtowcs, size_t, 806*88e42b0fSchristos (wchar_t *restrict dest, 807*88e42b0fSchristos const char **restrict srcp, size_t len, 808*88e42b0fSchristos mbstate_t *restrict ps) 809*88e42b0fSchristos _GL_ARG_NONNULL ((2))); 810*88e42b0fSchristos # endif 811*88e42b0fSchristos _GL_CXXALIAS_SYS (mbsrtowcs, size_t, 812*88e42b0fSchristos (wchar_t *restrict dest, 813*88e42b0fSchristos const char **restrict srcp, size_t len, 814*88e42b0fSchristos mbstate_t *restrict ps)); 815*88e42b0fSchristos # endif 816*88e42b0fSchristos # if __GLIBC__ >= 2 817*88e42b0fSchristos _GL_CXXALIASWARN (mbsrtowcs); 818*88e42b0fSchristos # endif 819*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 820*88e42b0fSchristos # undef mbsrtowcs 821*88e42b0fSchristos # if HAVE_RAW_DECL_MBSRTOWCS 822*88e42b0fSchristos _GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - " 823*88e42b0fSchristos "use gnulib module mbsrtowcs for portability"); 824*88e42b0fSchristos # endif 825*88e42b0fSchristos #endif 826*88e42b0fSchristos 827*88e42b0fSchristos 828*88e42b0fSchristos /* Convert a string to a wide string. */ 829*88e42b0fSchristos #if 0 830*88e42b0fSchristos # if 0 831*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 832*88e42b0fSchristos # undef mbsnrtowcs 833*88e42b0fSchristos # define mbsnrtowcs rpl_mbsnrtowcs 834*88e42b0fSchristos # endif 835*88e42b0fSchristos _GL_FUNCDECL_RPL (mbsnrtowcs, size_t, 836*88e42b0fSchristos (wchar_t *restrict dest, 837*88e42b0fSchristos const char **restrict srcp, size_t srclen, size_t len, 838*88e42b0fSchristos mbstate_t *restrict ps) 839*88e42b0fSchristos _GL_ARG_NONNULL ((2))); 840*88e42b0fSchristos _GL_CXXALIAS_RPL (mbsnrtowcs, size_t, 841*88e42b0fSchristos (wchar_t *restrict dest, 842*88e42b0fSchristos const char **restrict srcp, size_t srclen, size_t len, 843*88e42b0fSchristos mbstate_t *restrict ps)); 844*88e42b0fSchristos # else 845*88e42b0fSchristos # if !1 846*88e42b0fSchristos _GL_FUNCDECL_SYS (mbsnrtowcs, size_t, 847*88e42b0fSchristos (wchar_t *restrict dest, 848*88e42b0fSchristos const char **restrict srcp, size_t srclen, size_t len, 849*88e42b0fSchristos mbstate_t *restrict ps) 850*88e42b0fSchristos _GL_ARG_NONNULL ((2))); 851*88e42b0fSchristos # endif 852*88e42b0fSchristos _GL_CXXALIAS_SYS (mbsnrtowcs, size_t, 853*88e42b0fSchristos (wchar_t *restrict dest, 854*88e42b0fSchristos const char **restrict srcp, size_t srclen, size_t len, 855*88e42b0fSchristos mbstate_t *restrict ps)); 856*88e42b0fSchristos # endif 857*88e42b0fSchristos _GL_CXXALIASWARN (mbsnrtowcs); 858*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 859*88e42b0fSchristos # undef mbsnrtowcs 860*88e42b0fSchristos # if HAVE_RAW_DECL_MBSNRTOWCS 861*88e42b0fSchristos _GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - " 862*88e42b0fSchristos "use gnulib module mbsnrtowcs for portability"); 863*88e42b0fSchristos # endif 864*88e42b0fSchristos #endif 865*88e42b0fSchristos 866*88e42b0fSchristos 867*88e42b0fSchristos /* Convert a wide character to a multibyte character. */ 868*88e42b0fSchristos #if 0 869*88e42b0fSchristos # if 0 870*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 871*88e42b0fSchristos # undef wcrtomb 872*88e42b0fSchristos # define wcrtomb rpl_wcrtomb 873*88e42b0fSchristos # endif 874*88e42b0fSchristos _GL_FUNCDECL_RPL (wcrtomb, size_t, 875*88e42b0fSchristos (char *restrict s, wchar_t wc, mbstate_t *restrict ps)); 876*88e42b0fSchristos _GL_CXXALIAS_RPL (wcrtomb, size_t, 877*88e42b0fSchristos (char *restrict s, wchar_t wc, mbstate_t *restrict ps)); 878*88e42b0fSchristos # else 879*88e42b0fSchristos # if !1 880*88e42b0fSchristos _GL_FUNCDECL_SYS (wcrtomb, size_t, 881*88e42b0fSchristos (char *restrict s, wchar_t wc, mbstate_t *restrict ps)); 882*88e42b0fSchristos # endif 883*88e42b0fSchristos _GL_CXXALIAS_SYS (wcrtomb, size_t, 884*88e42b0fSchristos (char *restrict s, wchar_t wc, mbstate_t *restrict ps)); 885*88e42b0fSchristos # endif 886*88e42b0fSchristos # if __GLIBC__ >= 2 887*88e42b0fSchristos _GL_CXXALIASWARN (wcrtomb); 888*88e42b0fSchristos # endif 889*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 890*88e42b0fSchristos # undef wcrtomb 891*88e42b0fSchristos # if HAVE_RAW_DECL_WCRTOMB 892*88e42b0fSchristos _GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - " 893*88e42b0fSchristos "use gnulib module wcrtomb for portability"); 894*88e42b0fSchristos # endif 895*88e42b0fSchristos #endif 896*88e42b0fSchristos 897*88e42b0fSchristos 898*88e42b0fSchristos /* Convert a wide string to a string. */ 899*88e42b0fSchristos #if 0 900*88e42b0fSchristos # if 0 901*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 902*88e42b0fSchristos # undef wcsrtombs 903*88e42b0fSchristos # define wcsrtombs rpl_wcsrtombs 904*88e42b0fSchristos # endif 905*88e42b0fSchristos _GL_FUNCDECL_RPL (wcsrtombs, size_t, 906*88e42b0fSchristos (char *restrict dest, const wchar_t **restrict srcp, 907*88e42b0fSchristos size_t len, 908*88e42b0fSchristos mbstate_t *restrict ps) 909*88e42b0fSchristos _GL_ARG_NONNULL ((2))); 910*88e42b0fSchristos _GL_CXXALIAS_RPL (wcsrtombs, size_t, 911*88e42b0fSchristos (char *restrict dest, const wchar_t **restrict srcp, 912*88e42b0fSchristos size_t len, 913*88e42b0fSchristos mbstate_t *restrict ps)); 914*88e42b0fSchristos # else 915*88e42b0fSchristos # if !1 916*88e42b0fSchristos _GL_FUNCDECL_SYS (wcsrtombs, size_t, 917*88e42b0fSchristos (char *restrict dest, const wchar_t **restrict srcp, 918*88e42b0fSchristos size_t len, 919*88e42b0fSchristos mbstate_t *restrict ps) 920*88e42b0fSchristos _GL_ARG_NONNULL ((2))); 921*88e42b0fSchristos # endif 922*88e42b0fSchristos _GL_CXXALIAS_SYS (wcsrtombs, size_t, 923*88e42b0fSchristos (char *restrict dest, const wchar_t **restrict srcp, 924*88e42b0fSchristos size_t len, 925*88e42b0fSchristos mbstate_t *restrict ps)); 926*88e42b0fSchristos # endif 927*88e42b0fSchristos # if __GLIBC__ >= 2 928*88e42b0fSchristos _GL_CXXALIASWARN (wcsrtombs); 929*88e42b0fSchristos # endif 930*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 931*88e42b0fSchristos # undef wcsrtombs 932*88e42b0fSchristos # if HAVE_RAW_DECL_WCSRTOMBS 933*88e42b0fSchristos _GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - " 934*88e42b0fSchristos "use gnulib module wcsrtombs for portability"); 935*88e42b0fSchristos # endif 936*88e42b0fSchristos #endif 937*88e42b0fSchristos 938*88e42b0fSchristos 939*88e42b0fSchristos /* Convert a wide string to a string. */ 940*88e42b0fSchristos #if 0 941*88e42b0fSchristos # if 0 942*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 943*88e42b0fSchristos # undef wcsnrtombs 944*88e42b0fSchristos # define wcsnrtombs rpl_wcsnrtombs 945*88e42b0fSchristos # endif 946*88e42b0fSchristos _GL_FUNCDECL_RPL (wcsnrtombs, size_t, 947*88e42b0fSchristos (char *restrict dest, 948*88e42b0fSchristos const wchar_t **restrict srcp, size_t srclen, 949*88e42b0fSchristos size_t len, 950*88e42b0fSchristos mbstate_t *restrict ps) 951*88e42b0fSchristos _GL_ARG_NONNULL ((2))); 952*88e42b0fSchristos _GL_CXXALIAS_RPL (wcsnrtombs, size_t, 953*88e42b0fSchristos (char *restrict dest, 954*88e42b0fSchristos const wchar_t **restrict srcp, size_t srclen, 955*88e42b0fSchristos size_t len, 956*88e42b0fSchristos mbstate_t *restrict ps)); 957*88e42b0fSchristos # else 958*88e42b0fSchristos # if !1 || (defined __cplusplus && defined __sun) 959*88e42b0fSchristos _GL_FUNCDECL_SYS (wcsnrtombs, size_t, 960*88e42b0fSchristos (char *restrict dest, 961*88e42b0fSchristos const wchar_t **restrict srcp, size_t srclen, 962*88e42b0fSchristos size_t len, 963*88e42b0fSchristos mbstate_t *restrict ps) 964*88e42b0fSchristos _GL_ARG_NONNULL ((2))); 965*88e42b0fSchristos # endif 966*88e42b0fSchristos _GL_CXXALIAS_SYS (wcsnrtombs, size_t, 967*88e42b0fSchristos (char *restrict dest, 968*88e42b0fSchristos const wchar_t **restrict srcp, size_t srclen, 969*88e42b0fSchristos size_t len, 970*88e42b0fSchristos mbstate_t *restrict ps)); 971*88e42b0fSchristos # endif 972*88e42b0fSchristos # if __GLIBC__ >= 2 973*88e42b0fSchristos _GL_CXXALIASWARN (wcsnrtombs); 974*88e42b0fSchristos # endif 975*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 976*88e42b0fSchristos # undef wcsnrtombs 977*88e42b0fSchristos # if HAVE_RAW_DECL_WCSNRTOMBS 978*88e42b0fSchristos _GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - " 979*88e42b0fSchristos "use gnulib module wcsnrtombs for portability"); 980*88e42b0fSchristos # endif 981*88e42b0fSchristos #endif 982*88e42b0fSchristos 983*88e42b0fSchristos 984*88e42b0fSchristos /* Return the number of screen columns needed for WC. */ 985*88e42b0fSchristos #if 0 986*88e42b0fSchristos # if 0 987*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 988*88e42b0fSchristos # undef wcwidth 989*88e42b0fSchristos # define wcwidth rpl_wcwidth 990*88e42b0fSchristos # endif 991*88e42b0fSchristos _GL_FUNCDECL_RPL (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE); 992*88e42b0fSchristos _GL_CXXALIAS_RPL (wcwidth, int, (wchar_t)); 993*88e42b0fSchristos # else 994*88e42b0fSchristos # if !1 995*88e42b0fSchristos /* wcwidth exists but is not declared. */ 996*88e42b0fSchristos _GL_FUNCDECL_SYS (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE); 997*88e42b0fSchristos # endif 998*88e42b0fSchristos _GL_CXXALIAS_SYS (wcwidth, int, (wchar_t)); 999*88e42b0fSchristos # endif 1000*88e42b0fSchristos # if __GLIBC__ >= 2 1001*88e42b0fSchristos _GL_CXXALIASWARN (wcwidth); 1002*88e42b0fSchristos # endif 1003*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1004*88e42b0fSchristos # undef wcwidth 1005*88e42b0fSchristos # if HAVE_RAW_DECL_WCWIDTH 1006*88e42b0fSchristos _GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - " 1007*88e42b0fSchristos "use gnulib module wcwidth for portability"); 1008*88e42b0fSchristos # endif 1009*88e42b0fSchristos #endif 1010*88e42b0fSchristos 1011*88e42b0fSchristos 1012*88e42b0fSchristos /* Search N wide characters of S for C. */ 1013*88e42b0fSchristos #if 1 1014*88e42b0fSchristos # if !1 1015*88e42b0fSchristos _GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n) 1016*88e42b0fSchristos _GL_ATTRIBUTE_PURE); 1017*88e42b0fSchristos # endif 1018*88e42b0fSchristos /* On some systems, this function is defined as an overloaded function: 1019*88e42b0fSchristos extern "C++" { 1020*88e42b0fSchristos const wchar_t * std::wmemchr (const wchar_t *, wchar_t, size_t); 1021*88e42b0fSchristos wchar_t * std::wmemchr (wchar_t *, wchar_t, size_t); 1022*88e42b0fSchristos } */ 1023*88e42b0fSchristos _GL_CXXALIAS_SYS_CAST2 (wmemchr, 1024*88e42b0fSchristos wchar_t *, (const wchar_t *, wchar_t, size_t), 1025*88e42b0fSchristos const wchar_t *, (const wchar_t *, wchar_t, size_t)); 1026*88e42b0fSchristos # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 1027*88e42b0fSchristos && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 1028*88e42b0fSchristos _GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); 1029*88e42b0fSchristos _GL_CXXALIASWARN1 (wmemchr, const wchar_t *, 1030*88e42b0fSchristos (const wchar_t *s, wchar_t c, size_t n)); 1031*88e42b0fSchristos # elif __GLIBC__ >= 2 1032*88e42b0fSchristos _GL_CXXALIASWARN (wmemchr); 1033*88e42b0fSchristos # endif 1034*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1035*88e42b0fSchristos # undef wmemchr 1036*88e42b0fSchristos # if HAVE_RAW_DECL_WMEMCHR 1037*88e42b0fSchristos _GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - " 1038*88e42b0fSchristos "use gnulib module wmemchr for portability"); 1039*88e42b0fSchristos # endif 1040*88e42b0fSchristos #endif 1041*88e42b0fSchristos 1042*88e42b0fSchristos 1043*88e42b0fSchristos /* Compare N wide characters of S1 and S2. */ 1044*88e42b0fSchristos #if 0 1045*88e42b0fSchristos # if !1 1046*88e42b0fSchristos _GL_FUNCDECL_SYS (wmemcmp, int, 1047*88e42b0fSchristos (const wchar_t *s1, const wchar_t *s2, size_t n) 1048*88e42b0fSchristos _GL_ATTRIBUTE_PURE); 1049*88e42b0fSchristos # endif 1050*88e42b0fSchristos _GL_CXXALIAS_SYS (wmemcmp, int, 1051*88e42b0fSchristos (const wchar_t *s1, const wchar_t *s2, size_t n)); 1052*88e42b0fSchristos # if __GLIBC__ >= 2 1053*88e42b0fSchristos _GL_CXXALIASWARN (wmemcmp); 1054*88e42b0fSchristos # endif 1055*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1056*88e42b0fSchristos # undef wmemcmp 1057*88e42b0fSchristos # if HAVE_RAW_DECL_WMEMCMP 1058*88e42b0fSchristos _GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - " 1059*88e42b0fSchristos "use gnulib module wmemcmp for portability"); 1060*88e42b0fSchristos # endif 1061*88e42b0fSchristos #endif 1062*88e42b0fSchristos 1063*88e42b0fSchristos 1064*88e42b0fSchristos /* Copy N wide characters of SRC to DEST. */ 1065*88e42b0fSchristos #if 0 1066*88e42b0fSchristos # if !1 1067*88e42b0fSchristos _GL_FUNCDECL_SYS (wmemcpy, wchar_t *, 1068*88e42b0fSchristos (wchar_t *restrict dest, 1069*88e42b0fSchristos const wchar_t *restrict src, size_t n)); 1070*88e42b0fSchristos # endif 1071*88e42b0fSchristos _GL_CXXALIAS_SYS (wmemcpy, wchar_t *, 1072*88e42b0fSchristos (wchar_t *restrict dest, 1073*88e42b0fSchristos const wchar_t *restrict src, size_t n)); 1074*88e42b0fSchristos # if __GLIBC__ >= 2 1075*88e42b0fSchristos _GL_CXXALIASWARN (wmemcpy); 1076*88e42b0fSchristos # endif 1077*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1078*88e42b0fSchristos # undef wmemcpy 1079*88e42b0fSchristos # if HAVE_RAW_DECL_WMEMCPY 1080*88e42b0fSchristos _GL_WARN_ON_USE (wmemcpy, "wmemcpy is unportable - " 1081*88e42b0fSchristos "use gnulib module wmemcpy for portability"); 1082*88e42b0fSchristos # endif 1083*88e42b0fSchristos #endif 1084*88e42b0fSchristos 1085*88e42b0fSchristos 1086*88e42b0fSchristos /* Copy N wide characters of SRC to DEST, guaranteeing correct behavior for 1087*88e42b0fSchristos overlapping memory areas. */ 1088*88e42b0fSchristos #if 0 1089*88e42b0fSchristos # if !1 1090*88e42b0fSchristos _GL_FUNCDECL_SYS (wmemmove, wchar_t *, 1091*88e42b0fSchristos (wchar_t *dest, const wchar_t *src, size_t n)); 1092*88e42b0fSchristos # endif 1093*88e42b0fSchristos _GL_CXXALIAS_SYS (wmemmove, wchar_t *, 1094*88e42b0fSchristos (wchar_t *dest, const wchar_t *src, size_t n)); 1095*88e42b0fSchristos # if __GLIBC__ >= 2 1096*88e42b0fSchristos _GL_CXXALIASWARN (wmemmove); 1097*88e42b0fSchristos # endif 1098*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1099*88e42b0fSchristos # undef wmemmove 1100*88e42b0fSchristos # if HAVE_RAW_DECL_WMEMMOVE 1101*88e42b0fSchristos _GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - " 1102*88e42b0fSchristos "use gnulib module wmemmove for portability"); 1103*88e42b0fSchristos # endif 1104*88e42b0fSchristos #endif 1105*88e42b0fSchristos 1106*88e42b0fSchristos 1107*88e42b0fSchristos /* Copy N wide characters of SRC to DEST. 1108*88e42b0fSchristos Return pointer to wide characters after the last written wide character. */ 1109*88e42b0fSchristos #if 1 1110*88e42b0fSchristos # if !0 1111*88e42b0fSchristos _GL_FUNCDECL_SYS (wmempcpy, wchar_t *, 1112*88e42b0fSchristos (wchar_t *restrict dest, 1113*88e42b0fSchristos const wchar_t *restrict src, size_t n)); 1114*88e42b0fSchristos # endif 1115*88e42b0fSchristos _GL_CXXALIAS_SYS (wmempcpy, wchar_t *, 1116*88e42b0fSchristos (wchar_t *restrict dest, 1117*88e42b0fSchristos const wchar_t *restrict src, size_t n)); 1118*88e42b0fSchristos # if __GLIBC__ >= 2 1119*88e42b0fSchristos _GL_CXXALIASWARN (wmempcpy); 1120*88e42b0fSchristos # endif 1121*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1122*88e42b0fSchristos # undef wmempcpy 1123*88e42b0fSchristos # if HAVE_RAW_DECL_WMEMPCPY 1124*88e42b0fSchristos _GL_WARN_ON_USE (wmempcpy, "wmempcpy is unportable - " 1125*88e42b0fSchristos "use gnulib module wmempcpy for portability"); 1126*88e42b0fSchristos # endif 1127*88e42b0fSchristos #endif 1128*88e42b0fSchristos 1129*88e42b0fSchristos 1130*88e42b0fSchristos /* Set N wide characters of S to C. */ 1131*88e42b0fSchristos #if 0 1132*88e42b0fSchristos # if !1 1133*88e42b0fSchristos _GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); 1134*88e42b0fSchristos # endif 1135*88e42b0fSchristos _GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); 1136*88e42b0fSchristos # if __GLIBC__ >= 2 1137*88e42b0fSchristos _GL_CXXALIASWARN (wmemset); 1138*88e42b0fSchristos # endif 1139*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1140*88e42b0fSchristos # undef wmemset 1141*88e42b0fSchristos # if HAVE_RAW_DECL_WMEMSET 1142*88e42b0fSchristos _GL_WARN_ON_USE (wmemset, "wmemset is unportable - " 1143*88e42b0fSchristos "use gnulib module wmemset for portability"); 1144*88e42b0fSchristos # endif 1145*88e42b0fSchristos #endif 1146*88e42b0fSchristos 1147*88e42b0fSchristos 1148*88e42b0fSchristos /* Return the number of wide characters in S. */ 1149*88e42b0fSchristos #if 0 1150*88e42b0fSchristos # if !1 1151*88e42b0fSchristos _GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s) _GL_ATTRIBUTE_PURE); 1152*88e42b0fSchristos # endif 1153*88e42b0fSchristos _GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s)); 1154*88e42b0fSchristos # if __GLIBC__ >= 2 1155*88e42b0fSchristos _GL_CXXALIASWARN (wcslen); 1156*88e42b0fSchristos # endif 1157*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1158*88e42b0fSchristos # undef wcslen 1159*88e42b0fSchristos # if HAVE_RAW_DECL_WCSLEN 1160*88e42b0fSchristos _GL_WARN_ON_USE (wcslen, "wcslen is unportable - " 1161*88e42b0fSchristos "use gnulib module wcslen for portability"); 1162*88e42b0fSchristos # endif 1163*88e42b0fSchristos #endif 1164*88e42b0fSchristos 1165*88e42b0fSchristos 1166*88e42b0fSchristos /* Return the number of wide characters in S, but at most MAXLEN. */ 1167*88e42b0fSchristos #if 0 1168*88e42b0fSchristos # if !1 1169*88e42b0fSchristos _GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen) 1170*88e42b0fSchristos _GL_ATTRIBUTE_PURE); 1171*88e42b0fSchristos # endif 1172*88e42b0fSchristos _GL_CXXALIAS_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen)); 1173*88e42b0fSchristos _GL_CXXALIASWARN (wcsnlen); 1174*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1175*88e42b0fSchristos # undef wcsnlen 1176*88e42b0fSchristos # if HAVE_RAW_DECL_WCSNLEN 1177*88e42b0fSchristos _GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - " 1178*88e42b0fSchristos "use gnulib module wcsnlen for portability"); 1179*88e42b0fSchristos # endif 1180*88e42b0fSchristos #endif 1181*88e42b0fSchristos 1182*88e42b0fSchristos 1183*88e42b0fSchristos /* Copy SRC to DEST. */ 1184*88e42b0fSchristos #if 0 1185*88e42b0fSchristos # if !1 1186*88e42b0fSchristos _GL_FUNCDECL_SYS (wcscpy, wchar_t *, 1187*88e42b0fSchristos (wchar_t *restrict dest, const wchar_t *restrict src)); 1188*88e42b0fSchristos # endif 1189*88e42b0fSchristos _GL_CXXALIAS_SYS (wcscpy, wchar_t *, 1190*88e42b0fSchristos (wchar_t *restrict dest, const wchar_t *restrict src)); 1191*88e42b0fSchristos # if __GLIBC__ >= 2 1192*88e42b0fSchristos _GL_CXXALIASWARN (wcscpy); 1193*88e42b0fSchristos # endif 1194*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1195*88e42b0fSchristos # undef wcscpy 1196*88e42b0fSchristos # if HAVE_RAW_DECL_WCSCPY 1197*88e42b0fSchristos _GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - " 1198*88e42b0fSchristos "use gnulib module wcscpy for portability"); 1199*88e42b0fSchristos # endif 1200*88e42b0fSchristos #endif 1201*88e42b0fSchristos 1202*88e42b0fSchristos 1203*88e42b0fSchristos /* Copy SRC to DEST, returning the address of the terminating L'\0' in DEST. */ 1204*88e42b0fSchristos #if 0 1205*88e42b0fSchristos # if !1 1206*88e42b0fSchristos _GL_FUNCDECL_SYS (wcpcpy, wchar_t *, 1207*88e42b0fSchristos (wchar_t *restrict dest, const wchar_t *restrict src)); 1208*88e42b0fSchristos # endif 1209*88e42b0fSchristos _GL_CXXALIAS_SYS (wcpcpy, wchar_t *, 1210*88e42b0fSchristos (wchar_t *restrict dest, const wchar_t *restrict src)); 1211*88e42b0fSchristos _GL_CXXALIASWARN (wcpcpy); 1212*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1213*88e42b0fSchristos # undef wcpcpy 1214*88e42b0fSchristos # if HAVE_RAW_DECL_WCPCPY 1215*88e42b0fSchristos _GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - " 1216*88e42b0fSchristos "use gnulib module wcpcpy for portability"); 1217*88e42b0fSchristos # endif 1218*88e42b0fSchristos #endif 1219*88e42b0fSchristos 1220*88e42b0fSchristos 1221*88e42b0fSchristos /* Copy no more than N wide characters of SRC to DEST. */ 1222*88e42b0fSchristos #if 0 1223*88e42b0fSchristos # if !1 1224*88e42b0fSchristos _GL_FUNCDECL_SYS (wcsncpy, wchar_t *, 1225*88e42b0fSchristos (wchar_t *restrict dest, 1226*88e42b0fSchristos const wchar_t *restrict src, size_t n)); 1227*88e42b0fSchristos # endif 1228*88e42b0fSchristos _GL_CXXALIAS_SYS (wcsncpy, wchar_t *, 1229*88e42b0fSchristos (wchar_t *restrict dest, 1230*88e42b0fSchristos const wchar_t *restrict src, size_t n)); 1231*88e42b0fSchristos # if __GLIBC__ >= 2 1232*88e42b0fSchristos _GL_CXXALIASWARN (wcsncpy); 1233*88e42b0fSchristos # endif 1234*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1235*88e42b0fSchristos # undef wcsncpy 1236*88e42b0fSchristos # if HAVE_RAW_DECL_WCSNCPY 1237*88e42b0fSchristos _GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - " 1238*88e42b0fSchristos "use gnulib module wcsncpy for portability"); 1239*88e42b0fSchristos # endif 1240*88e42b0fSchristos #endif 1241*88e42b0fSchristos 1242*88e42b0fSchristos 1243*88e42b0fSchristos /* Copy no more than N characters of SRC to DEST, returning the address of 1244*88e42b0fSchristos the last character written into DEST. */ 1245*88e42b0fSchristos #if 0 1246*88e42b0fSchristos # if !1 1247*88e42b0fSchristos _GL_FUNCDECL_SYS (wcpncpy, wchar_t *, 1248*88e42b0fSchristos (wchar_t *restrict dest, 1249*88e42b0fSchristos const wchar_t *restrict src, size_t n)); 1250*88e42b0fSchristos # endif 1251*88e42b0fSchristos _GL_CXXALIAS_SYS (wcpncpy, wchar_t *, 1252*88e42b0fSchristos (wchar_t *restrict dest, 1253*88e42b0fSchristos const wchar_t *restrict src, size_t n)); 1254*88e42b0fSchristos _GL_CXXALIASWARN (wcpncpy); 1255*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1256*88e42b0fSchristos # undef wcpncpy 1257*88e42b0fSchristos # if HAVE_RAW_DECL_WCPNCPY 1258*88e42b0fSchristos _GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - " 1259*88e42b0fSchristos "use gnulib module wcpncpy for portability"); 1260*88e42b0fSchristos # endif 1261*88e42b0fSchristos #endif 1262*88e42b0fSchristos 1263*88e42b0fSchristos 1264*88e42b0fSchristos /* Append SRC onto DEST. */ 1265*88e42b0fSchristos #if 0 1266*88e42b0fSchristos # if !1 1267*88e42b0fSchristos _GL_FUNCDECL_SYS (wcscat, wchar_t *, 1268*88e42b0fSchristos (wchar_t *restrict dest, const wchar_t *restrict src)); 1269*88e42b0fSchristos # endif 1270*88e42b0fSchristos _GL_CXXALIAS_SYS (wcscat, wchar_t *, 1271*88e42b0fSchristos (wchar_t *restrict dest, const wchar_t *restrict src)); 1272*88e42b0fSchristos # if __GLIBC__ >= 2 1273*88e42b0fSchristos _GL_CXXALIASWARN (wcscat); 1274*88e42b0fSchristos # endif 1275*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1276*88e42b0fSchristos # undef wcscat 1277*88e42b0fSchristos # if HAVE_RAW_DECL_WCSCAT 1278*88e42b0fSchristos _GL_WARN_ON_USE (wcscat, "wcscat is unportable - " 1279*88e42b0fSchristos "use gnulib module wcscat for portability"); 1280*88e42b0fSchristos # endif 1281*88e42b0fSchristos #endif 1282*88e42b0fSchristos 1283*88e42b0fSchristos 1284*88e42b0fSchristos /* Append no more than N wide characters of SRC onto DEST. */ 1285*88e42b0fSchristos #if 0 1286*88e42b0fSchristos # if !1 1287*88e42b0fSchristos _GL_FUNCDECL_SYS (wcsncat, wchar_t *, 1288*88e42b0fSchristos (wchar_t *restrict dest, const wchar_t *restrict src, 1289*88e42b0fSchristos size_t n)); 1290*88e42b0fSchristos # endif 1291*88e42b0fSchristos _GL_CXXALIAS_SYS (wcsncat, wchar_t *, 1292*88e42b0fSchristos (wchar_t *restrict dest, const wchar_t *restrict src, 1293*88e42b0fSchristos size_t n)); 1294*88e42b0fSchristos # if __GLIBC__ >= 2 1295*88e42b0fSchristos _GL_CXXALIASWARN (wcsncat); 1296*88e42b0fSchristos # endif 1297*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1298*88e42b0fSchristos # undef wcsncat 1299*88e42b0fSchristos # if HAVE_RAW_DECL_WCSNCAT 1300*88e42b0fSchristos _GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - " 1301*88e42b0fSchristos "use gnulib module wcsncat for portability"); 1302*88e42b0fSchristos # endif 1303*88e42b0fSchristos #endif 1304*88e42b0fSchristos 1305*88e42b0fSchristos 1306*88e42b0fSchristos /* Compare S1 and S2. */ 1307*88e42b0fSchristos #if 0 1308*88e42b0fSchristos # if !1 1309*88e42b0fSchristos _GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2) 1310*88e42b0fSchristos _GL_ATTRIBUTE_PURE); 1311*88e42b0fSchristos # endif 1312*88e42b0fSchristos _GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)); 1313*88e42b0fSchristos # if __GLIBC__ >= 2 1314*88e42b0fSchristos _GL_CXXALIASWARN (wcscmp); 1315*88e42b0fSchristos # endif 1316*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1317*88e42b0fSchristos # undef wcscmp 1318*88e42b0fSchristos # if HAVE_RAW_DECL_WCSCMP 1319*88e42b0fSchristos _GL_WARN_ON_USE (wcscmp, "wcscmp is unportable - " 1320*88e42b0fSchristos "use gnulib module wcscmp for portability"); 1321*88e42b0fSchristos # endif 1322*88e42b0fSchristos #endif 1323*88e42b0fSchristos 1324*88e42b0fSchristos 1325*88e42b0fSchristos /* Compare no more than N wide characters of S1 and S2. */ 1326*88e42b0fSchristos #if 0 1327*88e42b0fSchristos # if !1 1328*88e42b0fSchristos _GL_FUNCDECL_SYS (wcsncmp, int, 1329*88e42b0fSchristos (const wchar_t *s1, const wchar_t *s2, size_t n) 1330*88e42b0fSchristos _GL_ATTRIBUTE_PURE); 1331*88e42b0fSchristos # endif 1332*88e42b0fSchristos _GL_CXXALIAS_SYS (wcsncmp, int, 1333*88e42b0fSchristos (const wchar_t *s1, const wchar_t *s2, size_t n)); 1334*88e42b0fSchristos # if __GLIBC__ >= 2 1335*88e42b0fSchristos _GL_CXXALIASWARN (wcsncmp); 1336*88e42b0fSchristos # endif 1337*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1338*88e42b0fSchristos # undef wcsncmp 1339*88e42b0fSchristos # if HAVE_RAW_DECL_WCSNCMP 1340*88e42b0fSchristos _GL_WARN_ON_USE (wcsncmp, "wcsncmp is unportable - " 1341*88e42b0fSchristos "use gnulib module wcsncmp for portability"); 1342*88e42b0fSchristos # endif 1343*88e42b0fSchristos #endif 1344*88e42b0fSchristos 1345*88e42b0fSchristos 1346*88e42b0fSchristos /* Compare S1 and S2, ignoring case. */ 1347*88e42b0fSchristos #if 0 1348*88e42b0fSchristos # if !1 1349*88e42b0fSchristos _GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2) 1350*88e42b0fSchristos _GL_ATTRIBUTE_PURE); 1351*88e42b0fSchristos # endif 1352*88e42b0fSchristos _GL_CXXALIAS_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2)); 1353*88e42b0fSchristos _GL_CXXALIASWARN (wcscasecmp); 1354*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1355*88e42b0fSchristos # undef wcscasecmp 1356*88e42b0fSchristos # if HAVE_RAW_DECL_WCSCASECMP 1357*88e42b0fSchristos _GL_WARN_ON_USE (wcscasecmp, "wcscasecmp is unportable - " 1358*88e42b0fSchristos "use gnulib module wcscasecmp for portability"); 1359*88e42b0fSchristos # endif 1360*88e42b0fSchristos #endif 1361*88e42b0fSchristos 1362*88e42b0fSchristos 1363*88e42b0fSchristos /* Compare no more than N chars of S1 and S2, ignoring case. */ 1364*88e42b0fSchristos #if 0 1365*88e42b0fSchristos # if !1 1366*88e42b0fSchristos _GL_FUNCDECL_SYS (wcsncasecmp, int, 1367*88e42b0fSchristos (const wchar_t *s1, const wchar_t *s2, size_t n) 1368*88e42b0fSchristos _GL_ATTRIBUTE_PURE); 1369*88e42b0fSchristos # endif 1370*88e42b0fSchristos _GL_CXXALIAS_SYS (wcsncasecmp, int, 1371*88e42b0fSchristos (const wchar_t *s1, const wchar_t *s2, size_t n)); 1372*88e42b0fSchristos _GL_CXXALIASWARN (wcsncasecmp); 1373*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1374*88e42b0fSchristos # undef wcsncasecmp 1375*88e42b0fSchristos # if HAVE_RAW_DECL_WCSNCASECMP 1376*88e42b0fSchristos _GL_WARN_ON_USE (wcsncasecmp, "wcsncasecmp is unportable - " 1377*88e42b0fSchristos "use gnulib module wcsncasecmp for portability"); 1378*88e42b0fSchristos # endif 1379*88e42b0fSchristos #endif 1380*88e42b0fSchristos 1381*88e42b0fSchristos 1382*88e42b0fSchristos /* Compare S1 and S2, both interpreted as appropriate to the LC_COLLATE 1383*88e42b0fSchristos category of the current locale. */ 1384*88e42b0fSchristos #if 0 1385*88e42b0fSchristos # if !1 1386*88e42b0fSchristos _GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2)); 1387*88e42b0fSchristos # endif 1388*88e42b0fSchristos _GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2)); 1389*88e42b0fSchristos # if __GLIBC__ >= 2 1390*88e42b0fSchristos _GL_CXXALIASWARN (wcscoll); 1391*88e42b0fSchristos # endif 1392*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1393*88e42b0fSchristos # undef wcscoll 1394*88e42b0fSchristos # if HAVE_RAW_DECL_WCSCOLL 1395*88e42b0fSchristos _GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - " 1396*88e42b0fSchristos "use gnulib module wcscoll for portability"); 1397*88e42b0fSchristos # endif 1398*88e42b0fSchristos #endif 1399*88e42b0fSchristos 1400*88e42b0fSchristos 1401*88e42b0fSchristos /* Transform S2 into array pointed to by S1 such that if wcscmp is applied 1402*88e42b0fSchristos to two transformed strings the result is the as applying 'wcscoll' to the 1403*88e42b0fSchristos original strings. */ 1404*88e42b0fSchristos #if 0 1405*88e42b0fSchristos # if !1 1406*88e42b0fSchristos _GL_FUNCDECL_SYS (wcsxfrm, size_t, 1407*88e42b0fSchristos (wchar_t *restrict s1, const wchar_t *restrict s2, size_t n)); 1408*88e42b0fSchristos # endif 1409*88e42b0fSchristos _GL_CXXALIAS_SYS (wcsxfrm, size_t, 1410*88e42b0fSchristos (wchar_t *restrict s1, const wchar_t *restrict s2, size_t n)); 1411*88e42b0fSchristos # if __GLIBC__ >= 2 1412*88e42b0fSchristos _GL_CXXALIASWARN (wcsxfrm); 1413*88e42b0fSchristos # endif 1414*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1415*88e42b0fSchristos # undef wcsxfrm 1416*88e42b0fSchristos # if HAVE_RAW_DECL_WCSXFRM 1417*88e42b0fSchristos _GL_WARN_ON_USE (wcsxfrm, "wcsxfrm is unportable - " 1418*88e42b0fSchristos "use gnulib module wcsxfrm for portability"); 1419*88e42b0fSchristos # endif 1420*88e42b0fSchristos #endif 1421*88e42b0fSchristos 1422*88e42b0fSchristos 1423*88e42b0fSchristos /* Duplicate S, returning an identical malloc'd string. */ 1424*88e42b0fSchristos #if 0 1425*88e42b0fSchristos # if !1 1426*88e42b0fSchristos _GL_FUNCDECL_SYS (wcsdup, wchar_t *, (const wchar_t *s)); 1427*88e42b0fSchristos # endif 1428*88e42b0fSchristos _GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s)); 1429*88e42b0fSchristos _GL_CXXALIASWARN (wcsdup); 1430*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1431*88e42b0fSchristos # undef wcsdup 1432*88e42b0fSchristos # if HAVE_RAW_DECL_WCSDUP 1433*88e42b0fSchristos _GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - " 1434*88e42b0fSchristos "use gnulib module wcsdup for portability"); 1435*88e42b0fSchristos # endif 1436*88e42b0fSchristos #endif 1437*88e42b0fSchristos 1438*88e42b0fSchristos 1439*88e42b0fSchristos /* Find the first occurrence of WC in WCS. */ 1440*88e42b0fSchristos #if 0 1441*88e42b0fSchristos # if !1 1442*88e42b0fSchristos _GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc) 1443*88e42b0fSchristos _GL_ATTRIBUTE_PURE); 1444*88e42b0fSchristos # endif 1445*88e42b0fSchristos /* On some systems, this function is defined as an overloaded function: 1446*88e42b0fSchristos extern "C++" { 1447*88e42b0fSchristos const wchar_t * std::wcschr (const wchar_t *, wchar_t); 1448*88e42b0fSchristos wchar_t * std::wcschr (wchar_t *, wchar_t); 1449*88e42b0fSchristos } */ 1450*88e42b0fSchristos _GL_CXXALIAS_SYS_CAST2 (wcschr, 1451*88e42b0fSchristos wchar_t *, (const wchar_t *, wchar_t), 1452*88e42b0fSchristos const wchar_t *, (const wchar_t *, wchar_t)); 1453*88e42b0fSchristos # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 1454*88e42b0fSchristos && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 1455*88e42b0fSchristos _GL_CXXALIASWARN1 (wcschr, wchar_t *, (wchar_t *wcs, wchar_t wc)); 1456*88e42b0fSchristos _GL_CXXALIASWARN1 (wcschr, const wchar_t *, (const wchar_t *wcs, wchar_t wc)); 1457*88e42b0fSchristos # elif __GLIBC__ >= 2 1458*88e42b0fSchristos _GL_CXXALIASWARN (wcschr); 1459*88e42b0fSchristos # endif 1460*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1461*88e42b0fSchristos # undef wcschr 1462*88e42b0fSchristos # if HAVE_RAW_DECL_WCSCHR 1463*88e42b0fSchristos _GL_WARN_ON_USE (wcschr, "wcschr is unportable - " 1464*88e42b0fSchristos "use gnulib module wcschr for portability"); 1465*88e42b0fSchristos # endif 1466*88e42b0fSchristos #endif 1467*88e42b0fSchristos 1468*88e42b0fSchristos 1469*88e42b0fSchristos /* Find the last occurrence of WC in WCS. */ 1470*88e42b0fSchristos #if 0 1471*88e42b0fSchristos # if !1 1472*88e42b0fSchristos _GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc) 1473*88e42b0fSchristos _GL_ATTRIBUTE_PURE); 1474*88e42b0fSchristos # endif 1475*88e42b0fSchristos /* On some systems, this function is defined as an overloaded function: 1476*88e42b0fSchristos extern "C++" { 1477*88e42b0fSchristos const wchar_t * std::wcsrchr (const wchar_t *, wchar_t); 1478*88e42b0fSchristos wchar_t * std::wcsrchr (wchar_t *, wchar_t); 1479*88e42b0fSchristos } */ 1480*88e42b0fSchristos _GL_CXXALIAS_SYS_CAST2 (wcsrchr, 1481*88e42b0fSchristos wchar_t *, (const wchar_t *, wchar_t), 1482*88e42b0fSchristos const wchar_t *, (const wchar_t *, wchar_t)); 1483*88e42b0fSchristos # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 1484*88e42b0fSchristos && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 1485*88e42b0fSchristos _GL_CXXALIASWARN1 (wcsrchr, wchar_t *, (wchar_t *wcs, wchar_t wc)); 1486*88e42b0fSchristos _GL_CXXALIASWARN1 (wcsrchr, const wchar_t *, (const wchar_t *wcs, wchar_t wc)); 1487*88e42b0fSchristos # elif __GLIBC__ >= 2 1488*88e42b0fSchristos _GL_CXXALIASWARN (wcsrchr); 1489*88e42b0fSchristos # endif 1490*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1491*88e42b0fSchristos # undef wcsrchr 1492*88e42b0fSchristos # if HAVE_RAW_DECL_WCSRCHR 1493*88e42b0fSchristos _GL_WARN_ON_USE (wcsrchr, "wcsrchr is unportable - " 1494*88e42b0fSchristos "use gnulib module wcsrchr for portability"); 1495*88e42b0fSchristos # endif 1496*88e42b0fSchristos #endif 1497*88e42b0fSchristos 1498*88e42b0fSchristos 1499*88e42b0fSchristos /* Return the length of the initial segmet of WCS which consists entirely 1500*88e42b0fSchristos of wide characters not in REJECT. */ 1501*88e42b0fSchristos #if 0 1502*88e42b0fSchristos # if !1 1503*88e42b0fSchristos _GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject) 1504*88e42b0fSchristos _GL_ATTRIBUTE_PURE); 1505*88e42b0fSchristos # endif 1506*88e42b0fSchristos _GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject)); 1507*88e42b0fSchristos # if __GLIBC__ >= 2 1508*88e42b0fSchristos _GL_CXXALIASWARN (wcscspn); 1509*88e42b0fSchristos # endif 1510*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1511*88e42b0fSchristos # undef wcscspn 1512*88e42b0fSchristos # if HAVE_RAW_DECL_WCSCSPN 1513*88e42b0fSchristos _GL_WARN_ON_USE (wcscspn, "wcscspn is unportable - " 1514*88e42b0fSchristos "use gnulib module wcscspn for portability"); 1515*88e42b0fSchristos # endif 1516*88e42b0fSchristos #endif 1517*88e42b0fSchristos 1518*88e42b0fSchristos 1519*88e42b0fSchristos /* Return the length of the initial segmet of WCS which consists entirely 1520*88e42b0fSchristos of wide characters in ACCEPT. */ 1521*88e42b0fSchristos #if 0 1522*88e42b0fSchristos # if !1 1523*88e42b0fSchristos _GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept) 1524*88e42b0fSchristos _GL_ATTRIBUTE_PURE); 1525*88e42b0fSchristos # endif 1526*88e42b0fSchristos _GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept)); 1527*88e42b0fSchristos # if __GLIBC__ >= 2 1528*88e42b0fSchristos _GL_CXXALIASWARN (wcsspn); 1529*88e42b0fSchristos # endif 1530*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1531*88e42b0fSchristos # undef wcsspn 1532*88e42b0fSchristos # if HAVE_RAW_DECL_WCSSPN 1533*88e42b0fSchristos _GL_WARN_ON_USE (wcsspn, "wcsspn is unportable - " 1534*88e42b0fSchristos "use gnulib module wcsspn for portability"); 1535*88e42b0fSchristos # endif 1536*88e42b0fSchristos #endif 1537*88e42b0fSchristos 1538*88e42b0fSchristos 1539*88e42b0fSchristos /* Find the first occurrence in WCS of any character in ACCEPT. */ 1540*88e42b0fSchristos #if 0 1541*88e42b0fSchristos # if !1 1542*88e42b0fSchristos _GL_FUNCDECL_SYS (wcspbrk, wchar_t *, 1543*88e42b0fSchristos (const wchar_t *wcs, const wchar_t *accept) 1544*88e42b0fSchristos _GL_ATTRIBUTE_PURE); 1545*88e42b0fSchristos # endif 1546*88e42b0fSchristos /* On some systems, this function is defined as an overloaded function: 1547*88e42b0fSchristos extern "C++" { 1548*88e42b0fSchristos const wchar_t * std::wcspbrk (const wchar_t *, const wchar_t *); 1549*88e42b0fSchristos wchar_t * std::wcspbrk (wchar_t *, const wchar_t *); 1550*88e42b0fSchristos } */ 1551*88e42b0fSchristos _GL_CXXALIAS_SYS_CAST2 (wcspbrk, 1552*88e42b0fSchristos wchar_t *, (const wchar_t *, const wchar_t *), 1553*88e42b0fSchristos const wchar_t *, (const wchar_t *, const wchar_t *)); 1554*88e42b0fSchristos # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 1555*88e42b0fSchristos && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 1556*88e42b0fSchristos _GL_CXXALIASWARN1 (wcspbrk, wchar_t *, 1557*88e42b0fSchristos (wchar_t *wcs, const wchar_t *accept)); 1558*88e42b0fSchristos _GL_CXXALIASWARN1 (wcspbrk, const wchar_t *, 1559*88e42b0fSchristos (const wchar_t *wcs, const wchar_t *accept)); 1560*88e42b0fSchristos # elif __GLIBC__ >= 2 1561*88e42b0fSchristos _GL_CXXALIASWARN (wcspbrk); 1562*88e42b0fSchristos # endif 1563*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1564*88e42b0fSchristos # undef wcspbrk 1565*88e42b0fSchristos # if HAVE_RAW_DECL_WCSPBRK 1566*88e42b0fSchristos _GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - " 1567*88e42b0fSchristos "use gnulib module wcspbrk for portability"); 1568*88e42b0fSchristos # endif 1569*88e42b0fSchristos #endif 1570*88e42b0fSchristos 1571*88e42b0fSchristos 1572*88e42b0fSchristos /* Find the first occurrence of NEEDLE in HAYSTACK. */ 1573*88e42b0fSchristos #if 0 1574*88e42b0fSchristos # if !1 1575*88e42b0fSchristos _GL_FUNCDECL_SYS (wcsstr, wchar_t *, 1576*88e42b0fSchristos (const wchar_t *restrict haystack, 1577*88e42b0fSchristos const wchar_t *restrict needle) 1578*88e42b0fSchristos _GL_ATTRIBUTE_PURE); 1579*88e42b0fSchristos # endif 1580*88e42b0fSchristos /* On some systems, this function is defined as an overloaded function: 1581*88e42b0fSchristos extern "C++" { 1582*88e42b0fSchristos const wchar_t * std::wcsstr (const wchar_t *, const wchar_t *); 1583*88e42b0fSchristos wchar_t * std::wcsstr (wchar_t *, const wchar_t *); 1584*88e42b0fSchristos } */ 1585*88e42b0fSchristos _GL_CXXALIAS_SYS_CAST2 (wcsstr, 1586*88e42b0fSchristos wchar_t *, 1587*88e42b0fSchristos (const wchar_t *restrict, const wchar_t *restrict), 1588*88e42b0fSchristos const wchar_t *, 1589*88e42b0fSchristos (const wchar_t *restrict, const wchar_t *restrict)); 1590*88e42b0fSchristos # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 1591*88e42b0fSchristos && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 1592*88e42b0fSchristos _GL_CXXALIASWARN1 (wcsstr, wchar_t *, 1593*88e42b0fSchristos (wchar_t *restrict haystack, 1594*88e42b0fSchristos const wchar_t *restrict needle)); 1595*88e42b0fSchristos _GL_CXXALIASWARN1 (wcsstr, const wchar_t *, 1596*88e42b0fSchristos (const wchar_t *restrict haystack, 1597*88e42b0fSchristos const wchar_t *restrict needle)); 1598*88e42b0fSchristos # elif __GLIBC__ >= 2 1599*88e42b0fSchristos _GL_CXXALIASWARN (wcsstr); 1600*88e42b0fSchristos # endif 1601*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1602*88e42b0fSchristos # undef wcsstr 1603*88e42b0fSchristos # if HAVE_RAW_DECL_WCSSTR 1604*88e42b0fSchristos _GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - " 1605*88e42b0fSchristos "use gnulib module wcsstr for portability"); 1606*88e42b0fSchristos # endif 1607*88e42b0fSchristos #endif 1608*88e42b0fSchristos 1609*88e42b0fSchristos 1610*88e42b0fSchristos /* Divide WCS into tokens separated by characters in DELIM. */ 1611*88e42b0fSchristos #if 0 1612*88e42b0fSchristos # if 0 1613*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1614*88e42b0fSchristos # undef wcstok 1615*88e42b0fSchristos # define wcstok rpl_wcstok 1616*88e42b0fSchristos # endif 1617*88e42b0fSchristos _GL_FUNCDECL_RPL (wcstok, wchar_t *, 1618*88e42b0fSchristos (wchar_t *restrict wcs, const wchar_t *restrict delim, 1619*88e42b0fSchristos wchar_t **restrict ptr)); 1620*88e42b0fSchristos _GL_CXXALIAS_RPL (wcstok, wchar_t *, 1621*88e42b0fSchristos (wchar_t *restrict wcs, const wchar_t *restrict delim, 1622*88e42b0fSchristos wchar_t **restrict ptr)); 1623*88e42b0fSchristos # else 1624*88e42b0fSchristos # if !1 1625*88e42b0fSchristos _GL_FUNCDECL_SYS (wcstok, wchar_t *, 1626*88e42b0fSchristos (wchar_t *restrict wcs, const wchar_t *restrict delim, 1627*88e42b0fSchristos wchar_t **restrict ptr)); 1628*88e42b0fSchristos # endif 1629*88e42b0fSchristos _GL_CXXALIAS_SYS (wcstok, wchar_t *, 1630*88e42b0fSchristos (wchar_t *restrict wcs, const wchar_t *restrict delim, 1631*88e42b0fSchristos wchar_t **restrict ptr)); 1632*88e42b0fSchristos # endif 1633*88e42b0fSchristos # if __GLIBC__ >= 2 1634*88e42b0fSchristos _GL_CXXALIASWARN (wcstok); 1635*88e42b0fSchristos # endif 1636*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1637*88e42b0fSchristos # undef wcstok 1638*88e42b0fSchristos # if HAVE_RAW_DECL_WCSTOK 1639*88e42b0fSchristos _GL_WARN_ON_USE (wcstok, "wcstok is unportable - " 1640*88e42b0fSchristos "use gnulib module wcstok for portability"); 1641*88e42b0fSchristos # endif 1642*88e42b0fSchristos #endif 1643*88e42b0fSchristos 1644*88e42b0fSchristos 1645*88e42b0fSchristos /* Determine number of column positions required for first N wide 1646*88e42b0fSchristos characters (or fewer if S ends before this) in S. */ 1647*88e42b0fSchristos #if 0 1648*88e42b0fSchristos # if 0 1649*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1650*88e42b0fSchristos # undef wcswidth 1651*88e42b0fSchristos # define wcswidth rpl_wcswidth 1652*88e42b0fSchristos # endif 1653*88e42b0fSchristos _GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n) 1654*88e42b0fSchristos _GL_ATTRIBUTE_PURE); 1655*88e42b0fSchristos _GL_CXXALIAS_RPL (wcswidth, int, (const wchar_t *s, size_t n)); 1656*88e42b0fSchristos # else 1657*88e42b0fSchristos # if !1 1658*88e42b0fSchristos _GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n) 1659*88e42b0fSchristos _GL_ATTRIBUTE_PURE); 1660*88e42b0fSchristos # endif 1661*88e42b0fSchristos _GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n)); 1662*88e42b0fSchristos # endif 1663*88e42b0fSchristos # if __GLIBC__ >= 2 1664*88e42b0fSchristos _GL_CXXALIASWARN (wcswidth); 1665*88e42b0fSchristos # endif 1666*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1667*88e42b0fSchristos # undef wcswidth 1668*88e42b0fSchristos # if HAVE_RAW_DECL_WCSWIDTH 1669*88e42b0fSchristos _GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - " 1670*88e42b0fSchristos "use gnulib module wcswidth for portability"); 1671*88e42b0fSchristos # endif 1672*88e42b0fSchristos #endif 1673*88e42b0fSchristos 1674*88e42b0fSchristos 1675*88e42b0fSchristos /* Convert *TP to a date and time wide string. See 1676*88e42b0fSchristos <https://pubs.opengroup.org/onlinepubs/9699919799/functions/wcsftime.html>. */ 1677*88e42b0fSchristos #if 0 1678*88e42b0fSchristos # if 0 1679*88e42b0fSchristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1680*88e42b0fSchristos # undef wcsftime 1681*88e42b0fSchristos # define wcsftime rpl_wcsftime 1682*88e42b0fSchristos # endif 1683*88e42b0fSchristos _GL_FUNCDECL_RPL (wcsftime, size_t, 1684*88e42b0fSchristos (wchar_t *restrict __buf, size_t __bufsize, 1685*88e42b0fSchristos const wchar_t *restrict __fmt, 1686*88e42b0fSchristos const struct tm *restrict __tp) 1687*88e42b0fSchristos _GL_ARG_NONNULL ((1, 3, 4))); 1688*88e42b0fSchristos _GL_CXXALIAS_RPL (wcsftime, size_t, 1689*88e42b0fSchristos (wchar_t *restrict __buf, size_t __bufsize, 1690*88e42b0fSchristos const wchar_t *restrict __fmt, 1691*88e42b0fSchristos const struct tm *restrict __tp)); 1692*88e42b0fSchristos # else 1693*88e42b0fSchristos # if !1 1694*88e42b0fSchristos _GL_FUNCDECL_SYS (wcsftime, size_t, 1695*88e42b0fSchristos (wchar_t *restrict __buf, size_t __bufsize, 1696*88e42b0fSchristos const wchar_t *restrict __fmt, 1697*88e42b0fSchristos const struct tm *restrict __tp) 1698*88e42b0fSchristos _GL_ARG_NONNULL ((1, 3, 4))); 1699*88e42b0fSchristos # endif 1700*88e42b0fSchristos _GL_CXXALIAS_SYS (wcsftime, size_t, 1701*88e42b0fSchristos (wchar_t *restrict __buf, size_t __bufsize, 1702*88e42b0fSchristos const wchar_t *restrict __fmt, 1703*88e42b0fSchristos const struct tm *restrict __tp)); 1704*88e42b0fSchristos # endif 1705*88e42b0fSchristos # if __GLIBC__ >= 2 1706*88e42b0fSchristos _GL_CXXALIASWARN (wcsftime); 1707*88e42b0fSchristos # endif 1708*88e42b0fSchristos #elif defined GNULIB_POSIXCHECK 1709*88e42b0fSchristos # undef wcsftime 1710*88e42b0fSchristos # if HAVE_RAW_DECL_WCSFTIME 1711*88e42b0fSchristos _GL_WARN_ON_USE (wcsftime, "wcsftime is unportable - " 1712*88e42b0fSchristos "use gnulib module wcsftime for portability"); 1713*88e42b0fSchristos # endif 1714*88e42b0fSchristos #endif 1715*88e42b0fSchristos 1716*88e42b0fSchristos 1717*88e42b0fSchristos #endif /* _GL_WCHAR_H */ 1718*88e42b0fSchristos #endif /* _GL_WCHAR_H */ 1719*88e42b0fSchristos #endif 1720