Blame gl/sys_time.in.h

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