Use iteration in math-factorial-iter
[emacs.git] / lib / sys_time.in.h
blob57739bc4c560e2df863628bc70bbef575ecc87a2
1 /* Provide a more complete sys/time.h.
3 Copyright (C) 2007-2017 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 #ifndef _@GUARD_PREFIX@_SYS_TIME_H
22 #if __GNUC__ >= 3
23 @PRAGMA_SYSTEM_HEADER@
24 #endif
25 @PRAGMA_COLUMNS@
27 /* On Cygwin and on many BSDish systems, <sys/time.h> includes itself
28 recursively via <sys/select.h>.
29 Simply delegate to the system's header in this case; it is a no-op.
30 Without this extra ifdef, the C++ gettimeofday declaration below
31 would be a forward declaration in gnulib's nested <sys/time.h>. */
32 #if defined _CYGWIN_SYS_TIME_H || defined _SYS_TIME_H || defined _SYS_TIME_H_
33 # @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
34 #else
36 /* The include_next requires a split double-inclusion guard. */
37 #if @HAVE_SYS_TIME_H@
38 # @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
39 #endif
41 #ifndef _@GUARD_PREFIX@_SYS_TIME_H
42 #define _@GUARD_PREFIX@_SYS_TIME_H
44 #if ! @HAVE_SYS_TIME_H@
45 # include <time.h>
46 #endif
48 /* On native Windows with MSVC, get the 'struct timeval' type.
49 Also, on native Windows with a 64-bit time_t, where we are overriding the
50 'struct timeval' type, get all declarations of system functions whose
51 signature contains 'struct timeval'. */
52 #if (defined _MSC_VER || @REPLACE_STRUCT_TIMEVAL@) && @HAVE_WINSOCK2_H@ && !defined _GL_INCLUDING_WINSOCK2_H
53 # define _GL_INCLUDING_WINSOCK2_H
54 # include <winsock2.h>
55 # undef _GL_INCLUDING_WINSOCK2_H
56 #endif
58 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
60 /* The definition of _GL_ARG_NONNULL is copied here. */
62 /* The definition of _GL_WARN_ON_USE is copied here. */
64 #ifdef __cplusplus
65 extern "C" {
66 #endif
68 #if !@HAVE_STRUCT_TIMEVAL@ || @REPLACE_STRUCT_TIMEVAL@
70 # if @REPLACE_STRUCT_TIMEVAL@
71 # define timeval rpl_timeval
72 # endif
74 # if !GNULIB_defined_struct_timeval
75 struct timeval
77 time_t tv_sec;
78 long int tv_usec;
80 # define GNULIB_defined_struct_timeval 1
81 # endif
83 #endif
85 #ifdef __cplusplus
87 #endif
89 #if @GNULIB_GETTIMEOFDAY@
90 # if @REPLACE_GETTIMEOFDAY@
91 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
92 # undef gettimeofday
93 # define gettimeofday rpl_gettimeofday
94 # endif
95 _GL_FUNCDECL_RPL (gettimeofday, int,
96 (struct timeval *restrict, void *restrict)
97 _GL_ARG_NONNULL ((1)));
98 _GL_CXXALIAS_RPL (gettimeofday, int,
99 (struct timeval *restrict, void *restrict));
100 # else
101 # if !@HAVE_GETTIMEOFDAY@
102 _GL_FUNCDECL_SYS (gettimeofday, int,
103 (struct timeval *restrict, void *restrict)
104 _GL_ARG_NONNULL ((1)));
105 # endif
106 /* Need to cast, because on glibc systems, by default, the second argument is
107 struct timezone *. */
108 _GL_CXXALIAS_SYS_CAST (gettimeofday, int,
109 (struct timeval *restrict, void *restrict));
110 # endif
111 _GL_CXXALIASWARN (gettimeofday);
112 # if defined __cplusplus && defined GNULIB_NAMESPACE
113 namespace GNULIB_NAMESPACE {
114 typedef ::timeval
115 #undef timeval
116 timeval;
118 # endif
119 #elif defined GNULIB_POSIXCHECK
120 # undef gettimeofday
121 # if HAVE_RAW_DECL_GETTIMEOFDAY
122 _GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - "
123 "use gnulib module gettimeofday for portability");
124 # endif
125 #endif
127 /* Hide some function declarations from <winsock2.h>. */
129 #if defined _MSC_VER && @HAVE_WINSOCK2_H@
130 # if !defined _@GUARD_PREFIX@_UNISTD_H
131 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
132 # undef close
133 # define close close_used_without_including_unistd_h
134 # else
135 _GL_WARN_ON_USE (close,
136 "close() used without including <unistd.h>");
137 # endif
138 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
139 # undef gethostname
140 # define gethostname gethostname_used_without_including_unistd_h
141 # else
142 _GL_WARN_ON_USE (gethostname,
143 "gethostname() used without including <unistd.h>");
144 # endif
145 # endif
146 # if !defined _@GUARD_PREFIX@_SYS_SOCKET_H
147 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
148 # undef socket
149 # define socket socket_used_without_including_sys_socket_h
150 # undef connect
151 # define connect connect_used_without_including_sys_socket_h
152 # undef accept
153 # define accept accept_used_without_including_sys_socket_h
154 # undef bind
155 # define bind bind_used_without_including_sys_socket_h
156 # undef getpeername
157 # define getpeername getpeername_used_without_including_sys_socket_h
158 # undef getsockname
159 # define getsockname getsockname_used_without_including_sys_socket_h
160 # undef getsockopt
161 # define getsockopt getsockopt_used_without_including_sys_socket_h
162 # undef listen
163 # define listen listen_used_without_including_sys_socket_h
164 # undef recv
165 # define recv recv_used_without_including_sys_socket_h
166 # undef send
167 # define send send_used_without_including_sys_socket_h
168 # undef recvfrom
169 # define recvfrom recvfrom_used_without_including_sys_socket_h
170 # undef sendto
171 # define sendto sendto_used_without_including_sys_socket_h
172 # undef setsockopt
173 # define setsockopt setsockopt_used_without_including_sys_socket_h
174 # undef shutdown
175 # define shutdown shutdown_used_without_including_sys_socket_h
176 # else
177 _GL_WARN_ON_USE (socket,
178 "socket() used without including <sys/socket.h>");
179 _GL_WARN_ON_USE (connect,
180 "connect() used without including <sys/socket.h>");
181 _GL_WARN_ON_USE (accept,
182 "accept() used without including <sys/socket.h>");
183 _GL_WARN_ON_USE (bind,
184 "bind() used without including <sys/socket.h>");
185 _GL_WARN_ON_USE (getpeername,
186 "getpeername() used without including <sys/socket.h>");
187 _GL_WARN_ON_USE (getsockname,
188 "getsockname() used without including <sys/socket.h>");
189 _GL_WARN_ON_USE (getsockopt,
190 "getsockopt() used without including <sys/socket.h>");
191 _GL_WARN_ON_USE (listen,
192 "listen() used without including <sys/socket.h>");
193 _GL_WARN_ON_USE (recv,
194 "recv() used without including <sys/socket.h>");
195 _GL_WARN_ON_USE (send,
196 "send() used without including <sys/socket.h>");
197 _GL_WARN_ON_USE (recvfrom,
198 "recvfrom() used without including <sys/socket.h>");
199 _GL_WARN_ON_USE (sendto,
200 "sendto() used without including <sys/socket.h>");
201 _GL_WARN_ON_USE (setsockopt,
202 "setsockopt() used without including <sys/socket.h>");
203 _GL_WARN_ON_USE (shutdown,
204 "shutdown() used without including <sys/socket.h>");
205 # endif
206 # endif
207 # if !defined _@GUARD_PREFIX@_SYS_SELECT_H
208 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
209 # undef select
210 # define select select_used_without_including_sys_select_h
211 # else
212 _GL_WARN_ON_USE (select,
213 "select() used without including <sys/select.h>");
214 # endif
215 # endif
216 #endif
218 #endif /* _@GUARD_PREFIX@_SYS_TIME_H */
219 #endif /* _CYGWIN_SYS_TIME_H */
220 #endif /* _@GUARD_PREFIX@_SYS_TIME_H */