1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2 /* Provide a more complete sys/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 /* Written by Paul Eggert.  */
20 
21 #ifndef _GL_SYS_TIME_H
22 
23 #if __GNUC__ >= 3
24 #pragma GCC system_header
25 #endif
26 
27 
28 /* On Cygwin and on many BSDish systems, <sys/time.h> includes itself
29    recursively via <sys/select.h>.
30    Simply delegate to the system's header in this case; it is a no-op.
31    Without this extra ifdef, the C++ gettimeofday declaration below
32    would be a forward declaration in gnulib's nested <sys/time.h>.  */
33 #if defined _CYGWIN_SYS_TIME_H || defined _SYS_TIME_H || defined _SYS_TIME_H_
34 # include_next <sys/time.h>
35 #else
36 
37 /* The include_next requires a split double-inclusion guard.  */
38 #if 1
39 # include_next <sys/time.h>
40 #endif
41 
42 #ifndef _GL_SYS_TIME_H
43 #define _GL_SYS_TIME_H
44 
45 #if ! 1
46 # include <time.h>
47 #endif
48 
49 /* On native Windows with MSVC, get the 'struct timeval' type.
50    Also, on native Windows with a 64-bit time_t, where we are overriding the
51    'struct timeval' type, get all declarations of system functions whose
52    signature contains 'struct timeval'.  */
53 #if (defined _MSC_VER || 0) && 0 && !defined _GL_INCLUDING_WINSOCK2_H
54 # define _GL_INCLUDING_WINSOCK2_H
55 # include <winsock2.h>
56 # undef _GL_INCLUDING_WINSOCK2_H
57 #endif
58 
59 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
60 /* C++ compatible function declaration macros.
61    Copyright (C) 2010-2021 Free Software Foundation, Inc.
62 
63    This program is free software: you can redistribute it and/or modify it
64    under the terms of the GNU General Public License as published
65    by the Free Software Foundation; either version 3 of the License, or
66    (at your option) any later version.
67 
68    This program is distributed in the hope that it will be useful,
69    but WITHOUT ANY WARRANTY; without even the implied warranty of
70    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
71    General Public License for more details.
72 
73    You should have received a copy of the GNU General Public License
74    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
75 
76 #ifndef _GL_CXXDEFS_H
77 #define _GL_CXXDEFS_H
78 
79 /* Begin/end the GNULIB_NAMESPACE namespace.  */
80 #if defined __cplusplus && defined GNULIB_NAMESPACE
81 # define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE {
82 # define _GL_END_NAMESPACE }
83 #else
84 # define _GL_BEGIN_NAMESPACE
85 # define _GL_END_NAMESPACE
86 #endif
87 
88 /* The three most frequent use cases of these macros are:
89 
90    * For providing a substitute for a function that is missing on some
91      platforms, but is declared and works fine on the platforms on which
92      it exists:
93 
94        #if @GNULIB_FOO@
95        # if !@HAVE_FOO@
96        _GL_FUNCDECL_SYS (foo, ...);
97        # endif
98        _GL_CXXALIAS_SYS (foo, ...);
99        _GL_CXXALIASWARN (foo);
100        #elif defined GNULIB_POSIXCHECK
101        ...
102        #endif
103 
104    * For providing a replacement for a function that exists on all platforms,
105      but is broken/insufficient and needs to be replaced on some platforms:
106 
107        #if @GNULIB_FOO@
108        # if @REPLACE_FOO@
109        #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
110        #   undef foo
111        #   define foo rpl_foo
112        #  endif
113        _GL_FUNCDECL_RPL (foo, ...);
114        _GL_CXXALIAS_RPL (foo, ...);
115        # else
116        _GL_CXXALIAS_SYS (foo, ...);
117        # endif
118        _GL_CXXALIASWARN (foo);
119        #elif defined GNULIB_POSIXCHECK
120        ...
121        #endif
122 
123    * For providing a replacement for a function that exists on some platforms
124      but is broken/insufficient and needs to be replaced on some of them and
125      is additionally either missing or undeclared on some other platforms:
126 
127        #if @GNULIB_FOO@
128        # if @REPLACE_FOO@
129        #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
130        #   undef foo
131        #   define foo rpl_foo
132        #  endif
133        _GL_FUNCDECL_RPL (foo, ...);
134        _GL_CXXALIAS_RPL (foo, ...);
135        # else
136        #  if !@HAVE_FOO@   or   if !@HAVE_DECL_FOO@
137        _GL_FUNCDECL_SYS (foo, ...);
138        #  endif
139        _GL_CXXALIAS_SYS (foo, ...);
140        # endif
141        _GL_CXXALIASWARN (foo);
142        #elif defined GNULIB_POSIXCHECK
143        ...
144        #endif
145 */
146 
147 /* _GL_EXTERN_C declaration;
148    performs the declaration with C linkage.  */
149 #if defined __cplusplus
150 # define _GL_EXTERN_C extern "C"
151 #else
152 # define _GL_EXTERN_C extern
153 #endif
154 
155 /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
156    declares a replacement function, named rpl_func, with the given prototype,
157    consisting of return type, parameters, and attributes.
158    Example:
159      _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
160                                   _GL_ARG_NONNULL ((1)));
161  */
162 #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
163   _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
164 #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
165   _GL_EXTERN_C rettype rpl_func parameters_and_attributes
166 
167 /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
168    declares the system function, named func, with the given prototype,
169    consisting of return type, parameters, and attributes.
170    Example:
171      _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
172                                   _GL_ARG_NONNULL ((1)));
173  */
174 #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
175   _GL_EXTERN_C rettype func parameters_and_attributes
176 
177 /* _GL_CXXALIAS_RPL (func, rettype, parameters);
178    declares a C++ alias called GNULIB_NAMESPACE::func
179    that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
180    Example:
181      _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
182 
183    Wrapping rpl_func in an object with an inline conversion operator
184    avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is
185    actually used in the program.  */
186 #define _GL_CXXALIAS_RPL(func,rettype,parameters) \
187   _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
188 #if defined __cplusplus && defined GNULIB_NAMESPACE
189 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
190     namespace GNULIB_NAMESPACE                                \
191     {                                                         \
192       static const struct _gl_ ## func ## _wrapper            \
193       {                                                       \
194         typedef rettype (*type) parameters;                   \
195                                                               \
196         inline operator type () const                         \
197         {                                                     \
198           return ::rpl_func;                                  \
199         }                                                     \
200       } func = {};                                            \
201     }                                                         \
202     _GL_EXTERN_C int _gl_cxxalias_dummy
203 #else
204 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
205     _GL_EXTERN_C int _gl_cxxalias_dummy
206 #endif
207 
208 /* _GL_CXXALIAS_MDA (func, rettype, parameters);
209    is to be used when func is a Microsoft deprecated alias, on native Windows.
210    It declares a C++ alias called GNULIB_NAMESPACE::func
211    that redirects to _func, if GNULIB_NAMESPACE is defined.
212    Example:
213      _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...));
214  */
215 #define _GL_CXXALIAS_MDA(func,rettype,parameters) \
216   _GL_CXXALIAS_RPL_1 (func, _##func, rettype, parameters)
217 
218 /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
219    is like  _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
220    except that the C function rpl_func may have a slightly different
221    declaration.  A cast is used to silence the "invalid conversion" error
222    that would otherwise occur.  */
223 #if defined __cplusplus && defined GNULIB_NAMESPACE
224 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
225     namespace GNULIB_NAMESPACE                                     \
226     {                                                              \
227       static const struct _gl_ ## func ## _wrapper                 \
228       {                                                            \
229         typedef rettype (*type) parameters;                        \
230                                                                    \
231         inline operator type () const                              \
232         {                                                          \
233           return reinterpret_cast<type>(::rpl_func);               \
234         }                                                          \
235       } func = {};                                                 \
236     }                                                              \
237     _GL_EXTERN_C int _gl_cxxalias_dummy
238 #else
239 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
240     _GL_EXTERN_C int _gl_cxxalias_dummy
241 #endif
242 
243 /* _GL_CXXALIAS_MDA_CAST (func, rettype, parameters);
244    is like  _GL_CXXALIAS_MDA (func, rettype, parameters);
245    except that the C function func may have a slightly different declaration.
246    A cast is used to silence the "invalid conversion" error that would
247    otherwise occur.  */
248 #define _GL_CXXALIAS_MDA_CAST(func,rettype,parameters) \
249   _GL_CXXALIAS_RPL_CAST_1 (func, _##func, rettype, parameters)
250 
251 /* _GL_CXXALIAS_SYS (func, rettype, parameters);
252    declares a C++ alias called GNULIB_NAMESPACE::func
253    that redirects to the system provided function func, if GNULIB_NAMESPACE
254    is defined.
255    Example:
256      _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
257 
258    Wrapping func in an object with an inline conversion operator
259    avoids a reference to func unless GNULIB_NAMESPACE::func is
260    actually used in the program.  */
261 #if defined __cplusplus && defined GNULIB_NAMESPACE
262 # define _GL_CXXALIAS_SYS(func,rettype,parameters)            \
263     namespace GNULIB_NAMESPACE                                \
264     {                                                         \
265       static const struct _gl_ ## func ## _wrapper            \
266       {                                                       \
267         typedef rettype (*type) parameters;                   \
268                                                               \
269         inline operator type () const                         \
270         {                                                     \
271           return ::func;                                      \
272         }                                                     \
273       } func = {};                                            \
274     }                                                         \
275     _GL_EXTERN_C int _gl_cxxalias_dummy
276 #else
277 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
278     _GL_EXTERN_C int _gl_cxxalias_dummy
279 #endif
280 
281 /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
282    is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
283    except that the C function func may have a slightly different declaration.
284    A cast is used to silence the "invalid conversion" error that would
285    otherwise occur.  */
286 #if defined __cplusplus && defined GNULIB_NAMESPACE
287 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
288     namespace GNULIB_NAMESPACE                          \
289     {                                                   \
290       static const struct _gl_ ## func ## _wrapper      \
291       {                                                 \
292         typedef rettype (*type) parameters;             \
293                                                         \
294         inline operator type () const                   \
295         {                                               \
296           return reinterpret_cast<type>(::func);        \
297         }                                               \
298       } func = {};                                      \
299     }                                                   \
300     _GL_EXTERN_C int _gl_cxxalias_dummy
301 #else
302 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
303     _GL_EXTERN_C int _gl_cxxalias_dummy
304 #endif
305 
306 /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
307    is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
308    except that the C function is picked among a set of overloaded functions,
309    namely the one with rettype2 and parameters2.  Two consecutive casts
310    are used to silence the "cannot find a match" and "invalid conversion"
311    errors that would otherwise occur.  */
312 #if defined __cplusplus && defined GNULIB_NAMESPACE
313   /* The outer cast must be a reinterpret_cast.
314      The inner cast: When the function is defined as a set of overloaded
315      functions, it works as a static_cast<>, choosing the designated variant.
316      When the function is defined as a single variant, it works as a
317      reinterpret_cast<>. The parenthesized cast syntax works both ways.  */
318 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
319     namespace GNULIB_NAMESPACE                                                \
320     {                                                                         \
321       static const struct _gl_ ## func ## _wrapper                            \
322       {                                                                       \
323         typedef rettype (*type) parameters;                                   \
324                                                                               \
325         inline operator type () const                                         \
326         {                                                                     \
327           return reinterpret_cast<type>((rettype2 (*) parameters2)(::func));  \
328         }                                                                     \
329       } func = {};                                                            \
330     }                                                                         \
331     _GL_EXTERN_C int _gl_cxxalias_dummy
332 #else
333 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
334     _GL_EXTERN_C int _gl_cxxalias_dummy
335 #endif
336 
337 /* _GL_CXXALIASWARN (func);
338    causes a warning to be emitted when ::func is used but not when
339    GNULIB_NAMESPACE::func is used.  func must be defined without overloaded
340    variants.  */
341 #if defined __cplusplus && defined GNULIB_NAMESPACE
342 # define _GL_CXXALIASWARN(func) \
343    _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
344 # define _GL_CXXALIASWARN_1(func,namespace) \
345    _GL_CXXALIASWARN_2 (func, namespace)
346 /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
347    we enable the warning only when not optimizing.  */
348 # if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
349 #  define _GL_CXXALIASWARN_2(func,namespace) \
350     _GL_WARN_ON_USE (func, \
351                      "The symbol ::" #func " refers to the system function. " \
352                      "Use " #namespace "::" #func " instead.")
353 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
354 #  define _GL_CXXALIASWARN_2(func,namespace) \
355      extern __typeof__ (func) func
356 # else
357 #  define _GL_CXXALIASWARN_2(func,namespace) \
358      _GL_EXTERN_C int _gl_cxxalias_dummy
359 # endif
360 #else
361 # define _GL_CXXALIASWARN(func) \
362     _GL_EXTERN_C int _gl_cxxalias_dummy
363 #endif
364 
365 /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
366    causes a warning to be emitted when the given overloaded variant of ::func
367    is used but not when GNULIB_NAMESPACE::func is used.  */
368 #if defined __cplusplus && defined GNULIB_NAMESPACE
369 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
370    _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
371                         GNULIB_NAMESPACE)
372 # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
373    _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
374 /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
375    we enable the warning only when not optimizing.  */
376 # if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
377 #  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
378     _GL_WARN_ON_USE_CXX (func, rettype, rettype, parameters_and_attributes, \
379                          "The symbol ::" #func " refers to the system function. " \
380                          "Use " #namespace "::" #func " instead.")
381 # else
382 #  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
383      _GL_EXTERN_C int _gl_cxxalias_dummy
384 # endif
385 #else
386 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
387     _GL_EXTERN_C int _gl_cxxalias_dummy
388 #endif
389 
390 #endif /* _GL_CXXDEFS_H */
391 
392 /* The definition of _GL_ARG_NONNULL is copied here.  */
393 /* A C macro for declaring that specific arguments must not be NULL.
394    Copyright (C) 2009-2021 Free Software Foundation, Inc.
395 
396    This program is free software: you can redistribute it and/or modify it
397    under the terms of the GNU General Public License as published
398    by the Free Software Foundation; either version 3 of the License, or
399    (at your option) any later version.
400 
401    This program is distributed in the hope that it will be useful,
402    but WITHOUT ANY WARRANTY; without even the implied warranty of
403    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
404    General Public License for more details.
405 
406    You should have received a copy of the GNU General Public License
407    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
408 
409 /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
410    that the values passed as arguments n, ..., m must be non-NULL pointers.
411    n = 1 stands for the first argument, n = 2 for the second argument etc.  */
412 #ifndef _GL_ARG_NONNULL
413 # if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || defined __clang__
414 #  define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
415 # else
416 #  define _GL_ARG_NONNULL(params)
417 # endif
418 #endif
419 
420 /* The definition of _GL_WARN_ON_USE is copied here.  */
421 /* A C macro for emitting warnings if a function is used.
422    Copyright (C) 2010-2021 Free Software Foundation, Inc.
423 
424    This program is free software: you can redistribute it and/or modify it
425    under the terms of the GNU General Public License as published
426    by the Free Software Foundation; either version 3 of the License, or
427    (at your option) any later version.
428 
429    This program is distributed in the hope that it will be useful,
430    but WITHOUT ANY WARRANTY; without even the implied warranty of
431    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
432    General Public License for more details.
433 
434    You should have received a copy of the GNU General Public License
435    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
436 
437 /* _GL_WARN_ON_USE (function, "literal string") issues a declaration
438    for FUNCTION which will then trigger a compiler warning containing
439    the text of "literal string" anywhere that function is called, if
440    supported by the compiler.  If the compiler does not support this
441    feature, the macro expands to an unused extern declaration.
442 
443    _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the
444    attribute used in _GL_WARN_ON_USE.  If the compiler does not support
445    this feature, it expands to empty.
446 
447    These macros are useful for marking a function as a potential
448    portability trap, with the intent that "literal string" include
449    instructions on the replacement function that should be used
450    instead.
451    _GL_WARN_ON_USE is for functions with 'extern' linkage.
452    _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline'
453    linkage.
454 
455    However, one of the reasons that a function is a portability trap is
456    if it has the wrong signature.  Declaring FUNCTION with a different
457    signature in C is a compilation error, so this macro must use the
458    same type as any existing declaration so that programs that avoid
459    the problematic FUNCTION do not fail to compile merely because they
460    included a header that poisoned the function.  But this implies that
461    _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already
462    have a declaration.  Use of this macro implies that there must not
463    be any other macro hiding the declaration of FUNCTION; but
464    undefining FUNCTION first is part of the poisoning process anyway
465    (although for symbols that are provided only via a macro, the result
466    is a compilation error rather than a warning containing
467    "literal string").  Also note that in C++, it is only safe to use if
468    FUNCTION has no overloads.
469 
470    For an example, it is possible to poison 'getline' by:
471    - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]],
472      [getline]) in configure.ac, which potentially defines
473      HAVE_RAW_DECL_GETLINE
474    - adding this code to a header that wraps the system <stdio.h>:
475      #undef getline
476      #if HAVE_RAW_DECL_GETLINE
477      _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but"
478        "not universally present; use the gnulib module getline");
479      #endif
480 
481    It is not possible to directly poison global variables.  But it is
482    possible to write a wrapper accessor function, and poison that
483    (less common usage, like &environ, will cause a compilation error
484    rather than issue the nice warning, but the end result of informing
485    the developer about their portability problem is still achieved):
486      #if HAVE_RAW_DECL_ENVIRON
487      static char ***
488      rpl_environ (void) { return &environ; }
489      _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared");
490      # undef environ
491      # define environ (*rpl_environ ())
492      #endif
493    or better (avoiding contradictory use of 'static' and 'extern'):
494      #if HAVE_RAW_DECL_ENVIRON
495      static char ***
496      _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared")
497      rpl_environ (void) { return &environ; }
498      # undef environ
499      # define environ (*rpl_environ ())
500      #endif
501    */
502 #ifndef _GL_WARN_ON_USE
503 
504 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
505 /* A compiler attribute is available in gcc versions 4.3.0 and later.  */
506 #  define _GL_WARN_ON_USE(function, message) \
507 extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
508 #  define _GL_WARN_ON_USE_ATTRIBUTE(message) \
509   __attribute__ ((__warning__ (message)))
510 # elif __clang_major__ >= 4
511 /* Another compiler attribute is available in clang.  */
512 #  define _GL_WARN_ON_USE(function, message) \
513 extern __typeof__ (function) function \
514   __attribute__ ((__diagnose_if__ (1, message, "warning")))
515 #  define _GL_WARN_ON_USE_ATTRIBUTE(message) \
516   __attribute__ ((__diagnose_if__ (1, message, "warning")))
517 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
518 /* Verify the existence of the function.  */
519 #  define _GL_WARN_ON_USE(function, message) \
520 extern __typeof__ (function) function
521 #  define _GL_WARN_ON_USE_ATTRIBUTE(message)
522 # else /* Unsupported.  */
523 #  define _GL_WARN_ON_USE(function, message) \
524 _GL_WARN_EXTERN_C int _gl_warn_on_use
525 #  define _GL_WARN_ON_USE_ATTRIBUTE(message)
526 # endif
527 #endif
528 
529 /* _GL_WARN_ON_USE_CXX (function, rettype_gcc, rettype_clang, parameters_and_attributes, "message")
530    is like _GL_WARN_ON_USE (function, "message"), except that in C++ mode the
531    function is declared with the given prototype, consisting of return type,
532    parameters, and attributes.
533    This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
534    not work in this case.  */
535 #ifndef _GL_WARN_ON_USE_CXX
536 # if !defined __cplusplus
537 #  define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
538      _GL_WARN_ON_USE (function, msg)
539 # else
540 #  if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
541 /* A compiler attribute is available in gcc versions 4.3.0 and later.  */
542 #   define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
543 extern rettype_gcc function parameters_and_attributes \
544   __attribute__ ((__warning__ (msg)))
545 #  elif __clang_major__ >= 4
546 /* Another compiler attribute is available in clang.  */
547 #   define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
548 extern rettype_clang function parameters_and_attributes \
549   __attribute__ ((__diagnose_if__ (1, msg, "warning")))
550 #  elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
551 /* Verify the existence of the function.  */
552 #   define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
553 extern rettype_gcc function parameters_and_attributes
554 #  else /* Unsupported.  */
555 #   define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
556 _GL_WARN_EXTERN_C int _gl_warn_on_use
557 #  endif
558 # endif
559 #endif
560 
561 /* _GL_WARN_EXTERN_C declaration;
562    performs the declaration with C linkage.  */
563 #ifndef _GL_WARN_EXTERN_C
564 # if defined __cplusplus
565 #  define _GL_WARN_EXTERN_C extern "C"
566 # else
567 #  define _GL_WARN_EXTERN_C extern
568 # endif
569 #endif
570 
571 #ifdef __cplusplus
572 extern "C" {
573 #endif
574 
575 #if !1 || 0
576 
577 # if 0
578 #  define timeval rpl_timeval
579 # endif
580 
581 # if !GNULIB_defined_struct_timeval
582 struct timeval
583 {
584   time_t tv_sec;
585   long int tv_usec;
586 };
587 #  define GNULIB_defined_struct_timeval 1
588 # endif
589 
590 #endif
591 
592 #ifdef __cplusplus
593 }
594 #endif
595 
596 #if 1
597 # if 0
598 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
599 #   undef gettimeofday
600 #   define gettimeofday rpl_gettimeofday
601 #  endif
602 _GL_FUNCDECL_RPL (gettimeofday, int,
603                   (struct timeval *restrict, void *restrict)
604                   _GL_ARG_NONNULL ((1)));
605 _GL_CXXALIAS_RPL (gettimeofday, int,
606                   (struct timeval *restrict, void *restrict));
607 # else
608 #  if !1
609 _GL_FUNCDECL_SYS (gettimeofday, int,
610                   (struct timeval *restrict, void *restrict)
611                   _GL_ARG_NONNULL ((1)));
612 #  endif
613 /* Need to cast, because on glibc systems, by default, the second argument is
614                                                   struct timezone *.  */
615 _GL_CXXALIAS_SYS_CAST (gettimeofday, int,
616                        (struct timeval *restrict, void *restrict));
617 # endif
618 _GL_CXXALIASWARN (gettimeofday);
619 # if defined __cplusplus && defined GNULIB_NAMESPACE
620 namespace GNULIB_NAMESPACE {
621   typedef ::timeval
622 #  undef timeval
623     timeval;
624 #  if 0
625 #   define timeval rpl_timeval
626   typedef ::timeval timeval;
627 #  endif
628 }
629 # endif
630 #elif defined GNULIB_POSIXCHECK
631 # undef gettimeofday
632 # if HAVE_RAW_DECL_GETTIMEOFDAY
633 _GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - "
634                  "use gnulib module gettimeofday for portability");
635 # endif
636 #endif
637 
638 /* Hide some function declarations from <winsock2.h>.  */
639 
640 #if defined _MSC_VER && 0
641 # if !defined _GL_UNISTD_H
642 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
643 #   undef close
644 #   define close close_used_without_including_unistd_h
645 #  elif !defined __clang__
646      _GL_WARN_ON_USE (close,
647                       "close() used without including <unistd.h>");
648 #  endif
649 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
650 #   undef gethostname
651 #   define gethostname gethostname_used_without_including_unistd_h
652 #  else
653      _GL_WARN_ON_USE (gethostname,
654                       "gethostname() used without including <unistd.h>");
655 #  endif
656 # endif
657 # if !defined _GL_SYS_SOCKET_H
658 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
659 #   undef socket
660 #   define socket              socket_used_without_including_sys_socket_h
661 #   undef connect
662 #   define connect             connect_used_without_including_sys_socket_h
663 #   undef accept
664 #   define accept              accept_used_without_including_sys_socket_h
665 #   undef bind
666 #   define bind                bind_used_without_including_sys_socket_h
667 #   undef getpeername
668 #   define getpeername         getpeername_used_without_including_sys_socket_h
669 #   undef getsockname
670 #   define getsockname         getsockname_used_without_including_sys_socket_h
671 #   undef getsockopt
672 #   define getsockopt          getsockopt_used_without_including_sys_socket_h
673 #   undef listen
674 #   define listen              listen_used_without_including_sys_socket_h
675 #   undef recv
676 #   define recv                recv_used_without_including_sys_socket_h
677 #   undef send
678 #   define send                send_used_without_including_sys_socket_h
679 #   undef recvfrom
680 #   define recvfrom            recvfrom_used_without_including_sys_socket_h
681 #   undef sendto
682 #   define sendto              sendto_used_without_including_sys_socket_h
683 #   undef setsockopt
684 #   define setsockopt          setsockopt_used_without_including_sys_socket_h
685 #   undef shutdown
686 #   define shutdown            shutdown_used_without_including_sys_socket_h
687 #  else
688      _GL_WARN_ON_USE (socket,
689                       "socket() used without including <sys/socket.h>");
690      _GL_WARN_ON_USE (connect,
691                       "connect() used without including <sys/socket.h>");
692      _GL_WARN_ON_USE (accept,
693                       "accept() used without including <sys/socket.h>");
694      _GL_WARN_ON_USE (bind,
695                       "bind() used without including <sys/socket.h>");
696      _GL_WARN_ON_USE (getpeername,
697                       "getpeername() used without including <sys/socket.h>");
698      _GL_WARN_ON_USE (getsockname,
699                       "getsockname() used without including <sys/socket.h>");
700      _GL_WARN_ON_USE (getsockopt,
701                       "getsockopt() used without including <sys/socket.h>");
702      _GL_WARN_ON_USE (listen,
703                       "listen() used without including <sys/socket.h>");
704      _GL_WARN_ON_USE (recv,
705                       "recv() used without including <sys/socket.h>");
706      _GL_WARN_ON_USE (send,
707                       "send() used without including <sys/socket.h>");
708      _GL_WARN_ON_USE (recvfrom,
709                       "recvfrom() used without including <sys/socket.h>");
710      _GL_WARN_ON_USE (sendto,
711                       "sendto() used without including <sys/socket.h>");
712      _GL_WARN_ON_USE (setsockopt,
713                       "setsockopt() used without including <sys/socket.h>");
714      _GL_WARN_ON_USE (shutdown,
715                       "shutdown() used without including <sys/socket.h>");
716 #  endif
717 # endif
718 # if !defined _GL_SYS_SELECT_H
719 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
720 #   undef select
721 #   define select select_used_without_including_sys_select_h
722 #  else
723      _GL_WARN_ON_USE (select,
724                       "select() used without including <sys/select.h>");
725 #  endif
726 # endif
727 #endif
728 
729 #endif /* _GL_SYS_TIME_H */
730 #endif /* _CYGWIN_SYS_TIME_H */
731 #endif /* _GL_SYS_TIME_H */
732