improve disabling deprecation warnings internally

This commit is contained in:
arvidn
2020-03-06 14:17:03 +01:00
committed by Arvid Norberg
parent f1bd9fdab8
commit 77460944aa
21 changed files with 148 additions and 421 deletions

View File

@ -580,6 +580,7 @@ HEADERS = \
aux_/deprecated.hpp \
aux_/deque.hpp \
aux_/dev_random.hpp \
aux_/disable_deprecation_warnings_push.hpp \
aux_/disable_warnings_pop.hpp \
aux_/disable_warnings_push.hpp \
aux_/disk_job_fence.hpp \

View File

@ -13,18 +13,8 @@ void bind_fingerprint()
def("generate_fingerprint", &generate_fingerprint);
#if TORRENT_ABI_VERSION == 1
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif
#ifdef _MSC_VER
#pragma warning(push, 1)
#pragma warning(disable: 4996)
#endif
#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"
class_<fingerprint>("fingerprint", no_init)
.def(
init<char const*,int,int,int,int>(
@ -38,14 +28,7 @@ void bind_fingerprint()
.def_readonly("revision_version", &fingerprint::revision_version)
.def_readonly("tag_version", &fingerprint::tag_version)
;
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#endif // TORRENT_ABI_VERSION
}

View File

@ -38,15 +38,14 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size)
{
lt::error_code ec;
int pos;
#if defined __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"
lt::lazy_entry ret;
lazy_bdecode(reinterpret_cast<char const*>(data), reinterpret_cast<char const*>(data) + size, ret, ec, &pos);
#if defined __GNUC__
#pragma GCC diagnostic pop
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
return 0;
}

View File

