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