Blame lib/sys_time.in.h

Packit 33f14e
/* Provide a more complete sys/time.h.
Packit 33f14e
Packit 33f14e
   Copyright (C) 2007-2017 Free Software Foundation, Inc.
Packit 33f14e
Packit 33f14e
   This program is free software; you can redistribute it and/or modify
Packit 33f14e
   it under the terms of the GNU General Public License as published by
Packit 33f14e
   the Free Software Foundation; either version 3, or (at your option)
Packit 33f14e
   any later version.
Packit 33f14e
Packit 33f14e
   This program is distributed in the hope that it will be useful,
Packit 33f14e
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 33f14e
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 33f14e
   GNU General Public License for more details.
Packit 33f14e
Packit 33f14e
   You should have received a copy of the GNU General Public License
Packit 33f14e
   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
Packit 33f14e
Packit 33f14e
/* Written by Paul Eggert.  */
Packit 33f14e
Packit 33f14e
#ifndef _@GUARD_PREFIX@_SYS_TIME_H
Packit 33f14e
Packit 33f14e
#if __GNUC__ >= 3
Packit 33f14e
@PRAGMA_SYSTEM_HEADER@
Packit 33f14e
#endif
Packit 33f14e
@PRAGMA_COLUMNS@
Packit 33f14e
Packit 33f14e
/* On Cygwin and on many BSDish systems, <sys/time.h> includes itself
Packit 33f14e
   recursively via <sys/select.h>.
Packit 33f14e
   Simply delegate to the system's header in this case; it is a no-op.
Packit 33f14e
   Without this extra ifdef, the C++ gettimeofday declaration below
Packit 33f14e
   would be a forward declaration in gnulib's nested <sys/time.h>.  */
Packit 33f14e
#if defined _CYGWIN_SYS_TIME_H || defined _SYS_TIME_H || defined _SYS_TIME_H_
Packit 33f14e
# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
Packit 33f14e
#else
Packit 33f14e
Packit 33f14e
/* The include_next requires a split double-inclusion guard.  */
Packit 33f14e
#if @HAVE_SYS_TIME_H@
Packit 33f14e
# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
Packit 33f14e
#endif
Packit 33f14e
Packit 33f14e
#ifndef _@GUARD_PREFIX@_SYS_TIME_H
Packit 33f14e
#define _@GUARD_PREFIX@_SYS_TIME_H
Packit 33f14e
Packit 33f14e
#if ! @HAVE_SYS_TIME_H@
Packit 33f14e
# include <time.h>
Packit 33f14e
#endif
Packit 33f14e
Packit 33f14e
/* On native Windows with MSVC, get the 'struct timeval' type.
Packit 33f14e
   Also, on native Windows with a 64-bit time_t, where we are overriding the
Packit 33f14e
   'struct timeval' type, get all declarations of system functions whose
Packit 33f14e
   signature contains 'struct timeval'.  */
Packit 33f14e
#if (defined _MSC_VER || @REPLACE_STRUCT_TIMEVAL@) && @HAVE_WINSOCK2_H@ && !defined _GL_INCLUDING_WINSOCK2_H
Packit 33f14e
# define _GL_INCLUDING_WINSOCK2_H
Packit 33f14e
# include <winsock2.h>
Packit 33f14e
# undef _GL_INCLUDING_WINSOCK2_H
Packit 33f14e
#endif
Packit 33f14e
Packit 33f14e
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
Packit 33f14e
Packit 33f14e
/* The definition of _GL_ARG_NONNULL is copied here.  */
Packit 33f14e
Packit 33f14e
/* The definition of _GL_WARN_ON_USE is copied here.  */
Packit 33f14e
Packit 33f14e
#ifdef __cplusplus
Packit 33f14e
extern "C" {
Packit 33f14e
#endif
Packit 33f14e
Packit 33f14e
#if !@HAVE_STRUCT_TIMEVAL@ || @REPLACE_STRUCT_TIMEVAL@
Packit 33f14e
Packit 33f14e
# if @REPLACE_STRUCT_TIMEVAL@
Packit 33f14e
#  define timeval rpl_timeval
Packit 33f14e
# endif
Packit 33f14e
Packit 33f14e
# if !GNULIB_defined_struct_timeval
Packit 33f14e
struct timeval
Packit 33f14e
{
Packit 33f14e
  time_t tv_sec;
Packit 33f14e
  long int tv_usec;
Packit 33f14e
};
Packit 33f14e
#  define GNULIB_defined_struct_timeval 1
Packit 33f14e
# endif
Packit 33f14e
Packit 33f14e
#endif
Packit 33f14e
Packit 33f14e
#ifdef __cplusplus
Packit 33f14e
}
Packit 33f14e
#endif
Packit 33f14e
Packit 33f14e
#if @GNULIB_GETTIMEOFDAY@
Packit 33f14e
# if @REPLACE_GETTIMEOFDAY@
Packit 33f14e
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
Packit 33f14e
#   undef gettimeofday
Packit 33f14e
#   define gettimeofday rpl_gettimeofday
Packit 33f14e
#  endif
Packit 33f14e
_GL_FUNCDECL_RPL (gettimeofday, int,
Packit 33f14e
                  (struct timeval *restrict, void *restrict)
Packit 33f14e
                  _GL_ARG_NONNULL ((1)));
