Blame gl/sys_time.in.h

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