Blame gnulib/lib/sys_time.in.h

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