Verify callback is run in either side.
[gnutls.git] / gl / sys_time.in.h
blobd915cee467a2fe6af7c43cbbdaebdd3b2e5c2b1e
1 /* Provide a more complete sys/time.h.
3 Copyright (C) 2007-2012 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3, or (at your option)
8 any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, see <http://www.gnu.org/licenses/>. */
18 /* Written by Paul Eggert. */
20 #if __GNUC__ >= 3
21 @PRAGMA_SYSTEM_HEADER@
22 #endif
23 @PRAGMA_COLUMNS@
25 #if defined _@GUARD_PREFIX@_SYS_TIME_H
27 /* Simply delegate to the system's header, without adding anything. */
28 # if @HAVE_SYS_TIME_H@
29 # @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
30 # endif
32 #else
34 # define _@GUARD_PREFIX@_SYS_TIME_H
36 # if @HAVE_SYS_TIME_H@
37 # @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
38 # else
39 # include <time.h>
40 # endif
42 /* On native Windows with MSVC, get the 'struct timeval' type.
43 Also, on native Windows with a 64-bit time_t, where we are overriding the
44 'struct timeval' type, get all declarations of system functions whose
45 signature contains 'struct timeval'. */
46 # if (defined _MSC_VER || @REPLACE_STRUCT_TIMEVAL@) && @HAVE_WINSOCK2_H@ && !defined _GL_INCLUDING_WINSOCK2_H
47 # define _GL_INCLUDING_WINSOCK2_H
48 # include <winsock2.h>
49 # undef _GL_INCLUDING_WINSOCK2_H
50 # endif
52 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
54 /* The definition of _GL_ARG_NONNULL is copied here. */
56 /* The definition of _GL_WARN_ON_USE is copied here. */
58 # ifdef __cplusplus
59 extern "C" {
60 # endif
62 # if !@HAVE_STRUCT_TIMEVAL@ || @REPLACE_STRUCT_TIMEVAL@
64 # if @REPLACE_STRUCT_TIMEVAL@
65 # define timeval rpl_timeval
66 # endif
68 # if !GNULIB_defined_struct_timeval
69 struct timeval
71 time_t tv_sec;
72 long int tv_usec;
74 # define GNULIB_defined_struct_timeval 1
75 # endif
77 # endif
79 # ifdef __cplusplus
81 # endif
83 # if @GNULIB_GETTIMEOFDAY@
84 # if @REPLACE_GETTIMEOFDAY@
85 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
86 # undef gettimeofday
87 # define gettimeofday rpl_gettimeofday
88 # endif
89 _GL_FUNCDECL_RPL (gettimeofday, int,
90 (struct timeval *restrict, void *restrict)
91 _GL_ARG_NONNULL ((1)));
92 _GL_CXXALIAS_RPL (gettimeofday, int,
93 (struct timeval *restrict, void *restrict));
94 # else
95 # if !@HAVE_GETTIMEOFDAY@
96 _GL_FUNCDECL_SYS (gettimeofday, int,
97 (struct timeval *restrict, void *restrict)
98 _GL_ARG_NONNULL ((1)));
99 # endif
100 /* Need to cast, because on glibc systems, by default, the second argument is
101 struct timezone *. */
102 _GL_CXXALIAS_SYS_CAST (gettimeofday, int,
103 (struct timeval *restrict, void *restrict));
104 # endif
105 _GL_CXXALIASWARN (gettimeofday);
106 # elif defined GNULIB_POSIXCHECK
107 # undef gettimeofday
108 # if HAVE_RAW_DECL_GETTIMEOFDAY
109 _GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - "
110 "use gnulib module gettimeofday for portability");
111 # endif
112 # endif
114 /* Hide some function declarations from <winsock2.h>. */
116 # if defined _MSC_VER && @HAVE_WINSOCK2_H@
117 # if !defined _@GUARD_PREFIX@_UNISTD_H
118 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
119 # undef close
120 # define close close_used_without_including_unistd_h
121 # else
122 _GL_WARN_ON_USE (close,
123 "close() used without including <unistd.h>");
124 # endif
125 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
126 # undef gethostname
127 # define gethostname gethostname_used_without_including_unistd_h
128 # else
129 _GL_WARN_ON_USE (gethostname,
130 "gethostname() used without including <unistd.h>");
131 # endif
132 # endif
133 # if !defined _@GUARD_PREFIX@_SYS_SOCKET_H
134 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
135 # undef socket
136 # define socket socket_used_without_including_sys_socket_h
137 # undef connect
138 # define connect connect_used_without_including_sys_socket_h
139 # undef accept
140 # define accept accept_used_without_including_sys_socket_h
141 # undef bind
142 # define bind bind_used_without_including_sys_socket_h
143 # undef getpeername
144 # define getpeername getpeername_used_without_including_sys_socket_h
145 # undef getsockname
146 # define getsockname getsockname_used_without_including_sys_socket_h
147 # undef getsockopt
148 # define getsockopt getsockopt_used_without_including_sys_socket_h
149 # undef listen
150 # define listen listen_used_without_including_sys_socket_h
151 # undef recv
152 # define recv recv_used_without_including_sys_socket_h
153 # undef send
154 # define send send_used_without_including_sys_socket_h
155 # undef recvfrom
156 # define recvfrom recvfrom_used_without_including_sys_socket_h
157 # undef sendto
158 # define sendto sendto_used_without_including_sys_socket_h
159 # undef setsockopt
160 # define setsockopt setsockopt_used_without_including_sys_socket_h
161 # undef shutdown
162 # define shutdown shutdown_used_without_including_sys_socket_h
163 # else
164 _GL_WARN_ON_USE (socket,
165 "socket() used without including <sys/socket.h>");
166 _GL_WARN_ON_USE (connect,
167 "connect() used without including <sys/socket.h>");
168 _GL_WARN_ON_USE (accept,
169 "accept() used without including <sys/socket.h>");
170 _GL_WARN_ON_USE (bind,
171 "bind() used without including <sys/socket.h>");
172 _GL_WARN_ON_USE (getpeername,
173 "getpeername() used without including <sys/socket.h>");
174 _GL_WARN_ON_USE (getsockname,
175 "getsockname() used without including <sys/socket.h>");
176 _GL_WARN_ON_USE (getsockopt,
177 "getsockopt() used without including <sys/socket.h>");
178 _GL_WARN_ON_USE (listen,
179 "listen() used without including <sys/socket.h>");
180 _GL_WARN_ON_USE (recv,
181 "recv() used without including <sys/socket.h>");
182 _GL_WARN_ON_USE (send,
183 "send() used without including <sys/socket.h>");
184 _GL_WARN_ON_USE (recvfrom,
185 "recvfrom() used without including <sys/socket.h>");
186 _GL_WARN_ON_USE (sendto,
187 "sendto() used without including <sys/socket.h>");
188 _GL_WARN_ON_USE (setsockopt,
189 "setsockopt() used without including <sys/socket.h>");
190 _GL_WARN_ON_USE (shutdown,
191 "shutdown() used without including <sys/socket.h>");
192 # endif
193 # endif
194 # if !defined _@GUARD_PREFIX@_SYS_SELECT_H
195 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
196 # undef select
197 # define select select_used_without_including_sys_select_h
198 # else
199 _GL_WARN_ON_USE (select,
200 "select() used without including <sys/select.h>");
201 # endif
202 # endif
203 # endif
205 #endif /* _@GUARD_PREFIX@_SYS_TIME_H */