1*49678444Schristos /* This file is automatically generated. DO NOT EDIT! */ 2*49678444Schristos /* Generated from: NetBSD: mknative-gdb,v 1.12 2020/09/17 16:54:31 christos Exp */ 3*49678444Schristos /* Generated from: NetBSD: mknative.common,v 1.16 2018/04/15 15:13:37 christos Exp */ 4*49678444Schristos 5*49678444Schristos /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ 6*49678444Schristos /* A more-standard <time.h>. 7*49678444Schristos 8*49678444Schristos Copyright (C) 2007-2020 Free Software Foundation, Inc. 9*49678444Schristos 10*49678444Schristos This program is free software; you can redistribute it and/or modify 11*49678444Schristos it under the terms of the GNU General Public License as published by 12*49678444Schristos the Free Software Foundation; either version 3, or (at your option) 13*49678444Schristos any later version. 14*49678444Schristos 15*49678444Schristos This program is distributed in the hope that it will be useful, 16*49678444Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of 17*49678444Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*49678444Schristos GNU General Public License for more details. 19*49678444Schristos 20*49678444Schristos You should have received a copy of the GNU General Public License 21*49678444Schristos along with this program; if not, see <https://www.gnu.org/licenses/>. */ 22*49678444Schristos 23*49678444Schristos #if __GNUC__ >= 3 24*49678444Schristos #pragma GCC system_header 25*49678444Schristos #endif 26*49678444Schristos 27*49678444Schristos 28*49678444Schristos /* Don't get in the way of glibc when it includes time.h merely to 29*49678444Schristos declare a few standard symbols, rather than to declare all the 30*49678444Schristos symbols. (However, skip this for MinGW as it treats __need_time_t 31*49678444Schristos incompatibly.) Also, Solaris 8 <time.h> eventually includes itself 32*49678444Schristos recursively; if that is happening, just include the system <time.h> 33*49678444Schristos without adding our own declarations. */ 34*49678444Schristos #if (((defined __need_time_t || defined __need_clock_t \ 35*49678444Schristos || defined __need_timespec) \ 36*49678444Schristos && !defined __MINGW32__) \ 37*49678444Schristos || defined _GL_TIME_H) 38*49678444Schristos 39*49678444Schristos # include_next <time.h> 40*49678444Schristos 41*49678444Schristos #else 42*49678444Schristos 43*49678444Schristos # define _GL_TIME_H 44*49678444Schristos 45*49678444Schristos /* mingw's <time.h> provides the functions asctime_r, ctime_r, gmtime_r, 46*49678444Schristos localtime_r only if <unistd.h> or <pthread.h> has been included before. */ 47*49678444Schristos # if defined __MINGW32__ 48*49678444Schristos # include <unistd.h> 49*49678444Schristos # endif 50*49678444Schristos 51*49678444Schristos # include_next <time.h> 52*49678444Schristos 53*49678444Schristos /* NetBSD 5.0 mis-defines NULL. */ 54*49678444Schristos # include <stddef.h> 55*49678444Schristos 56*49678444Schristos /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 57*49678444Schristos /* C++ compatible function declaration macros. 58*49678444Schristos Copyright (C) 2010-2020 Free Software Foundation, Inc. 59*49678444Schristos 60*49678444Schristos This program is free software: you can redistribute it and/or modify it 61*49678444Schristos under the terms of the GNU General Public License as published 62*49678444Schristos by the Free Software Foundation; either version 3 of the License, or 63*49678444Schristos (at your option) any later version. 64*49678444Schristos 65*49678444Schristos This program is distributed in the hope that it will be useful, 66*49678444Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of 67*49678444Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 68*49678444Schristos General Public License for more details. 69*49678444Schristos 70*49678444Schristos You should have received a copy of the GNU General Public License 71*49678444Schristos along with this program. If not, see <https://www.gnu.org/licenses/>. */ 72*49678444Schristos 73*49678444Schristos #ifndef _GL_CXXDEFS_H 74*49678444Schristos #define _GL_CXXDEFS_H 75*49678444Schristos 76*49678444Schristos /* Begin/end the GNULIB_NAMESPACE namespace. */ 77*49678444Schristos #if defined __cplusplus && defined GNULIB_NAMESPACE 78*49678444Schristos # define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE { 79*49678444Schristos # define _GL_END_NAMESPACE } 80*49678444Schristos #else 81*49678444Schristos # define _GL_BEGIN_NAMESPACE 82*49678444Schristos # define _GL_END_NAMESPACE 83*49678444Schristos #endif 84*49678444Schristos 85*49678444Schristos /* The three most frequent use cases of these macros are: 86*49678444Schristos 87*49678444Schristos * For providing a substitute for a function that is missing on some 88*49678444Schristos platforms, but is declared and works fine on the platforms on which 89*49678444Schristos it exists: 90*49678444Schristos 91*49678444Schristos #if @GNULIB_FOO@ 92*49678444Schristos # if !@HAVE_FOO@ 93*49678444Schristos _GL_FUNCDECL_SYS (foo, ...); 94*49678444Schristos # endif 95*49678444Schristos _GL_CXXALIAS_SYS (foo, ...); 96*49678444Schristos _GL_CXXALIASWARN (foo); 97*49678444Schristos #elif defined GNULIB_POSIXCHECK 98*49678444Schristos ... 99*49678444Schristos #endif 100*49678444Schristos 101*49678444Schristos * For providing a replacement for a function that exists on all platforms, 102*49678444Schristos but is broken/insufficient and needs to be replaced on some platforms: 103*49678444Schristos 104*49678444Schristos #if @GNULIB_FOO@ 105*49678444Schristos # if @REPLACE_FOO@ 106*49678444Schristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 107*49678444Schristos # undef foo 108*49678444Schristos # define foo rpl_foo 109*49678444Schristos # endif 110*49678444Schristos _GL_FUNCDECL_RPL (foo, ...); 111*49678444Schristos _GL_CXXALIAS_RPL (foo, ...); 112*49678444Schristos # else 113*49678444Schristos _GL_CXXALIAS_SYS (foo, ...); 114*49678444Schristos # endif 115*49678444Schristos _GL_CXXALIASWARN (foo); 116*49678444Schristos #elif defined GNULIB_POSIXCHECK 117*49678444Schristos ... 118*49678444Schristos #endif 119*49678444Schristos 120*49678444Schristos * For providing a replacement for a function that exists on some platforms 121*49678444Schristos but is broken/insufficient and needs to be replaced on some of them and 122*49678444Schristos is additionally either missing or undeclared on some other platforms: 123*49678444Schristos 124*49678444Schristos #if @GNULIB_FOO@ 125*49678444Schristos # if @REPLACE_FOO@ 126*49678444Schristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 127*49678444Schristos # undef foo 128*49678444Schristos # define foo rpl_foo 129*49678444Schristos # endif 130*49678444Schristos _GL_FUNCDECL_RPL (foo, ...); 131*49678444Schristos _GL_CXXALIAS_RPL (foo, ...); 132*49678444Schristos # else 133*49678444Schristos # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ 134*49678444Schristos _GL_FUNCDECL_SYS (foo, ...); 135*49678444Schristos # endif 136*49678444Schristos _GL_CXXALIAS_SYS (foo, ...); 137*49678444Schristos # endif 138*49678444Schristos _GL_CXXALIASWARN (foo); 139*49678444Schristos #elif defined GNULIB_POSIXCHECK 140*49678444Schristos ... 141*49678444Schristos #endif 142*49678444Schristos */ 143*49678444Schristos 144*49678444Schristos /* _GL_EXTERN_C declaration; 145*49678444Schristos performs the declaration with C linkage. */ 146*49678444Schristos #if defined __cplusplus 147*49678444Schristos # define _GL_EXTERN_C extern "C" 148*49678444Schristos #else 149*49678444Schristos # define _GL_EXTERN_C extern 150*49678444Schristos #endif 151*49678444Schristos 152*49678444Schristos /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); 153*49678444Schristos declares a replacement function, named rpl_func, with the given prototype, 154*49678444Schristos consisting of return type, parameters, and attributes. 155*49678444Schristos Example: 156*49678444Schristos _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) 157*49678444Schristos _GL_ARG_NONNULL ((1))); 158*49678444Schristos */ 159*49678444Schristos #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ 160*49678444Schristos _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) 161*49678444Schristos #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ 162*49678444Schristos _GL_EXTERN_C rettype rpl_func parameters_and_attributes 163*49678444Schristos 164*49678444Schristos /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); 165*49678444Schristos declares the system function, named func, with the given prototype, 166*49678444Schristos consisting of return type, parameters, and attributes. 167*49678444Schristos Example: 168*49678444Schristos _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) 169*49678444Schristos _GL_ARG_NONNULL ((1))); 170*49678444Schristos */ 171*49678444Schristos #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ 172*49678444Schristos _GL_EXTERN_C rettype func parameters_and_attributes 173*49678444Schristos 174*49678444Schristos /* _GL_CXXALIAS_RPL (func, rettype, parameters); 175*49678444Schristos declares a C++ alias called GNULIB_NAMESPACE::func 176*49678444Schristos that redirects to rpl_func, if GNULIB_NAMESPACE is defined. 177*49678444Schristos Example: 178*49678444Schristos _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); 179*49678444Schristos 180*49678444Schristos Wrapping rpl_func in an object with an inline conversion operator 181*49678444Schristos avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is 182*49678444Schristos actually used in the program. */ 183*49678444Schristos #define _GL_CXXALIAS_RPL(func,rettype,parameters) \ 184*49678444Schristos _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) 185*49678444Schristos #if defined __cplusplus && defined GNULIB_NAMESPACE 186*49678444Schristos # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 187*49678444Schristos namespace GNULIB_NAMESPACE \ 188*49678444Schristos { \ 189*49678444Schristos static const struct _gl_ ## func ## _wrapper \ 190*49678444Schristos { \ 191*49678444Schristos typedef rettype (*type) parameters; \ 192*49678444Schristos \ 193*49678444Schristos inline operator type () const \ 194*49678444Schristos { \ 195*49678444Schristos return ::rpl_func; \ 196*49678444Schristos } \ 197*49678444Schristos } func = {}; \ 198*49678444Schristos } \ 199*49678444Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 200*49678444Schristos #else 201*49678444Schristos # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 202*49678444Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 203*49678444Schristos #endif 204*49678444Schristos 205*49678444Schristos /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); 206*49678444Schristos is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); 207*49678444Schristos except that the C function rpl_func may have a slightly different 208*49678444Schristos declaration. A cast is used to silence the "invalid conversion" error 209*49678444Schristos that would otherwise occur. */ 210*49678444Schristos #if defined __cplusplus && defined GNULIB_NAMESPACE 211*49678444Schristos # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 212*49678444Schristos namespace GNULIB_NAMESPACE \ 213*49678444Schristos { \ 214*49678444Schristos static const struct _gl_ ## func ## _wrapper \ 215*49678444Schristos { \ 216*49678444Schristos typedef rettype (*type) parameters; \ 217*49678444Schristos \ 218*49678444Schristos inline operator type () const \ 219*49678444Schristos { \ 220*49678444Schristos return reinterpret_cast<type>(::rpl_func); \ 221*49678444Schristos } \ 222*49678444Schristos } func = {}; \ 223*49678444Schristos } \ 224*49678444Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 225*49678444Schristos #else 226*49678444Schristos # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 227*49678444Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 228*49678444Schristos #endif 229*49678444Schristos 230*49678444Schristos /* _GL_CXXALIAS_SYS (func, rettype, parameters); 231*49678444Schristos declares a C++ alias called GNULIB_NAMESPACE::func 232*49678444Schristos that redirects to the system provided function func, if GNULIB_NAMESPACE 233*49678444Schristos is defined. 234*49678444Schristos Example: 235*49678444Schristos _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); 236*49678444Schristos 237*49678444Schristos Wrapping func in an object with an inline conversion operator 238*49678444Schristos avoids a reference to func unless GNULIB_NAMESPACE::func is 239*49678444Schristos actually used in the program. */ 240*49678444Schristos #if defined __cplusplus && defined GNULIB_NAMESPACE 241*49678444Schristos # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 242*49678444Schristos namespace GNULIB_NAMESPACE \ 243*49678444Schristos { \ 244*49678444Schristos static const struct _gl_ ## func ## _wrapper \ 245*49678444Schristos { \ 246*49678444Schristos typedef rettype (*type) parameters; \ 247*49678444Schristos \ 248*49678444Schristos inline operator type () const \ 249*49678444Schristos { \ 250*49678444Schristos return ::func; \ 251*49678444Schristos } \ 252*49678444Schristos } func = {}; \ 253*49678444Schristos } \ 254*49678444Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 255*49678444Schristos #else 256*49678444Schristos # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 257*49678444Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 258*49678444Schristos #endif 259*49678444Schristos 260*49678444Schristos /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); 261*49678444Schristos is like _GL_CXXALIAS_SYS (func, rettype, parameters); 262*49678444Schristos except that the C function func may have a slightly different declaration. 263*49678444Schristos A cast is used to silence the "invalid conversion" error that would 264*49678444Schristos otherwise occur. */ 265*49678444Schristos #if defined __cplusplus && defined GNULIB_NAMESPACE 266*49678444Schristos # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 267*49678444Schristos namespace GNULIB_NAMESPACE \ 268*49678444Schristos { \ 269*49678444Schristos static const struct _gl_ ## func ## _wrapper \ 270*49678444Schristos { \ 271*49678444Schristos typedef rettype (*type) parameters; \ 272*49678444Schristos \ 273*49678444Schristos inline operator type () const \ 274*49678444Schristos { \ 275*49678444Schristos return reinterpret_cast<type>(::func); \ 276*49678444Schristos } \ 277*49678444Schristos } func = {}; \ 278*49678444Schristos } \ 279*49678444Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 280*49678444Schristos #else 281*49678444Schristos # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 282*49678444Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 283*49678444Schristos #endif 284*49678444Schristos 285*49678444Schristos /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); 286*49678444Schristos is like _GL_CXXALIAS_SYS (func, rettype, parameters); 287*49678444Schristos except that the C function is picked among a set of overloaded functions, 288*49678444Schristos namely the one with rettype2 and parameters2. Two consecutive casts 289*49678444Schristos are used to silence the "cannot find a match" and "invalid conversion" 290*49678444Schristos errors that would otherwise occur. */ 291*49678444Schristos #if defined __cplusplus && defined GNULIB_NAMESPACE 292*49678444Schristos /* The outer cast must be a reinterpret_cast. 293*49678444Schristos The inner cast: When the function is defined as a set of overloaded 294*49678444Schristos functions, it works as a static_cast<>, choosing the designated variant. 295*49678444Schristos When the function is defined as a single variant, it works as a 296*49678444Schristos reinterpret_cast<>. The parenthesized cast syntax works both ways. */ 297*49678444Schristos # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 298*49678444Schristos namespace GNULIB_NAMESPACE \ 299*49678444Schristos { \ 300*49678444Schristos static const struct _gl_ ## func ## _wrapper \ 301*49678444Schristos { \ 302*49678444Schristos typedef rettype (*type) parameters; \ 303*49678444Schristos \ 304*49678444Schristos inline operator type () const \ 305*49678444Schristos { \ 306*49678444Schristos return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \ 307*49678444Schristos } \ 308*49678444Schristos } func = {}; \ 309*49678444Schristos } \ 310*49678444Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 311*49678444Schristos #else 312*49678444Schristos # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 313*49678444Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 314*49678444Schristos #endif 315*49678444Schristos 316*49678444Schristos /* _GL_CXXALIASWARN (func); 317*49678444Schristos causes a warning to be emitted when ::func is used but not when 318*49678444Schristos GNULIB_NAMESPACE::func is used. func must be defined without overloaded 319*49678444Schristos variants. */ 320*49678444Schristos #if defined __cplusplus && defined GNULIB_NAMESPACE 321*49678444Schristos # define _GL_CXXALIASWARN(func) \ 322*49678444Schristos _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) 323*49678444Schristos # define _GL_CXXALIASWARN_1(func,namespace) \ 324*49678444Schristos _GL_CXXALIASWARN_2 (func, namespace) 325*49678444Schristos /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 326*49678444Schristos we enable the warning only when not optimizing. */ 327*49678444Schristos # if !__OPTIMIZE__ 328*49678444Schristos # define _GL_CXXALIASWARN_2(func,namespace) \ 329*49678444Schristos _GL_WARN_ON_USE (func, \ 330*49678444Schristos "The symbol ::" #func " refers to the system function. " \ 331*49678444Schristos "Use " #namespace "::" #func " instead.") 332*49678444Schristos # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 333*49678444Schristos # define _GL_CXXALIASWARN_2(func,namespace) \ 334*49678444Schristos extern __typeof__ (func) func 335*49678444Schristos # else 336*49678444Schristos # define _GL_CXXALIASWARN_2(func,namespace) \ 337*49678444Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 338*49678444Schristos # endif 339*49678444Schristos #else 340*49678444Schristos # define _GL_CXXALIASWARN(func) \ 341*49678444Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 342*49678444Schristos #endif 343*49678444Schristos 344*49678444Schristos /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); 345*49678444Schristos causes a warning to be emitted when the given overloaded variant of ::func 346*49678444Schristos is used but not when GNULIB_NAMESPACE::func is used. */ 347*49678444Schristos #if defined __cplusplus && defined GNULIB_NAMESPACE 348*49678444Schristos # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 349*49678444Schristos _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ 350*49678444Schristos GNULIB_NAMESPACE) 351*49678444Schristos # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ 352*49678444Schristos _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) 353*49678444Schristos /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 354*49678444Schristos we enable the warning only when not optimizing. */ 355*49678444Schristos # if !__OPTIMIZE__ 356*49678444Schristos # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 357*49678444Schristos _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \ 358*49678444Schristos "The symbol ::" #func " refers to the system function. " \ 359*49678444Schristos "Use " #namespace "::" #func " instead.") 360*49678444Schristos # else 361*49678444Schristos # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 362*49678444Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 363*49678444Schristos # endif 364*49678444Schristos #else 365*49678444Schristos # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 366*49678444Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 367*49678444Schristos #endif 368*49678444Schristos 369*49678444Schristos #endif /* _GL_CXXDEFS_H */ 370*49678444Schristos 371*49678444Schristos /* The definition of _GL_ARG_NONNULL is copied here. */ 372*49678444Schristos /* A C macro for declaring that specific arguments must not be NULL. 373*49678444Schristos Copyright (C) 2009-2020 Free Software Foundation, Inc. 374*49678444Schristos 375*49678444Schristos This program is free software: you can redistribute it and/or modify it 376*49678444Schristos under the terms of the GNU General Public License as published 377*49678444Schristos by the Free Software Foundation; either version 3 of the License, or 378*49678444Schristos (at your option) any later version. 379*49678444Schristos 380*49678444Schristos This program is distributed in the hope that it will be useful, 381*49678444Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of 382*49678444Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 383*49678444Schristos General Public License for more details. 384*49678444Schristos 385*49678444Schristos You should have received a copy of the GNU General Public License 386*49678444Schristos along with this program. If not, see <https://www.gnu.org/licenses/>. */ 387*49678444Schristos 388*49678444Schristos /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools 389*49678444Schristos that the values passed as arguments n, ..., m must be non-NULL pointers. 390*49678444Schristos n = 1 stands for the first argument, n = 2 for the second argument etc. */ 391*49678444Schristos #ifndef _GL_ARG_NONNULL 392*49678444Schristos # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3 393*49678444Schristos # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) 394*49678444Schristos # else 395*49678444Schristos # define _GL_ARG_NONNULL(params) 396*49678444Schristos # endif 397*49678444Schristos #endif 398*49678444Schristos 399*49678444Schristos /* The definition of _GL_WARN_ON_USE is copied here. */ 400*49678444Schristos /* A C macro for emitting warnings if a function is used. 401*49678444Schristos Copyright (C) 2010-2020 Free Software Foundation, Inc. 402*49678444Schristos 403*49678444Schristos This program is free software: you can redistribute it and/or modify it 404*49678444Schristos under the terms of the GNU General Public License as published 405*49678444Schristos by the Free Software Foundation; either version 3 of the License, or 406*49678444Schristos (at your option) any later version. 407*49678444Schristos 408*49678444Schristos This program is distributed in the hope that it will be useful, 409*49678444Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of 410*49678444Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 411*49678444Schristos General Public License for more details. 412*49678444Schristos 413*49678444Schristos You should have received a copy of the GNU General Public License 414*49678444Schristos along with this program. If not, see <https://www.gnu.org/licenses/>. */ 415*49678444Schristos 416*49678444Schristos /* _GL_WARN_ON_USE (function, "literal string") issues a declaration 417*49678444Schristos for FUNCTION which will then trigger a compiler warning containing 418*49678444Schristos the text of "literal string" anywhere that function is called, if 419*49678444Schristos supported by the compiler. If the compiler does not support this 420*49678444Schristos feature, the macro expands to an unused extern declaration. 421*49678444Schristos 422*49678444Schristos _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the 423*49678444Schristos attribute used in _GL_WARN_ON_USE. If the compiler does not support 424*49678444Schristos this feature, it expands to empty. 425*49678444Schristos 426*49678444Schristos These macros are useful for marking a function as a potential 427*49678444Schristos portability trap, with the intent that "literal string" include 428*49678444Schristos instructions on the replacement function that should be used 429*49678444Schristos instead. 430*49678444Schristos _GL_WARN_ON_USE is for functions with 'extern' linkage. 431*49678444Schristos _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline' 432*49678444Schristos linkage. 433*49678444Schristos 434*49678444Schristos However, one of the reasons that a function is a portability trap is 435*49678444Schristos if it has the wrong signature. Declaring FUNCTION with a different 436*49678444Schristos signature in C is a compilation error, so this macro must use the 437*49678444Schristos same type as any existing declaration so that programs that avoid 438*49678444Schristos the problematic FUNCTION do not fail to compile merely because they 439*49678444Schristos included a header that poisoned the function. But this implies that 440*49678444Schristos _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already 441*49678444Schristos have a declaration. Use of this macro implies that there must not 442*49678444Schristos be any other macro hiding the declaration of FUNCTION; but 443*49678444Schristos undefining FUNCTION first is part of the poisoning process anyway 444*49678444Schristos (although for symbols that are provided only via a macro, the result 445*49678444Schristos is a compilation error rather than a warning containing 446*49678444Schristos "literal string"). Also note that in C++, it is only safe to use if 447*49678444Schristos FUNCTION has no overloads. 448*49678444Schristos 449*49678444Schristos For an example, it is possible to poison 'getline' by: 450*49678444Schristos - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]], 451*49678444Schristos [getline]) in configure.ac, which potentially defines 452*49678444Schristos HAVE_RAW_DECL_GETLINE 453*49678444Schristos - adding this code to a header that wraps the system <stdio.h>: 454*49678444Schristos #undef getline 455*49678444Schristos #if HAVE_RAW_DECL_GETLINE 456*49678444Schristos _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but" 457*49678444Schristos "not universally present; use the gnulib module getline"); 458*49678444Schristos #endif 459*49678444Schristos 460*49678444Schristos It is not possible to directly poison global variables. But it is 461*49678444Schristos possible to write a wrapper accessor function, and poison that 462*49678444Schristos (less common usage, like &environ, will cause a compilation error 463*49678444Schristos rather than issue the nice warning, but the end result of informing 464*49678444Schristos the developer about their portability problem is still achieved): 465*49678444Schristos #if HAVE_RAW_DECL_ENVIRON 466*49678444Schristos static char *** 467*49678444Schristos rpl_environ (void) { return &environ; } 468*49678444Schristos _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared"); 469*49678444Schristos # undef environ 470*49678444Schristos # define environ (*rpl_environ ()) 471*49678444Schristos #endif 472*49678444Schristos or better (avoiding contradictory use of 'static' and 'extern'): 473*49678444Schristos #if HAVE_RAW_DECL_ENVIRON 474*49678444Schristos static char *** 475*49678444Schristos _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared") 476*49678444Schristos rpl_environ (void) { return &environ; } 477*49678444Schristos # undef environ 478*49678444Schristos # define environ (*rpl_environ ()) 479*49678444Schristos #endif 480*49678444Schristos */ 481*49678444Schristos #ifndef _GL_WARN_ON_USE 482*49678444Schristos 483*49678444Schristos # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 484*49678444Schristos /* A compiler attribute is available in gcc versions 4.3.0 and later. */ 485*49678444Schristos # define _GL_WARN_ON_USE(function, message) \ 486*49678444Schristos extern __typeof__ (function) function __attribute__ ((__warning__ (message))) 487*49678444Schristos # define _GL_WARN_ON_USE_ATTRIBUTE(message) \ 488*49678444Schristos __attribute__ ((__warning__ (message))) 489*49678444Schristos # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 490*49678444Schristos /* Verify the existence of the function. */ 491*49678444Schristos # define _GL_WARN_ON_USE(function, message) \ 492*49678444Schristos extern __typeof__ (function) function 493*49678444Schristos # define _GL_WARN_ON_USE_ATTRIBUTE(message) 494*49678444Schristos # else /* Unsupported. */ 495*49678444Schristos # define _GL_WARN_ON_USE(function, message) \ 496*49678444Schristos _GL_WARN_EXTERN_C int _gl_warn_on_use 497*49678444Schristos # define _GL_WARN_ON_USE_ATTRIBUTE(message) 498*49678444Schristos # endif 499*49678444Schristos #endif 500*49678444Schristos 501*49678444Schristos /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string") 502*49678444Schristos is like _GL_WARN_ON_USE (function, "string"), except that in C++ mode the 503*49678444Schristos function is declared with the given prototype, consisting of return type, 504*49678444Schristos parameters, and attributes. 505*49678444Schristos This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does 506*49678444Schristos not work in this case. */ 507*49678444Schristos #ifndef _GL_WARN_ON_USE_CXX 508*49678444Schristos # if !defined __cplusplus 509*49678444Schristos # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 510*49678444Schristos _GL_WARN_ON_USE (function, msg) 511*49678444Schristos # else 512*49678444Schristos # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 513*49678444Schristos # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 514*49678444Schristos extern rettype function parameters_and_attributes \ 515*49678444Schristos __attribute__ ((__warning__ (msg))) 516*49678444Schristos # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 517*49678444Schristos /* Verify the existence of the function. */ 518*49678444Schristos # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 519*49678444Schristos extern rettype function parameters_and_attributes 520*49678444Schristos # else /* Unsupported. */ 521*49678444Schristos # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 522*49678444Schristos _GL_WARN_EXTERN_C int _gl_warn_on_use 523*49678444Schristos # endif 524*49678444Schristos # endif 525*49678444Schristos #endif 526*49678444Schristos 527*49678444Schristos /* _GL_WARN_EXTERN_C declaration; 528*49678444Schristos performs the declaration with C linkage. */ 529*49678444Schristos #ifndef _GL_WARN_EXTERN_C 530*49678444Schristos # if defined __cplusplus 531*49678444Schristos # define _GL_WARN_EXTERN_C extern "C" 532*49678444Schristos # else 533*49678444Schristos # define _GL_WARN_EXTERN_C extern 534*49678444Schristos # endif 535*49678444Schristos #endif 536*49678444Schristos 537*49678444Schristos /* Some systems don't define struct timespec (e.g., AIX 4.1). 538*49678444Schristos Or they define it with the wrong member names or define it in <sys/time.h> 539*49678444Schristos (e.g., FreeBSD circa 1997). Stock Mingw prior to 3.0 does not define it, 540*49678444Schristos but the pthreads-win32 library defines it in <pthread.h>. */ 541*49678444Schristos # if ! 1 542*49678444Schristos # if 0 543*49678444Schristos # include <sys/time.h> 544*49678444Schristos # elif 0 545*49678444Schristos # include <pthread.h> 546*49678444Schristos # elif 0 547*49678444Schristos # include <unistd.h> 548*49678444Schristos # else 549*49678444Schristos 550*49678444Schristos # ifdef __cplusplus 551*49678444Schristos extern "C" { 552*49678444Schristos # endif 553*49678444Schristos 554*49678444Schristos # if !GNULIB_defined_struct_timespec 555*49678444Schristos # undef timespec 556*49678444Schristos # define timespec rpl_timespec 557*49678444Schristos struct timespec 558*49678444Schristos { 559*49678444Schristos time_t tv_sec; 560*49678444Schristos long int tv_nsec; 561*49678444Schristos }; 562*49678444Schristos # define GNULIB_defined_struct_timespec 1 563*49678444Schristos # endif 564*49678444Schristos 565*49678444Schristos # ifdef __cplusplus 566*49678444Schristos } 567*49678444Schristos # endif 568*49678444Schristos 569*49678444Schristos # endif 570*49678444Schristos # endif 571*49678444Schristos 572*49678444Schristos # if !GNULIB_defined_struct_time_t_must_be_integral 573*49678444Schristos /* https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html 574*49678444Schristos requires time_t to be an integer type, even though C99 permits floating 575*49678444Schristos point. We don't know of any implementation that uses floating 576*49678444Schristos point, and it is much easier to write code that doesn't have to 577*49678444Schristos worry about that corner case, so we force the issue. */ 578*49678444Schristos struct __time_t_must_be_integral { 579*49678444Schristos unsigned int __floating_time_t_unsupported : (time_t) 1; 580*49678444Schristos }; 581*49678444Schristos # define GNULIB_defined_struct_time_t_must_be_integral 1 582*49678444Schristos # endif 583*49678444Schristos 584*49678444Schristos /* Sleep for at least RQTP seconds unless interrupted, If interrupted, 585*49678444Schristos return -1 and store the remaining time into RMTP. See 586*49678444Schristos <https://pubs.opengroup.org/onlinepubs/9699919799/functions/nanosleep.html>. */ 587*49678444Schristos # if 0 588*49678444Schristos # if GNULIB_PORTCHECK 589*49678444Schristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 590*49678444Schristos # define nanosleep rpl_nanosleep 591*49678444Schristos # endif 592*49678444Schristos _GL_FUNCDECL_RPL (nanosleep, int, 593*49678444Schristos (struct timespec const *__rqtp, struct timespec *__rmtp) 594*49678444Schristos _GL_ARG_NONNULL ((1))); 595*49678444Schristos _GL_CXXALIAS_RPL (nanosleep, int, 596*49678444Schristos (struct timespec const *__rqtp, struct timespec *__rmtp)); 597*49678444Schristos # else 598*49678444Schristos # if ! 1 599*49678444Schristos _GL_FUNCDECL_SYS (nanosleep, int, 600*49678444Schristos (struct timespec const *__rqtp, struct timespec *__rmtp) 601*49678444Schristos _GL_ARG_NONNULL ((1))); 602*49678444Schristos # endif 603*49678444Schristos _GL_CXXALIAS_SYS (nanosleep, int, 604*49678444Schristos (struct timespec const *__rqtp, struct timespec *__rmtp)); 605*49678444Schristos # endif 606*49678444Schristos _GL_CXXALIASWARN (nanosleep); 607*49678444Schristos # endif 608*49678444Schristos 609*49678444Schristos /* Initialize time conversion information. */ 610*49678444Schristos # if 0 611*49678444Schristos # if GNULIB_PORTCHECK 612*49678444Schristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 613*49678444Schristos # undef tzset 614*49678444Schristos # define tzset rpl_tzset 615*49678444Schristos # endif 616*49678444Schristos _GL_FUNCDECL_RPL (tzset, void, (void)); 617*49678444Schristos _GL_CXXALIAS_RPL (tzset, void, (void)); 618*49678444Schristos # else 619*49678444Schristos # if ! 1 620*49678444Schristos _GL_FUNCDECL_SYS (tzset, void, (void)); 621*49678444Schristos # endif 622*49678444Schristos _GL_CXXALIAS_SYS (tzset, void, (void)); 623*49678444Schristos # endif 624*49678444Schristos _GL_CXXALIASWARN (tzset); 625*49678444Schristos # endif 626*49678444Schristos 627*49678444Schristos /* Return the 'time_t' representation of TP and normalize TP. */ 628*49678444Schristos # if 0 629*49678444Schristos # if GNULIB_PORTCHECK 630*49678444Schristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 631*49678444Schristos # define mktime rpl_mktime 632*49678444Schristos # endif 633*49678444Schristos _GL_FUNCDECL_RPL (mktime, time_t, (struct tm *__tp) _GL_ARG_NONNULL ((1))); 634*49678444Schristos _GL_CXXALIAS_RPL (mktime, time_t, (struct tm *__tp)); 635*49678444Schristos # else 636*49678444Schristos _GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp)); 637*49678444Schristos # endif 638*49678444Schristos # if __GLIBC__ >= 2 639*49678444Schristos _GL_CXXALIASWARN (mktime); 640*49678444Schristos # endif 641*49678444Schristos # endif 642*49678444Schristos 643*49678444Schristos /* Convert TIMER to RESULT, assuming local time and UTC respectively. See 644*49678444Schristos <https://pubs.opengroup.org/onlinepubs/9699919799/functions/localtime_r.html> and 645*49678444Schristos <https://pubs.opengroup.org/onlinepubs/9699919799/functions/gmtime_r.html>. */ 646*49678444Schristos # if 1 647*49678444Schristos # if 0 648*49678444Schristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 649*49678444Schristos # undef localtime_r 650*49678444Schristos # define localtime_r rpl_localtime_r 651*49678444Schristos # endif 652*49678444Schristos _GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer, 653*49678444Schristos struct tm *restrict __result) 654*49678444Schristos _GL_ARG_NONNULL ((1, 2))); 655*49678444Schristos _GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer, 656*49678444Schristos struct tm *restrict __result)); 657*49678444Schristos # else 658*49678444Schristos # if ! 1 659*49678444Schristos _GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer, 660*49678444Schristos struct tm *restrict __result) 661*49678444Schristos _GL_ARG_NONNULL ((1, 2))); 662*49678444Schristos # endif 663*49678444Schristos _GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer, 664*49678444Schristos struct tm *restrict __result)); 665*49678444Schristos # endif 666*49678444Schristos # if 1 667*49678444Schristos _GL_CXXALIASWARN (localtime_r); 668*49678444Schristos # endif 669*49678444Schristos # if 0 670*49678444Schristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 671*49678444Schristos # undef gmtime_r 672*49678444Schristos # define gmtime_r rpl_gmtime_r 673*49678444Schristos # endif 674*49678444Schristos _GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer, 675*49678444Schristos struct tm *restrict __result) 676*49678444Schristos _GL_ARG_NONNULL ((1, 2))); 677*49678444Schristos _GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer, 678*49678444Schristos struct tm *restrict __result)); 679*49678444Schristos # else 680*49678444Schristos # if ! 1 681*49678444Schristos _GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, 682*49678444Schristos struct tm *restrict __result) 683*49678444Schristos _GL_ARG_NONNULL ((1, 2))); 684*49678444Schristos # endif 685*49678444Schristos _GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, 686*49678444Schristos struct tm *restrict __result)); 687*49678444Schristos # endif 688*49678444Schristos # if 1 689*49678444Schristos _GL_CXXALIASWARN (gmtime_r); 690*49678444Schristos # endif 691*49678444Schristos # endif 692*49678444Schristos 693*49678444Schristos /* Convert TIMER to RESULT, assuming local time and UTC respectively. See 694*49678444Schristos <https://pubs.opengroup.org/onlinepubs/9699919799/functions/localtime.html> and 695*49678444Schristos <https://pubs.opengroup.org/onlinepubs/9699919799/functions/gmtime.html>. */ 696*49678444Schristos # if 0 || 0 697*49678444Schristos # if 0 698*49678444Schristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 699*49678444Schristos # undef localtime 700*49678444Schristos # define localtime rpl_localtime 701*49678444Schristos # endif 702*49678444Schristos _GL_FUNCDECL_RPL (localtime, struct tm *, (time_t const *__timer) 703*49678444Schristos _GL_ARG_NONNULL ((1))); 704*49678444Schristos _GL_CXXALIAS_RPL (localtime, struct tm *, (time_t const *__timer)); 705*49678444Schristos # else 706*49678444Schristos _GL_CXXALIAS_SYS (localtime, struct tm *, (time_t const *__timer)); 707*49678444Schristos # endif 708*49678444Schristos # if __GLIBC__ >= 2 709*49678444Schristos _GL_CXXALIASWARN (localtime); 710*49678444Schristos # endif 711*49678444Schristos # endif 712*49678444Schristos 713*49678444Schristos # if 0 || 0 714*49678444Schristos # if 0 715*49678444Schristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 716*49678444Schristos # undef gmtime 717*49678444Schristos # define gmtime rpl_gmtime 718*49678444Schristos # endif 719*49678444Schristos _GL_FUNCDECL_RPL (gmtime, struct tm *, (time_t const *__timer) 720*49678444Schristos _GL_ARG_NONNULL ((1))); 721*49678444Schristos _GL_CXXALIAS_RPL (gmtime, struct tm *, (time_t const *__timer)); 722*49678444Schristos # else 723*49678444Schristos _GL_CXXALIAS_SYS (gmtime, struct tm *, (time_t const *__timer)); 724*49678444Schristos # endif 725*49678444Schristos _GL_CXXALIASWARN (gmtime); 726*49678444Schristos # endif 727*49678444Schristos 728*49678444Schristos /* Parse BUF as a timestamp, assuming FORMAT specifies its layout, and store 729*49678444Schristos the resulting broken-down time into TM. See 730*49678444Schristos <https://pubs.opengroup.org/onlinepubs/9699919799/functions/strptime.html>. */ 731*49678444Schristos # if 0 732*49678444Schristos # if ! 1 733*49678444Schristos _GL_FUNCDECL_SYS (strptime, char *, (char const *restrict __buf, 734*49678444Schristos char const *restrict __format, 735*49678444Schristos struct tm *restrict __tm) 736*49678444Schristos _GL_ARG_NONNULL ((1, 2, 3))); 737*49678444Schristos # endif 738*49678444Schristos _GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf, 739*49678444Schristos char const *restrict __format, 740*49678444Schristos struct tm *restrict __tm)); 741*49678444Schristos _GL_CXXALIASWARN (strptime); 742*49678444Schristos # endif 743*49678444Schristos 744*49678444Schristos /* Convert *TP to a date and time string. See 745*49678444Schristos <https://pubs.opengroup.org/onlinepubs/9699919799/functions/ctime.html>. */ 746*49678444Schristos # if 0 747*49678444Schristos # if GNULIB_PORTCHECK 748*49678444Schristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 749*49678444Schristos # define ctime rpl_ctime 750*49678444Schristos # endif 751*49678444Schristos _GL_FUNCDECL_RPL (ctime, char *, (time_t const *__tp) 752*49678444Schristos _GL_ARG_NONNULL ((1))); 753*49678444Schristos _GL_CXXALIAS_RPL (ctime, char *, (time_t const *__tp)); 754*49678444Schristos # else 755*49678444Schristos _GL_CXXALIAS_SYS (ctime, char *, (time_t const *__tp)); 756*49678444Schristos # endif 757*49678444Schristos # if __GLIBC__ >= 2 758*49678444Schristos _GL_CXXALIASWARN (ctime); 759*49678444Schristos # endif 760*49678444Schristos # endif 761*49678444Schristos 762*49678444Schristos /* Convert *TP to a date and time string. See 763*49678444Schristos <https://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html>. */ 764*49678444Schristos # if 0 765*49678444Schristos # if GNULIB_PORTCHECK 766*49678444Schristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 767*49678444Schristos # define strftime rpl_strftime 768*49678444Schristos # endif 769*49678444Schristos _GL_FUNCDECL_RPL (strftime, size_t, 770*49678444Schristos (char *restrict __buf, size_t __bufsize, 771*49678444Schristos const char *restrict __fmt, const struct tm *restrict __tp) 772*49678444Schristos _GL_ARG_NONNULL ((1, 3, 4))); 773*49678444Schristos _GL_CXXALIAS_RPL (strftime, size_t, 774*49678444Schristos (char *restrict __buf, size_t __bufsize, 775*49678444Schristos const char *restrict __fmt, const struct tm *restrict __tp)); 776*49678444Schristos # else 777*49678444Schristos _GL_CXXALIAS_SYS (strftime, size_t, 778*49678444Schristos (char *restrict __buf, size_t __bufsize, 779*49678444Schristos const char *restrict __fmt, const struct tm *restrict __tp)); 780*49678444Schristos # endif 781*49678444Schristos # if __GLIBC__ >= 2 782*49678444Schristos _GL_CXXALIASWARN (strftime); 783*49678444Schristos # endif 784*49678444Schristos # endif 785*49678444Schristos 786*49678444Schristos # if defined _GNU_SOURCE && 0 && ! 0 787*49678444Schristos typedef struct tm_zone *timezone_t; 788*49678444Schristos _GL_FUNCDECL_SYS (tzalloc, timezone_t, (char const *__name)); 789*49678444Schristos _GL_CXXALIAS_SYS (tzalloc, timezone_t, (char const *__name)); 790*49678444Schristos _GL_FUNCDECL_SYS (tzfree, void, (timezone_t __tz)); 791*49678444Schristos _GL_CXXALIAS_SYS (tzfree, void, (timezone_t __tz)); 792*49678444Schristos _GL_FUNCDECL_SYS (localtime_rz, struct tm *, 793*49678444Schristos (timezone_t __tz, time_t const *restrict __timer, 794*49678444Schristos struct tm *restrict __result) _GL_ARG_NONNULL ((2, 3))); 795*49678444Schristos _GL_CXXALIAS_SYS (localtime_rz, struct tm *, 796*49678444Schristos (timezone_t __tz, time_t const *restrict __timer, 797*49678444Schristos struct tm *restrict __result)); 798*49678444Schristos _GL_FUNCDECL_SYS (mktime_z, time_t, 799*49678444Schristos (timezone_t __tz, struct tm *restrict __result) 800*49678444Schristos _GL_ARG_NONNULL ((2))); 801*49678444Schristos _GL_CXXALIAS_SYS (mktime_z, time_t, 802*49678444Schristos (timezone_t __tz, struct tm *restrict __result)); 803*49678444Schristos # endif 804*49678444Schristos 805*49678444Schristos /* Convert TM to a time_t value, assuming UTC. */ 806*49678444Schristos # if 0 807*49678444Schristos # if GNULIB_PORTCHECK 808*49678444Schristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 809*49678444Schristos # undef timegm 810*49678444Schristos # define timegm rpl_timegm 811*49678444Schristos # endif 812*49678444Schristos _GL_FUNCDECL_RPL (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1))); 813*49678444Schristos _GL_CXXALIAS_RPL (timegm, time_t, (struct tm *__tm)); 814*49678444Schristos # else 815*49678444Schristos # if ! 1 816*49678444Schristos _GL_FUNCDECL_SYS (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1))); 817*49678444Schristos # endif 818*49678444Schristos _GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm)); 819*49678444Schristos # endif 820*49678444Schristos _GL_CXXALIASWARN (timegm); 821*49678444Schristos # endif 822*49678444Schristos 823*49678444Schristos /* Encourage applications to avoid unsafe functions that can overrun 824*49678444Schristos buffers when given outlandish struct tm values. Portable 825*49678444Schristos applications should use strftime (or even sprintf) instead. */ 826*49678444Schristos # if defined GNULIB_POSIXCHECK 827*49678444Schristos # undef asctime 828*49678444Schristos _GL_WARN_ON_USE (asctime, "asctime can overrun buffers in some cases - " 829*49678444Schristos "better use strftime (or even sprintf) instead"); 830*49678444Schristos # endif 831*49678444Schristos # if defined GNULIB_POSIXCHECK 832*49678444Schristos # undef asctime_r 833*49678444Schristos _GL_WARN_ON_USE (asctime, "asctime_r can overrun buffers in some cases - " 834*49678444Schristos "better use strftime (or even sprintf) instead"); 835*49678444Schristos # endif 836*49678444Schristos # if defined GNULIB_POSIXCHECK 837*49678444Schristos # undef ctime 838*49678444Schristos _GL_WARN_ON_USE (asctime, "ctime can overrun buffers in some cases - " 839*49678444Schristos "better use strftime (or even sprintf) instead"); 840*49678444Schristos # endif 841*49678444Schristos # if defined GNULIB_POSIXCHECK 842*49678444Schristos # undef ctime_r 843*49678444Schristos _GL_WARN_ON_USE (asctime, "ctime_r can overrun buffers in some cases - " 844*49678444Schristos "better use strftime (or even sprintf) instead"); 845*49678444Schristos # endif 846*49678444Schristos 847*49678444Schristos #endif 848