@ -73,10 +73,7 @@ namespace libtorrent {
// hidden
using alert_category_t = flags::bitfield_flag<std::uint32_t, struct alert_category_tag>;
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"
// The ``alert`` class is the base class that specific messages are derived from.
// alert types are not copyable, and cannot be constructed by the client. The
@ -84,9 +81,8 @@ namespace libtorrent {
// under session_handle::pop_alerts())
struct TORRENT_EXPORT alert
{
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
// hidden
TORRENT_UNEXPORT alert(alert const& rhs) = delete;
alert& operator=(alert const&) = delete;

View File

@ -227,15 +227,7 @@ TORRENT_VERSION_NAMESPACE_2
#if TORRENT_ABI_VERSION == 1
#ifdef _MSC_VER
#pragma warning(push, 1)
// warning C4996: X: was declared deprecated
#pragma warning( disable : 4996 )
#endif
#if defined __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"
// The ``torrent_added_alert`` is posted once every time a torrent is successfully
// added. It doesn't contain any members of its own, but inherits the torrent handle
@ -253,12 +245,7 @@ TORRENT_VERSION_NAMESPACE_2
std::string message() const override;
};
#if defined __GNUC__
#pragma GCC diagnostic pop
#endif
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#endif
@ -332,17 +319,14 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT_PRIO(file_completed_alert, 6, alert_priority::normal)
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"
static constexpr alert_category_t static_category =
alert::file_progress_notification
PROGRESS_NOTIFICATION
;
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
std::string message() const override;
// refers to the index of the file that completed.
@ -373,17 +357,13 @@ TORRENT_VERSION_NAMESPACE_2
aux::allocation_slot m_old_name_idx;
#if TORRENT_ABI_VERSION == 1
#if defined __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Weverything"
#endif
#include "libtorrent/aux_/disable_warnings_push.hpp"
public:
TORRENT_DEPRECATED std::string name;
#if defined __clang__
#pragma clang diagnostic pop
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#endif
};
@ -906,17 +886,14 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(piece_finished_alert, 27)
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"
static constexpr alert_category_t static_category =
alert::piece_progress_notification
PROGRESS_NOTIFICATION
;
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
std::string message() const override;
// the index of the piece that finished
@ -933,18 +910,14 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(request_dropped_alert, 28)
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"
static constexpr alert_category_t static_category =
alert::block_progress_notification
| alert::peer_notification
PROGRESS_NOTIFICATION
;
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
std::string message() const override;
int const block_index;
@ -961,18 +934,14 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(block_timeout_alert, 29)
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"
static constexpr alert_category_t static_category =
alert::block_progress_notification
| alert::peer_notification
PROGRESS_NOTIFICATION
;
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
std::string message() const override;
int const block_index;
@ -989,17 +958,13 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(block_finished_alert, 30)
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"
static constexpr alert_category_t static_category =
alert::block_progress_notification
PROGRESS_NOTIFICATION
;
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
std::string message() const override;
int const block_index;
@ -1016,17 +981,12 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(block_downloading_alert, 31)
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"
static constexpr alert_category_t static_category =
alert::block_progress_notification
PROGRESS_NOTIFICATION
;
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
std::string message() const override;
int const block_index;
@ -1873,15 +1833,7 @@ TORRENT_VERSION_NAMESPACE_2
#if TORRENT_ABI_VERSION == 1
#ifdef _MSC_VER
#pragma warning(push, 1)
// warning C4996: X: was declared deprecated
#pragma warning( disable : 4996 )
#endif
#if defined __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"
// This alert is posted when a bittorrent feature is blocked because of the
// anonymous mode. For instance, if the tracker proxy is not set up, no
@ -1911,12 +1863,7 @@ TORRENT_VERSION_NAMESPACE_2
std::string str;
};
#if defined __GNUC__
#pragma GCC diagnostic pop
#endif
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#endif // TORRENT_ABI_VERSION
@ -2096,15 +2043,7 @@ TORRENT_VERSION_NAMESPACE_2
};
#if TORRENT_ABI_VERSION == 1
#ifdef _MSC_VER
#pragma warning(push, 1)
// warning C4996: X: was declared deprecated
#pragma warning( disable : 4996 )
#endif
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"
struct TORRENT_DEPRECATED_EXPORT mmap_cache_alert final : alert
{
mmap_cache_alert(aux::stack_allocator& alloc
@ -2116,12 +2055,7 @@ TORRENT_VERSION_NAMESPACE_2
error_code const error;
};
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#endif // TORRENT_ABI_VERSION
// The session_stats_alert is posted when the user requests session statistics by
@ -2140,23 +2074,13 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_UNEXPORT session_stats_alert(aux::stack_allocator& alloc, counters const& cnt);
#if TORRENT_ABI_VERSION == 1
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif
#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"
#endif
TORRENT_DEFINE_ALERT_PRIO(session_stats_alert, 70, alert_priority::critical)
#if TORRENT_ABI_VERSION == 1
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#endif
static constexpr alert_category_t static_category = alert::stats_notification;
@ -2896,17 +2820,12 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(block_uploaded_alert, 94)
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"
static constexpr alert_category_t static_category =
alert::upload_notification
PROGRESS_NOTIFICATION
;
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
std::string message() const override;
int const block_index;

View File

@ -0,0 +1,51 @@
/*
Copyright (c) 2020, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the distribution.
* Neither the name of the author nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated"
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#if __GNUC__ >= 9
#pragma GCC diagnostic ignored "-Wdeprecated-copy"
#endif
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated"
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif
#ifdef _MSC_VER
#pragma warning(push, 1)
#pragma warning(disable: 4996)
#endif

View File

@ -472,22 +472,10 @@ namespace aux {
void add_dht_node(udp::endpoint const& n) override;
void add_dht_router(std::pair<std::string, int> const& node);
#if TORRENT_ABI_VERSION <= 2
#ifdef _MSC_VER
#pragma warning(push, 1)
#pragma warning( disable : 4996 ) // warning C4996: X: was declared deprecated
#endif
#if defined __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"
void set_dht_settings(dht::dht_settings const& s);
dht::dht_settings get_dht_settings() const;
#if defined __GNUC__
#pragma GCC diagnostic pop
#endif
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#endif
// you must give up ownership of the dht state

View File

@ -60,10 +60,7 @@ namespace libtorrent {
// information about a file in a file_storage
struct TORRENT_DEPRECATED_EXPORT file_entry
{
#if defined __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"
// hidden
file_entry();
// hidden
@ -73,9 +70,7 @@ namespace libtorrent {
file_entry(file_entry&&) noexcept = default;
file_entry& operator=(file_entry&&) & = default;
#if defined __GNUC__
#pragma GCC diagnostic pop
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
// the full path of this file. The paths are unicode strings
// encoded in UTF-8.
@ -326,14 +321,8 @@ namespace aux {
void rename_file(file_index_t index, std::string const& new_filename);
#if TORRENT_ABI_VERSION == 1
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#ifdef _MSC_VER
#pragma warning(push, 1)
#pragma warning(disable: 4996)
#endif
#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"
TORRENT_DEPRECATED
void add_file_borrow(char const* filename, int filename_len
, std::string const& path, std::int64_t file_size
@ -389,12 +378,7 @@ namespace aux {
iterator file_at_offset_deprecated(std::int64_t offset) const;
file_entry at_deprecated(int index) const;
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#endif // TORRENT_ABI_VERSION
// returns a list of file_slice objects representing the portions of

View File

@ -75,15 +75,7 @@ namespace aux {
#if TORRENT_ABI_VERSION == 1
#ifdef _MSC_VER
#pragma warning(push, 1)
// warning C4996: X: was declared deprecated
#pragma warning( disable : 4996 )
#endif
#if defined __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"
// deprecated in 1.2
TORRENT_DEPRECATED
@ -96,12 +88,7 @@ namespace aux {
inline bool from_hex(char const *in, int len, char* out)
{ return aux::from_hex({in, len}, out); }
#if defined __GNUC__
#pragma GCC diagnostic pop
#endif
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#endif
} // namespace libtorrent

View File

@ -67,18 +67,8 @@ namespace aux {
#if TORRENT_ABI_VERSION == 1
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif
#ifdef _MSC_VER
#pragma warning(push, 1)
#pragma warning(disable: 4996)
#endif
#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"
// Returns an optional fingerprint if any can be identified from the peer
// id. This can be used to automate the identification of clients. It will
// not be able to identify peers with non- standard encodings. Only Azureus
@ -87,15 +77,7 @@ namespace aux {
boost::optional<fingerprint>
client_fingerprint(peer_id const& p);
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#endif // TORRENT_ABI_VERSION

View File

@ -158,14 +158,7 @@ namespace dht {
int max_infohashes_sample_count = 20;
};
#ifdef _MSC_VER
#pragma warning(push, 1)
#pragma warning( disable : 4996 ) // warning C4996: X: was declared deprecated
#endif
#if defined __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"
// internal
struct settings : dht_settings
@ -179,12 +172,7 @@ namespace dht {
TORRENT_EXTRA_EXPORT dht_settings read_dht_settings(bdecode_node const& e);
TORRENT_EXTRA_EXPORT entry save_dht_settings(dht_settings const& settings);
#if defined __GNUC__
#pragma GCC diagnostic pop
#endif
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#endif

View File

@ -93,15 +93,7 @@ namespace libtorrent {
TORRENT_DEPRECATED_EXPORT int lazy_bdecode(char const* start, char const* end
, lazy_entry& ret, int depth_limit = 1000, int item_limit = 1000000);
#ifdef _MSC_VER
#pragma warning(push, 1)
// warning C4996: X: was declared deprecated
#pragma warning( disable : 4996 )
#endif
#if defined __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"
// this is a string that is not 0-terminated. Instead it
// comes with a length, specified in bytes. This is particularly
@ -412,12 +404,7 @@ namespace libtorrent {
TORRENT_DEPRECATED_EXPORT std::string print_entry(lazy_entry const& e
, bool single_line = false, int indent = 0);
#if defined __GNUC__
#pragma GCC diagnostic pop
#endif
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
// defined in bdecode.cpp
TORRENT_DEPRECATED

View File

@ -180,14 +180,9 @@ namespace aux {
session& operator=(session const&) = delete;
#if TORRENT_ABI_VERSION <= 2
#ifdef _MSC_VER
#pragma warning(push, 1)
#pragma warning( disable : 4996 ) // warning C4996: X: was declared deprecated
#endif
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"
// Constructs the session objects which acts as the container of torrents.
// It provides configuration options across torrents (such as rate limits,
// disk cache, ip filter etc.). In order to avoid a race condition between
@ -225,27 +220,8 @@ namespace aux {
session(settings_pack const&, io_context&, session_flags_t);
session(settings_pack&& pack, io_context& ios) : session(std::move(pack), ios, add_default_plugins) {}
session(settings_pack const& pack, io_context& ios) : session(pack, ios, add_default_plugins) {}
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif
#if TORRENT_ABI_VERSION == 1
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif
#ifdef _MSC_VER
#pragma warning(push, 1)
#pragma warning(disable: 4996)
#endif
TORRENT_DEPRECATED
session(fingerprint const& print
, session_flags_t const flags = start_default_features | add_default_plugins
@ -257,15 +233,9 @@ namespace aux {
, char const* listen_interface = "0.0.0.0"
, session_flags_t const flags = start_default_features | add_default_plugins
, alert_category_t const alert_mask = alert::error_notification);
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#endif // TORRENT_ABI_VERSION
// The destructor of session will notify all trackers that our torrents

View File

@ -370,26 +370,16 @@ namespace libtorrent {
#endif
#if TORRENT_ABI_VERSION <= 2
#ifdef _MSC_VER
#pragma warning(push, 1)
#pragma warning( disable : 4996 ) // warning C4996: X: was declared deprecated
#endif
#if defined __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"
// ``set_dht_settings`` sets some parameters available to the dht node.
// See dht_settings for more information.
//
// ``get_dht_settings()`` returns the current settings
void set_dht_settings(dht::dht_settings const& settings);
dht::dht_settings get_dht_settings() const;
#if defined __GNUC__
#pragma GCC diagnostic pop
#endif
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#endif
@ -860,14 +850,7 @@ namespace libtorrent {
#if TORRENT_ABI_VERSION == 1
#ifdef _MSC_VER
#pragma warning(push, 1)
#pragma warning( disable : 4996 ) // warning C4996: X: was declared deprecated
#endif
#if defined __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"
// deprecated in libtorrent 1.1. use settings_pack instead
TORRENT_DEPRECATED
@ -875,12 +858,7 @@ namespace libtorrent {
TORRENT_DEPRECATED
pe_settings get_pe_settings() const;
#if defined __GNUC__
#pragma GCC diagnostic pop
#endif
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
// ``set_i2p_proxy`` sets the i2p_ proxy, and tries to open a persistent
// connection to it. The only used fields in the proxy settings structs

View File

@ -99,22 +99,13 @@ struct TORRENT_EXPORT session_params
std::vector<std::shared_ptr<plugin>> extensions;
#if TORRENT_ABI_VERSION <= 2
#ifdef _MSC_VER
#pragma warning(push, 1)
#pragma warning( disable : 4996 ) // warning C4996: X: was declared deprecated
#endif
#if defined __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"
// this is deprecated. Use the dht_* settings instead.
dht::dht_settings dht_settings;
#if defined __GNUC__
#pragma GCC diagnostic pop
#endif
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#endif

View File

@ -45,21 +45,11 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent {
#ifdef _MSC_VER
#pragma warning(push, 1)
#pragma warning( disable : 4996 ) // warning C4996: X: was declared deprecated
#endif
#if defined __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"
using dht_settings = dht::dht_settings;
#if defined __GNUC__
#pragma GCC diagnostic pop
#endif
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
using aux::proxy_settings;

View File

@ -412,25 +412,12 @@ TORRENT_VERSION_NAMESPACE_3
file_iterator file_at_offset(std::int64_t offset) const
{ return m_files.file_at_offset_deprecated(offset); }
#ifdef _MSC_VER
#pragma warning(push, 1)
// warning C4996: X: was declared deprecated
#pragma warning( disable : 4996 )
#endif
#if defined __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"
TORRENT_DEPRECATED
file_entry file_at(int index) const { return m_files.at_deprecated(index); }
#if defined __GNUC__
#pragma GCC diagnostic pop
#endif
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#endif // TORRENT_ABI_VERSION

View File

@ -52,10 +52,7 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent {
#if TORRENT_ABI_VERSION == 1
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"
#endif
TORRENT_VERSION_NAMESPACE_2
@ -65,9 +62,7 @@ TORRENT_VERSION_NAMESPACE_2
struct TORRENT_EXPORT torrent_status
{
#if TORRENT_ABI_VERSION == 1
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#endif
// hidden
torrent_status() noexcept;

View File

@ -858,15 +858,7 @@ namespace {
using lfo = listen_failed_alert::op_t;
// we have to use deprecated enum values here. suppress the warnings
#ifdef _MSC_VER
#pragma warning(push, 1)
// warning C4996: X: was declared deprecated
#pragma warning( disable : 4996 )
#endif
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"
switch (op)
{
case o::bittorrent: return -1;
@ -916,12 +908,7 @@ namespace {
}
return -1;
}
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#endif // TORRENT_ABI_VERSION

View File

@ -410,18 +410,7 @@ namespace {
#endif
#if TORRENT_ABI_VERSION == 1
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif
#ifdef _MSC_VER
#pragma warning(push, 1)
#pragma warning(disable: 4996)
#endif
#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"
session::session(fingerprint const& print, session_flags_t const flags
, alert_category_t const alert_mask)
{
@ -465,15 +454,7 @@ namespace {
}
start(flags, std::move(pack), nullptr);
}
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#endif // TORRENT_ABI_VERSION
session& session::operator=(session&&) & = default;
@ -531,17 +512,12 @@ namespace {
{
#if TORRENT_HAVE_MMAP || TORRENT_HAVE_MAP_VIEW_OF_FILE
// TODO: In C++17. use if constexpr instead
#ifdef _MSC_VER
#pragma warning(push, 1)
#pragma warning(disable: 4127) // conditional expression is constant
#endif
#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"
if (sizeof(void*) == 8)
return mmap_disk_io_constructor(ios, sett, cnt);
else
return posix_disk_io_constructor(ios, sett, cnt);
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#else
return posix_disk_io_constructor(ios, sett, cnt);
#endif

View File

@ -52,19 +52,7 @@ POSSIBILITY OF SUCH DAMAGE.
// in warning about deprecated use in any of the tests.
// the unreachable code warnings are disabled since the test macros may
// sometimes have conditions that are known at compile time
#if defined __clang__
#pragma clang diagnostic ignored "-Wdeprecated"
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#pragma clang diagnostic ignored "-Wunreachable-code"
#elif defined __GNUC__
#pragma GCC diagnostic ignored "-Wdeprecated"
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#pragma GCC diagnostic ignored "-Wunreachable-code"
#elif defined _MSC_VER
#pragma warning(disable : 4996)
#endif
#include "libtorrent/aux_/disable_deprecation_warnings_push.hpp"
#if defined TORRENT_BUILDING_TEST_SHARED
#define EXPORT BOOST_SYMBOL_EXPORT