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