xref: /dflybsd-src/gnu/usr.bin/grep/libgreputils/sys/time.h (revision 51ddd709576b6d603cb35ff07b103a739f875a02)
1*51ddd709SJohn Marino /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2*51ddd709SJohn Marino /* Provide a more complete sys/time.h.
3*51ddd709SJohn Marino 
4*51ddd709SJohn Marino    Copyright (C) 2007-2014 Free Software Foundation, Inc.
5*51ddd709SJohn Marino 
6*51ddd709SJohn Marino    This program is free software; you can redistribute it and/or modify
7*51ddd709SJohn Marino    it under the terms of the GNU General Public License as published by
8*51ddd709SJohn Marino    the Free Software Foundation; either version 3, or (at your option)
9*51ddd709SJohn Marino    any later version.
10*51ddd709SJohn Marino 
11*51ddd709SJohn Marino    This program is distributed in the hope that it will be useful,
12*51ddd709SJohn Marino    but WITHOUT ANY WARRANTY; without even the implied warranty of
13*51ddd709SJohn Marino    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14*51ddd709SJohn Marino    GNU General Public License for more details.
15*51ddd709SJohn Marino 
16*51ddd709SJohn Marino    You should have received a copy of the GNU General Public License
17*51ddd709SJohn Marino    along with this program; if not, see <http://www.gnu.org/licenses/>.  */
18*51ddd709SJohn Marino 
19*51ddd709SJohn Marino /* Written by Paul Eggert.  */
20*51ddd709SJohn Marino 
21*51ddd709SJohn Marino #ifndef _GL_SYS_TIME_H
22*51ddd709SJohn Marino 
23*51ddd709SJohn Marino #if __GNUC__ >= 3
24*51ddd709SJohn Marino #pragma GCC system_header
25*51ddd709SJohn Marino #endif
26*51ddd709SJohn Marino 
27*51ddd709SJohn Marino 
28*51ddd709SJohn Marino /* On Cygwin and on many BSDish systems, <sys/time.h> includes itself
29*51ddd709SJohn Marino    recursively via <sys/select.h>.
30*51ddd709SJohn Marino    Simply delegate to the system's header in this case; it is a no-op.
31*51ddd709SJohn Marino    Without this extra ifdef, the C++ gettimeofday declaration below
32*51ddd709SJohn Marino    would be a forward declaration in gnulib's nested <sys/time.h>.  */
33*51ddd709SJohn Marino #if defined _CYGWIN_SYS_TIME_H || defined _SYS_TIME_H || defined _SYS_TIME_H_
34*51ddd709SJohn Marino # include_next <sys/time.h>
35*51ddd709SJohn Marino #else
36*51ddd709SJohn Marino 
37*51ddd709SJohn Marino /* The include_next requires a split double-inclusion guard.  */
38*51ddd709SJohn Marino #if 1
39*51ddd709SJohn Marino # include_next <sys/time.h>
40*51ddd709SJohn Marino #endif
41*51ddd709SJohn Marino 
42*51ddd709SJohn Marino #ifndef _GL_SYS_TIME_H
43*51ddd709SJohn Marino #define _GL_SYS_TIME_H
44*51ddd709SJohn Marino 
45*51ddd709SJohn Marino #if ! 1
46*51ddd709SJohn Marino # include <time.h>
47*51ddd709SJohn Marino #endif
48*51ddd709SJohn Marino 
49*51ddd709SJohn Marino /* On native Windows with MSVC, get the 'struct timeval' type.
50*51ddd709SJohn Marino    Also, on native Windows with a 64-bit time_t, where we are overriding the
51*51ddd709SJohn Marino    'struct timeval' type, get all declarations of system functions whose
52*51ddd709SJohn Marino    signature contains 'struct timeval'.  */
53*51ddd709SJohn Marino #if (defined _MSC_VER || 0) && 0 && !defined _GL_INCLUDING_WINSOCK2_H
54*51ddd709SJohn Marino # define _GL_INCLUDING_WINSOCK2_H
55*51ddd709SJohn Marino # include <winsock2.h>
56*51ddd709SJohn Marino # undef _GL_INCLUDING_WINSOCK2_H
57*51ddd709SJohn Marino #endif
58*51ddd709SJohn Marino 
59*51ddd709SJohn Marino /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
60*51ddd709SJohn Marino #ifndef _GL_CXXDEFS_H
61*51ddd709SJohn Marino #define _GL_CXXDEFS_H
62*51ddd709SJohn Marino 
63*51ddd709SJohn Marino /* The three most frequent use cases of these macros are:
64*51ddd709SJohn Marino 
65*51ddd709SJohn Marino    * For providing a substitute for a function that is missing on some
66*51ddd709SJohn Marino      platforms, but is declared and works fine on the platforms on which
67*51ddd709SJohn Marino      it exists:
68*51ddd709SJohn Marino 
69*51ddd709SJohn Marino        #if @GNULIB_FOO@
70*51ddd709SJohn Marino        # if !@HAVE_FOO@
71*51ddd709SJohn Marino        _GL_FUNCDECL_SYS (foo, ...);
72*51ddd709SJohn Marino        # endif
73*51ddd709SJohn Marino        _GL_CXXALIAS_SYS (foo, ...);
74*51ddd709SJohn Marino        _GL_CXXALIASWARN (foo);
75*51ddd709SJohn Marino        #elif defined GNULIB_POSIXCHECK
76*51ddd709SJohn Marino        ...
77*51ddd709SJohn Marino        #endif
78*51ddd709SJohn Marino 
79*51ddd709SJohn Marino    * For providing a replacement for a function that exists on all platforms,
80*51ddd709SJohn Marino      but is broken/insufficient and needs to be replaced on some platforms:
81*51ddd709SJohn Marino 
82*51ddd709SJohn Marino        #if @GNULIB_FOO@
83*51ddd709SJohn Marino        # if @REPLACE_FOO@
84*51ddd709SJohn Marino        #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
85*51ddd709SJohn Marino        #   undef foo
86*51ddd709SJohn Marino        #   define foo rpl_foo
87*51ddd709SJohn Marino        #  endif
88*51ddd709SJohn Marino        _GL_FUNCDECL_RPL (foo, ...);
89*51ddd709SJohn Marino        _GL_CXXALIAS_RPL (foo, ...);
90*51ddd709SJohn Marino        # else
91*51ddd709SJohn Marino        _GL_CXXALIAS_SYS (foo, ...);
92*51ddd709SJohn Marino        # endif
93*51ddd709SJohn Marino        _GL_CXXALIASWARN (foo);
94*51ddd709SJohn Marino        #elif defined GNULIB_POSIXCHECK
95*51ddd709SJohn Marino        ...
96*51ddd709SJohn Marino        #endif
97*51ddd709SJohn Marino 
98*51ddd709SJohn Marino    * For providing a replacement for a function that exists on some platforms
99*51ddd709SJohn Marino      but is broken/insufficient and needs to be replaced on some of them and
100*51ddd709SJohn Marino      is additionally either missing or undeclared on some other platforms:
101*51ddd709SJohn Marino 
102*51ddd709SJohn Marino        #if @GNULIB_FOO@
103*51ddd709SJohn Marino        # if @REPLACE_FOO@
104*51ddd709SJohn Marino        #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
105*51ddd709SJohn Marino        #   undef foo
106*51ddd709SJohn Marino        #   define foo rpl_foo
107*51ddd709SJohn Marino        #  endif
108*51ddd709SJohn Marino        _GL_FUNCDECL_RPL (foo, ...);
109*51ddd709SJohn Marino        _GL_CXXALIAS_RPL (foo, ...);
110*51ddd709SJohn Marino        # else
111*51ddd709SJohn Marino        #  if !@HAVE_FOO@   or   if !@HAVE_DECL_FOO@
112*51ddd709SJohn Marino        _GL_FUNCDECL_SYS (foo, ...);
113*51ddd709SJohn Marino        #  endif
114*51ddd709SJohn Marino        _GL_CXXALIAS_SYS (foo, ...);
115*51ddd709SJohn Marino        # endif
116*51ddd709SJohn Marino        _GL_CXXALIASWARN (foo);
117*51ddd709SJohn Marino        #elif defined GNULIB_POSIXCHECK
118*51ddd709SJohn Marino        ...
119*51ddd709SJohn Marino        #endif
120*51ddd709SJohn Marino */
121*51ddd709SJohn Marino 
122*51ddd709SJohn Marino /* _GL_EXTERN_C declaration;
123*51ddd709SJohn Marino    performs the declaration with C linkage.  */
124*51ddd709SJohn Marino #if defined __cplusplus
125*51ddd709SJohn Marino # define _GL_EXTERN_C extern "C"
126*51ddd709SJohn Marino #else
127*51ddd709SJohn Marino # define _GL_EXTERN_C extern
128*51ddd709SJohn Marino #endif
129*51ddd709SJohn Marino 
130*51ddd709SJohn Marino /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
131*51ddd709SJohn Marino    declares a replacement function, named rpl_func, with the given prototype,
132*51ddd709SJohn Marino    consisting of return type, parameters, and attributes.
133*51ddd709SJohn Marino    Example:
134*51ddd709SJohn Marino      _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
135*51ddd709SJohn Marino                                   _GL_ARG_NONNULL ((1)));
136*51ddd709SJohn Marino  */
137*51ddd709SJohn Marino #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
138*51ddd709SJohn Marino   _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
139*51ddd709SJohn Marino #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
140*51ddd709SJohn Marino   _GL_EXTERN_C rettype rpl_func parameters_and_attributes
141*51ddd709SJohn Marino 
142*51ddd709SJohn Marino /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
143*51ddd709SJohn Marino    declares the system function, named func, with the given prototype,
144*51ddd709SJohn Marino    consisting of return type, parameters, and attributes.
145*51ddd709SJohn Marino    Example:
146*51ddd709SJohn Marino      _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
147*51ddd709SJohn Marino                                   _GL_ARG_NONNULL ((1)));
148*51ddd709SJohn Marino  */
149*51ddd709SJohn Marino #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
150*51ddd709SJohn Marino   _GL_EXTERN_C rettype func parameters_and_attributes
151*51ddd709SJohn Marino 
152*51ddd709SJohn Marino /* _GL_CXXALIAS_RPL (func, rettype, parameters);
153*51ddd709SJohn Marino    declares a C++ alias called GNULIB_NAMESPACE::func
154*51ddd709SJohn Marino    that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
155*51ddd709SJohn Marino    Example:
156*51ddd709SJohn Marino      _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
157*51ddd709SJohn Marino  */
158*51ddd709SJohn Marino #define _GL_CXXALIAS_RPL(func,rettype,parameters) \
159*51ddd709SJohn Marino   _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
160*51ddd709SJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE
161*51ddd709SJohn Marino # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
162*51ddd709SJohn Marino     namespace GNULIB_NAMESPACE                                \
163*51ddd709SJohn Marino     {                                                         \
164*51ddd709SJohn Marino       rettype (*const func) parameters = ::rpl_func;          \
165*51ddd709SJohn Marino     }                                                         \
166*51ddd709SJohn Marino     _GL_EXTERN_C int _gl_cxxalias_dummy
167*51ddd709SJohn Marino #else
168*51ddd709SJohn Marino # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
169*51ddd709SJohn Marino     _GL_EXTERN_C int _gl_cxxalias_dummy
170*51ddd709SJohn Marino #endif
171*51ddd709SJohn Marino 
172*51ddd709SJohn Marino /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
173*51ddd709SJohn Marino    is like  _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
174*51ddd709SJohn Marino    except that the C function rpl_func may have a slightly different
175*51ddd709SJohn Marino    declaration.  A cast is used to silence the "invalid conversion" error
176*51ddd709SJohn Marino    that would otherwise occur.  */
177*51ddd709SJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE
178*51ddd709SJohn Marino # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
179*51ddd709SJohn Marino     namespace GNULIB_NAMESPACE                                     \
180*51ddd709SJohn Marino     {                                                              \
181*51ddd709SJohn Marino       rettype (*const func) parameters =                           \
182*51ddd709SJohn Marino         reinterpret_cast<rettype(*)parameters>(::rpl_func);        \
183*51ddd709SJohn Marino     }                                                              \
184*51ddd709SJohn Marino     _GL_EXTERN_C int _gl_cxxalias_dummy
185*51ddd709SJohn Marino #else
186*51ddd709SJohn Marino # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
187*51ddd709SJohn Marino     _GL_EXTERN_C int _gl_cxxalias_dummy
188*51ddd709SJohn Marino #endif
189*51ddd709SJohn Marino 
190*51ddd709SJohn Marino /* _GL_CXXALIAS_SYS (func, rettype, parameters);
191*51ddd709SJohn Marino    declares a C++ alias called GNULIB_NAMESPACE::func
192*51ddd709SJohn Marino    that redirects to the system provided function func, if GNULIB_NAMESPACE
193*51ddd709SJohn Marino    is defined.
194*51ddd709SJohn Marino    Example:
195*51ddd709SJohn Marino      _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
196*51ddd709SJohn Marino  */
197*51ddd709SJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE
198*51ddd709SJohn Marino   /* If we were to write
199*51ddd709SJohn Marino        rettype (*const func) parameters = ::func;
200*51ddd709SJohn Marino      like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls
201*51ddd709SJohn Marino      better (remove an indirection through a 'static' pointer variable),
202*51ddd709SJohn Marino      but then the _GL_CXXALIASWARN macro below would cause a warning not only
203*51ddd709SJohn Marino      for uses of ::func but also for uses of GNULIB_NAMESPACE::func.  */
204*51ddd709SJohn Marino # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
205*51ddd709SJohn Marino     namespace GNULIB_NAMESPACE                     \
206*51ddd709SJohn Marino     {                                              \
207*51ddd709SJohn Marino       static rettype (*func) parameters = ::func;  \
208*51ddd709SJohn Marino     }                                              \
209*51ddd709SJohn Marino     _GL_EXTERN_C int _gl_cxxalias_dummy
210*51ddd709SJohn Marino #else
211*51ddd709SJohn Marino # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
212*51ddd709SJohn Marino     _GL_EXTERN_C int _gl_cxxalias_dummy
213*51ddd709SJohn Marino #endif
214*51ddd709SJohn Marino 
215*51ddd709SJohn Marino /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
216*51ddd709SJohn Marino    is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
217*51ddd709SJohn Marino    except that the C function func may have a slightly different declaration.
218*51ddd709SJohn Marino    A cast is used to silence the "invalid conversion" error that would
219*51ddd709SJohn Marino    otherwise occur.  */
220*51ddd709SJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE
221*51ddd709SJohn Marino # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
222*51ddd709SJohn Marino     namespace GNULIB_NAMESPACE                          \
223*51ddd709SJohn Marino     {                                                   \
224*51ddd709SJohn Marino       static rettype (*func) parameters =               \
225*51ddd709SJohn Marino         reinterpret_cast<rettype(*)parameters>(::func); \
226*51ddd709SJohn Marino     }                                                   \
227*51ddd709SJohn Marino     _GL_EXTERN_C int _gl_cxxalias_dummy
228*51ddd709SJohn Marino #else
229*51ddd709SJohn Marino # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
230*51ddd709SJohn Marino     _GL_EXTERN_C int _gl_cxxalias_dummy
231*51ddd709SJohn Marino #endif
232*51ddd709SJohn Marino 
233*51ddd709SJohn Marino /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
234*51ddd709SJohn Marino    is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
235*51ddd709SJohn Marino    except that the C function is picked among a set of overloaded functions,
236*51ddd709SJohn Marino    namely the one with rettype2 and parameters2.  Two consecutive casts
237*51ddd709SJohn Marino    are used to silence the "cannot find a match" and "invalid conversion"
238*51ddd709SJohn Marino    errors that would otherwise occur.  */
239*51ddd709SJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE
240*51ddd709SJohn Marino   /* The outer cast must be a reinterpret_cast.
241*51ddd709SJohn Marino      The inner cast: When the function is defined as a set of overloaded
242*51ddd709SJohn Marino      functions, it works as a static_cast<>, choosing the designated variant.
243*51ddd709SJohn Marino      When the function is defined as a single variant, it works as a
244*51ddd709SJohn Marino      reinterpret_cast<>. The parenthesized cast syntax works both ways.  */
245*51ddd709SJohn Marino # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
246*51ddd709SJohn Marino     namespace GNULIB_NAMESPACE                                                \
247*51ddd709SJohn Marino     {                                                                         \
248*51ddd709SJohn Marino       static rettype (*func) parameters =                                     \
249*51ddd709SJohn Marino         reinterpret_cast<rettype(*)parameters>(                               \
250*51ddd709SJohn Marino           (rettype2(*)parameters2)(::func));                                  \
251*51ddd709SJohn Marino     }                                                                         \
252*51ddd709SJohn Marino     _GL_EXTERN_C int _gl_cxxalias_dummy
253*51ddd709SJohn Marino #else
254*51ddd709SJohn Marino # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
255*51ddd709SJohn Marino     _GL_EXTERN_C int _gl_cxxalias_dummy
256*51ddd709SJohn Marino #endif
257*51ddd709SJohn Marino 
258*51ddd709SJohn Marino /* _GL_CXXALIASWARN (func);
259*51ddd709SJohn Marino    causes a warning to be emitted when ::func is used but not when
260*51ddd709SJohn Marino    GNULIB_NAMESPACE::func is used.  func must be defined without overloaded
261*51ddd709SJohn Marino    variants.  */
262*51ddd709SJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE
263*51ddd709SJohn Marino # define _GL_CXXALIASWARN(func) \
264*51ddd709SJohn Marino    _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
265*51ddd709SJohn Marino # define _GL_CXXALIASWARN_1(func,namespace) \
266*51ddd709SJohn Marino    _GL_CXXALIASWARN_2 (func, namespace)
267*51ddd709SJohn Marino /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
268*51ddd709SJohn Marino    we enable the warning only when not optimizing.  */
269*51ddd709SJohn Marino # if !__OPTIMIZE__
270*51ddd709SJohn Marino #  define _GL_CXXALIASWARN_2(func,namespace) \
271*51ddd709SJohn Marino     _GL_WARN_ON_USE (func, \
272*51ddd709SJohn Marino                      "The symbol ::" #func " refers to the system function. " \
273*51ddd709SJohn Marino                      "Use " #namespace "::" #func " instead.")
274*51ddd709SJohn Marino # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
275*51ddd709SJohn Marino #  define _GL_CXXALIASWARN_2(func,namespace) \
276*51ddd709SJohn Marino      extern __typeof__ (func) func
277*51ddd709SJohn Marino # else
278*51ddd709SJohn Marino #  define _GL_CXXALIASWARN_2(func,namespace) \
279*51ddd709SJohn Marino      _GL_EXTERN_C int _gl_cxxalias_dummy
280*51ddd709SJohn Marino # endif
281*51ddd709SJohn Marino #else
282*51ddd709SJohn Marino # define _GL_CXXALIASWARN(func) \
283*51ddd709SJohn Marino     _GL_EXTERN_C int _gl_cxxalias_dummy
284*51ddd709SJohn Marino #endif
285*51ddd709SJohn Marino 
286*51ddd709SJohn Marino /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
287*51ddd709SJohn Marino    causes a warning to be emitted when the given overloaded variant of ::func
288*51ddd709SJohn Marino    is used but not when GNULIB_NAMESPACE::func is used.  */
289*51ddd709SJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE
290*51ddd709SJohn Marino # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
291*51ddd709SJohn Marino    _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
292*51ddd709SJohn Marino                         GNULIB_NAMESPACE)
293*51ddd709SJohn Marino # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
294*51ddd709SJohn Marino    _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
295*51ddd709SJohn Marino /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
296*51ddd709SJohn Marino    we enable the warning only when not optimizing.  */
297*51ddd709SJohn Marino # if !__OPTIMIZE__
298*51ddd709SJohn Marino #  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
299*51ddd709SJohn Marino     _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
300*51ddd709SJohn Marino                          "The symbol ::" #func " refers to the system function. " \
301*51ddd709SJohn Marino                          "Use " #namespace "::" #func " instead.")
302*51ddd709SJohn Marino # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
303*51ddd709SJohn Marino #  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
304*51ddd709SJohn Marino      extern __typeof__ (func) func
305*51ddd709SJohn Marino # else
306*51ddd709SJohn Marino #  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
307*51ddd709SJohn Marino      _GL_EXTERN_C int _gl_cxxalias_dummy
308*51ddd709SJohn Marino # endif
309*51ddd709SJohn Marino #else
310*51ddd709SJohn Marino # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
311*51ddd709SJohn Marino     _GL_EXTERN_C int _gl_cxxalias_dummy
312*51ddd709SJohn Marino #endif
313*51ddd709SJohn Marino 
314*51ddd709SJohn Marino #endif /* _GL_CXXDEFS_H */
315*51ddd709SJohn Marino 
316*51ddd709SJohn Marino /* The definition of _GL_ARG_NONNULL is copied here.  */
317*51ddd709SJohn Marino /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
318*51ddd709SJohn Marino    that the values passed as arguments n, ..., m must be non-NULL pointers.
319*51ddd709SJohn Marino    n = 1 stands for the first argument, n = 2 for the second argument etc.  */
320*51ddd709SJohn Marino #ifndef _GL_ARG_NONNULL
321*51ddd709SJohn Marino # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
322*51ddd709SJohn Marino #  define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
323*51ddd709SJohn Marino # else
324*51ddd709SJohn Marino #  define _GL_ARG_NONNULL(params)
325*51ddd709SJohn Marino # endif
326*51ddd709SJohn Marino #endif
327*51ddd709SJohn Marino 
328*51ddd709SJohn Marino /* The definition of _GL_WARN_ON_USE is copied here.  */
329*51ddd709SJohn Marino #ifndef _GL_WARN_ON_USE
330*51ddd709SJohn Marino 
331*51ddd709SJohn Marino # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
332*51ddd709SJohn Marino /* A compiler attribute is available in gcc versions 4.3.0 and later.  */
333*51ddd709SJohn Marino #  define _GL_WARN_ON_USE(function, message) \
334*51ddd709SJohn Marino extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
335*51ddd709SJohn Marino # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
336*51ddd709SJohn Marino /* Verify the existence of the function.  */
337*51ddd709SJohn Marino #  define _GL_WARN_ON_USE(function, message) \
338*51ddd709SJohn Marino extern __typeof__ (function) function
339*51ddd709SJohn Marino # else /* Unsupported.  */
340*51ddd709SJohn Marino #  define _GL_WARN_ON_USE(function, message) \
341*51ddd709SJohn Marino _GL_WARN_EXTERN_C int _gl_warn_on_use
342*51ddd709SJohn Marino # endif
343*51ddd709SJohn Marino #endif
344*51ddd709SJohn Marino 
345*51ddd709SJohn Marino /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
346*51ddd709SJohn Marino    is like _GL_WARN_ON_USE (function, "string"), except that the function is
347*51ddd709SJohn Marino    declared with the given prototype, consisting of return type, parameters,
348*51ddd709SJohn Marino    and attributes.
349*51ddd709SJohn Marino    This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
350*51ddd709SJohn Marino    not work in this case.  */
351*51ddd709SJohn Marino #ifndef _GL_WARN_ON_USE_CXX
352*51ddd709SJohn Marino # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
353*51ddd709SJohn Marino #  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
354*51ddd709SJohn Marino extern rettype function parameters_and_attributes \
355*51ddd709SJohn Marino      __attribute__ ((__warning__ (msg)))
356*51ddd709SJohn Marino # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
357*51ddd709SJohn Marino /* Verify the existence of the function.  */
358*51ddd709SJohn Marino #  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
359*51ddd709SJohn Marino extern rettype function parameters_and_attributes
360*51ddd709SJohn Marino # else /* Unsupported.  */
361*51ddd709SJohn Marino #  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
362*51ddd709SJohn Marino _GL_WARN_EXTERN_C int _gl_warn_on_use
363*51ddd709SJohn Marino # endif
364*51ddd709SJohn Marino #endif
365*51ddd709SJohn Marino 
366*51ddd709SJohn Marino /* _GL_WARN_EXTERN_C declaration;
367*51ddd709SJohn Marino    performs the declaration with C linkage.  */
368*51ddd709SJohn Marino #ifndef _GL_WARN_EXTERN_C
369*51ddd709SJohn Marino # if defined __cplusplus
370*51ddd709SJohn Marino #  define _GL_WARN_EXTERN_C extern "C"
371*51ddd709SJohn Marino # else
372*51ddd709SJohn Marino #  define _GL_WARN_EXTERN_C extern
373*51ddd709SJohn Marino # endif
374*51ddd709SJohn Marino #endif
375*51ddd709SJohn Marino 
376*51ddd709SJohn Marino #ifdef __cplusplus
377*51ddd709SJohn Marino extern "C" {
378*51ddd709SJohn Marino #endif
379*51ddd709SJohn Marino 
380*51ddd709SJohn Marino #if !1 || 0
381*51ddd709SJohn Marino 
382*51ddd709SJohn Marino # if 0
383*51ddd709SJohn Marino #  define timeval rpl_timeval
384*51ddd709SJohn Marino # endif
385*51ddd709SJohn Marino 
386*51ddd709SJohn Marino # if !GNULIB_defined_struct_timeval
387*51ddd709SJohn Marino struct timeval
388*51ddd709SJohn Marino {
389*51ddd709SJohn Marino   time_t tv_sec;
390*51ddd709SJohn Marino   long int tv_usec;
391*51ddd709SJohn Marino };
392*51ddd709SJohn Marino #  define GNULIB_defined_struct_timeval 1
393*51ddd709SJohn Marino # endif
394*51ddd709SJohn Marino 
395*51ddd709SJohn Marino #endif
396*51ddd709SJohn Marino 
397*51ddd709SJohn Marino #ifdef __cplusplus
398*51ddd709SJohn Marino }
399*51ddd709SJohn Marino #endif
400*51ddd709SJohn Marino 
401*51ddd709SJohn Marino #if 1
402*51ddd709SJohn Marino # if 0
403*51ddd709SJohn Marino #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
404*51ddd709SJohn Marino #   undef gettimeofday
405*51ddd709SJohn Marino #   define gettimeofday rpl_gettimeofday
406*51ddd709SJohn Marino #  endif
407*51ddd709SJohn Marino _GL_FUNCDECL_RPL (gettimeofday, int,
408*51ddd709SJohn Marino                   (struct timeval *restrict, void *restrict)
409*51ddd709SJohn Marino                   _GL_ARG_NONNULL ((1)));
410*51ddd709SJohn Marino _GL_CXXALIAS_RPL (gettimeofday, int,
411*51ddd709SJohn Marino                   (struct timeval *restrict, void *restrict));
412*51ddd709SJohn Marino # else
413*51ddd709SJohn Marino #  if !1
414*51ddd709SJohn Marino _GL_FUNCDECL_SYS (gettimeofday, int,
415*51ddd709SJohn Marino                   (struct timeval *restrict, void *restrict)
416*51ddd709SJohn Marino                   _GL_ARG_NONNULL ((1)));
417*51ddd709SJohn Marino #  endif
418*51ddd709SJohn Marino /* Need to cast, because on glibc systems, by default, the second argument is
419*51ddd709SJohn Marino                                                   struct timezone *.  */
420*51ddd709SJohn Marino _GL_CXXALIAS_SYS_CAST (gettimeofday, int,
421*51ddd709SJohn Marino                        (struct timeval *restrict, void *restrict));
422*51ddd709SJohn Marino # endif
423*51ddd709SJohn Marino _GL_CXXALIASWARN (gettimeofday);
424*51ddd709SJohn Marino #elif defined GNULIB_POSIXCHECK
425*51ddd709SJohn Marino # undef gettimeofday
426*51ddd709SJohn Marino # if HAVE_RAW_DECL_GETTIMEOFDAY
427*51ddd709SJohn Marino _GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - "
428*51ddd709SJohn Marino                  "use gnulib module gettimeofday for portability");
429*51ddd709SJohn Marino # endif
430*51ddd709SJohn Marino #endif
431*51ddd709SJohn Marino 
432*51ddd709SJohn Marino /* Hide some function declarations from <winsock2.h>.  */
433*51ddd709SJohn Marino 
434*51ddd709SJohn Marino #if defined _MSC_VER && 0
435*51ddd709SJohn Marino # if !defined _GL_UNISTD_H
436*51ddd709SJohn Marino #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
437*51ddd709SJohn Marino #   undef close
438*51ddd709SJohn Marino #   define close close_used_without_including_unistd_h
439*51ddd709SJohn Marino #  else
440*51ddd709SJohn Marino      _GL_WARN_ON_USE (close,
441*51ddd709SJohn Marino                       "close() used without including <unistd.h>");
442*51ddd709SJohn Marino #  endif
443*51ddd709SJohn Marino #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
444*51ddd709SJohn Marino #   undef gethostname
445*51ddd709SJohn Marino #   define gethostname gethostname_used_without_including_unistd_h
446*51ddd709SJohn Marino #  else
447*51ddd709SJohn Marino      _GL_WARN_ON_USE (gethostname,
448*51ddd709SJohn Marino                       "gethostname() used without including <unistd.h>");
449*51ddd709SJohn Marino #  endif
450*51ddd709SJohn Marino # endif
451*51ddd709SJohn Marino # if !defined _GL_SYS_SOCKET_H
452*51ddd709SJohn Marino #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
453*51ddd709SJohn Marino #   undef socket
454*51ddd709SJohn Marino #   define socket              socket_used_without_including_sys_socket_h
455*51ddd709SJohn Marino #   undef connect
456*51ddd709SJohn Marino #   define connect             connect_used_without_including_sys_socket_h
457*51ddd709SJohn Marino #   undef accept
458*51ddd709SJohn Marino #   define accept              accept_used_without_including_sys_socket_h
459*51ddd709SJohn Marino #   undef bind
460*51ddd709SJohn Marino #   define bind                bind_used_without_including_sys_socket_h
461*51ddd709SJohn Marino #   undef getpeername
462*51ddd709SJohn Marino #   define getpeername         getpeername_used_without_including_sys_socket_h
463*51ddd709SJohn Marino #   undef getsockname
464*51ddd709SJohn Marino #   define getsockname         getsockname_used_without_including_sys_socket_h
465*51ddd709SJohn Marino #   undef getsockopt
466*51ddd709SJohn Marino #   define getsockopt          getsockopt_used_without_including_sys_socket_h
467*51ddd709SJohn Marino #   undef listen
468*51ddd709SJohn Marino #   define listen              listen_used_without_including_sys_socket_h
469*51ddd709SJohn Marino #   undef recv
470*51ddd709SJohn Marino #   define recv                recv_used_without_including_sys_socket_h
471*51ddd709SJohn Marino #   undef send
472*51ddd709SJohn Marino #   define send                send_used_without_including_sys_socket_h
473*51ddd709SJohn Marino #   undef recvfrom
474*51ddd709SJohn Marino #   define recvfrom            recvfrom_used_without_including_sys_socket_h
475*51ddd709SJohn Marino #   undef sendto
476*51ddd709SJohn Marino #   define sendto              sendto_used_without_including_sys_socket_h
477*51ddd709SJohn Marino #   undef setsockopt
478*51ddd709SJohn Marino #   define setsockopt          setsockopt_used_without_including_sys_socket_h
479*51ddd709SJohn Marino #   undef shutdown
480*51ddd709SJohn Marino #   define shutdown            shutdown_used_without_including_sys_socket_h
481*51ddd709SJohn Marino #  else
482*51ddd709SJohn Marino      _GL_WARN_ON_USE (socket,
483*51ddd709SJohn Marino                       "socket() used without including <sys/socket.h>");
484*51ddd709SJohn Marino      _GL_WARN_ON_USE (connect,
485*51ddd709SJohn Marino                       "connect() used without including <sys/socket.h>");
486*51ddd709SJohn Marino      _GL_WARN_ON_USE (accept,
487*51ddd709SJohn Marino                       "accept() used without including <sys/socket.h>");
488*51ddd709SJohn Marino      _GL_WARN_ON_USE (bind,
489*51ddd709SJohn Marino                       "bind() used without including <sys/socket.h>");
490*51ddd709SJohn Marino      _GL_WARN_ON_USE (getpeername,
491*51ddd709SJohn Marino                       "getpeername() used without including <sys/socket.h>");
492*51ddd709SJohn Marino      _GL_WARN_ON_USE (getsockname,
493*51ddd709SJohn Marino                       "getsockname() used without including <sys/socket.h>");
494*51ddd709SJohn Marino      _GL_WARN_ON_USE (getsockopt,
495*51ddd709SJohn Marino                       "getsockopt() used without including <sys/socket.h>");
496*51ddd709SJohn Marino      _GL_WARN_ON_USE (listen,
497*51ddd709SJohn Marino                       "listen() used without including <sys/socket.h>");
498*51ddd709SJohn Marino      _GL_WARN_ON_USE (recv,
499*51ddd709SJohn Marino                       "recv() used without including <sys/socket.h>");
500*51ddd709SJohn Marino      _GL_WARN_ON_USE (send,
501*51ddd709SJohn Marino                       "send() used without including <sys/socket.h>");
502*51ddd709SJohn Marino      _GL_WARN_ON_USE (recvfrom,
503*51ddd709SJohn Marino                       "recvfrom() used without including <sys/socket.h>");
504*51ddd709SJohn Marino      _GL_WARN_ON_USE (sendto,
505*51ddd709SJohn Marino                       "sendto() used without including <sys/socket.h>");
506*51ddd709SJohn Marino      _GL_WARN_ON_USE (setsockopt,
507*51ddd709SJohn Marino                       "setsockopt() used without including <sys/socket.h>");
508*51ddd709SJohn Marino      _GL_WARN_ON_USE (shutdown,
509*51ddd709SJohn Marino                       "shutdown() used without including <sys/socket.h>");
510*51ddd709SJohn Marino #  endif
511*51ddd709SJohn Marino # endif
512*51ddd709SJohn Marino # if !defined _GL_SYS_SELECT_H
513*51ddd709SJohn Marino #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
514*51ddd709SJohn Marino #   undef select
515*51ddd709SJohn Marino #   define select select_used_without_including_sys_select_h
516*51ddd709SJohn Marino #  else
517*51ddd709SJohn Marino      _GL_WARN_ON_USE (select,
518*51ddd709SJohn Marino                       "select() used without including <sys/select.h>");
519*51ddd709SJohn Marino #  endif
520*51ddd709SJohn Marino # endif
521*51ddd709SJohn Marino #endif
522*51ddd709SJohn Marino 
523*51ddd709SJohn Marino #endif /* _GL_SYS_TIME_H */
524*51ddd709SJohn Marino #endif /* _CYGWIN_SYS_TIME_H */
525*51ddd709SJohn Marino #endif /* _GL_SYS_TIME_H */
526