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