Packit 33f14e
_GL_CXXALIAS_RPL (gettimeofday, int,
Packit 33f14e
                  (struct timeval *restrict, void *restrict));
Packit 33f14e
# else
Packit 33f14e
#  if !@HAVE_GETTIMEOFDAY@
Packit 33f14e
_GL_FUNCDECL_SYS (gettimeofday, int,
Packit 33f14e
                  (struct timeval *restrict, void *restrict)
Packit 33f14e
                  _GL_ARG_NONNULL ((1)));
Packit 33f14e
#  endif
Packit 33f14e
/* Need to cast, because on glibc systems, by default, the second argument is
Packit 33f14e
                                                  struct timezone *.  */
Packit 33f14e
_GL_CXXALIAS_SYS_CAST (gettimeofday, int,
Packit 33f14e
                       (struct timeval *restrict, void *restrict));
Packit 33f14e
# endif
Packit 33f14e
_GL_CXXALIASWARN (gettimeofday);
Packit 33f14e
# if defined __cplusplus && defined GNULIB_NAMESPACE
Packit 33f14e
namespace GNULIB_NAMESPACE {
Packit 33f14e
  typedef ::timeval
Packit 33f14e
#undef timeval
Packit 33f14e
    timeval;
Packit 33f14e
}
Packit 33f14e
# endif
Packit 33f14e
#elif defined GNULIB_POSIXCHECK
Packit 33f14e
# undef gettimeofday
Packit 33f14e
# if HAVE_RAW_DECL_GETTIMEOFDAY
Packit 33f14e
_GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - "
Packit 33f14e
                 "use gnulib module gettimeofday for portability");
Packit 33f14e
# endif
Packit 33f14e
#endif
Packit 33f14e
Packit 33f14e
/* Hide some function declarations from <winsock2.h>.  */
Packit 33f14e
Packit 33f14e
#if defined _MSC_VER && @HAVE_WINSOCK2_H@
Packit 33f14e
# if !defined _@GUARD_PREFIX@_UNISTD_H
Packit 33f14e
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
Packit 33f14e
#   undef close
Packit 33f14e
#   define close close_used_without_including_unistd_h
Packit 33f14e
#  else
Packit 33f14e
     _GL_WARN_ON_USE (close,
Packit 33f14e
                      "close() used without including <unistd.h>");
Packit 33f14e
#  endif
Packit 33f14e
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
Packit 33f14e
#   undef gethostname
Packit 33f14e
#   define gethostname gethostname_used_without_including_unistd_h
Packit 33f14e
#  else
Packit 33f14e
     _GL_WARN_ON_USE (gethostname,
Packit 33f14e
                      "gethostname() used without including <unistd.h>");
