From 2373083ae33d4a57b7fae663d8f9799f1a198c56 Mon Sep 17 00:00:00 2001 From: stickz Date: Mon, 13 Jan 2025 11:53:52 -0500 Subject: [PATCH] libtorrent: Bump c++ standard to 17 resolves crash when compiling with -march=native. --- libtorrent/configure.ac | 5 +- libtorrent/rak/priority_queue_default.h | 2 +- libtorrent/scripts/rak_cxx.m4 | 61 ------------------- libtorrent/src/data/chunk_list.h | 3 +- libtorrent/src/data/hash_check_queue.h | 2 +- libtorrent/src/download/delegator.h | 2 +- libtorrent/src/net/listen.h | 2 +- libtorrent/src/net/throttle_node.h | 2 +- libtorrent/src/torrent/connection_manager.h | 2 +- libtorrent/src/torrent/data/download_data.h | 2 +- libtorrent/src/torrent/data/transfer_list.h | 2 +- .../src/torrent/download/choke_queue.cc | 1 - libtorrent/src/torrent/download/choke_queue.h | 2 +- libtorrent/src/torrent/download/group_entry.h | 2 +- libtorrent/src/torrent/download_info.h | 2 +- libtorrent/src/torrent/peer/client_list.cc | 2 +- libtorrent/src/torrent/peer/connection_list.h | 2 +- libtorrent/src/torrent/poll.h | 2 +- libtorrent/src/torrent/tracker_controller.h | 2 +- libtorrent/src/torrent/tracker_list.h | 2 +- .../src/torrent/utils/directory_events.h | 2 +- libtorrent/src/torrent/utils/log.cc | 2 - libtorrent/src/torrent/utils/log.h | 4 +- libtorrent/src/torrent/utils/log_buffer.cc | 1 - libtorrent/src/torrent/utils/log_buffer.h | 2 +- libtorrent/src/torrent/utils/net.h | 2 +- .../src/torrent/utils/signal_bitfield.h | 2 +- libtorrent/src/torrent/utils/thread_base.h | 2 +- libtorrent/src/utils/instrumentation.h | 2 +- libtorrent/src/utils/queue_buckets.h | 4 +- libtorrent/src/utils/udnsevent.h | 2 +- 31 files changed, 30 insertions(+), 97 deletions(-) delete mode 100644 libtorrent/scripts/rak_cxx.m4 diff --git a/libtorrent/configure.ac b/libtorrent/configure.ac index e4b6334eb..19f23b269 100644 --- a/libtorrent/configure.ac +++ b/libtorrent/configure.ac @@ -28,15 +28,14 @@ AC_C_BIGENDIAN( AC_MSG_ERROR([Could not determine endianness]) ) +AX_CXX_COMPILE_STDCXX(17, noext, mandatory) + RAK_CHECK_CFLAGS RAK_CHECK_CXXFLAGS RAK_ENABLE_DEBUG RAK_ENABLE_EXTRA_DEBUG RAK_ENABLE_WERROR -RAK_CHECK_CXX11 -RAK_CHECK_TR1_LIB - AC_SYS_LARGEFILE TORRENT_ENABLE_ALIGNED diff --git a/libtorrent/rak/priority_queue_default.h b/libtorrent/rak/priority_queue_default.h index aa712ce56..794b8116d 100644 --- a/libtorrent/rak/priority_queue_default.h +++ b/libtorrent/rak/priority_queue_default.h @@ -37,7 +37,7 @@ #ifndef RAK_PRIORITY_QUEUE_DEFAULT_H #define RAK_PRIORITY_QUEUE_DEFAULT_H -#include lt_tr1_functional +#include #include #include #include diff --git a/libtorrent/scripts/rak_cxx.m4 b/libtorrent/scripts/rak_cxx.m4 deleted file mode 100644 index 3660f3a75..000000000 --- a/libtorrent/scripts/rak_cxx.m4 +++ /dev/null @@ -1,61 +0,0 @@ -AC_DEFUN([RAK_CHECK_CXX11], [ - AC_ARG_ENABLE([c++0x], - AC_HELP_STRING([--enable-c++0x], [compile with C++0x (unsupported)]), - [ - if test "$enableval" = "yes"; then - AX_CXX_COMPILE_STDCXX_0X - else - AX_CXX_COMPILE_STDCXX_11(noext) - fi - ],[ - AX_CXX_COMPILE_STDCXX_11(noext) - ] - ) -]) - -AC_DEFUN([RAK_CHECK_TR1_LIB], [ - AC_LANG_PUSH(C++) - AC_MSG_CHECKING(should use TR1 headers) - - AC_COMPILE_IFELSE([AC_LANG_SOURCE([ - #include - class Foo; typedef std::unordered_map Bar; - Bar b1; - ]) - ], [ - AC_MSG_RESULT(no) - AC_DEFINE(USE_TR1_LIB, 0, Define to 1 if you need to use TR1 containers.) - - AC_DEFINE([lt_tr1_array], [], [TR1 array]) - AC_DEFINE([lt_tr1_functional], [], [TR1 functional]) - AC_DEFINE([lt_tr1_memory], [], [TR1 memory]) - AC_DEFINE([lt_tr1_unordered_map], [], [TR1 unordered_map]) - - ], [ - AC_COMPILE_IFELSE([AC_LANG_SOURCE([ - #include - class Foo; typedef std::tr1::unordered_map Bar; - Bar b1; - ]) - ], [ - AC_MSG_RESULT([yes]) - AC_DEFINE(USE_TR1_LIB, 1, Define to 1 if you need to use TR1 containers.) - - AC_DEFINE([lt_tr1_array], [], [TR1 array]) - AC_DEFINE([lt_tr1_functional], [], [TR1 functional]) - AC_DEFINE([lt_tr1_memory], [], [TR1 memory]) - AC_DEFINE([lt_tr1_unordered_map], [], [TR1 unordered_map]) - - ], [ - AC_MSG_ERROR([No support for C++11 standard library nor TR1 extensions found.]) - ]) - ]) - - AH_VERBATIM(lt_tr1_zzz, [ -#if USE_TR1_LIB == 1 -namespace std { namespace tr1 {} using namespace tr1; } -#endif -]) - - AC_LANG_POP(C++) -]) diff --git a/libtorrent/src/data/chunk_list.h b/libtorrent/src/data/chunk_list.h index b6ff4cdb9..2c4363f3d 100644 --- a/libtorrent/src/data/chunk_list.h +++ b/libtorrent/src/data/chunk_list.h @@ -39,8 +39,7 @@ #include #include -#include lt_tr1_functional - +#include #include "chunk.h" #include "chunk_handle.h" #include "chunk_list_node.h" diff --git a/libtorrent/src/data/hash_check_queue.h b/libtorrent/src/data/hash_check_queue.h index b933f1370..1c3d18b7b 100644 --- a/libtorrent/src/data/hash_check_queue.h +++ b/libtorrent/src/data/hash_check_queue.h @@ -39,7 +39,7 @@ #include #include -#include lt_tr1_functional +#include #include "rak/allocators.h" diff --git a/libtorrent/src/download/delegator.h b/libtorrent/src/download/delegator.h index ca5363c8f..31b0bc2a8 100644 --- a/libtorrent/src/download/delegator.h +++ b/libtorrent/src/download/delegator.h @@ -39,7 +39,7 @@ #include #include -#include lt_tr1_functional +#include #include "torrent/data/transfer_list.h" diff --git a/libtorrent/src/net/listen.h b/libtorrent/src/net/listen.h index b3c845aa8..e2f2822b8 100644 --- a/libtorrent/src/net/listen.h +++ b/libtorrent/src/net/listen.h @@ -38,7 +38,7 @@ #define LIBTORRENT_LISTEN_H #include -#include lt_tr1_functional +#include #include #include "socket_base.h" diff --git a/libtorrent/src/net/throttle_node.h b/libtorrent/src/net/throttle_node.h index 77cb6cc7c..5af27a22d 100644 --- a/libtorrent/src/net/throttle_node.h +++ b/libtorrent/src/net/throttle_node.h @@ -37,7 +37,7 @@ #ifndef LIBTORRENT_NET_THROTTLE_NODE_H #define LIBTORRENT_NET_THROTTLE_NODE_H -#include lt_tr1_functional +#include #include "torrent/rate.h" diff --git a/libtorrent/src/torrent/connection_manager.h b/libtorrent/src/torrent/connection_manager.h index cd2a23326..5e9a7d590 100644 --- a/libtorrent/src/torrent/connection_manager.h +++ b/libtorrent/src/torrent/connection_manager.h @@ -46,7 +46,7 @@ #include #include #include -#include lt_tr1_functional +#include #include #ifdef USE_UDNS diff --git a/libtorrent/src/torrent/data/download_data.h b/libtorrent/src/torrent/data/download_data.h index 2b9c94120..fc2120477 100644 --- a/libtorrent/src/torrent/data/download_data.h +++ b/libtorrent/src/torrent/data/download_data.h @@ -37,7 +37,7 @@ #ifndef LIBTORRENT_DATA_DOWNLOAD_DATA_H #define LIBTORRENT_DATA_DOWNLOAD_DATA_H -#include lt_tr1_functional +#include #include #include diff --git a/libtorrent/src/torrent/data/transfer_list.h b/libtorrent/src/torrent/data/transfer_list.h index 0a359b5eb..c17bd33ba 100644 --- a/libtorrent/src/torrent/data/transfer_list.h +++ b/libtorrent/src/torrent/data/transfer_list.h @@ -39,7 +39,7 @@ #include #include -#include lt_tr1_functional +#include namespace torrent { diff --git a/libtorrent/src/torrent/download/choke_queue.cc b/libtorrent/src/torrent/download/choke_queue.cc index 9f28886c2..97e0405a5 100644 --- a/libtorrent/src/torrent/download/choke_queue.cc +++ b/libtorrent/src/torrent/download/choke_queue.cc @@ -40,7 +40,6 @@ #include #include #include -#include lt_tr1_functional #include "protocol/peer_connection_base.h" #include "torrent/download/group_entry.h" diff --git a/libtorrent/src/torrent/download/choke_queue.h b/libtorrent/src/torrent/download/choke_queue.h index 973f65228..d0a9eeac3 100644 --- a/libtorrent/src/torrent/download/choke_queue.h +++ b/libtorrent/src/torrent/download/choke_queue.h @@ -42,7 +42,7 @@ #include #include #include -#include lt_tr1_functional +#include #include namespace torrent { diff --git a/libtorrent/src/torrent/download/group_entry.h b/libtorrent/src/torrent/download/group_entry.h index 48becaff2..c7a6e82b3 100644 --- a/libtorrent/src/torrent/download/group_entry.h +++ b/libtorrent/src/torrent/download/group_entry.h @@ -39,7 +39,7 @@ #include #include -#include lt_tr1_functional +#include #include #include diff --git a/libtorrent/src/torrent/download_info.h b/libtorrent/src/torrent/download_info.h index 341e4c25b..b80060f8d 100644 --- a/libtorrent/src/torrent/download_info.h +++ b/libtorrent/src/torrent/download_info.h @@ -40,7 +40,7 @@ #include #include #include -#include lt_tr1_functional +#include #include #include diff --git a/libtorrent/src/torrent/peer/client_list.cc b/libtorrent/src/torrent/peer/client_list.cc index c857f62da..2da090ead 100644 --- a/libtorrent/src/torrent/peer/client_list.cc +++ b/libtorrent/src/torrent/peer/client_list.cc @@ -38,7 +38,7 @@ #include #include -#include lt_tr1_functional +#include #include "client_list.h" #include "exceptions.h" diff --git a/libtorrent/src/torrent/peer/connection_list.h b/libtorrent/src/torrent/peer/connection_list.h index ec26835f7..cc56eb8f6 100644 --- a/libtorrent/src/torrent/peer/connection_list.h +++ b/libtorrent/src/torrent/peer/connection_list.h @@ -39,7 +39,7 @@ #include #include -#include lt_tr1_functional +#include #include #include diff --git a/libtorrent/src/torrent/poll.h b/libtorrent/src/torrent/poll.h index 882c4b3da..9e7479592 100644 --- a/libtorrent/src/torrent/poll.h +++ b/libtorrent/src/torrent/poll.h @@ -37,7 +37,7 @@ #ifndef LIBTORRENT_TORRENT_POLL_H #define LIBTORRENT_TORRENT_POLL_H -#include lt_tr1_functional +#include #include diff --git a/libtorrent/src/torrent/tracker_controller.h b/libtorrent/src/torrent/tracker_controller.h index 70d1b43f2..6167e7e66 100644 --- a/libtorrent/src/torrent/tracker_controller.h +++ b/libtorrent/src/torrent/tracker_controller.h @@ -38,7 +38,7 @@ #define LIBTORRENT_TRACKER_CONTROLLER_H #include -#include lt_tr1_functional +#include #include #include diff --git a/libtorrent/src/torrent/tracker_list.h b/libtorrent/src/torrent/tracker_list.h index c6817b3a9..dd080833b 100644 --- a/libtorrent/src/torrent/tracker_list.h +++ b/libtorrent/src/torrent/tracker_list.h @@ -41,7 +41,7 @@ #include #include #include -#include lt_tr1_functional +#include namespace torrent { diff --git a/libtorrent/src/torrent/utils/directory_events.h b/libtorrent/src/torrent/utils/directory_events.h index 30fa05088..2b19ecc4b 100644 --- a/libtorrent/src/torrent/utils/directory_events.h +++ b/libtorrent/src/torrent/utils/directory_events.h @@ -39,7 +39,7 @@ #include #include -#include lt_tr1_functional +#include #include namespace torrent { diff --git a/libtorrent/src/torrent/utils/log.cc b/libtorrent/src/torrent/utils/log.cc index 3f903b64b..9393ccbb1 100644 --- a/libtorrent/src/torrent/utils/log.cc +++ b/libtorrent/src/torrent/utils/log.cc @@ -54,8 +54,6 @@ #include #include #include -#include lt_tr1_functional -#include lt_tr1_memory namespace torrent { diff --git a/libtorrent/src/torrent/utils/log.h b/libtorrent/src/torrent/utils/log.h index c843c095b..5707093e5 100644 --- a/libtorrent/src/torrent/utils/log.h +++ b/libtorrent/src/torrent/utils/log.h @@ -40,8 +40,8 @@ #include #include #include -#include lt_tr1_array -#include lt_tr1_functional +#include +#include #include namespace torrent { diff --git a/libtorrent/src/torrent/utils/log_buffer.cc b/libtorrent/src/torrent/utils/log_buffer.cc index f82d57e02..b97259d3d 100644 --- a/libtorrent/src/torrent/utils/log_buffer.cc +++ b/libtorrent/src/torrent/utils/log_buffer.cc @@ -39,7 +39,6 @@ #include "log_buffer.h" #include -#include lt_tr1_functional #include "globals.h" diff --git a/libtorrent/src/torrent/utils/log_buffer.h b/libtorrent/src/torrent/utils/log_buffer.h index befd780b2..1ecc47048 100644 --- a/libtorrent/src/torrent/utils/log_buffer.h +++ b/libtorrent/src/torrent/utils/log_buffer.h @@ -40,7 +40,7 @@ #include #include #include -#include lt_tr1_functional +#include #include namespace torrent { diff --git a/libtorrent/src/torrent/utils/net.h b/libtorrent/src/torrent/utils/net.h index f5af7cc0a..3147093e4 100644 --- a/libtorrent/src/torrent/utils/net.h +++ b/libtorrent/src/torrent/utils/net.h @@ -38,7 +38,7 @@ #define LIBTORRENT_UTILS_NET_H #include -#include lt_tr1_functional +#include namespace torrent { diff --git a/libtorrent/src/torrent/utils/signal_bitfield.h b/libtorrent/src/torrent/utils/signal_bitfield.h index b9f57a60f..52ec0bd21 100644 --- a/libtorrent/src/torrent/utils/signal_bitfield.h +++ b/libtorrent/src/torrent/utils/signal_bitfield.h @@ -37,7 +37,7 @@ #ifndef LIBTORRENT_UTILS_SIGNAL_BITFIELD_H #define LIBTORRENT_UTILS_SIGNAL_BITFIELD_H -#include lt_tr1_functional +#include #include namespace torrent { diff --git a/libtorrent/src/torrent/utils/thread_base.h b/libtorrent/src/torrent/utils/thread_base.h index bfd443ae6..72ca45155 100644 --- a/libtorrent/src/torrent/utils/thread_base.h +++ b/libtorrent/src/torrent/utils/thread_base.h @@ -41,7 +41,7 @@ #include #include #include -#include lt_tr1_functional +#include namespace torrent { diff --git a/libtorrent/src/utils/instrumentation.h b/libtorrent/src/utils/instrumentation.h index 1204f33b8..5363e78c0 100644 --- a/libtorrent/src/utils/instrumentation.h +++ b/libtorrent/src/utils/instrumentation.h @@ -36,8 +36,8 @@ #ifndef LIBTORRENT_UTILS_INSTRUMENTATION_H #define LIBTORRENT_UTILS_INSTRUMENTATION_H -#include lt_tr1_array +#include #include #include "torrent/common.h" diff --git a/libtorrent/src/utils/queue_buckets.h b/libtorrent/src/utils/queue_buckets.h index f87764b69..2a61c39b6 100644 --- a/libtorrent/src/utils/queue_buckets.h +++ b/libtorrent/src/utils/queue_buckets.h @@ -39,8 +39,8 @@ #include #include -#include lt_tr1_functional -#include lt_tr1_array +#include +#include namespace torrent { diff --git a/libtorrent/src/utils/udnsevent.h b/libtorrent/src/utils/udnsevent.h index cd4e51927..87428c36d 100644 --- a/libtorrent/src/utils/udnsevent.h +++ b/libtorrent/src/utils/udnsevent.h @@ -1,7 +1,7 @@ #ifndef LIBTORRENT_NET_UDNSEVENT_H #define LIBTORRENT_NET_UDNSEVENT_H -#include lt_tr1_functional +#include #include #include