From 87ec36cacfd408cfe7405f804b35e29aefd209b4 Mon Sep 17 00:00:00 2001 From: Jeffrey Date: Mon, 7 Mar 2022 20:00:51 -0600 Subject: Refactor out pragma_comp_defs Relevant commits on the old cleanup PR: 36933c7f5c7778e2d7fbfea5361c11fb41070467 21e43de0f300ee47b7e597098908601bf591950b 3c678bb1cedfd7b865ac2e7aaf014de4bfb3eb3d --- contrib/epee/include/net/abstract_tcp_server2.inl | 10 ---------- contrib/epee/include/net/network_throttle.hpp | 1 - contrib/epee/include/pragma_comp_defs.h | 14 -------------- contrib/epee/include/storages/portable_storage_to_bin.h | 14 ++++---------- 4 files changed, 4 insertions(+), 35 deletions(-) delete mode 100644 contrib/epee/include/pragma_comp_defs.h (limited to 'contrib/epee/include') diff --git a/contrib/epee/include/net/abstract_tcp_server2.inl b/contrib/epee/include/net/abstract_tcp_server2.inl index 58cec5520..0c3b457bc 100644 --- a/contrib/epee/include/net/abstract_tcp_server2.inl +++ b/contrib/epee/include/net/abstract_tcp_server2.inl @@ -44,8 +44,6 @@ #include "warnings.h" #include "string_tools_lexical.h" #include "misc_language.h" -#include "net/local_ip.h" -#include "pragma_comp_defs.h" #include #include @@ -64,7 +62,6 @@ #define TIMEOUT_EXTRA_MS_PER_BYTE 0.2 -PRAGMA_WARNING_PUSH namespace epee { namespace net_utils @@ -79,8 +76,6 @@ namespace net_utils /************************************************************************/ /* */ /************************************************************************/ -PRAGMA_WARNING_DISABLE_VS(4355) - template connection::connection( boost::asio::io_service& io_service, std::shared_ptr state, @@ -111,7 +106,6 @@ PRAGMA_WARNING_DISABLE_VS(4355) MDEBUG("test, connection constructor set m_connection_type="< connection::~connection() noexcept(false) @@ -1092,8 +1086,6 @@ PRAGMA_WARNING_DISABLE_VS(4355) } } //----------------------------------------------------------------------------- -PUSH_WARNINGS -DISABLE_GCC_WARNING(maybe-uninitialized) template bool boosted_tcp_server::init_server(const std::string port, const std::string& address, const std::string port_ipv6, const std::string address_ipv6, bool use_ipv6, bool require_ipv4, @@ -1113,7 +1105,6 @@ DISABLE_GCC_WARNING(maybe-uninitialized) } return this->init_server(p, address, p_ipv6, address_ipv6, use_ipv6, require_ipv4, std::move(ssl_options)); } -POP_WARNINGS //--------------------------------------------------------------------------------- template bool boosted_tcp_server::worker_thread() @@ -1734,4 +1725,3 @@ POP_WARNINGS } // namespace } // namespace -PRAGMA_WARNING_POP diff --git a/contrib/epee/include/net/network_throttle.hpp b/contrib/epee/include/net/network_throttle.hpp index 378fd5de4..750231610 100644 --- a/contrib/epee/include/net/network_throttle.hpp +++ b/contrib/epee/include/net/network_throttle.hpp @@ -59,7 +59,6 @@ #include #include #include "misc_language.h" -#include "pragma_comp_defs.h" #include #include #include diff --git a/contrib/epee/include/pragma_comp_defs.h b/contrib/epee/include/pragma_comp_defs.h deleted file mode 100644 index f4ef7057e..000000000 --- a/contrib/epee/include/pragma_comp_defs.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#if defined(__GNUC__) - #define PRAGMA_WARNING_PUSH _Pragma("GCC diagnostic push") - #define PRAGMA_WARNING_POP _Pragma("GCC diagnostic pop") - #define PRAGMA_WARNING_DISABLE_VS(w) - #define PRAGMA_GCC(w) _Pragma(w) -#elif defined(_MSC_VER) - #define PRAGMA_WARNING_PUSH __pragma(warning( push )) - #define PRAGMA_WARNING_POP __pragma(warning( pop )) - #define PRAGMA_WARNING_DISABLE_VS(w) __pragma( warning ( disable: w )) - //#define PRAGMA_WARNING_DISABLE_GCC(w) - #define PRAGMA_GCC(w) -#endif diff --git a/contrib/epee/include/storages/portable_storage_to_bin.h b/contrib/epee/include/storages/portable_storage_to_bin.h index b82cf532b..be4033dd8 100644 --- a/contrib/epee/include/storages/portable_storage_to_bin.h +++ b/contrib/epee/include/storages/portable_storage_to_bin.h @@ -28,7 +28,6 @@ #pragma once -#include "pragma_comp_defs.h" #include "misc_language.h" #include "portable_storage_base.h" #include "portable_storage_bin_utils.h" @@ -49,12 +48,7 @@ namespace epee return sizeof(pack_value); } - PRAGMA_WARNING_PUSH - PRAGMA_GCC("GCC diagnostic ignored \"-Wstrict-aliasing\"") -#ifdef __clang__ - PRAGMA_GCC("GCC diagnostic ignored \"-Wtautological-constant-out-of-range-compare\"") -#endif - template + template size_t pack_varint(t_stream& strm, size_t val) { //the first two bits always reserved for size information @@ -70,13 +64,13 @@ namespace epee return pack_varint_t(strm, PORTABLE_RAW_SIZE_MARK_DWORD, val); }else { - CHECK_AND_ASSERT_THROW_MES(val <= 4611686018427387903, "failed to pack varint - too big amount = " << val); + // Same as checking val <= 4611686018427387903 except that it's portable for 32-bit size_t + CHECK_AND_ASSERT_THROW_MES(!(val >> 31 >> 31), "failed to pack varint - too big amount = " << val); return pack_varint_t(strm, PORTABLE_RAW_SIZE_MARK_INT64, val); } } - PRAGMA_WARNING_POP - template + template bool put_string(t_stream& strm, const std::string& v) { pack_varint(strm, v.size()); -- cgit v1.2.3