mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-01-19 12:44:39 +08:00
PR libstdc++/89460 Fix Networking TS test failures on HP-UX
Check for availability of POSIX sockatmark before using it. Rename _S_ntoh overloads that are ambiguous when passed an integral type that is neither uint16_t nor uint32_t. PR libstdc++/89460 * configure.ac: Check for sockatmark. * crossconfig.m4: Check for sockatmark. * config.h.in: Regenerate. * configure: Regenerate. * include/experimental/internet (address_v4::_S_hton): Rename overloaded functions to _S_hton_16 and _S_ntoh_16. (address_v4::_S_ntoh): Rename to _S_ntoh_16 and _S_ntoh_32. (basic_endpoint): Adjust calls to _S_hton and _S_ntoh. * include/experimental/socket (basic_socket::at_mark): Check _GLIBCXX_HAVE_SOCKATMARK. From-SVN: r269588
This commit is contained in:
parent
93964ebd2f
commit
187fdaea67
@ -1,5 +1,17 @@
|
||||
2019-03-11 Jonathan Wakely <jwakely@redhat.com>
|
||||
|
||||
PR libstdc++/89460
|
||||
* configure.ac: Check for sockatmark.
|
||||
* crossconfig.m4: Check for sockatmark.
|
||||
* config.h.in: Regenerate.
|
||||
* configure: Regenerate.
|
||||
* include/experimental/internet (address_v4::_S_hton): Rename
|
||||
overloaded functions to _S_hton_16 and _S_ntoh_16.
|
||||
(address_v4::_S_ntoh): Rename to _S_ntoh_16 and _S_ntoh_32.
|
||||
(basic_endpoint): Adjust calls to _S_hton and _S_ntoh.
|
||||
* include/experimental/socket (basic_socket::at_mark): Check
|
||||
_GLIBCXX_HAVE_SOCKATMARK.
|
||||
|
||||
* testsuite/29_atomics/atomic_flag/test_and_set/explicit-hle.cc: Use
|
||||
const variables instead of macros.
|
||||
|
||||
|
@ -390,6 +390,9 @@
|
||||
/* Defined if sleep exists. */
|
||||
#undef HAVE_SLEEP
|
||||
|
||||
/* Define to 1 if you have the `sockatmark' function. */
|
||||
#undef HAVE_SOCKATMARK
|
||||
|
||||
/* Define to 1 if you have the `sqrtf' function. */
|
||||
#undef HAVE_SQRTF
|
||||
|
||||
|
46
libstdc++-v3/configure
vendored
46
libstdc++-v3/configure
vendored
@ -28442,6 +28442,19 @@ if test "x$ac_cv_func_timespec_get" = xyes; then :
|
||||
#define HAVE_TIMESPEC_GET 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
# For Networking TS.
|
||||
for ac_func in sockatmark
|
||||
do :
|
||||
ac_fn_c_check_func "$LINENO" "sockatmark" "ac_cv_func_sockatmark"
|
||||
if test "x$ac_cv_func_sockatmark" = xyes; then :
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_SOCKATMARK 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
done
|
||||
|
||||
@ -53638,6 +53651,17 @@ if test "x$ac_cv_func_timespec_get" = xyes; then :
|
||||
#define HAVE_TIMESPEC_GET 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
done
|
||||
|
||||
for ac_func in sockatmark
|
||||
do :
|
||||
ac_fn_c_check_func "$LINENO" "sockatmark" "ac_cv_func_sockatmark"
|
||||
if test "x$ac_cv_func_sockatmark" = xyes; then :
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_SOCKATMARK 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
done
|
||||
|
||||
@ -60268,6 +60292,17 @@ _ACEOF
|
||||
fi
|
||||
done
|
||||
|
||||
for ac_func in sockatmark
|
||||
do :
|
||||
ac_fn_c_check_func "$LINENO" "sockatmark" "ac_cv_func_sockatmark"
|
||||
if test "x$ac_cv_func_sockatmark" = xyes; then :
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_SOCKATMARK 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
|
||||
|
||||
@ -66589,6 +66624,17 @@ if test "x$ac_cv_func_timespec_get" = xyes; then :
|
||||
#define HAVE_TIMESPEC_GET 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
done
|
||||
|
||||
for ac_func in sockatmark
|
||||
do :
|
||||
ac_fn_c_check_func "$LINENO" "sockatmark" "ac_cv_func_sockatmark"
|
||||
if test "x$ac_cv_func_sockatmark" = xyes; then :
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_SOCKATMARK 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
done
|
||||
|
||||
|
@ -268,6 +268,9 @@ if $GLIBCXX_IS_NATIVE; then
|
||||
# C11 functions for C++17 library
|
||||
AC_CHECK_FUNCS(timespec_get)
|
||||
|
||||
# For Networking TS.
|
||||
AC_CHECK_FUNCS(sockatmark)
|
||||
|
||||
# For iconv support.
|
||||
AM_ICONV
|
||||
|
||||
|
@ -136,6 +136,7 @@ case "${host}" in
|
||||
AC_CHECK_FUNCS(__cxa_thread_atexit)
|
||||
AC_CHECK_FUNCS(aligned_alloc posix_memalign memalign _aligned_malloc)
|
||||
AC_CHECK_FUNCS(timespec_get)
|
||||
AC_CHECK_FUNCS(sockatmark)
|
||||
;;
|
||||
|
||||
*-fuchsia*)
|
||||
@ -196,6 +197,7 @@ case "${host}" in
|
||||
AC_CHECK_FUNCS(__cxa_thread_atexit_impl)
|
||||
AC_CHECK_FUNCS(aligned_alloc posix_memalign memalign _aligned_malloc)
|
||||
AC_CHECK_FUNCS(timespec_get)
|
||||
AC_CHECK_FUNCS(sockatmark)
|
||||
AM_ICONV
|
||||
;;
|
||||
*-mingw32*)
|
||||
@ -224,6 +226,7 @@ case "${host}" in
|
||||
fi
|
||||
AC_CHECK_FUNCS(aligned_alloc posix_memalign memalign _aligned_malloc)
|
||||
AC_CHECK_FUNCS(timespec_get)
|
||||
AC_CHECK_FUNCS(sockatmark)
|
||||
;;
|
||||
*-qnx6.1* | *-qnx6.2*)
|
||||
SECTION_FLAGS='-ffunction-sections -fdata-sections'
|
||||
|
@ -158,7 +158,7 @@ namespace ip
|
||||
{ }
|
||||
|
||||
explicit constexpr
|
||||
address_v4(uint_type __val) : _M_addr(_S_hton(__val))
|
||||
address_v4(uint_type __val) : _M_addr(_S_hton_32(__val))
|
||||
{
|
||||
#if UINT_LEAST32_MAX > 0xFFFFFFFF
|
||||
if (__val > 0xFFFFFFFF)
|
||||
@ -191,7 +191,8 @@ namespace ip
|
||||
};
|
||||
}
|
||||
|
||||
constexpr uint_type to_uint() const noexcept { return _S_ntoh(_M_addr); }
|
||||
constexpr uint_type
|
||||
to_uint() const noexcept { return _S_ntoh_32(_M_addr); }
|
||||
|
||||
#ifdef _GLIBCXX_HAVE_ARPA_INET_H
|
||||
template<typename _Allocator = allocator<char>>
|
||||
@ -224,22 +225,22 @@ namespace ip
|
||||
friend address_v4 make_address_v4(const char*, error_code&) noexcept;
|
||||
|
||||
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
static constexpr uint16_t _S_hton(uint16_t __h) { return __h; }
|
||||
static constexpr uint16_t _S_ntoh(uint16_t __n) { return __n; }
|
||||
static constexpr uint32_t _S_hton(uint32_t __h) { return __h; }
|
||||
static constexpr uint32_t _S_ntoh(uint32_t __n) { return __n; }
|
||||
static constexpr uint16_t _S_hton_16(uint16_t __h) { return __h; }
|
||||
static constexpr uint16_t _S_ntoh_16(uint16_t __n) { return __n; }
|
||||
static constexpr uint32_t _S_hton_32(uint32_t __h) { return __h; }
|
||||
static constexpr uint32_t _S_ntoh_32(uint32_t __n) { return __n; }
|
||||
#else
|
||||
static constexpr uint16_t
|
||||
_S_hton(uint16_t __h) { return __builtin_bswap16(__h); }
|
||||
_S_hton_16(uint16_t __h) { return __builtin_bswap16(__h); }
|
||||
|
||||
static constexpr uint16_t
|
||||
_S_ntoh(uint16_t __n) { return __builtin_bswap16(__n); }
|
||||
_S_ntoh_16(uint16_t __n) { return __builtin_bswap16(__n); }
|
||||
|
||||
static constexpr uint32_t
|
||||
_S_hton(uint32_t __h) { return __builtin_bswap32(__h); }
|
||||
_S_hton_32(uint32_t __h) { return __builtin_bswap32(__h); }
|
||||
|
||||
static constexpr uint32_t
|
||||
_S_ntoh(uint32_t __n) { return __builtin_bswap32(__n); }
|
||||
_S_ntoh_32(uint32_t __n) { return __builtin_bswap32(__n); }
|
||||
#endif
|
||||
|
||||
in_addr_t _M_addr; // network byte order
|
||||
@ -1396,7 +1397,7 @@ namespace ip
|
||||
|| __proto == protocol_type::v6());
|
||||
|
||||
_M_data._M_v4.sin_family = __proto.family();
|
||||
_M_data._M_v4.sin_port = address_v4::_S_hton(__port_num);
|
||||
_M_data._M_v4.sin_port = address_v4::_S_hton_16(__port_num);
|
||||
}
|
||||
|
||||
constexpr
|
||||
@ -1407,14 +1408,14 @@ namespace ip
|
||||
if (__addr.is_v4())
|
||||
{
|
||||
_M_data._M_v4.sin_family = protocol_type::v4().family();
|
||||
_M_data._M_v4.sin_port = address_v4::_S_hton(__port_num);
|
||||
_M_data._M_v4.sin_port = address_v4::_S_hton_16(__port_num);
|
||||
_M_data._M_v4.sin_addr.s_addr = __addr._M_v4._M_addr;
|
||||
}
|
||||
else
|
||||
{
|
||||
_M_data._M_v6 = {};
|
||||
_M_data._M_v6.sin6_family = protocol_type::v6().family();
|
||||
_M_data._M_v6.sin6_port = address_v4::_S_hton(__port_num);
|
||||
_M_data._M_v6.sin6_port = address_v4::_S_hton_16(__port_num);
|
||||
__builtin_memcpy(_M_data._M_v6.sin6_addr.s6_addr,
|
||||
__addr._M_v6._M_bytes.data(), 16);
|
||||
_M_data._M_v6.sin6_scope_id = __addr._M_v6._M_scope_id;
|
||||
@ -1466,11 +1467,11 @@ namespace ip
|
||||
|
||||
constexpr port_type
|
||||
port() const noexcept
|
||||
{ return address_v4::_S_ntoh(_M_data._M_v4.sin_port); }
|
||||
{ return address_v4::_S_ntoh_16(_M_data._M_v4.sin_port); }
|
||||
|
||||
void
|
||||
port(port_type __port_num) noexcept
|
||||
{ _M_data._M_v4.sin_port = address_v4::_S_hton(__port_num); }
|
||||
{ _M_data._M_v4.sin_port = address_v4::_S_hton_16(__port_num); }
|
||||
|
||||
void* data() noexcept { return &_M_data; }
|
||||
const void* data() const noexcept { return &_M_data; }
|
||||
|
@ -794,7 +794,7 @@ inline namespace v1
|
||||
bool
|
||||
at_mark(error_code& __ec) const
|
||||
{
|
||||
#ifdef _GLIBCXX_HAVE_SYS_SOCKET_H
|
||||
#ifdef _GLIBCXX_HAVE_SOCKATMARK
|
||||
const int __result = ::sockatmark(native_handle());
|
||||
if (__result == -1)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user