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