151ddd709SJohn Marino /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ 251ddd709SJohn Marino /* A POSIX <locale.h>. 3*4ce1b016SDaniel Fojt Copyright (C) 2007-2020 Free Software Foundation, Inc. 451ddd709SJohn Marino 551ddd709SJohn Marino This program is free software: you can redistribute it and/or modify 651ddd709SJohn Marino it under the terms of the GNU General Public License as published by 751ddd709SJohn Marino the Free Software Foundation; either version 3 of the License, or 851ddd709SJohn Marino (at your option) any later version. 951ddd709SJohn Marino 1051ddd709SJohn Marino This program is distributed in the hope that it will be useful, 1151ddd709SJohn Marino but WITHOUT ANY WARRANTY; without even the implied warranty of 1251ddd709SJohn Marino MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1351ddd709SJohn Marino GNU General Public License for more details. 1451ddd709SJohn Marino 1551ddd709SJohn Marino You should have received a copy of the GNU General Public License 16*4ce1b016SDaniel Fojt along with this program. If not, see <https://www.gnu.org/licenses/>. */ 1751ddd709SJohn Marino 1851ddd709SJohn Marino #if __GNUC__ >= 3 1951ddd709SJohn Marino #pragma GCC system_header 2051ddd709SJohn Marino #endif 2151ddd709SJohn Marino 2251ddd709SJohn Marino 23*4ce1b016SDaniel Fojt #if (defined _WIN32 && !defined __CYGWIN__ && defined __need_locale_t) \ 24*4ce1b016SDaniel Fojt || defined _GL_ALREADY_INCLUDING_LOCALE_H 2551ddd709SJohn Marino 26*4ce1b016SDaniel Fojt /* Special invocation convention: 27*4ce1b016SDaniel Fojt - Inside mingw header files, 28*4ce1b016SDaniel Fojt - To handle Solaris header files (through Solaris 10) when combined 29*4ce1b016SDaniel Fojt with gettext's libintl.h. */ 3051ddd709SJohn Marino 3151ddd709SJohn Marino #include_next <locale.h> 3251ddd709SJohn Marino 3351ddd709SJohn Marino #else 3451ddd709SJohn Marino /* Normal invocation convention. */ 3551ddd709SJohn Marino 3651ddd709SJohn Marino #ifndef _GL_LOCALE_H 3751ddd709SJohn Marino 3851ddd709SJohn Marino #define _GL_ALREADY_INCLUDING_LOCALE_H 3951ddd709SJohn Marino 4051ddd709SJohn Marino /* The include_next requires a split double-inclusion guard. */ 4151ddd709SJohn Marino #include_next <locale.h> 4251ddd709SJohn Marino 4351ddd709SJohn Marino #undef _GL_ALREADY_INCLUDING_LOCALE_H 4451ddd709SJohn Marino 4551ddd709SJohn Marino #ifndef _GL_LOCALE_H 4651ddd709SJohn Marino #define _GL_LOCALE_H 4751ddd709SJohn Marino 4851ddd709SJohn Marino /* NetBSD 5.0 mis-defines NULL. */ 4951ddd709SJohn Marino #include <stddef.h> 5051ddd709SJohn Marino 5151ddd709SJohn Marino /* Mac OS X 10.5 defines the locale_t type in <xlocale.h>. */ 520fe220b4Szrj #if 1 5351ddd709SJohn Marino # include <xlocale.h> 5451ddd709SJohn Marino #endif 5551ddd709SJohn Marino 5651ddd709SJohn Marino /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 57*4ce1b016SDaniel Fojt /* C++ compatible function declaration macros. 58*4ce1b016SDaniel Fojt Copyright (C) 2010-2020 Free Software Foundation, Inc. 59*4ce1b016SDaniel Fojt 60*4ce1b016SDaniel Fojt This program is free software: you can redistribute it and/or modify it 61*4ce1b016SDaniel Fojt under the terms of the GNU General Public License as published 62*4ce1b016SDaniel Fojt by the Free Software Foundation; either version 3 of the License, or 63*4ce1b016SDaniel Fojt (at your option) any later version. 64*4ce1b016SDaniel Fojt 65*4ce1b016SDaniel Fojt This program is distributed in the hope that it will be useful, 66*4ce1b016SDaniel Fojt but WITHOUT ANY WARRANTY; without even the implied warranty of 67*4ce1b016SDaniel Fojt MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 68*4ce1b016SDaniel Fojt General Public License for more details. 69*4ce1b016SDaniel Fojt 70*4ce1b016SDaniel Fojt You should have received a copy of the GNU General Public License 71*4ce1b016SDaniel Fojt along with this program. If not, see <https://www.gnu.org/licenses/>. */ 72*4ce1b016SDaniel Fojt 7351ddd709SJohn Marino #ifndef _GL_CXXDEFS_H 7451ddd709SJohn Marino #define _GL_CXXDEFS_H 7551ddd709SJohn Marino 76*4ce1b016SDaniel Fojt /* Begin/end the GNULIB_NAMESPACE namespace. */ 77*4ce1b016SDaniel Fojt #if defined __cplusplus && defined GNULIB_NAMESPACE 78*4ce1b016SDaniel Fojt # define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE { 79*4ce1b016SDaniel Fojt # define _GL_END_NAMESPACE } 80*4ce1b016SDaniel Fojt #else 81*4ce1b016SDaniel Fojt # define _GL_BEGIN_NAMESPACE 82*4ce1b016SDaniel Fojt # define _GL_END_NAMESPACE 83*4ce1b016SDaniel Fojt #endif 84*4ce1b016SDaniel Fojt 8551ddd709SJohn Marino /* The three most frequent use cases of these macros are: 8651ddd709SJohn Marino 8751ddd709SJohn Marino * For providing a substitute for a function that is missing on some 8851ddd709SJohn Marino platforms, but is declared and works fine on the platforms on which 8951ddd709SJohn Marino it exists: 9051ddd709SJohn Marino 9151ddd709SJohn Marino #if @GNULIB_FOO@ 9251ddd709SJohn Marino # if !@HAVE_FOO@ 9351ddd709SJohn Marino _GL_FUNCDECL_SYS (foo, ...); 9451ddd709SJohn Marino # endif 9551ddd709SJohn Marino _GL_CXXALIAS_SYS (foo, ...); 9651ddd709SJohn Marino _GL_CXXALIASWARN (foo); 9751ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 9851ddd709SJohn Marino ... 9951ddd709SJohn Marino #endif 10051ddd709SJohn Marino 10151ddd709SJohn Marino * For providing a replacement for a function that exists on all platforms, 10251ddd709SJohn Marino but is broken/insufficient and needs to be replaced on some platforms: 10351ddd709SJohn Marino 10451ddd709SJohn Marino #if @GNULIB_FOO@ 10551ddd709SJohn Marino # if @REPLACE_FOO@ 10651ddd709SJohn Marino # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 10751ddd709SJohn Marino # undef foo 10851ddd709SJohn Marino # define foo rpl_foo 10951ddd709SJohn Marino # endif 11051ddd709SJohn Marino _GL_FUNCDECL_RPL (foo, ...); 11151ddd709SJohn Marino _GL_CXXALIAS_RPL (foo, ...); 11251ddd709SJohn Marino # else 11351ddd709SJohn Marino _GL_CXXALIAS_SYS (foo, ...); 11451ddd709SJohn Marino # endif 11551ddd709SJohn Marino _GL_CXXALIASWARN (foo); 11651ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 11751ddd709SJohn Marino ... 11851ddd709SJohn Marino #endif 11951ddd709SJohn Marino 12051ddd709SJohn Marino * For providing a replacement for a function that exists on some platforms 12151ddd709SJohn Marino but is broken/insufficient and needs to be replaced on some of them and 12251ddd709SJohn Marino is additionally either missing or undeclared on some other platforms: 12351ddd709SJohn Marino 12451ddd709SJohn Marino #if @GNULIB_FOO@ 12551ddd709SJohn Marino # if @REPLACE_FOO@ 12651ddd709SJohn Marino # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 12751ddd709SJohn Marino # undef foo 12851ddd709SJohn Marino # define foo rpl_foo 12951ddd709SJohn Marino # endif 13051ddd709SJohn Marino _GL_FUNCDECL_RPL (foo, ...); 13151ddd709SJohn Marino _GL_CXXALIAS_RPL (foo, ...); 13251ddd709SJohn Marino # else 13351ddd709SJohn Marino # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ 13451ddd709SJohn Marino _GL_FUNCDECL_SYS (foo, ...); 13551ddd709SJohn Marino # endif 13651ddd709SJohn Marino _GL_CXXALIAS_SYS (foo, ...); 13751ddd709SJohn Marino # endif 13851ddd709SJohn Marino _GL_CXXALIASWARN (foo); 13951ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 14051ddd709SJohn Marino ... 14151ddd709SJohn Marino #endif 14251ddd709SJohn Marino */ 14351ddd709SJohn Marino 14451ddd709SJohn Marino /* _GL_EXTERN_C declaration; 14551ddd709SJohn Marino performs the declaration with C linkage. */ 14651ddd709SJohn Marino #if defined __cplusplus 14751ddd709SJohn Marino # define _GL_EXTERN_C extern "C" 14851ddd709SJohn Marino #else 14951ddd709SJohn Marino # define _GL_EXTERN_C extern 15051ddd709SJohn Marino #endif 15151ddd709SJohn Marino 15251ddd709SJohn Marino /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); 15351ddd709SJohn Marino declares a replacement function, named rpl_func, with the given prototype, 15451ddd709SJohn Marino consisting of return type, parameters, and attributes. 15551ddd709SJohn Marino Example: 15651ddd709SJohn Marino _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) 15751ddd709SJohn Marino _GL_ARG_NONNULL ((1))); 15851ddd709SJohn Marino */ 15951ddd709SJohn Marino #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ 16051ddd709SJohn Marino _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) 16151ddd709SJohn Marino #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ 16251ddd709SJohn Marino _GL_EXTERN_C rettype rpl_func parameters_and_attributes 16351ddd709SJohn Marino 16451ddd709SJohn Marino /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); 16551ddd709SJohn Marino declares the system function, named func, with the given prototype, 16651ddd709SJohn Marino consisting of return type, parameters, and attributes. 16751ddd709SJohn Marino Example: 16851ddd709SJohn Marino _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) 16951ddd709SJohn Marino _GL_ARG_NONNULL ((1))); 17051ddd709SJohn Marino */ 17151ddd709SJohn Marino #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ 17251ddd709SJohn Marino _GL_EXTERN_C rettype func parameters_and_attributes 17351ddd709SJohn Marino 17451ddd709SJohn Marino /* _GL_CXXALIAS_RPL (func, rettype, parameters); 17551ddd709SJohn Marino declares a C++ alias called GNULIB_NAMESPACE::func 17651ddd709SJohn Marino that redirects to rpl_func, if GNULIB_NAMESPACE is defined. 17751ddd709SJohn Marino Example: 17851ddd709SJohn Marino _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); 179*4ce1b016SDaniel Fojt 180*4ce1b016SDaniel Fojt Wrapping rpl_func in an object with an inline conversion operator 181*4ce1b016SDaniel Fojt avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is 182*4ce1b016SDaniel Fojt actually used in the program. */ 18351ddd709SJohn Marino #define _GL_CXXALIAS_RPL(func,rettype,parameters) \ 18451ddd709SJohn Marino _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) 18551ddd709SJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE 18651ddd709SJohn Marino # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 18751ddd709SJohn Marino namespace GNULIB_NAMESPACE \ 18851ddd709SJohn Marino { \ 189*4ce1b016SDaniel Fojt static const struct _gl_ ## func ## _wrapper \ 190*4ce1b016SDaniel Fojt { \ 191*4ce1b016SDaniel Fojt typedef rettype (*type) parameters; \ 192*4ce1b016SDaniel Fojt \ 193*4ce1b016SDaniel Fojt inline operator type () const \ 194*4ce1b016SDaniel Fojt { \ 195*4ce1b016SDaniel Fojt return ::rpl_func; \ 196*4ce1b016SDaniel Fojt } \ 197*4ce1b016SDaniel Fojt } func = {}; \ 19851ddd709SJohn Marino } \ 19951ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 20051ddd709SJohn Marino #else 20151ddd709SJohn Marino # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 20251ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 20351ddd709SJohn Marino #endif 20451ddd709SJohn Marino 20551ddd709SJohn Marino /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); 20651ddd709SJohn Marino is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); 20751ddd709SJohn Marino except that the C function rpl_func may have a slightly different 20851ddd709SJohn Marino declaration. A cast is used to silence the "invalid conversion" error 20951ddd709SJohn Marino that would otherwise occur. */ 21051ddd709SJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE 21151ddd709SJohn Marino # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 21251ddd709SJohn Marino namespace GNULIB_NAMESPACE \ 21351ddd709SJohn Marino { \ 214*4ce1b016SDaniel Fojt static const struct _gl_ ## func ## _wrapper \ 215*4ce1b016SDaniel Fojt { \ 216*4ce1b016SDaniel Fojt typedef rettype (*type) parameters; \ 217*4ce1b016SDaniel Fojt \ 218*4ce1b016SDaniel Fojt inline operator type () const \ 219*4ce1b016SDaniel Fojt { \ 220*4ce1b016SDaniel Fojt return reinterpret_cast<type>(::rpl_func); \ 221*4ce1b016SDaniel Fojt } \ 222*4ce1b016SDaniel Fojt } func = {}; \ 22351ddd709SJohn Marino } \ 22451ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 22551ddd709SJohn Marino #else 22651ddd709SJohn Marino # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 22751ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 22851ddd709SJohn Marino #endif 22951ddd709SJohn Marino 23051ddd709SJohn Marino /* _GL_CXXALIAS_SYS (func, rettype, parameters); 23151ddd709SJohn Marino declares a C++ alias called GNULIB_NAMESPACE::func 23251ddd709SJohn Marino that redirects to the system provided function func, if GNULIB_NAMESPACE 23351ddd709SJohn Marino is defined. 23451ddd709SJohn Marino Example: 23551ddd709SJohn Marino _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); 236*4ce1b016SDaniel Fojt 237*4ce1b016SDaniel Fojt Wrapping func in an object with an inline conversion operator 238*4ce1b016SDaniel Fojt avoids a reference to func unless GNULIB_NAMESPACE::func is 239*4ce1b016SDaniel Fojt actually used in the program. */ 24051ddd709SJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE 24151ddd709SJohn Marino # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 24251ddd709SJohn Marino namespace GNULIB_NAMESPACE \ 24351ddd709SJohn Marino { \ 244*4ce1b016SDaniel Fojt static const struct _gl_ ## func ## _wrapper \ 245*4ce1b016SDaniel Fojt { \ 246*4ce1b016SDaniel Fojt typedef rettype (*type) parameters; \ 247*4ce1b016SDaniel Fojt \ 248*4ce1b016SDaniel Fojt inline operator type () const \ 249*4ce1b016SDaniel Fojt { \ 250*4ce1b016SDaniel Fojt return ::func; \ 251*4ce1b016SDaniel Fojt } \ 252*4ce1b016SDaniel Fojt } func = {}; \ 25351ddd709SJohn Marino } \ 25451ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 25551ddd709SJohn Marino #else 25651ddd709SJohn Marino # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 25751ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 25851ddd709SJohn Marino #endif 25951ddd709SJohn Marino 26051ddd709SJohn Marino /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); 26151ddd709SJohn Marino is like _GL_CXXALIAS_SYS (func, rettype, parameters); 26251ddd709SJohn Marino except that the C function func may have a slightly different declaration. 26351ddd709SJohn Marino A cast is used to silence the "invalid conversion" error that would 26451ddd709SJohn Marino otherwise occur. */ 26551ddd709SJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE 26651ddd709SJohn Marino # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 26751ddd709SJohn Marino namespace GNULIB_NAMESPACE \ 26851ddd709SJohn Marino { \ 269*4ce1b016SDaniel Fojt static const struct _gl_ ## func ## _wrapper \ 270*4ce1b016SDaniel Fojt { \ 271*4ce1b016SDaniel Fojt typedef rettype (*type) parameters; \ 272*4ce1b016SDaniel Fojt \ 273*4ce1b016SDaniel Fojt inline operator type () const \ 274*4ce1b016SDaniel Fojt { \ 275*4ce1b016SDaniel Fojt return reinterpret_cast<type>(::func); \ 276*4ce1b016SDaniel Fojt } \ 277*4ce1b016SDaniel Fojt } func = {}; \ 27851ddd709SJohn Marino } \ 27951ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 28051ddd709SJohn Marino #else 28151ddd709SJohn Marino # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 28251ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 28351ddd709SJohn Marino #endif 28451ddd709SJohn Marino 28551ddd709SJohn Marino /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); 28651ddd709SJohn Marino is like _GL_CXXALIAS_SYS (func, rettype, parameters); 28751ddd709SJohn Marino except that the C function is picked among a set of overloaded functions, 28851ddd709SJohn Marino namely the one with rettype2 and parameters2. Two consecutive casts 28951ddd709SJohn Marino are used to silence the "cannot find a match" and "invalid conversion" 29051ddd709SJohn Marino errors that would otherwise occur. */ 29151ddd709SJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE 29251ddd709SJohn Marino /* The outer cast must be a reinterpret_cast. 29351ddd709SJohn Marino The inner cast: When the function is defined as a set of overloaded 29451ddd709SJohn Marino functions, it works as a static_cast<>, choosing the designated variant. 29551ddd709SJohn Marino When the function is defined as a single variant, it works as a 29651ddd709SJohn Marino reinterpret_cast<>. The parenthesized cast syntax works both ways. */ 29751ddd709SJohn Marino # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 29851ddd709SJohn Marino namespace GNULIB_NAMESPACE \ 29951ddd709SJohn Marino { \ 300*4ce1b016SDaniel Fojt static const struct _gl_ ## func ## _wrapper \ 301*4ce1b016SDaniel Fojt { \ 302*4ce1b016SDaniel Fojt typedef rettype (*type) parameters; \ 303*4ce1b016SDaniel Fojt \ 304*4ce1b016SDaniel Fojt inline operator type () const \ 305*4ce1b016SDaniel Fojt { \ 306*4ce1b016SDaniel Fojt return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \ 307*4ce1b016SDaniel Fojt } \ 308*4ce1b016SDaniel Fojt } func = {}; \ 30951ddd709SJohn Marino } \ 31051ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 31151ddd709SJohn Marino #else 31251ddd709SJohn Marino # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 31351ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 31451ddd709SJohn Marino #endif 31551ddd709SJohn Marino 31651ddd709SJohn Marino /* _GL_CXXALIASWARN (func); 31751ddd709SJohn Marino causes a warning to be emitted when ::func is used but not when 31851ddd709SJohn Marino GNULIB_NAMESPACE::func is used. func must be defined without overloaded 31951ddd709SJohn Marino variants. */ 32051ddd709SJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE 32151ddd709SJohn Marino # define _GL_CXXALIASWARN(func) \ 32251ddd709SJohn Marino _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) 32351ddd709SJohn Marino # define _GL_CXXALIASWARN_1(func,namespace) \ 32451ddd709SJohn Marino _GL_CXXALIASWARN_2 (func, namespace) 325*4ce1b016SDaniel Fojt /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 32651ddd709SJohn Marino we enable the warning only when not optimizing. */ 32751ddd709SJohn Marino # if !__OPTIMIZE__ 32851ddd709SJohn Marino # define _GL_CXXALIASWARN_2(func,namespace) \ 32951ddd709SJohn Marino _GL_WARN_ON_USE (func, \ 33051ddd709SJohn Marino "The symbol ::" #func " refers to the system function. " \ 33151ddd709SJohn Marino "Use " #namespace "::" #func " instead.") 33251ddd709SJohn Marino # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 33351ddd709SJohn Marino # define _GL_CXXALIASWARN_2(func,namespace) \ 33451ddd709SJohn Marino extern __typeof__ (func) func 33551ddd709SJohn Marino # else 33651ddd709SJohn Marino # define _GL_CXXALIASWARN_2(func,namespace) \ 33751ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 33851ddd709SJohn Marino # endif 33951ddd709SJohn Marino #else 34051ddd709SJohn Marino # define _GL_CXXALIASWARN(func) \ 34151ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 34251ddd709SJohn Marino #endif 34351ddd709SJohn Marino 34451ddd709SJohn Marino /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); 34551ddd709SJohn Marino causes a warning to be emitted when the given overloaded variant of ::func 34651ddd709SJohn Marino is used but not when GNULIB_NAMESPACE::func is used. */ 34751ddd709SJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE 34851ddd709SJohn Marino # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 34951ddd709SJohn Marino _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ 35051ddd709SJohn Marino GNULIB_NAMESPACE) 35151ddd709SJohn Marino # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ 35251ddd709SJohn Marino _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) 353*4ce1b016SDaniel Fojt /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 35451ddd709SJohn Marino we enable the warning only when not optimizing. */ 35551ddd709SJohn Marino # if !__OPTIMIZE__ 35651ddd709SJohn Marino # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 35751ddd709SJohn Marino _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \ 35851ddd709SJohn Marino "The symbol ::" #func " refers to the system function. " \ 35951ddd709SJohn Marino "Use " #namespace "::" #func " instead.") 36051ddd709SJohn Marino # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 36151ddd709SJohn Marino # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 36251ddd709SJohn Marino extern __typeof__ (func) func 36351ddd709SJohn Marino # else 36451ddd709SJohn Marino # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 36551ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 36651ddd709SJohn Marino # endif 36751ddd709SJohn Marino #else 36851ddd709SJohn Marino # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 36951ddd709SJohn Marino _GL_EXTERN_C int _gl_cxxalias_dummy 37051ddd709SJohn Marino #endif 37151ddd709SJohn Marino 37251ddd709SJohn Marino #endif /* _GL_CXXDEFS_H */ 37351ddd709SJohn Marino 37451ddd709SJohn Marino /* The definition of _GL_ARG_NONNULL is copied here. */ 375*4ce1b016SDaniel Fojt /* A C macro for declaring that specific arguments must not be NULL. 376*4ce1b016SDaniel Fojt Copyright (C) 2009-2020 Free Software Foundation, Inc. 377*4ce1b016SDaniel Fojt 378*4ce1b016SDaniel Fojt This program is free software: you can redistribute it and/or modify it 379*4ce1b016SDaniel Fojt under the terms of the GNU General Public License as published 380*4ce1b016SDaniel Fojt by the Free Software Foundation; either version 3 of the License, or 381*4ce1b016SDaniel Fojt (at your option) any later version. 382*4ce1b016SDaniel Fojt 383*4ce1b016SDaniel Fojt This program is distributed in the hope that it will be useful, 384*4ce1b016SDaniel Fojt but WITHOUT ANY WARRANTY; without even the implied warranty of 385*4ce1b016SDaniel Fojt MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 386*4ce1b016SDaniel Fojt General Public License for more details. 387*4ce1b016SDaniel Fojt 388*4ce1b016SDaniel Fojt You should have received a copy of the GNU General Public License 389*4ce1b016SDaniel Fojt along with this program. If not, see <https://www.gnu.org/licenses/>. */ 390*4ce1b016SDaniel Fojt 39151ddd709SJohn Marino /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools 39251ddd709SJohn Marino that the values passed as arguments n, ..., m must be non-NULL pointers. 39351ddd709SJohn Marino n = 1 stands for the first argument, n = 2 for the second argument etc. */ 39451ddd709SJohn Marino #ifndef _GL_ARG_NONNULL 39551ddd709SJohn Marino # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3 39651ddd709SJohn Marino # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) 39751ddd709SJohn Marino # else 39851ddd709SJohn Marino # define _GL_ARG_NONNULL(params) 39951ddd709SJohn Marino # endif 40051ddd709SJohn Marino #endif 40151ddd709SJohn Marino 40251ddd709SJohn Marino /* The definition of _GL_WARN_ON_USE is copied here. */ 403*4ce1b016SDaniel Fojt /* A C macro for emitting warnings if a function is used. 404*4ce1b016SDaniel Fojt Copyright (C) 2010-2020 Free Software Foundation, Inc. 405*4ce1b016SDaniel Fojt 406*4ce1b016SDaniel Fojt This program is free software: you can redistribute it and/or modify it 407*4ce1b016SDaniel Fojt under the terms of the GNU General Public License as published 408*4ce1b016SDaniel Fojt by the Free Software Foundation; either version 3 of the License, or 409*4ce1b016SDaniel Fojt (at your option) any later version. 410*4ce1b016SDaniel Fojt 411*4ce1b016SDaniel Fojt This program is distributed in the hope that it will be useful, 412*4ce1b016SDaniel Fojt but WITHOUT ANY WARRANTY; without even the implied warranty of 413*4ce1b016SDaniel Fojt MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 414*4ce1b016SDaniel Fojt General Public License for more details. 415*4ce1b016SDaniel Fojt 416*4ce1b016SDaniel Fojt You should have received a copy of the GNU General Public License 417*4ce1b016SDaniel Fojt along with this program. If not, see <https://www.gnu.org/licenses/>. */ 418*4ce1b016SDaniel Fojt 419*4ce1b016SDaniel Fojt /* _GL_WARN_ON_USE (function, "literal string") issues a declaration 420*4ce1b016SDaniel Fojt for FUNCTION which will then trigger a compiler warning containing 421*4ce1b016SDaniel Fojt the text of "literal string" anywhere that function is called, if 422*4ce1b016SDaniel Fojt supported by the compiler. If the compiler does not support this 423*4ce1b016SDaniel Fojt feature, the macro expands to an unused extern declaration. 424*4ce1b016SDaniel Fojt 425*4ce1b016SDaniel Fojt _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the 426*4ce1b016SDaniel Fojt attribute used in _GL_WARN_ON_USE. If the compiler does not support 427*4ce1b016SDaniel Fojt this feature, it expands to empty. 428*4ce1b016SDaniel Fojt 429*4ce1b016SDaniel Fojt These macros are useful for marking a function as a potential 430*4ce1b016SDaniel Fojt portability trap, with the intent that "literal string" include 431*4ce1b016SDaniel Fojt instructions on the replacement function that should be used 432*4ce1b016SDaniel Fojt instead. 433*4ce1b016SDaniel Fojt _GL_WARN_ON_USE is for functions with 'extern' linkage. 434*4ce1b016SDaniel Fojt _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline' 435*4ce1b016SDaniel Fojt linkage. 436*4ce1b016SDaniel Fojt 437*4ce1b016SDaniel Fojt However, one of the reasons that a function is a portability trap is 438*4ce1b016SDaniel Fojt if it has the wrong signature. Declaring FUNCTION with a different 439*4ce1b016SDaniel Fojt signature in C is a compilation error, so this macro must use the 440*4ce1b016SDaniel Fojt same type as any existing declaration so that programs that avoid 441*4ce1b016SDaniel Fojt the problematic FUNCTION do not fail to compile merely because they 442*4ce1b016SDaniel Fojt included a header that poisoned the function. But this implies that 443*4ce1b016SDaniel Fojt _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already 444*4ce1b016SDaniel Fojt have a declaration. Use of this macro implies that there must not 445*4ce1b016SDaniel Fojt be any other macro hiding the declaration of FUNCTION; but 446*4ce1b016SDaniel Fojt undefining FUNCTION first is part of the poisoning process anyway 447*4ce1b016SDaniel Fojt (although for symbols that are provided only via a macro, the result 448*4ce1b016SDaniel Fojt is a compilation error rather than a warning containing 449*4ce1b016SDaniel Fojt "literal string"). Also note that in C++, it is only safe to use if 450*4ce1b016SDaniel Fojt FUNCTION has no overloads. 451*4ce1b016SDaniel Fojt 452*4ce1b016SDaniel Fojt For an example, it is possible to poison 'getline' by: 453*4ce1b016SDaniel Fojt - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]], 454*4ce1b016SDaniel Fojt [getline]) in configure.ac, which potentially defines 455*4ce1b016SDaniel Fojt HAVE_RAW_DECL_GETLINE 456*4ce1b016SDaniel Fojt - adding this code to a header that wraps the system <stdio.h>: 457*4ce1b016SDaniel Fojt #undef getline 458*4ce1b016SDaniel Fojt #if HAVE_RAW_DECL_GETLINE 459*4ce1b016SDaniel Fojt _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but" 460*4ce1b016SDaniel Fojt "not universally present; use the gnulib module getline"); 461*4ce1b016SDaniel Fojt #endif 462*4ce1b016SDaniel Fojt 463*4ce1b016SDaniel Fojt It is not possible to directly poison global variables. But it is 464*4ce1b016SDaniel Fojt possible to write a wrapper accessor function, and poison that 465*4ce1b016SDaniel Fojt (less common usage, like &environ, will cause a compilation error 466*4ce1b016SDaniel Fojt rather than issue the nice warning, but the end result of informing 467*4ce1b016SDaniel Fojt the developer about their portability problem is still achieved): 468*4ce1b016SDaniel Fojt #if HAVE_RAW_DECL_ENVIRON 469*4ce1b016SDaniel Fojt static char *** 470*4ce1b016SDaniel Fojt rpl_environ (void) { return &environ; } 471*4ce1b016SDaniel Fojt _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared"); 472*4ce1b016SDaniel Fojt # undef environ 473*4ce1b016SDaniel Fojt # define environ (*rpl_environ ()) 474*4ce1b016SDaniel Fojt #endif 475*4ce1b016SDaniel Fojt or better (avoiding contradictory use of 'static' and 'extern'): 476*4ce1b016SDaniel Fojt #if HAVE_RAW_DECL_ENVIRON 477*4ce1b016SDaniel Fojt static char *** 478*4ce1b016SDaniel Fojt _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared") 479*4ce1b016SDaniel Fojt rpl_environ (void) { return &environ; } 480*4ce1b016SDaniel Fojt # undef environ 481*4ce1b016SDaniel Fojt # define environ (*rpl_environ ()) 482*4ce1b016SDaniel Fojt #endif 483*4ce1b016SDaniel Fojt */ 48451ddd709SJohn Marino #ifndef _GL_WARN_ON_USE 48551ddd709SJohn Marino 48651ddd709SJohn Marino # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 48751ddd709SJohn Marino /* A compiler attribute is available in gcc versions 4.3.0 and later. */ 48851ddd709SJohn Marino # define _GL_WARN_ON_USE(function, message) \ 48951ddd709SJohn Marino extern __typeof__ (function) function __attribute__ ((__warning__ (message))) 490*4ce1b016SDaniel Fojt # define _GL_WARN_ON_USE_ATTRIBUTE(message) \ 491*4ce1b016SDaniel Fojt __attribute__ ((__warning__ (message))) 49251ddd709SJohn Marino # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 49351ddd709SJohn Marino /* Verify the existence of the function. */ 49451ddd709SJohn Marino # define _GL_WARN_ON_USE(function, message) \ 49551ddd709SJohn Marino extern __typeof__ (function) function 496*4ce1b016SDaniel Fojt # define _GL_WARN_ON_USE_ATTRIBUTE(message) 49751ddd709SJohn Marino # else /* Unsupported. */ 49851ddd709SJohn Marino # define _GL_WARN_ON_USE(function, message) \ 49951ddd709SJohn Marino _GL_WARN_EXTERN_C int _gl_warn_on_use 500*4ce1b016SDaniel Fojt # define _GL_WARN_ON_USE_ATTRIBUTE(message) 50151ddd709SJohn Marino # endif 50251ddd709SJohn Marino #endif 50351ddd709SJohn Marino 50451ddd709SJohn Marino /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string") 50551ddd709SJohn Marino is like _GL_WARN_ON_USE (function, "string"), except that the function is 50651ddd709SJohn Marino declared with the given prototype, consisting of return type, parameters, 50751ddd709SJohn Marino and attributes. 50851ddd709SJohn Marino This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does 50951ddd709SJohn Marino not work in this case. */ 51051ddd709SJohn Marino #ifndef _GL_WARN_ON_USE_CXX 51151ddd709SJohn Marino # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 51251ddd709SJohn Marino # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 51351ddd709SJohn Marino extern rettype function parameters_and_attributes \ 51451ddd709SJohn Marino __attribute__ ((__warning__ (msg))) 51551ddd709SJohn Marino # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 51651ddd709SJohn Marino /* Verify the existence of the function. */ 51751ddd709SJohn Marino # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 51851ddd709SJohn Marino extern rettype function parameters_and_attributes 51951ddd709SJohn Marino # else /* Unsupported. */ 52051ddd709SJohn Marino # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 52151ddd709SJohn Marino _GL_WARN_EXTERN_C int _gl_warn_on_use 52251ddd709SJohn Marino # endif 52351ddd709SJohn Marino #endif 52451ddd709SJohn Marino 52551ddd709SJohn Marino /* _GL_WARN_EXTERN_C declaration; 52651ddd709SJohn Marino performs the declaration with C linkage. */ 52751ddd709SJohn Marino #ifndef _GL_WARN_EXTERN_C 52851ddd709SJohn Marino # if defined __cplusplus 52951ddd709SJohn Marino # define _GL_WARN_EXTERN_C extern "C" 53051ddd709SJohn Marino # else 53151ddd709SJohn Marino # define _GL_WARN_EXTERN_C extern 53251ddd709SJohn Marino # endif 53351ddd709SJohn Marino #endif 53451ddd709SJohn Marino 53551ddd709SJohn Marino /* The LC_MESSAGES locale category is specified in POSIX, but not in ISO C. 53651ddd709SJohn Marino On systems that don't define it, use the same value as GNU libintl. */ 53751ddd709SJohn Marino #if !defined LC_MESSAGES 53851ddd709SJohn Marino # define LC_MESSAGES 1729 53951ddd709SJohn Marino #endif 54051ddd709SJohn Marino 541*4ce1b016SDaniel Fojt /* On native Windows with MSVC, 'struct lconv' lacks the members int_p_* and 542*4ce1b016SDaniel Fojt int_n_*. Instead of overriding 'struct lconv', merely define these member 543*4ce1b016SDaniel Fojt names as macros. This avoids trouble in C++ mode. */ 544*4ce1b016SDaniel Fojt #if defined _MSC_VER 545*4ce1b016SDaniel Fojt # define int_p_cs_precedes p_cs_precedes 546*4ce1b016SDaniel Fojt # define int_p_sign_posn p_sign_posn 547*4ce1b016SDaniel Fojt # define int_p_sep_by_space p_sep_by_space 548*4ce1b016SDaniel Fojt # define int_n_cs_precedes n_cs_precedes 549*4ce1b016SDaniel Fojt # define int_n_sign_posn n_sign_posn 550*4ce1b016SDaniel Fojt # define int_n_sep_by_space n_sep_by_space 551*4ce1b016SDaniel Fojt #endif 552*4ce1b016SDaniel Fojt 55351ddd709SJohn Marino /* Bionic libc's 'struct lconv' is just a dummy. */ 55451ddd709SJohn Marino #if 0 55551ddd709SJohn Marino # define lconv rpl_lconv 55651ddd709SJohn Marino struct lconv 55751ddd709SJohn Marino { 55851ddd709SJohn Marino /* All 'char *' are actually 'const char *'. */ 55951ddd709SJohn Marino 56051ddd709SJohn Marino /* Members that depend on the LC_NUMERIC category of the locale. See 561*4ce1b016SDaniel Fojt <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#tag_07_03_04> */ 56251ddd709SJohn Marino 56351ddd709SJohn Marino /* Symbol used as decimal point. */ 56451ddd709SJohn Marino char *decimal_point; 56551ddd709SJohn Marino /* Symbol used to separate groups of digits to the left of the decimal 56651ddd709SJohn Marino point. */ 56751ddd709SJohn Marino char *thousands_sep; 56851ddd709SJohn Marino /* Definition of the size of groups of digits to the left of the decimal 56951ddd709SJohn Marino point. */ 57051ddd709SJohn Marino char *grouping; 57151ddd709SJohn Marino 57251ddd709SJohn Marino /* Members that depend on the LC_MONETARY category of the locale. See 573*4ce1b016SDaniel Fojt <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#tag_07_03_03> */ 57451ddd709SJohn Marino 57551ddd709SJohn Marino /* Symbol used as decimal point. */ 57651ddd709SJohn Marino char *mon_decimal_point; 57751ddd709SJohn Marino /* Symbol used to separate groups of digits to the left of the decimal 57851ddd709SJohn Marino point. */ 57951ddd709SJohn Marino char *mon_thousands_sep; 58051ddd709SJohn Marino /* Definition of the size of groups of digits to the left of the decimal 58151ddd709SJohn Marino point. */ 58251ddd709SJohn Marino char *mon_grouping; 58351ddd709SJohn Marino /* Sign used to indicate a value >= 0. */ 58451ddd709SJohn Marino char *positive_sign; 58551ddd709SJohn Marino /* Sign used to indicate a value < 0. */ 58651ddd709SJohn Marino char *negative_sign; 58751ddd709SJohn Marino 58851ddd709SJohn Marino /* For formatting local currency. */ 58951ddd709SJohn Marino /* Currency symbol (3 characters) followed by separator (1 character). */ 59051ddd709SJohn Marino char *currency_symbol; 59151ddd709SJohn Marino /* Number of digits after the decimal point. */ 59251ddd709SJohn Marino char frac_digits; 59351ddd709SJohn Marino /* For values >= 0: 1 if the currency symbol precedes the number, 0 if it 59451ddd709SJohn Marino comes after the number. */ 59551ddd709SJohn Marino char p_cs_precedes; 59651ddd709SJohn Marino /* For values >= 0: Position of the sign. */ 59751ddd709SJohn Marino char p_sign_posn; 59851ddd709SJohn Marino /* For values >= 0: Placement of spaces between currency symbol, sign, and 59951ddd709SJohn Marino number. */ 60051ddd709SJohn Marino char p_sep_by_space; 60151ddd709SJohn Marino /* For values < 0: 1 if the currency symbol precedes the number, 0 if it 60251ddd709SJohn Marino comes after the number. */ 60351ddd709SJohn Marino char n_cs_precedes; 60451ddd709SJohn Marino /* For values < 0: Position of the sign. */ 60551ddd709SJohn Marino char n_sign_posn; 60651ddd709SJohn Marino /* For values < 0: Placement of spaces between currency symbol, sign, and 60751ddd709SJohn Marino number. */ 60851ddd709SJohn Marino char n_sep_by_space; 60951ddd709SJohn Marino 61051ddd709SJohn Marino /* For formatting international currency. */ 61151ddd709SJohn Marino /* Currency symbol (3 characters) followed by separator (1 character). */ 61251ddd709SJohn Marino char *int_curr_symbol; 61351ddd709SJohn Marino /* Number of digits after the decimal point. */ 61451ddd709SJohn Marino char int_frac_digits; 61551ddd709SJohn Marino /* For values >= 0: 1 if the currency symbol precedes the number, 0 if it 61651ddd709SJohn Marino comes after the number. */ 61751ddd709SJohn Marino char int_p_cs_precedes; 61851ddd709SJohn Marino /* For values >= 0: Position of the sign. */ 61951ddd709SJohn Marino char int_p_sign_posn; 62051ddd709SJohn Marino /* For values >= 0: Placement of spaces between currency symbol, sign, and 62151ddd709SJohn Marino number. */ 62251ddd709SJohn Marino char int_p_sep_by_space; 62351ddd709SJohn Marino /* For values < 0: 1 if the currency symbol precedes the number, 0 if it 62451ddd709SJohn Marino comes after the number. */ 62551ddd709SJohn Marino char int_n_cs_precedes; 62651ddd709SJohn Marino /* For values < 0: Position of the sign. */ 62751ddd709SJohn Marino char int_n_sign_posn; 62851ddd709SJohn Marino /* For values < 0: Placement of spaces between currency symbol, sign, and 62951ddd709SJohn Marino number. */ 63051ddd709SJohn Marino char int_n_sep_by_space; 63151ddd709SJohn Marino }; 63251ddd709SJohn Marino #endif 63351ddd709SJohn Marino 63451ddd709SJohn Marino #if 1 63551ddd709SJohn Marino # if 0 63651ddd709SJohn Marino # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 63751ddd709SJohn Marino # undef localeconv 63851ddd709SJohn Marino # define localeconv rpl_localeconv 63951ddd709SJohn Marino # endif 64051ddd709SJohn Marino _GL_FUNCDECL_RPL (localeconv, struct lconv *, (void)); 64151ddd709SJohn Marino _GL_CXXALIAS_RPL (localeconv, struct lconv *, (void)); 64251ddd709SJohn Marino # else 64351ddd709SJohn Marino _GL_CXXALIAS_SYS (localeconv, struct lconv *, (void)); 64451ddd709SJohn Marino # endif 645*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2 64651ddd709SJohn Marino _GL_CXXALIASWARN (localeconv); 647*4ce1b016SDaniel Fojt # endif 64851ddd709SJohn Marino #elif 0 64951ddd709SJohn Marino # undef localeconv 65051ddd709SJohn Marino # define localeconv localeconv_used_without_requesting_gnulib_module_localeconv 65151ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 65251ddd709SJohn Marino # undef localeconv 65351ddd709SJohn Marino # if HAVE_RAW_DECL_LOCALECONV 65451ddd709SJohn Marino _GL_WARN_ON_USE (localeconv, 65551ddd709SJohn Marino "localeconv returns too few information on some platforms - " 65651ddd709SJohn Marino "use gnulib module localeconv for portability"); 65751ddd709SJohn Marino # endif 65851ddd709SJohn Marino #endif 65951ddd709SJohn Marino 66051ddd709SJohn Marino #if IN_GREP_GNULIB_TESTS 661*4ce1b016SDaniel Fojt # if 1 66251ddd709SJohn Marino # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 66351ddd709SJohn Marino # undef setlocale 66451ddd709SJohn Marino # define setlocale rpl_setlocale 66551ddd709SJohn Marino # define GNULIB_defined_setlocale 1 66651ddd709SJohn Marino # endif 66751ddd709SJohn Marino _GL_FUNCDECL_RPL (setlocale, char *, (int category, const char *locale)); 66851ddd709SJohn Marino _GL_CXXALIAS_RPL (setlocale, char *, (int category, const char *locale)); 66951ddd709SJohn Marino # else 67051ddd709SJohn Marino _GL_CXXALIAS_SYS (setlocale, char *, (int category, const char *locale)); 67151ddd709SJohn Marino # endif 672*4ce1b016SDaniel Fojt # if __GLIBC__ >= 2 67351ddd709SJohn Marino _GL_CXXALIASWARN (setlocale); 674*4ce1b016SDaniel Fojt # endif 67551ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 67651ddd709SJohn Marino # undef setlocale 67751ddd709SJohn Marino # if HAVE_RAW_DECL_SETLOCALE 67851ddd709SJohn Marino _GL_WARN_ON_USE (setlocale, "setlocale works differently on native Windows - " 67951ddd709SJohn Marino "use gnulib module setlocale for portability"); 68051ddd709SJohn Marino # endif 68151ddd709SJohn Marino #endif 68251ddd709SJohn Marino 683*4ce1b016SDaniel Fojt #if 1 684*4ce1b016SDaniel Fojt /* Included here for convenience. */ 685*4ce1b016SDaniel Fojt # include "setlocale_null.h" 686*4ce1b016SDaniel Fojt #endif 687*4ce1b016SDaniel Fojt 688*4ce1b016SDaniel Fojt #if /*@GNULIB_NEWLOCALE@ ||*/ (IN_GREP_GNULIB_TESTS && 1) 68951ddd709SJohn Marino # if 0 690*4ce1b016SDaniel Fojt # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 691*4ce1b016SDaniel Fojt # undef newlocale 692*4ce1b016SDaniel Fojt # define newlocale rpl_newlocale 693*4ce1b016SDaniel Fojt # define GNULIB_defined_newlocale 1 694*4ce1b016SDaniel Fojt # endif 695*4ce1b016SDaniel Fojt _GL_FUNCDECL_RPL (newlocale, locale_t, 696*4ce1b016SDaniel Fojt (int category_mask, const char *name, locale_t base) 697*4ce1b016SDaniel Fojt _GL_ARG_NONNULL ((2))); 698*4ce1b016SDaniel Fojt _GL_CXXALIAS_RPL (newlocale, locale_t, 699*4ce1b016SDaniel Fojt (int category_mask, const char *name, locale_t base)); 700*4ce1b016SDaniel Fojt # else 701*4ce1b016SDaniel Fojt # if 1 702*4ce1b016SDaniel Fojt _GL_CXXALIAS_SYS (newlocale, locale_t, 703*4ce1b016SDaniel Fojt (int category_mask, const char *name, locale_t base)); 704*4ce1b016SDaniel Fojt # endif 705*4ce1b016SDaniel Fojt # endif 706*4ce1b016SDaniel Fojt # if 1 707*4ce1b016SDaniel Fojt _GL_CXXALIASWARN (newlocale); 708*4ce1b016SDaniel Fojt # endif 709*4ce1b016SDaniel Fojt # if 1 || 0 710*4ce1b016SDaniel Fojt # ifndef HAVE_WORKING_NEWLOCALE 711*4ce1b016SDaniel Fojt # define HAVE_WORKING_NEWLOCALE 1 712*4ce1b016SDaniel Fojt # endif 713*4ce1b016SDaniel Fojt # endif 714*4ce1b016SDaniel Fojt #elif defined GNULIB_POSIXCHECK 715*4ce1b016SDaniel Fojt # undef newlocale 716*4ce1b016SDaniel Fojt # if HAVE_RAW_DECL_NEWLOCALE 717*4ce1b016SDaniel Fojt _GL_WARN_ON_USE (newlocale, "newlocale is not portable"); 718*4ce1b016SDaniel Fojt # endif 719*4ce1b016SDaniel Fojt #endif 720*4ce1b016SDaniel Fojt 721*4ce1b016SDaniel Fojt #if 0 || (IN_GREP_GNULIB_TESTS && 1) 72251ddd709SJohn Marino # if 0 72351ddd709SJohn Marino # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 72451ddd709SJohn Marino # undef duplocale 72551ddd709SJohn Marino # define duplocale rpl_duplocale 726*4ce1b016SDaniel Fojt # define GNULIB_defined_duplocale 1 72751ddd709SJohn Marino # endif 72851ddd709SJohn Marino _GL_FUNCDECL_RPL (duplocale, locale_t, (locale_t locale) _GL_ARG_NONNULL ((1))); 72951ddd709SJohn Marino _GL_CXXALIAS_RPL (duplocale, locale_t, (locale_t locale)); 73051ddd709SJohn Marino # else 73151ddd709SJohn Marino # if 1 73251ddd709SJohn Marino _GL_CXXALIAS_SYS (duplocale, locale_t, (locale_t locale)); 73351ddd709SJohn Marino # endif 73451ddd709SJohn Marino # endif 73551ddd709SJohn Marino # if 1 73651ddd709SJohn Marino _GL_CXXALIASWARN (duplocale); 73751ddd709SJohn Marino # endif 738*4ce1b016SDaniel Fojt # if 1 || 0 739*4ce1b016SDaniel Fojt # ifndef HAVE_WORKING_DUPLOCALE 740*4ce1b016SDaniel Fojt # define HAVE_WORKING_DUPLOCALE 1 741*4ce1b016SDaniel Fojt # endif 742*4ce1b016SDaniel Fojt # endif 74351ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK 74451ddd709SJohn Marino # undef duplocale 74551ddd709SJohn Marino # if HAVE_RAW_DECL_DUPLOCALE 74651ddd709SJohn Marino _GL_WARN_ON_USE (duplocale, "duplocale is buggy on some glibc systems - " 74751ddd709SJohn Marino "use gnulib module duplocale for portability"); 74851ddd709SJohn Marino # endif 74951ddd709SJohn Marino #endif 75051ddd709SJohn Marino 751*4ce1b016SDaniel Fojt #if /*@GNULIB_FREELOCALE@ ||*/ (IN_GREP_GNULIB_TESTS && 1) 752*4ce1b016SDaniel Fojt # if 0 753*4ce1b016SDaniel Fojt # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 754*4ce1b016SDaniel Fojt # undef freelocale 755*4ce1b016SDaniel Fojt # define freelocale rpl_freelocale 756*4ce1b016SDaniel Fojt # define GNULIB_defined_freelocale 1 757*4ce1b016SDaniel Fojt # endif 758*4ce1b016SDaniel Fojt _GL_FUNCDECL_RPL (freelocale, void, (locale_t locale) _GL_ARG_NONNULL ((1))); 759*4ce1b016SDaniel Fojt _GL_CXXALIAS_RPL (freelocale, void, (locale_t locale)); 760*4ce1b016SDaniel Fojt # else 761*4ce1b016SDaniel Fojt # if 1 762*4ce1b016SDaniel Fojt /* Need to cast, because on FreeBSD and Mac OS X 10.13, the return type is 763*4ce1b016SDaniel Fojt int. */ 764*4ce1b016SDaniel Fojt _GL_CXXALIAS_SYS_CAST (freelocale, void, (locale_t locale)); 765*4ce1b016SDaniel Fojt # endif 766*4ce1b016SDaniel Fojt # endif 767*4ce1b016SDaniel Fojt # if 1 768*4ce1b016SDaniel Fojt _GL_CXXALIASWARN (freelocale); 769*4ce1b016SDaniel Fojt # endif 770*4ce1b016SDaniel Fojt #elif defined GNULIB_POSIXCHECK 771*4ce1b016SDaniel Fojt # undef freelocale 772*4ce1b016SDaniel Fojt # if HAVE_RAW_DECL_FREELOCALE 773*4ce1b016SDaniel Fojt _GL_WARN_ON_USE (freelocale, "freelocale is not portable"); 774*4ce1b016SDaniel Fojt # endif 775*4ce1b016SDaniel Fojt #endif 776*4ce1b016SDaniel Fojt 77751ddd709SJohn Marino #endif /* _GL_LOCALE_H */ 77851ddd709SJohn Marino #endif /* _GL_LOCALE_H */ 779*4ce1b016SDaniel Fojt #endif /* !(__need_locale_t || _GL_ALREADY_INCLUDING_LOCALE_H) */ 780