132512b68Schristos /* This file is automatically generated. DO NOT EDIT! */ 2*fd82c4c4Schristos /* Generated from: NetBSD: mknative-gdb,v 1.12 2020/09/17 16:54:31 christos Exp */ 332512b68Schristos /* Generated from: NetBSD: mknative.common,v 1.16 2018/04/15 15:13:37 christos Exp */ 432512b68Schristos 532512b68Schristos /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ 632512b68Schristos /* A more-standard <time.h>. 732512b68Schristos 832512b68Schristos Copyright (C) 2007-2020 Free Software Foundation, Inc. 932512b68Schristos 1032512b68Schristos This program is free software; you can redistribute it and/or modify 1132512b68Schristos it under the terms of the GNU General Public License as published by 1232512b68Schristos the Free Software Foundation; either version 3, or (at your option) 1332512b68Schristos any later version. 1432512b68Schristos 1532512b68Schristos This program is distributed in the hope that it will be useful, 1632512b68Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of 1732512b68Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1832512b68Schristos GNU General Public License for more details. 1932512b68Schristos 2032512b68Schristos You should have received a copy of the GNU General Public License 2132512b68Schristos along with this program; if not, see <https://www.gnu.org/licenses/>. */ 2232512b68Schristos 2332512b68Schristos #if __GNUC__ >= 3 2432512b68Schristos #pragma GCC system_header 2532512b68Schristos #endif 2632512b68Schristos 2732512b68Schristos 2832512b68Schristos /* Don't get in the way of glibc when it includes time.h merely to 2932512b68Schristos declare a few standard symbols, rather than to declare all the 3032512b68Schristos symbols. (However, skip this for MinGW as it treats __need_time_t 3132512b68Schristos incompatibly.) Also, Solaris 8 <time.h> eventually includes itself 3232512b68Schristos recursively; if that is happening, just include the system <time.h> 3332512b68Schristos without adding our own declarations. */ 3432512b68Schristos #if (((defined __need_time_t || defined __need_clock_t \ 3532512b68Schristos || defined __need_timespec) \ 3632512b68Schristos && !defined __MINGW32__) \ 3732512b68Schristos || defined _GL_TIME_H) 3832512b68Schristos 3932512b68Schristos # include_next <time.h> 4032512b68Schristos 4132512b68Schristos #else 4232512b68Schristos 4332512b68Schristos # define _GL_TIME_H 4432512b68Schristos 4532512b68Schristos /* mingw's <time.h> provides the functions asctime_r, ctime_r, gmtime_r, 4632512b68Schristos localtime_r only if <unistd.h> or <pthread.h> has been included before. */ 4732512b68Schristos # if defined __MINGW32__ 4832512b68Schristos # include <unistd.h> 4932512b68Schristos # endif 5032512b68Schristos 5132512b68Schristos # include_next <time.h> 5232512b68Schristos 5332512b68Schristos /* NetBSD 5.0 mis-defines NULL. */ 5432512b68Schristos # include <stddef.h> 5532512b68Schristos 5632512b68Schristos /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 5732512b68Schristos /* C++ compatible function declaration macros. 5832512b68Schristos Copyright (C) 2010-2020 Free Software Foundation, Inc. 5932512b68Schristos 6032512b68Schristos This program is free software: you can redistribute it and/or modify it 6132512b68Schristos under the terms of the GNU General Public License as published 6232512b68Schristos by the Free Software Foundation; either version 3 of the License, or 6332512b68Schristos (at your option) any later version. 6432512b68Schristos 6532512b68Schristos This program is distributed in the hope that it will be useful, 6632512b68Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of 6732512b68Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 6832512b68Schristos General Public License for more details. 6932512b68Schristos 7032512b68Schristos You should have received a copy of the GNU General Public License 7132512b68Schristos along with this program. If not, see <https://www.gnu.org/licenses/>. */ 7232512b68Schristos 7332512b68Schristos #ifndef _GL_CXXDEFS_H 7432512b68Schristos #define _GL_CXXDEFS_H 7532512b68Schristos 7632512b68Schristos /* Begin/end the GNULIB_NAMESPACE namespace. */ 7732512b68Schristos #if defined __cplusplus && defined GNULIB_NAMESPACE 7832512b68Schristos # define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE { 7932512b68Schristos # define _GL_END_NAMESPACE } 8032512b68Schristos #else 8132512b68Schristos # define _GL_BEGIN_NAMESPACE 8232512b68Schristos # define _GL_END_NAMESPACE 8332512b68Schristos #endif 8432512b68Schristos 8532512b68Schristos /* The three most frequent use cases of these macros are: 8632512b68Schristos 8732512b68Schristos * For providing a substitute for a function that is missing on some 8832512b68Schristos platforms, but is declared and works fine on the platforms on which 8932512b68Schristos it exists: 9032512b68Schristos 9132512b68Schristos #if @GNULIB_FOO@ 9232512b68Schristos # if !@HAVE_FOO@ 9332512b68Schristos _GL_FUNCDECL_SYS (foo, ...); 9432512b68Schristos # endif 9532512b68Schristos _GL_CXXALIAS_SYS (foo, ...); 9632512b68Schristos _GL_CXXALIASWARN (foo); 9732512b68Schristos #elif defined GNULIB_POSIXCHECK 9832512b68Schristos ... 9932512b68Schristos #endif 10032512b68Schristos 10132512b68Schristos * For providing a replacement for a function that exists on all platforms, 10232512b68Schristos but is broken/insufficient and needs to be replaced on some platforms: 10332512b68Schristos 10432512b68Schristos #if @GNULIB_FOO@ 10532512b68Schristos # if @REPLACE_FOO@ 10632512b68Schristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 10732512b68Schristos # undef foo 10832512b68Schristos # define foo rpl_foo 10932512b68Schristos # endif 11032512b68Schristos _GL_FUNCDECL_RPL (foo, ...); 11132512b68Schristos _GL_CXXALIAS_RPL (foo, ...); 11232512b68Schristos # else 11332512b68Schristos _GL_CXXALIAS_SYS (foo, ...); 11432512b68Schristos # endif 11532512b68Schristos _GL_CXXALIASWARN (foo); 11632512b68Schristos #elif defined GNULIB_POSIXCHECK 11732512b68Schristos ... 11832512b68Schristos #endif 11932512b68Schristos 12032512b68Schristos * For providing a replacement for a function that exists on some platforms 12132512b68Schristos but is broken/insufficient and needs to be replaced on some of them and 12232512b68Schristos is additionally either missing or undeclared on some other platforms: 12332512b68Schristos 12432512b68Schristos #if @GNULIB_FOO@ 12532512b68Schristos # if @REPLACE_FOO@ 12632512b68Schristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 12732512b68Schristos # undef foo 12832512b68Schristos # define foo rpl_foo 12932512b68Schristos # endif 13032512b68Schristos _GL_FUNCDECL_RPL (foo, ...); 13132512b68Schristos _GL_CXXALIAS_RPL (foo, ...); 13232512b68Schristos # else 13332512b68Schristos # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ 13432512b68Schristos _GL_FUNCDECL_SYS (foo, ...); 13532512b68Schristos # endif 13632512b68Schristos _GL_CXXALIAS_SYS (foo, ...); 13732512b68Schristos # endif 13832512b68Schristos _GL_CXXALIASWARN (foo); 13932512b68Schristos #elif defined GNULIB_POSIXCHECK 14032512b68Schristos ... 14132512b68Schristos #endif 14232512b68Schristos */ 14332512b68Schristos 14432512b68Schristos /* _GL_EXTERN_C declaration; 14532512b68Schristos performs the declaration with C linkage. */ 14632512b68Schristos #if defined __cplusplus 14732512b68Schristos # define _GL_EXTERN_C extern "C" 14832512b68Schristos #else 14932512b68Schristos # define _GL_EXTERN_C extern 15032512b68Schristos #endif 15132512b68Schristos 15232512b68Schristos /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); 15332512b68Schristos declares a replacement function, named rpl_func, with the given prototype, 15432512b68Schristos consisting of return type, parameters, and attributes. 15532512b68Schristos Example: 15632512b68Schristos _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) 15732512b68Schristos _GL_ARG_NONNULL ((1))); 15832512b68Schristos */ 15932512b68Schristos #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ 16032512b68Schristos _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) 16132512b68Schristos #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ 16232512b68Schristos _GL_EXTERN_C rettype rpl_func parameters_and_attributes 16332512b68Schristos 16432512b68Schristos /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); 16532512b68Schristos declares the system function, named func, with the given prototype, 16632512b68Schristos consisting of return type, parameters, and attributes. 16732512b68Schristos Example: 16832512b68Schristos _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) 16932512b68Schristos _GL_ARG_NONNULL ((1))); 17032512b68Schristos */ 17132512b68Schristos #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ 17232512b68Schristos _GL_EXTERN_C rettype func parameters_and_attributes 17332512b68Schristos 17432512b68Schristos /* _GL_CXXALIAS_RPL (func, rettype, parameters); 17532512b68Schristos declares a C++ alias called GNULIB_NAMESPACE::func 17632512b68Schristos that redirects to rpl_func, if GNULIB_NAMESPACE is defined. 17732512b68Schristos Example: 17832512b68Schristos _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); 17932512b68Schristos 18032512b68Schristos Wrapping rpl_func in an object with an inline conversion operator 18132512b68Schristos avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is 18232512b68Schristos actually used in the program. */ 18332512b68Schristos #define _GL_CXXALIAS_RPL(func,rettype,parameters) \ 18432512b68Schristos _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) 18532512b68Schristos #if defined __cplusplus && defined GNULIB_NAMESPACE 18632512b68Schristos # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 18732512b68Schristos namespace GNULIB_NAMESPACE \ 18832512b68Schristos { \ 18932512b68Schristos static const struct _gl_ ## func ## _wrapper \ 19032512b68Schristos { \ 19132512b68Schristos typedef rettype (*type) parameters; \ 19232512b68Schristos \ 19332512b68Schristos inline operator type () const \ 19432512b68Schristos { \ 19532512b68Schristos return ::rpl_func; \ 19632512b68Schristos } \ 19732512b68Schristos } func = {}; \ 19832512b68Schristos } \ 19932512b68Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 20032512b68Schristos #else 20132512b68Schristos # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 20232512b68Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 20332512b68Schristos #endif 20432512b68Schristos 20532512b68Schristos /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); 20632512b68Schristos is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); 20732512b68Schristos except that the C function rpl_func may have a slightly different 20832512b68Schristos declaration. A cast is used to silence the "invalid conversion" error 20932512b68Schristos that would otherwise occur. */ 21032512b68Schristos #if defined __cplusplus && defined GNULIB_NAMESPACE 21132512b68Schristos # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 21232512b68Schristos namespace GNULIB_NAMESPACE \ 21332512b68Schristos { \ 21432512b68Schristos static const struct _gl_ ## func ## _wrapper \ 21532512b68Schristos { \ 21632512b68Schristos typedef rettype (*type) parameters; \ 21732512b68Schristos \ 21832512b68Schristos inline operator type () const \ 21932512b68Schristos { \ 22032512b68Schristos return reinterpret_cast<type>(::rpl_func); \ 22132512b68Schristos } \ 22232512b68Schristos } func = {}; \ 22332512b68Schristos } \ 22432512b68Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 22532512b68Schristos #else 22632512b68Schristos # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 22732512b68Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 22832512b68Schristos #endif 22932512b68Schristos 23032512b68Schristos /* _GL_CXXALIAS_SYS (func, rettype, parameters); 23132512b68Schristos declares a C++ alias called GNULIB_NAMESPACE::func 23232512b68Schristos that redirects to the system provided function func, if GNULIB_NAMESPACE 23332512b68Schristos is defined. 23432512b68Schristos Example: 23532512b68Schristos _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); 23632512b68Schristos 23732512b68Schristos Wrapping func in an object with an inline conversion operator 23832512b68Schristos avoids a reference to func unless GNULIB_NAMESPACE::func is 23932512b68Schristos actually used in the program. */ 24032512b68Schristos #if defined __cplusplus && defined GNULIB_NAMESPACE 24132512b68Schristos # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 24232512b68Schristos namespace GNULIB_NAMESPACE \ 24332512b68Schristos { \ 24432512b68Schristos static const struct _gl_ ## func ## _wrapper \ 24532512b68Schristos { \ 24632512b68Schristos typedef rettype (*type) parameters; \ 24732512b68Schristos \ 24832512b68Schristos inline operator type () const \ 24932512b68Schristos { \ 25032512b68Schristos return ::func; \ 25132512b68Schristos } \ 25232512b68Schristos } func = {}; \ 25332512b68Schristos } \ 25432512b68Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 25532512b68Schristos #else 25632512b68Schristos # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 25732512b68Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 25832512b68Schristos #endif 25932512b68Schristos 26032512b68Schristos /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); 26132512b68Schristos is like _GL_CXXALIAS_SYS (func, rettype, parameters); 26232512b68Schristos except that the C function func may have a slightly different declaration. 26332512b68Schristos A cast is used to silence the "invalid conversion" error that would 26432512b68Schristos otherwise occur. */ 26532512b68Schristos #if defined __cplusplus && defined GNULIB_NAMESPACE 26632512b68Schristos # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 26732512b68Schristos namespace GNULIB_NAMESPACE \ 26832512b68Schristos { \ 26932512b68Schristos static const struct _gl_ ## func ## _wrapper \ 27032512b68Schristos { \ 27132512b68Schristos typedef rettype (*type) parameters; \ 27232512b68Schristos \ 27332512b68Schristos inline operator type () const \ 27432512b68Schristos { \ 27532512b68Schristos return reinterpret_cast<type>(::func); \ 27632512b68Schristos } \ 27732512b68Schristos } func = {}; \ 27832512b68Schristos } \ 27932512b68Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 28032512b68Schristos #else 28132512b68Schristos # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 28232512b68Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 28332512b68Schristos #endif 28432512b68Schristos 28532512b68Schristos /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); 28632512b68Schristos is like _GL_CXXALIAS_SYS (func, rettype, parameters); 28732512b68Schristos except that the C function is picked among a set of overloaded functions, 28832512b68Schristos namely the one with rettype2 and parameters2. Two consecutive casts 28932512b68Schristos are used to silence the "cannot find a match" and "invalid conversion" 29032512b68Schristos errors that would otherwise occur. */ 29132512b68Schristos #if defined __cplusplus && defined GNULIB_NAMESPACE 29232512b68Schristos /* The outer cast must be a reinterpret_cast. 29332512b68Schristos The inner cast: When the function is defined as a set of overloaded 29432512b68Schristos functions, it works as a static_cast<>, choosing the designated variant. 29532512b68Schristos When the function is defined as a single variant, it works as a 29632512b68Schristos reinterpret_cast<>. The parenthesized cast syntax works both ways. */ 29732512b68Schristos # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 29832512b68Schristos namespace GNULIB_NAMESPACE \ 29932512b68Schristos { \ 30032512b68Schristos static const struct _gl_ ## func ## _wrapper \ 30132512b68Schristos { \ 30232512b68Schristos typedef rettype (*type) parameters; \ 30332512b68Schristos \ 30432512b68Schristos inline operator type () const \ 30532512b68Schristos { \ 30632512b68Schristos return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \ 30732512b68Schristos } \ 30832512b68Schristos } func = {}; \ 30932512b68Schristos } \ 31032512b68Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 31132512b68Schristos #else 31232512b68Schristos # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 31332512b68Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 31432512b68Schristos #endif 31532512b68Schristos 31632512b68Schristos /* _GL_CXXALIASWARN (func); 31732512b68Schristos causes a warning to be emitted when ::func is used but not when 31832512b68Schristos GNULIB_NAMESPACE::func is used. func must be defined without overloaded 31932512b68Schristos variants. */ 32032512b68Schristos #if defined __cplusplus && defined GNULIB_NAMESPACE 32132512b68Schristos # define _GL_CXXALIASWARN(func) \ 32232512b68Schristos _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) 32332512b68Schristos # define _GL_CXXALIASWARN_1(func,namespace) \ 32432512b68Schristos _GL_CXXALIASWARN_2 (func, namespace) 32532512b68Schristos /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 32632512b68Schristos we enable the warning only when not optimizing. */ 32732512b68Schristos # if !__OPTIMIZE__ 32832512b68Schristos # define _GL_CXXALIASWARN_2(func,namespace) \ 32932512b68Schristos _GL_WARN_ON_USE (func, \ 33032512b68Schristos "The symbol ::" #func " refers to the system function. " \ 33132512b68Schristos "Use " #namespace "::" #func " instead.") 33232512b68Schristos # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 33332512b68Schristos # define _GL_CXXALIASWARN_2(func,namespace) \ 33432512b68Schristos extern __typeof__ (func) func 33532512b68Schristos # else 33632512b68Schristos # define _GL_CXXALIASWARN_2(func,namespace) \ 33732512b68Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 33832512b68Schristos # endif 33932512b68Schristos #else 34032512b68Schristos # define _GL_CXXALIASWARN(func) \ 34132512b68Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 34232512b68Schristos #endif 34332512b68Schristos 34432512b68Schristos /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); 34532512b68Schristos causes a warning to be emitted when the given overloaded variant of ::func 34632512b68Schristos is used but not when GNULIB_NAMESPACE::func is used. */ 34732512b68Schristos #if defined __cplusplus && defined GNULIB_NAMESPACE 34832512b68Schristos # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 34932512b68Schristos _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ 35032512b68Schristos GNULIB_NAMESPACE) 35132512b68Schristos # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ 35232512b68Schristos _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) 35332512b68Schristos /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 35432512b68Schristos we enable the warning only when not optimizing. */ 35532512b68Schristos # if !__OPTIMIZE__ 35632512b68Schristos # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 35732512b68Schristos _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \ 35832512b68Schristos "The symbol ::" #func " refers to the system function. " \ 35932512b68Schristos "Use " #namespace "::" #func " instead.") 36032512b68Schristos # else 36132512b68Schristos # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 36232512b68Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 36332512b68Schristos # endif 36432512b68Schristos #else 36532512b68Schristos # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 36632512b68Schristos _GL_EXTERN_C int _gl_cxxalias_dummy 36732512b68Schristos #endif 36832512b68Schristos 36932512b68Schristos #endif /* _GL_CXXDEFS_H */ 37032512b68Schristos 37132512b68Schristos /* The definition of _GL_ARG_NONNULL is copied here. */ 37232512b68Schristos /* A C macro for declaring that specific arguments must not be NULL. 37332512b68Schristos Copyright (C) 2009-2020 Free Software Foundation, Inc. 37432512b68Schristos 37532512b68Schristos This program is free software: you can redistribute it and/or modify it 37632512b68Schristos under the terms of the GNU General Public License as published 37732512b68Schristos by the Free Software Foundation; either version 3 of the License, or 37832512b68Schristos (at your option) any later version. 37932512b68Schristos 38032512b68Schristos This program is distributed in the hope that it will be useful, 38132512b68Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of 38232512b68Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 38332512b68Schristos General Public License for more details. 38432512b68Schristos 38532512b68Schristos You should have received a copy of the GNU General Public License 38632512b68Schristos along with this program. If not, see <https://www.gnu.org/licenses/>. */ 38732512b68Schristos 38832512b68Schristos /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools 38932512b68Schristos that the values passed as arguments n, ..., m must be non-NULL pointers. 39032512b68Schristos n = 1 stands for the first argument, n = 2 for the second argument etc. */ 39132512b68Schristos #ifndef _GL_ARG_NONNULL 39232512b68Schristos # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3 39332512b68Schristos # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) 39432512b68Schristos # else 39532512b68Schristos # define _GL_ARG_NONNULL(params) 39632512b68Schristos # endif 39732512b68Schristos #endif 39832512b68Schristos 39932512b68Schristos /* The definition of _GL_WARN_ON_USE is copied here. */ 40032512b68Schristos /* A C macro for emitting warnings if a function is used. 40132512b68Schristos Copyright (C) 2010-2020 Free Software Foundation, Inc. 40232512b68Schristos 40332512b68Schristos This program is free software: you can redistribute it and/or modify it 40432512b68Schristos under the terms of the GNU General Public License as published 40532512b68Schristos by the Free Software Foundation; either version 3 of the License, or 40632512b68Schristos (at your option) any later version. 40732512b68Schristos 40832512b68Schristos This program is distributed in the hope that it will be useful, 40932512b68Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of 41032512b68Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 41132512b68Schristos General Public License for more details. 41232512b68Schristos 41332512b68Schristos You should have received a copy of the GNU General Public License 41432512b68Schristos along with this program. If not, see <https://www.gnu.org/licenses/>. */ 41532512b68Schristos 41632512b68Schristos /* _GL_WARN_ON_USE (function, "literal string") issues a declaration 41732512b68Schristos for FUNCTION which will then trigger a compiler warning containing 41832512b68Schristos the text of "literal string" anywhere that function is called, if 41932512b68Schristos supported by the compiler. If the compiler does not support this 42032512b68Schristos feature, the macro expands to an unused extern declaration. 42132512b68Schristos 42232512b68Schristos _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the 42332512b68Schristos attribute used in _GL_WARN_ON_USE. If the compiler does not support 42432512b68Schristos this feature, it expands to empty. 42532512b68Schristos 42632512b68Schristos These macros are useful for marking a function as a potential 42732512b68Schristos portability trap, with the intent that "literal string" include 42832512b68Schristos instructions on the replacement function that should be used 42932512b68Schristos instead. 43032512b68Schristos _GL_WARN_ON_USE is for functions with 'extern' linkage. 43132512b68Schristos _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline' 43232512b68Schristos linkage. 43332512b68Schristos 43432512b68Schristos However, one of the reasons that a function is a portability trap is 43532512b68Schristos if it has the wrong signature. Declaring FUNCTION with a different 43632512b68Schristos signature in C is a compilation error, so this macro must use the 43732512b68Schristos same type as any existing declaration so that programs that avoid 43832512b68Schristos the problematic FUNCTION do not fail to compile merely because they 43932512b68Schristos included a header that poisoned the function. But this implies that 44032512b68Schristos _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already 44132512b68Schristos have a declaration. Use of this macro implies that there must not 44232512b68Schristos be any other macro hiding the declaration of FUNCTION; but 44332512b68Schristos undefining FUNCTION first is part of the poisoning process anyway 44432512b68Schristos (although for symbols that are provided only via a macro, the result 44532512b68Schristos is a compilation error rather than a warning containing 44632512b68Schristos "literal string"). Also note that in C++, it is only safe to use if 44732512b68Schristos FUNCTION has no overloads. 44832512b68Schristos 44932512b68Schristos For an example, it is possible to poison 'getline' by: 45032512b68Schristos - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]], 45132512b68Schristos [getline]) in configure.ac, which potentially defines 45232512b68Schristos HAVE_RAW_DECL_GETLINE 45332512b68Schristos - adding this code to a header that wraps the system <stdio.h>: 45432512b68Schristos #undef getline 45532512b68Schristos #if HAVE_RAW_DECL_GETLINE 45632512b68Schristos _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but" 45732512b68Schristos "not universally present; use the gnulib module getline"); 45832512b68Schristos #endif 45932512b68Schristos 46032512b68Schristos It is not possible to directly poison global variables. But it is 46132512b68Schristos possible to write a wrapper accessor function, and poison that 46232512b68Schristos (less common usage, like &environ, will cause a compilation error 46332512b68Schristos rather than issue the nice warning, but the end result of informing 46432512b68Schristos the developer about their portability problem is still achieved): 46532512b68Schristos #if HAVE_RAW_DECL_ENVIRON 46632512b68Schristos static char *** 46732512b68Schristos rpl_environ (void) { return &environ; } 46832512b68Schristos _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared"); 46932512b68Schristos # undef environ 47032512b68Schristos # define environ (*rpl_environ ()) 47132512b68Schristos #endif 47232512b68Schristos or better (avoiding contradictory use of 'static' and 'extern'): 47332512b68Schristos #if HAVE_RAW_DECL_ENVIRON 47432512b68Schristos static char *** 47532512b68Schristos _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared") 47632512b68Schristos rpl_environ (void) { return &environ; } 47732512b68Schristos # undef environ 47832512b68Schristos # define environ (*rpl_environ ()) 47932512b68Schristos #endif 48032512b68Schristos */ 48132512b68Schristos #ifndef _GL_WARN_ON_USE 48232512b68Schristos 48332512b68Schristos # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 48432512b68Schristos /* A compiler attribute is available in gcc versions 4.3.0 and later. */ 48532512b68Schristos # define _GL_WARN_ON_USE(function, message) \ 48632512b68Schristos extern __typeof__ (function) function __attribute__ ((__warning__ (message))) 48732512b68Schristos # define _GL_WARN_ON_USE_ATTRIBUTE(message) \ 48832512b68Schristos __attribute__ ((__warning__ (message))) 48932512b68Schristos # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 49032512b68Schristos /* Verify the existence of the function. */ 49132512b68Schristos # define _GL_WARN_ON_USE(function, message) \ 49232512b68Schristos extern __typeof__ (function) function 49332512b68Schristos # define _GL_WARN_ON_USE_ATTRIBUTE(message) 49432512b68Schristos # else /* Unsupported. */ 49532512b68Schristos # define _GL_WARN_ON_USE(function, message) \ 49632512b68Schristos _GL_WARN_EXTERN_C int _gl_warn_on_use 49732512b68Schristos # define _GL_WARN_ON_USE_ATTRIBUTE(message) 49832512b68Schristos # endif 49932512b68Schristos #endif 50032512b68Schristos 50132512b68Schristos /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string") 50232512b68Schristos is like _GL_WARN_ON_USE (function, "string"), except that in C++ mode the 50332512b68Schristos function is declared with the given prototype, consisting of return type, 50432512b68Schristos parameters, and attributes. 50532512b68Schristos This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does 50632512b68Schristos not work in this case. */ 50732512b68Schristos #ifndef _GL_WARN_ON_USE_CXX 50832512b68Schristos # if !defined __cplusplus 50932512b68Schristos # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 51032512b68Schristos _GL_WARN_ON_USE (function, msg) 51132512b68Schristos # else 51232512b68Schristos # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 51332512b68Schristos # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 51432512b68Schristos extern rettype function parameters_and_attributes \ 51532512b68Schristos __attribute__ ((__warning__ (msg))) 51632512b68Schristos # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 51732512b68Schristos /* Verify the existence of the function. */ 51832512b68Schristos # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 51932512b68Schristos extern rettype function parameters_and_attributes 52032512b68Schristos # else /* Unsupported. */ 52132512b68Schristos # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 52232512b68Schristos _GL_WARN_EXTERN_C int _gl_warn_on_use 52332512b68Schristos # endif 52432512b68Schristos # endif 52532512b68Schristos #endif 52632512b68Schristos 52732512b68Schristos /* _GL_WARN_EXTERN_C declaration; 52832512b68Schristos performs the declaration with C linkage. */ 52932512b68Schristos #ifndef _GL_WARN_EXTERN_C 53032512b68Schristos # if defined __cplusplus 53132512b68Schristos # define _GL_WARN_EXTERN_C extern "C" 53232512b68Schristos # else 53332512b68Schristos # define _GL_WARN_EXTERN_C extern 53432512b68Schristos # endif 53532512b68Schristos #endif 53632512b68Schristos 53732512b68Schristos /* Some systems don't define struct timespec (e.g., AIX 4.1). 53832512b68Schristos Or they define it with the wrong member names or define it in <sys/time.h> 53932512b68Schristos (e.g., FreeBSD circa 1997). Stock Mingw prior to 3.0 does not define it, 54032512b68Schristos but the pthreads-win32 library defines it in <pthread.h>. */ 54132512b68Schristos # if ! 1 54232512b68Schristos # if 0 54332512b68Schristos # include <sys/time.h> 54432512b68Schristos # elif 0 54532512b68Schristos # include <pthread.h> 54632512b68Schristos # elif 0 54732512b68Schristos # include <unistd.h> 54832512b68Schristos # else 54932512b68Schristos 55032512b68Schristos # ifdef __cplusplus 55132512b68Schristos extern "C" { 55232512b68Schristos # endif 55332512b68Schristos 55432512b68Schristos # if !GNULIB_defined_struct_timespec 55532512b68Schristos # undef timespec 55632512b68Schristos # define timespec rpl_timespec 55732512b68Schristos struct timespec 55832512b68Schristos { 55932512b68Schristos time_t tv_sec; 56032512b68Schristos long int tv_nsec; 56132512b68Schristos }; 56232512b68Schristos # define GNULIB_defined_struct_timespec 1 56332512b68Schristos # endif 56432512b68Schristos 56532512b68Schristos # ifdef __cplusplus 56632512b68Schristos } 56732512b68Schristos # endif 56832512b68Schristos 56932512b68Schristos # endif 57032512b68Schristos # endif 57132512b68Schristos 57232512b68Schristos # if !GNULIB_defined_struct_time_t_must_be_integral 57332512b68Schristos /* https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html 57432512b68Schristos requires time_t to be an integer type, even though C99 permits floating 57532512b68Schristos point. We don't know of any implementation that uses floating 57632512b68Schristos point, and it is much easier to write code that doesn't have to 57732512b68Schristos worry about that corner case, so we force the issue. */ 57832512b68Schristos struct __time_t_must_be_integral { 57932512b68Schristos unsigned int __floating_time_t_unsupported : (time_t) 1; 58032512b68Schristos }; 58132512b68Schristos # define GNULIB_defined_struct_time_t_must_be_integral 1 58232512b68Schristos # endif 58332512b68Schristos 58432512b68Schristos /* Sleep for at least RQTP seconds unless interrupted, If interrupted, 58532512b68Schristos return -1 and store the remaining time into RMTP. See 58632512b68Schristos <https://pubs.opengroup.org/onlinepubs/9699919799/functions/nanosleep.html>. */ 58732512b68Schristos # if 0 58832512b68Schristos # if GNULIB_PORTCHECK 58932512b68Schristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 59032512b68Schristos # define nanosleep rpl_nanosleep 59132512b68Schristos # endif 59232512b68Schristos _GL_FUNCDECL_RPL (nanosleep, int, 59332512b68Schristos (struct timespec const *__rqtp, struct timespec *__rmtp) 59432512b68Schristos _GL_ARG_NONNULL ((1))); 59532512b68Schristos _GL_CXXALIAS_RPL (nanosleep, int, 59632512b68Schristos (struct timespec const *__rqtp, struct timespec *__rmtp)); 59732512b68Schristos # else 59832512b68Schristos # if ! 1 59932512b68Schristos _GL_FUNCDECL_SYS (nanosleep, int, 60032512b68Schristos (struct timespec const *__rqtp, struct timespec *__rmtp) 60132512b68Schristos _GL_ARG_NONNULL ((1))); 60232512b68Schristos # endif 60332512b68Schristos _GL_CXXALIAS_SYS (nanosleep, int, 60432512b68Schristos (struct timespec const *__rqtp, struct timespec *__rmtp)); 60532512b68Schristos # endif 60632512b68Schristos _GL_CXXALIASWARN (nanosleep); 60732512b68Schristos # endif 60832512b68Schristos 60932512b68Schristos /* Initialize time conversion information. */ 61032512b68Schristos # if 0 61132512b68Schristos # if GNULIB_PORTCHECK 61232512b68Schristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 61332512b68Schristos # undef tzset 61432512b68Schristos # define tzset rpl_tzset 61532512b68Schristos # endif 61632512b68Schristos _GL_FUNCDECL_RPL (tzset, void, (void)); 61732512b68Schristos _GL_CXXALIAS_RPL (tzset, void, (void)); 61832512b68Schristos # else 61932512b68Schristos # if ! 1 62032512b68Schristos _GL_FUNCDECL_SYS (tzset, void, (void)); 62132512b68Schristos # endif 62232512b68Schristos _GL_CXXALIAS_SYS (tzset, void, (void)); 62332512b68Schristos # endif 62432512b68Schristos _GL_CXXALIASWARN (tzset); 62532512b68Schristos # endif 62632512b68Schristos 62732512b68Schristos /* Return the 'time_t' representation of TP and normalize TP. */ 62832512b68Schristos # if 0 62932512b68Schristos # if GNULIB_PORTCHECK 63032512b68Schristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 63132512b68Schristos # define mktime rpl_mktime 63232512b68Schristos # endif 63332512b68Schristos _GL_FUNCDECL_RPL (mktime, time_t, (struct tm *__tp) _GL_ARG_NONNULL ((1))); 63432512b68Schristos _GL_CXXALIAS_RPL (mktime, time_t, (struct tm *__tp)); 63532512b68Schristos # else 63632512b68Schristos _GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp)); 63732512b68Schristos # endif 63832512b68Schristos # if __GLIBC__ >= 2 63932512b68Schristos _GL_CXXALIASWARN (mktime); 64032512b68Schristos # endif 64132512b68Schristos # endif 64232512b68Schristos 64332512b68Schristos /* Convert TIMER to RESULT, assuming local time and UTC respectively. See 64432512b68Schristos <https://pubs.opengroup.org/onlinepubs/9699919799/functions/localtime_r.html> and 64532512b68Schristos <https://pubs.opengroup.org/onlinepubs/9699919799/functions/gmtime_r.html>. */ 64632512b68Schristos # if 1 64732512b68Schristos # if 0 64832512b68Schristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 64932512b68Schristos # undef localtime_r 65032512b68Schristos # define localtime_r rpl_localtime_r 65132512b68Schristos # endif 65232512b68Schristos _GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer, 65332512b68Schristos struct tm *restrict __result) 65432512b68Schristos _GL_ARG_NONNULL ((1, 2))); 65532512b68Schristos _GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer, 65632512b68Schristos struct tm *restrict __result)); 65732512b68Schristos # else 65832512b68Schristos # if ! 1 65932512b68Schristos _GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer, 66032512b68Schristos struct tm *restrict __result) 66132512b68Schristos _GL_ARG_NONNULL ((1, 2))); 66232512b68Schristos # endif 66332512b68Schristos _GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer, 66432512b68Schristos struct tm *restrict __result)); 66532512b68Schristos # endif 66632512b68Schristos # if 1 66732512b68Schristos _GL_CXXALIASWARN (localtime_r); 66832512b68Schristos # endif 66932512b68Schristos # if 0 67032512b68Schristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 67132512b68Schristos # undef gmtime_r 67232512b68Schristos # define gmtime_r rpl_gmtime_r 67332512b68Schristos # endif 67432512b68Schristos _GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer, 67532512b68Schristos struct tm *restrict __result) 67632512b68Schristos _GL_ARG_NONNULL ((1, 2))); 67732512b68Schristos _GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer, 67832512b68Schristos struct tm *restrict __result)); 67932512b68Schristos # else 68032512b68Schristos # if ! 1 68132512b68Schristos _GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, 68232512b68Schristos struct tm *restrict __result) 68332512b68Schristos _GL_ARG_NONNULL ((1, 2))); 68432512b68Schristos # endif 68532512b68Schristos _GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, 68632512b68Schristos struct tm *restrict __result)); 68732512b68Schristos # endif 68832512b68Schristos # if 1 68932512b68Schristos _GL_CXXALIASWARN (gmtime_r); 69032512b68Schristos # endif 69132512b68Schristos # endif 69232512b68Schristos 69332512b68Schristos /* Convert TIMER to RESULT, assuming local time and UTC respectively. See 69432512b68Schristos <https://pubs.opengroup.org/onlinepubs/9699919799/functions/localtime.html> and 69532512b68Schristos <https://pubs.opengroup.org/onlinepubs/9699919799/functions/gmtime.html>. */ 696*fd82c4c4Schristos # if 0 || 0 697*fd82c4c4Schristos # if 0 69832512b68Schristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 69932512b68Schristos # undef localtime 70032512b68Schristos # define localtime rpl_localtime 70132512b68Schristos # endif 70232512b68Schristos _GL_FUNCDECL_RPL (localtime, struct tm *, (time_t const *__timer) 70332512b68Schristos _GL_ARG_NONNULL ((1))); 70432512b68Schristos _GL_CXXALIAS_RPL (localtime, struct tm *, (time_t const *__timer)); 70532512b68Schristos # else 70632512b68Schristos _GL_CXXALIAS_SYS (localtime, struct tm *, (time_t const *__timer)); 70732512b68Schristos # endif 70832512b68Schristos # if __GLIBC__ >= 2 70932512b68Schristos _GL_CXXALIASWARN (localtime); 71032512b68Schristos # endif 71132512b68Schristos # endif 71232512b68Schristos 713*fd82c4c4Schristos # if 0 || 0 714*fd82c4c4Schristos # if 0 71532512b68Schristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 71632512b68Schristos # undef gmtime 71732512b68Schristos # define gmtime rpl_gmtime 71832512b68Schristos # endif 71932512b68Schristos _GL_FUNCDECL_RPL (gmtime, struct tm *, (time_t const *__timer) 72032512b68Schristos _GL_ARG_NONNULL ((1))); 72132512b68Schristos _GL_CXXALIAS_RPL (gmtime, struct tm *, (time_t const *__timer)); 72232512b68Schristos # else 72332512b68Schristos _GL_CXXALIAS_SYS (gmtime, struct tm *, (time_t const *__timer)); 72432512b68Schristos # endif 72532512b68Schristos _GL_CXXALIASWARN (gmtime); 72632512b68Schristos # endif 72732512b68Schristos 72832512b68Schristos /* Parse BUF as a timestamp, assuming FORMAT specifies its layout, and store 72932512b68Schristos the resulting broken-down time into TM. See 73032512b68Schristos <https://pubs.opengroup.org/onlinepubs/9699919799/functions/strptime.html>. */ 73132512b68Schristos # if 0 73232512b68Schristos # if ! 1 73332512b68Schristos _GL_FUNCDECL_SYS (strptime, char *, (char const *restrict __buf, 73432512b68Schristos char const *restrict __format, 73532512b68Schristos struct tm *restrict __tm) 73632512b68Schristos _GL_ARG_NONNULL ((1, 2, 3))); 73732512b68Schristos # endif 73832512b68Schristos _GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf, 73932512b68Schristos char const *restrict __format, 74032512b68Schristos struct tm *restrict __tm)); 74132512b68Schristos _GL_CXXALIASWARN (strptime); 74232512b68Schristos # endif 74332512b68Schristos 74432512b68Schristos /* Convert *TP to a date and time string. See 74532512b68Schristos <https://pubs.opengroup.org/onlinepubs/9699919799/functions/ctime.html>. */ 74632512b68Schristos # if 0 74732512b68Schristos # if GNULIB_PORTCHECK 74832512b68Schristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 74932512b68Schristos # define ctime rpl_ctime 75032512b68Schristos # endif 75132512b68Schristos _GL_FUNCDECL_RPL (ctime, char *, (time_t const *__tp) 75232512b68Schristos _GL_ARG_NONNULL ((1))); 75332512b68Schristos _GL_CXXALIAS_RPL (ctime, char *, (time_t const *__tp)); 75432512b68Schristos # else 75532512b68Schristos _GL_CXXALIAS_SYS (ctime, char *, (time_t const *__tp)); 75632512b68Schristos # endif 75732512b68Schristos # if __GLIBC__ >= 2 75832512b68Schristos _GL_CXXALIASWARN (ctime); 75932512b68Schristos # endif 76032512b68Schristos # endif 76132512b68Schristos 76232512b68Schristos /* Convert *TP to a date and time string. See 76332512b68Schristos <https://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html>. */ 76432512b68Schristos # if 0 76532512b68Schristos # if GNULIB_PORTCHECK 76632512b68Schristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 76732512b68Schristos # define strftime rpl_strftime 76832512b68Schristos # endif 76932512b68Schristos _GL_FUNCDECL_RPL (strftime, size_t, 77032512b68Schristos (char *restrict __buf, size_t __bufsize, 77132512b68Schristos const char *restrict __fmt, const struct tm *restrict __tp) 77232512b68Schristos _GL_ARG_NONNULL ((1, 3, 4))); 77332512b68Schristos _GL_CXXALIAS_RPL (strftime, size_t, 77432512b68Schristos (char *restrict __buf, size_t __bufsize, 77532512b68Schristos const char *restrict __fmt, const struct tm *restrict __tp)); 77632512b68Schristos # else 77732512b68Schristos _GL_CXXALIAS_SYS (strftime, size_t, 77832512b68Schristos (char *restrict __buf, size_t __bufsize, 77932512b68Schristos const char *restrict __fmt, const struct tm *restrict __tp)); 78032512b68Schristos # endif 78132512b68Schristos # if __GLIBC__ >= 2 78232512b68Schristos _GL_CXXALIASWARN (strftime); 78332512b68Schristos # endif 78432512b68Schristos # endif 78532512b68Schristos 78632512b68Schristos # if defined _GNU_SOURCE && 0 && ! 0 78732512b68Schristos typedef struct tm_zone *timezone_t; 78832512b68Schristos _GL_FUNCDECL_SYS (tzalloc, timezone_t, (char const *__name)); 78932512b68Schristos _GL_CXXALIAS_SYS (tzalloc, timezone_t, (char const *__name)); 79032512b68Schristos _GL_FUNCDECL_SYS (tzfree, void, (timezone_t __tz)); 79132512b68Schristos _GL_CXXALIAS_SYS (tzfree, void, (timezone_t __tz)); 79232512b68Schristos _GL_FUNCDECL_SYS (localtime_rz, struct tm *, 79332512b68Schristos (timezone_t __tz, time_t const *restrict __timer, 79432512b68Schristos struct tm *restrict __result) _GL_ARG_NONNULL ((2, 3))); 79532512b68Schristos _GL_CXXALIAS_SYS (localtime_rz, struct tm *, 79632512b68Schristos (timezone_t __tz, time_t const *restrict __timer, 79732512b68Schristos struct tm *restrict __result)); 79832512b68Schristos _GL_FUNCDECL_SYS (mktime_z, time_t, 79932512b68Schristos (timezone_t __tz, struct tm *restrict __result) 80032512b68Schristos _GL_ARG_NONNULL ((2))); 80132512b68Schristos _GL_CXXALIAS_SYS (mktime_z, time_t, 80232512b68Schristos (timezone_t __tz, struct tm *restrict __result)); 80332512b68Schristos # endif 80432512b68Schristos 80532512b68Schristos /* Convert TM to a time_t value, assuming UTC. */ 80632512b68Schristos # if 0 80732512b68Schristos # if GNULIB_PORTCHECK 80832512b68Schristos # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 80932512b68Schristos # undef timegm 81032512b68Schristos # define timegm rpl_timegm 81132512b68Schristos # endif 81232512b68Schristos _GL_FUNCDECL_RPL (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1))); 81332512b68Schristos _GL_CXXALIAS_RPL (timegm, time_t, (struct tm *__tm)); 81432512b68Schristos # else 81532512b68Schristos # if ! 1 81632512b68Schristos _GL_FUNCDECL_SYS (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1))); 81732512b68Schristos # endif 81832512b68Schristos _GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm)); 81932512b68Schristos # endif 82032512b68Schristos _GL_CXXALIASWARN (timegm); 82132512b68Schristos # endif 82232512b68Schristos 82332512b68Schristos /* Encourage applications to avoid unsafe functions that can overrun 82432512b68Schristos buffers when given outlandish struct tm values. Portable 82532512b68Schristos applications should use strftime (or even sprintf) instead. */ 82632512b68Schristos # if defined GNULIB_POSIXCHECK 82732512b68Schristos # undef asctime 82832512b68Schristos _GL_WARN_ON_USE (asctime, "asctime can overrun buffers in some cases - " 82932512b68Schristos "better use strftime (or even sprintf) instead"); 83032512b68Schristos # endif 83132512b68Schristos # if defined GNULIB_POSIXCHECK 83232512b68Schristos # undef asctime_r 83332512b68Schristos _GL_WARN_ON_USE (asctime, "asctime_r can overrun buffers in some cases - " 83432512b68Schristos "better use strftime (or even sprintf) instead"); 83532512b68Schristos # endif 83632512b68Schristos # if defined GNULIB_POSIXCHECK 83732512b68Schristos # undef ctime 83832512b68Schristos _GL_WARN_ON_USE (asctime, "ctime can overrun buffers in some cases - " 83932512b68Schristos "better use strftime (or even sprintf) instead"); 84032512b68Schristos # endif 84132512b68Schristos # if defined GNULIB_POSIXCHECK 84232512b68Schristos # undef ctime_r 84332512b68Schristos _GL_WARN_ON_USE (asctime, "ctime_r can overrun buffers in some cases - " 84432512b68Schristos "better use strftime (or even sprintf) instead"); 84532512b68Schristos # endif 84632512b68Schristos 84732512b68Schristos #endif 848