Blame lib/sys_time.in.h

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