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