Packit 33f14e
#  endif
Packit 33f14e
# endif
Packit 33f14e
# if !defined _@GUARD_PREFIX@_SYS_SOCKET_H
Packit 33f14e
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
Packit 33f14e
#   undef socket
Packit 33f14e
#   define socket              socket_used_without_including_sys_socket_h
Packit 33f14e
#   undef connect
Packit 33f14e
#   define connect             connect_used_without_including_sys_socket_h
Packit 33f14e
#   undef accept
Packit 33f14e
#   define accept              accept_used_without_including_sys_socket_h
Packit 33f14e
#   undef bind
Packit 33f14e
#   define bind                bind_used_without_including_sys_socket_h
Packit 33f14e
#   undef getpeername
Packit 33f14e
#   define getpeername         getpeername_used_without_including_sys_socket_h
Packit 33f14e
#   undef getsockname
Packit 33f14e
#   define getsockname         getsockname_used_without_including_sys_socket_h
Packit 33f14e
#   undef getsockopt
Packit 33f14e
#   define getsockopt          getsockopt_used_without_including_sys_socket_h
Packit 33f14e
#   undef listen
Packit 33f14e
#   define listen              listen_used_without_including_sys_socket_h
Packit 33f14e
#   undef recv
Packit 33f14e
#   define recv                recv_used_without_including_sys_socket_h
Packit 33f14e
#   undef send
Packit 33f14e
#   define send                send_used_without_including_sys_socket_h
Packit 33f14e
#   undef recvfrom
Packit 33f14e
#   define recvfrom            recvfrom_used_without_including_sys_socket_h
Packit 33f14e
#   undef sendto
Packit 33f14e
#   define sendto              sendto_used_without_including_sys_socket_h
Packit 33f14e
#   undef setsockopt
Packit 33f14e
#   define setsockopt          setsockopt_used_without_including_sys_socket_h
Packit 33f14e
#   undef shutdown
Packit 33f14e
#   define shutdown            shutdown_used_without_including_sys_socket_h
Packit 33f14e
#  else
Packit 33f14e
     _GL_WARN_ON_USE (socket,
Packit 33f14e
                      "socket() used without including <sys/socket.h>");
Packit 33f14e
     _GL_WARN_ON_USE (connect,
Packit 33f14e
                      "connect() used without including <sys/socket.h>");
Packit 33f14e
     _GL_WARN_ON_USE (accept,
Packit 33f14e
                      "accept() used without including <sys/socket.h>");
Packit 33f14e
     _GL_WARN_ON_USE (bind,
Packit 33f14e
                      "bind() used without including <sys/socket.h>");
Packit 33f14e
     _GL_WARN_ON_USE (getpeername,
Packit 33f14e
                      "getpeername() used without including <sys/socket.h>");
Packit 33f14e
     _GL_WARN_ON_USE (getsockname,
Packit 33f14e
                      "getsockname() used without including <sys/socket.h>");
Packit 33f14e
     _GL_WARN_ON_USE (getsockopt,
Packit 33f14e
                      "getsockopt() used without including <sys/socket.h>");
Packit 33f14e
     _GL_WARN_ON_USE (listen,
Packit 33f14e
                      "listen() used without including <sys/socket.h>");
Packit 33f14e
     _GL_WARN_ON_USE (recv,
Packit 33f14e
                      "recv() used without including <sys/socket.h>");
Packit 33f14e
     _GL_WARN_ON_USE (send,
Packit 33f14e
                      "send() used without including <sys/socket.h>");
Packit 33f14e
     _GL_WARN_ON_USE (recvfrom,
Packit 33f14e
                      "recvfrom() used without including <sys/socket.h>");
Packit 33f14e
     _GL_WARN_ON_USE (sendto,
Packit 33f14e
                      "sendto() used without including <sys/socket.h>");
Packit 33f14e
     _GL_WARN_ON_USE (setsockopt,
Packit 33f14e
                      "setsockopt() used without including <sys/socket.h>");
Packit 33f14e
     _GL_WARN_ON_USE (shutdown,
Packit 33f14e
                      "shutdown() used without including <sys/socket.h>");
Packit 33f14e
#  endif
Packit 33f14e
# endif
Packit 33f14e
# if !defined _@GUARD_PREFIX@_SYS_SELECT_H
Packit 33f14e
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
Packit 33f14e
#   undef select
Packit 33f14e
#   define select select_used_without_including_sys_select_h
Packit 33f14e
#  else
Packit 33f14e
     _GL_WARN_ON_USE (select,
Packit 33f14e
                      "select() used without including <sys/select.h>");
Packit 33f14e
#  endif
Packit 33f14e
# endif
Packit 33f14e
#endif
Packit 33f14e
Packit 33f14e
#endif /* _@GUARD_PREFIX@_SYS_TIME_H */
Packit 33f14e
#endif /* _CYGWIN_SYS_TIME_H */
Packit 33f14e
#endif /* _@GUARD_PREFIX@_SYS_TIME_H */