Commit c32718be authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[master] applied the proposed patch for clang++ build problem.

tenatively okayed on jabber.  if inappropriate it's easy to back out.
parent 2ec061bc
......@@ -28,6 +28,7 @@ namespace asio {
namespace detail {
namespace descriptor_ops {
ASIO_DECL
int open(const char* path, int flags, asio::error_code& ec)
{
errno = 0;
......@@ -37,6 +38,7 @@ int open(const char* path, int flags, asio::error_code& ec)
return result;
}
ASIO_DECL
int close(int d, state_type& state, asio::error_code& ec)
{
int result = 0;
......@@ -64,6 +66,7 @@ int close(int d, state_type& state, asio::error_code& ec)
return result;
}
ASIO_DECL
bool set_internal_non_blocking(int d,
state_type& state, asio::error_code& ec)
{
......@@ -96,6 +99,7 @@ bool set_internal_non_blocking(int d,
return false;
}
ASIO_DECL
std::size_t sync_read(int d, state_type state, buf* bufs,
std::size_t count, bool all_empty, asio::error_code& ec)
{
......@@ -142,6 +146,7 @@ std::size_t sync_read(int d, state_type state, buf* bufs,
}
}
ASIO_DECL
bool non_blocking_read(int d, buf* bufs, std::size_t count,
asio::error_code& ec, std::size_t& bytes_transferred)
{
......@@ -180,6 +185,7 @@ bool non_blocking_read(int d, buf* bufs, std::size_t count,
}
}
ASIO_DECL
std::size_t sync_write(int d, state_type state, const buf* bufs,
std::size_t count, bool all_empty, asio::error_code& ec)
{
......@@ -219,6 +225,7 @@ std::size_t sync_write(int d, state_type state, const buf* bufs,
}
}
ASIO_DECL
bool non_blocking_write(int d, const buf* bufs, std::size_t count,
asio::error_code& ec, std::size_t& bytes_transferred)
{
......@@ -250,6 +257,7 @@ bool non_blocking_write(int d, const buf* bufs, std::size_t count,
}
}
ASIO_DECL
int ioctl(int d, state_type& state, long cmd,
ioctl_arg_type* arg, asio::error_code& ec)
{
......@@ -291,6 +299,7 @@ int ioctl(int d, state_type& state, long cmd,
return result;
}
ASIO_DECL
int fcntl(int d, long cmd, asio::error_code& ec)
{
if (d == -1)
......@@ -306,6 +315,7 @@ int fcntl(int d, long cmd, asio::error_code& ec)
return result;
}
ASIO_DECL
int fcntl(int d, long cmd, long arg, asio::error_code& ec)
{
if (d == -1)
......@@ -321,6 +331,7 @@ int fcntl(int d, long cmd, long arg, asio::error_code& ec)
return result;
}
ASIO_DECL
int poll_read(int d, asio::error_code& ec)
{
if (d == -1)
......@@ -340,6 +351,7 @@ int poll_read(int d, asio::error_code& ec)
return result;
}
ASIO_DECL
int poll_write(int d, asio::error_code& ec)
{
if (d == -1)
......
......@@ -77,6 +77,7 @@ inline socket_type call_accept(SockLenType msghdr::*,
return result;
}
ASIO_DECL
socket_type accept(socket_type s, socket_addr_type* addr,
std::size_t* addrlen, asio::error_code& ec)
{
......@@ -108,6 +109,7 @@ socket_type accept(socket_type s, socket_addr_type* addr,
return new_s;
}
ASIO_DECL
socket_type sync_accept(socket_type s, state_type state,
socket_addr_type* addr, std::size_t* addrlen, asio::error_code& ec)
{
......@@ -199,6 +201,7 @@ void complete_iocp_accept(socket_type s,
#else // defined(ASIO_HAS_IOCP)
ASIO_DECL
bool non_blocking_accept(socket_type s,
state_type state, socket_addr_type* addr, std::size_t* addrlen,
asio::error_code& ec, socket_type& new_socket)
......@@ -254,6 +257,7 @@ inline int call_bind(SockLenType msghdr::*,
return ::bind(s, addr, (SockLenType)addrlen);
}
ASIO_DECL
int bind(socket_type s, const socket_addr_type* addr,
std::size_t addrlen, asio::error_code& ec)
{
......@@ -271,6 +275,7 @@ int bind(socket_type s, const socket_addr_type* addr,
return result;
}
ASIO_DECL
int close(socket_type s, state_type& state,
bool destruction, asio::error_code& ec)
{
......@@ -322,6 +327,7 @@ int close(socket_type s, state_type& state,
return result;
}
ASIO_DECL
bool set_internal_non_blocking(socket_type s,
state_type& state, asio::error_code& ec)
{
......@@ -357,6 +363,7 @@ bool set_internal_non_blocking(socket_type s,
return false;
}
ASIO_DECL
int shutdown(socket_type s, int what, asio::error_code& ec)
{
if (s == invalid_socket)
......@@ -379,6 +386,7 @@ inline int call_connect(SockLenType msghdr::*,
return ::connect(s, addr, (SockLenType)addrlen);
}
ASIO_DECL
int connect(socket_type s, const socket_addr_type* addr,
std::size_t addrlen, asio::error_code& ec)
{
......@@ -396,6 +404,7 @@ int connect(socket_type s, const socket_addr_type* addr,
return result;
}
ASIO_DECL
void sync_connect(socket_type s, const socket_addr_type* addr,
std::size_t addrlen, asio::error_code& ec)
{
......@@ -424,6 +433,7 @@ void sync_connect(socket_type s, const socket_addr_type* addr,
asio::error::get_system_category());
}
ASIO_DECL
bool non_blocking_connect(socket_type s, asio::error_code& ec)
{
// Get the error code from the connect operation.
......@@ -444,6 +454,7 @@ bool non_blocking_connect(socket_type s, asio::error_code& ec)
return true;
}
ASIO_DECL
int socketpair(int af, int type, int protocol,
socket_type sv[2], asio::error_code& ec)
{
......@@ -463,6 +474,7 @@ int socketpair(int af, int type, int protocol,
#endif
}
ASIO_DECL
bool sockatmark(socket_type s, asio::error_code& ec)
{
if (s == invalid_socket)
......@@ -493,6 +505,7 @@ bool sockatmark(socket_type s, asio::error_code& ec)
return ec ? false : value != 0;
}
ASIO_DECL
size_t available(socket_type s, asio::error_code& ec)
{
if (s == invalid_socket)
......@@ -517,6 +530,7 @@ size_t available(socket_type s, asio::error_code& ec)
return ec ? static_cast<size_t>(0) : static_cast<size_t>(value);
}
ASIO_DECL
int listen(socket_type s, int backlog, asio::error_code& ec)
{
if (s == invalid_socket)
......@@ -549,6 +563,7 @@ typedef WSABUF buf;
typedef iovec buf;
#endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
ASIO_DECL
void init_buf(buf& b, void* data, size_t size)
{
#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
......@@ -560,6 +575,7 @@ void init_buf(buf& b, void* data, size_t size)
#endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
}
ASIO_DECL
void init_buf(buf& b, const void* data, size_t size)
{
#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
......@@ -593,6 +609,7 @@ inline void init_msghdr_msg_name(T& name, const socket_addr_type* addr)
name = reinterpret_cast<T>(const_cast<socket_addr_type*>(addr));
}
ASIO_DECL
int recv(socket_type s, buf* bufs, size_t count, int flags,
asio::error_code& ec)
{
......@@ -623,6 +640,7 @@ int recv(socket_type s, buf* bufs, size_t count, int flags,
#endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
}
ASIO_DECL
size_t sync_recv(socket_type s, state_type state, buf* bufs,
size_t count, int flags, bool all_empty, asio::error_code& ec)
{
......@@ -670,6 +688,7 @@ size_t sync_recv(socket_type s, state_type state, buf* bufs,
#if defined(ASIO_HAS_IOCP)
ASIO_DECL
void complete_iocp_recv(state_type state,
const weak_cancel_token_type& cancel_token, bool all_empty,
asio::error_code& ec, size_t bytes_transferred)
......@@ -698,6 +717,7 @@ void complete_iocp_recv(state_type state,
#else // defined(ASIO_HAS_IOCP)
ASIO_DECL
bool non_blocking_recv(socket_type s,
buf* bufs, size_t count, int flags, bool is_stream,
asio::error_code& ec, size_t& bytes_transferred)
......@@ -738,6 +758,7 @@ bool non_blocking_recv(socket_type s,
#endif // defined(ASIO_HAS_IOCP)
ASIO_DECL
int recvfrom(socket_type s, buf* bufs, size_t count, int flags,
socket_addr_type* addr, std::size_t* addrlen,
asio::error_code& ec)
......@@ -774,6 +795,7 @@ int recvfrom(socket_type s, buf* bufs, size_t count, int flags,
#endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
}
ASIO_DECL
size_t sync_recvfrom(socket_type s, state_type state, buf* bufs,
size_t count, int flags, socket_addr_type* addr,
std::size_t* addrlen, asio::error_code& ec)
......@@ -808,6 +830,7 @@ size_t sync_recvfrom(socket_type s, state_type state, buf* bufs,
#if defined(ASIO_HAS_IOCP)
ASIO_DECL
void complete_iocp_recvfrom(
const weak_cancel_token_type& cancel_token,
asio::error_code& ec)
......@@ -828,6 +851,7 @@ void complete_iocp_recvfrom(
#else // defined(ASIO_HAS_IOCP)
ASIO_DECL
bool non_blocking_recvfrom(socket_type s,
buf* bufs, size_t count, int flags,
socket_addr_type* addr, std::size_t* addrlen,
......@@ -862,6 +886,7 @@ bool non_blocking_recvfrom(socket_type s,
#endif // defined(ASIO_HAS_IOCP)
ASIO_DECL
int send(socket_type s, const buf* bufs, size_t count, int flags,
asio::error_code& ec)
{
......@@ -895,6 +920,7 @@ int send(socket_type s, const buf* bufs, size_t count, int flags,
#endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
}
ASIO_DECL
size_t sync_send(socket_type s, state_type state, const buf* bufs,
size_t count, int flags, bool all_empty, asio::error_code& ec)
{
......@@ -935,6 +961,7 @@ size_t sync_send(socket_type s, state_type state, const buf* bufs,
#if defined(ASIO_HAS_IOCP)
ASIO_DECL
void complete_iocp_send(
const weak_cancel_token_type& cancel_token,
asio::error_code& ec)
......@@ -955,6 +982,7 @@ void complete_iocp_send(
#else // defined(ASIO_HAS_IOCP)
ASIO_DECL
bool non_blocking_send(socket_type s,
const buf* bufs, size_t count, int flags,
asio::error_code& ec, size_t& bytes_transferred)
......@@ -988,6 +1016,7 @@ bool non_blocking_send(socket_type s,
#endif // defined(ASIO_HAS_IOCP)
ASIO_DECL
int sendto(socket_type s, const buf* bufs, size_t count, int flags,
const socket_addr_type* addr, std::size_t addrlen,
asio::error_code& ec)
......@@ -1024,6 +1053,7 @@ int sendto(socket_type s, const buf* bufs, size_t count, int flags,
#endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
}
ASIO_DECL
size_t sync_sendto(socket_type s, state_type state, const buf* bufs,
size_t count, int flags, const socket_addr_type* addr,
std::size_t addrlen, asio::error_code& ec)
......@@ -1058,6 +1088,7 @@ size_t sync_sendto(socket_type s, state_type state, const buf* bufs,
#if !defined(ASIO_HAS_IOCP)
ASIO_DECL
bool non_blocking_sendto(socket_type s,
const buf* bufs, size_t count, int flags,
const socket_addr_type* addr, std::size_t addrlen,
......@@ -1092,6 +1123,7 @@ bool non_blocking_sendto(socket_type s,
#endif // !defined(ASIO_HAS_IOCP)
ASIO_DECL
socket_type socket(int af, int type, int protocol,
asio::error_code& ec)
{
......@@ -1147,6 +1179,7 @@ inline int call_setsockopt(SockLenType msghdr::*,
(const char*)optval, (SockLenType)optlen);
}
ASIO_DECL
int setsockopt(socket_type s, state_type& state, int level, int optname,
const void* optval, std::size_t optlen, asio::error_code& ec)
{
......@@ -1235,6 +1268,7 @@ inline int call_getsockopt(SockLenType msghdr::*,
return result;
}
ASIO_DECL
int getsockopt(socket_type s, state_type state, int level, int optname,
void* optval, size_t* optlen, asio::error_code& ec)
{
......@@ -1344,6 +1378,7 @@ inline int call_getpeername(SockLenType msghdr::*,
return result;
}
ASIO_DECL
int getpeername(socket_type s, socket_addr_type* addr,
std::size_t* addrlen, bool cached, asio::error_code& ec)
{
......@@ -1396,6 +1431,7 @@ inline int call_getsockname(SockLenType msghdr::*,
return result;
}
ASIO_DECL
int getsockname(socket_type s, socket_addr_type* addr,
std::size_t* addrlen, asio::error_code& ec)
{
......@@ -1413,6 +1449,7 @@ int getsockname(socket_type s, socket_addr_type* addr,
return result;
}
ASIO_DECL
int ioctl(socket_type s, state_type& state, int cmd,
ioctl_arg_type* arg, asio::error_code& ec)
{
......@@ -1460,6 +1497,7 @@ int ioctl(socket_type s, state_type& state, int cmd,
return result;
}
ASIO_DECL
int select(int nfds, fd_set* readfds, fd_set* writefds,
fd_set* exceptfds, timeval* timeout, asio::error_code& ec)
{
......@@ -1501,6 +1539,7 @@ int select(int nfds, fd_set* readfds, fd_set* writefds,
#endif
}
ASIO_DECL
int poll_read(socket_type s, asio::error_code& ec)
{
if (s == invalid_socket)
......@@ -1537,6 +1576,7 @@ int poll_read(socket_type s, asio::error_code& ec)
// || defined(__SYMBIAN32__)
}
ASIO_DECL
int poll_write(socket_type s, asio::error_code& ec)
{
if (s == invalid_socket)
......@@ -1573,6 +1613,7 @@ int poll_write(socket_type s, asio::error_code& ec)
// || defined(__SYMBIAN32__)
}
ASIO_DECL
int poll_connect(socket_type s, asio::error_code& ec)
{
if (s == invalid_socket)
......@@ -1612,6 +1653,7 @@ int poll_connect(socket_type s, asio::error_code& ec)
// || defined(__SYMBIAN32__)
}
ASIO_DECL
const char* inet_ntop(int af, const void* src, char* dest, size_t length,
unsigned long scope_id, asio::error_code& ec)
{
......@@ -1688,6 +1730,7 @@ const char* inet_ntop(int af, const void* src, char* dest, size_t length,
#endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
}
ASIO_DECL
int inet_pton(int af, const char* src, void* dest,
unsigned long* scope_id, asio::error_code& ec)
{
......@@ -1774,6 +1817,7 @@ int inet_pton(int af, const char* src, void* dest,
#endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
}
ASIO_DECL
int gethostname(char* name, int namelen, asio::error_code& ec)
{
clear_last_error();
......@@ -2667,6 +2711,7 @@ inline asio::error_code translate_addrinfo_error(int error)
}
}
ASIO_DECL
asio::error_code getaddrinfo(const char* host,
const char* service, const addrinfo_type& hints,
addrinfo_type** result, asio::error_code& ec)
......@@ -2703,6 +2748,7 @@ asio::error_code getaddrinfo(const char* host,
#endif
}
ASIO_DECL
asio::error_code background_getaddrinfo(
const weak_cancel_token_type& cancel_token, const char* host,
const char* service, const addrinfo_type& hints,
......@@ -2715,6 +2761,7 @@ asio::error_code background_getaddrinfo(
return ec;
}
ASIO_DECL
void freeaddrinfo(addrinfo_type* ai)
{
#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
......@@ -2741,6 +2788,7 @@ void freeaddrinfo(addrinfo_type* ai)
#endif
}
ASIO_DECL
asio::error_code getnameinfo(const socket_addr_type* addr,
std::size_t addrlen, char* host, std::size_t hostlen,
char* serv, std::size_t servlen, int flags, asio::error_code& ec)
......@@ -2788,6 +2836,7 @@ asio::error_code getnameinfo(const socket_addr_type* addr,
#endif
}
ASIO_DECL
asio::error_code sync_getnameinfo(
const socket_addr_type* addr, std::size_t addrlen,
char* host, std::size_t hostlen, char* serv,
......@@ -2807,6 +2856,7 @@ asio::error_code sync_getnameinfo(
return ec;
}
ASIO_DECL
asio::error_code background_getnameinfo(
const weak_cancel_token_type& cancel_token,
const socket_addr_type* addr, std::size_t addrlen,
......@@ -2834,21 +2884,25 @@ asio::error_code background_getnameinfo(
return ec;
}
ASIO_DECL
u_long_type network_to_host_long(u_long_type value)
{
return ntohl(value);
}
ASIO_DECL
u_long_type host_to_network_long(u_long_type value)
{
return htonl(value);
}
ASIO_DECL
u_short_type network_to_host_short(u_short_type value)
{
return ntohs(value);
}
ASIO_DECL
u_short_type host_to_network_short(u_short_type value)
{
return htons(value);
......
......@@ -25,12 +25,14 @@
namespace asio {
namespace detail {
ASIO_DECL
void do_throw_error(const asio::error_code& err)
{
asio::system_error e(err);
boost::throw_exception(e);
}
ASIO_DECL
void do_throw_error(const asio::error_code& err, const char* location)
{
asio::system_error e(err, location);
......
......@@ -31,6 +31,7 @@ namespace asio {
namespace ip {
namespace detail {
ASIO_DECL
endpoint::endpoint()
: data_()
{
......@@ -39,6 +40,7 @@ endpoint::endpoint()
data_.v4.sin_addr.s_addr = INADDR_ANY;
}
ASIO_DECL
endpoint::endpoint(int family, unsigned short port_num)
: data_()
{
......@@ -62,6 +64,7 @@ endpoint::endpoint(int family, unsigned short port_num)
}
}
ASIO_DECL
endpoint::endpoint(const asio::ip::address& addr,
unsigned short port_num)
: data_()
......@@ -89,6 +92,7 @@ endpoint::endpoint(const asio::ip::address& addr,
}
}
ASIO_DECL
void endpoint::resize(std::size_t size)
{
if (size > sizeof(asio::detail::sockaddr_storage_type))
......@@ -98,6 +102,7 @@ void endpoint::resize(std::size_t size)
}
}
ASIO_DECL
unsigned short endpoint::port() const
{
if (is_v4())
......@@ -112,6 +117,7 @@ unsigned short endpoint::port() const
}
}
ASIO_DECL
void endpoint::port(unsigned short port_num)
{
if (is_v4())
......@@ -126,6 +132,7 @@ void endpoint::port(unsigned short port_num)
}
}
ASIO_DECL
asio::ip::address endpoint::address() const
{
using namespace std; // For memcpy.
......@@ -143,17 +150,20 @@ asio::ip::address endpoint::address() const
}
}
ASIO_DECL
void endpoint::address(const asio::ip::address& addr)
{
endpoint tmp_endpoint(addr, port());
data_ = tmp_endpoint.data_;
}
ASIO_DECL
bool operator==(const endpoint& e1, const endpoint& e2)
{
return e1.address() == e2.address() && e1.port() == e2.port();
}
ASIO_DECL
bool operator<(const endpoint& e1, const endpoint& e2)
{
if (e1.address() < e2.address())
......@@ -164,6 +174,7 @@ bool operator<(const endpoint& e1, const endpoint& e2)
}
#if !defined(BOOST_NO_IOSTREAM)
ASIO_DECL
std::string endpoint::to_string(asio::error_code& ec) const
{
std::string a = address().to_string(ec);
......
......@@ -28,6 +28,7 @@
namespace asio {
namespace ip {
ASIO_DECL
address::address()
: type_(ipv4),
ipv4_address_(),
......@@ -35,6 +36,7 @@ address::address()
{
}
ASIO_DECL
address::address(const asio::ip::address_v4& ipv4_address)
: type_(ipv4),
ipv4_address_(ipv4_address),
......@@ -42,6 +44,7 @@ address::address(const asio::ip::address_v4& ipv4_address)
{
}
ASIO_DECL
address::address(const asio::ip::address_v6& ipv6_address)
: type_(ipv6),
ipv4_address_(),
......@@ -49,6 +52,7 @@ address::address(const asio::ip::address_v6& ipv6_address)
{
}
ASIO_DECL
address::address(const address& other)
: type_(other.type_),
ipv4_address_(other.ipv4_address_),
......@@ -56,6 +60,7 @@ address::address(const address& other)
{
}
ASIO_DECL
address& address::operator=(const address& other)
{
type_ = other.type_;
......@@ -64,6 +69,7 @@ address& address::operator=(const address& other)
return *this;
}
ASIO_DECL
address& address::operator=(const asio::ip::address_v4& ipv4_address)
{
type_ = ipv4;
......@@ -72,6 +78,7 @@ address& address::operator=(const asio::ip::address_v4& ipv4_address)
return *this;
}
ASIO_DECL
address& address::operator=(const asio::ip::address_v6& ipv6_address)
{
type_ = ipv6;
......@@ -80,6 +87,7 @@ address& address::operator=(const asio::ip::address_v6& ipv6_address)
return *this;
}
ASIO_DECL
asio::ip::address_v4 address::to_v4() const
{
if (type_ != ipv4)
......@@ -90,6 +98,7 @@ asio::ip::address_v4 address::to_v4() const
return ipv4_address_;
}
ASIO_DECL
asio::ip::address_v6 address::to_v6() const
{
if (type_ != ipv6)
......@@ -100,6 +109,7 @@ asio::ip::address_v6 address::to_v6() const
return ipv6_address_;
}
ASIO_DECL
std::string address::to_string() const
{
if (type_ == ipv6)
......@@ -107,6 +117,7 @@ std::string address::to_string() const
return ipv4_address_.to_string();
}
ASIO_DECL
std::string address::to_string(asio::error_code& ec) const
{
if (type_ == ipv6)
......@@ -114,6 +125,7 @@ std::string address::to_string(asio::error_code& ec) const
return ipv4_address_.to_string(ec);
}