From 63503ee8f0a5647ca0d684b4602f5e8023879ad4 Mon Sep 17 00:00:00 2001 From: Nik Bougalis Date: Mon, 2 Dec 2019 02:15:44 -0800 Subject: [PATCH] Improve platform detection and reduce includes: The existing platform detection code was derived from the old Beast library, which was, itself, derived from JUCE. This commit removes that code and replaces it with the Boost.Predef library which defines a consistent set of compiler, architecture, operating system, library, and other version numbers. For more on Boost.Predef, please see the Boost documentation. The documentation for the current version as of this writing is at: https://www.boost.org/doc/libs/1_71_0/doc/html/predef.html --- Builds/CMake/RippledCompiler.cmake | 1 + Builds/CMake/RippledCore.cmake | 5 - src/beast/extras/beast/unit_test/main.cpp | 8 - src/ripple/app/main/Main.cpp | 23 +- src/ripple/app/misc/NetworkOPs.cpp | 2 +- src/ripple/app/misc/impl/ValidatorList.cpp | 1 + src/ripple/app/misc/impl/ValidatorSite.cpp | 10 +- src/ripple/app/tx/impl/Transactor.cpp | 2 +- src/ripple/basics/base_uint.h | 1 + src/ripple/basics/random.h | 1 - src/ripple/basics/win32_workaround.h | 45 --- .../detail/aged_unordered_container.h | 1 + src/ripple/beast/core/BasicNativeHeaders.h | 302 ------------------ src/ripple/beast/core/Config.h | 31 -- src/ripple/beast/core/ConfigCheck.h | 31 -- src/ripple/beast/core/CurrentThreadName.cpp | 123 ++++--- src/ripple/beast/core/CurrentThreadName.h | 11 +- src/ripple/beast/core/LexicalCast.h | 15 +- src/ripple/beast/core/List.h | 2 - src/ripple/beast/core/PlatformConfig.h | 211 ------------ src/ripple/beast/core/StandardConfig.h | 73 ----- src/ripple/beast/core/StandardIncludes.h | 78 ----- src/ripple/beast/core/core.unity.cpp | 52 --- .../beast/unity/beast_insight_unity.cpp | 2 - src/ripple/core/JobQueue.h | 1 - src/ripple/crypto/impl/RFC1751.cpp | 11 +- src/ripple/json/json_value.h | 1 - src/ripple/net/impl/RegisterSSLCerts.cpp | 2 +- src/ripple/nodestore/impl/EncodedBlob.cpp | 4 +- src/ripple/nodestore/impl/codec.h | 3 +- src/ripple/peerfinder/impl/Counts.h | 2 + src/ripple/peerfinder/impl/PrivateTypes.h | 37 --- src/ripple/protocol/SecretKey.h | 4 +- src/ripple/protocol/Serializer.h | 1 + src/ripple/protocol/impl/BuildInfo.cpp | 5 +- src/ripple/protocol/impl/ErrorCodes.cpp | 1 + src/ripple/protocol/impl/STAccount.cpp | 2 + src/ripple/rpc/handlers/AccountTx.cpp | 4 +- src/ripple/rpc/handlers/AccountTxOld.cpp | 4 +- src/ripple/unity/net.cpp | 3 - .../beast/beast_CurrentThreadName_test.cpp | 2 +- src/test/beast/beast_Debug_test.cpp | 58 ---- src/test/net/SSLHTTPDownloader_test.cpp | 1 + src/test/unity/beast_test_unity1.cpp | 1 - 44 files changed, 120 insertions(+), 1058 deletions(-) delete mode 100644 src/ripple/basics/win32_workaround.h delete mode 100644 src/ripple/beast/core/BasicNativeHeaders.h delete mode 100644 src/ripple/beast/core/Config.h delete mode 100644 src/ripple/beast/core/ConfigCheck.h delete mode 100644 src/ripple/beast/core/PlatformConfig.h delete mode 100644 src/ripple/beast/core/StandardConfig.h delete mode 100644 src/ripple/beast/core/StandardIncludes.h delete mode 100644 src/ripple/peerfinder/impl/PrivateTypes.h delete mode 100644 src/test/beast/beast_Debug_test.cpp diff --git a/Builds/CMake/RippledCompiler.cmake b/Builds/CMake/RippledCompiler.cmake index a289c9722..66be2f862 100644 --- a/Builds/CMake/RippledCompiler.cmake +++ b/Builds/CMake/RippledCompiler.cmake @@ -76,6 +76,7 @@ if (MSVC) _SCL_SECURE_NO_WARNINGS _CRT_SECURE_NO_WARNINGS WIN32_CONSOLE + WIN32_LEAN_AND_MEAN NOMINMAX # TODO: Resolve these warnings, don't just silence them _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS diff --git a/Builds/CMake/RippledCore.cmake b/Builds/CMake/RippledCore.cmake index c8f0b0c58..8e5778579 100644 --- a/Builds/CMake/RippledCore.cmake +++ b/Builds/CMake/RippledCore.cmake @@ -269,13 +269,9 @@ install ( DESTINATION include/ripple/beast/clock) install ( FILES - src/ripple/beast/core/Config.h - src/ripple/beast/core/ConfigCheck.h src/ripple/beast/core/LexicalCast.h src/ripple/beast/core/List.h - src/ripple/beast/core/PlatformConfig.h src/ripple/beast/core/SemanticVersion.h - src/ripple/beast/core/StandardConfig.h DESTINATION include/ripple/beast/core) install ( FILES @@ -792,7 +788,6 @@ else () src/test/beast/SemanticVersion_test.cpp src/test/beast/aged_associative_container_test.cpp src/test/beast/beast_CurrentThreadName_test.cpp - src/test/beast/beast_Debug_test.cpp src/test/beast/beast_Journal_test.cpp src/test/beast/beast_PropertyStream_test.cpp src/test/beast/beast_Zero_test.cpp diff --git a/src/beast/extras/beast/unit_test/main.cpp b/src/beast/extras/beast/unit_test/main.cpp index e6c1464ac..5762b5102 100644 --- a/src/beast/extras/beast/unit_test/main.cpp +++ b/src/beast/extras/beast/unit_test/main.cpp @@ -79,14 +79,6 @@ int main(int ac, char const* av[]) using namespace std; using namespace beast::unit_test; -#if BOOST_MSVC - { - int flags = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); - flags |= _CRTDBG_LEAK_CHECK_DF; - _CrtSetDbgFlag(flags); - } -#endif - namespace po = boost::program_options; po::options_description desc("Options"); desc.add_options() diff --git a/src/ripple/app/main/Main.cpp b/src/ripple/app/main/Main.cpp index 58827d223..354867759 100644 --- a/src/ripple/app/main/Main.cpp +++ b/src/ripple/app/main/Main.cpp @@ -37,10 +37,7 @@ #include #include -#include -#include #include -#include #include #include @@ -48,19 +45,31 @@ #include #include #include -#include -#include +#include #include #include #include #include -#ifdef _MSC_VER +#if BOOST_OS_WINDOWS #include #include #endif +// Do we know the plaform we're compiling on? If you're adding new platforms +// modify this check accordingly. +#if !BOOST_OS_LINUX && !BOOST_OS_WINDOWS && !BOOST_OS_MACOS +#error Supported platforms are: Linux, Windows and MacOS +#endif + +// Ensure that precisely one platform is detected. +#if (BOOST_OS_LINUX && (BOOST_OS_WINDOWS || BOOST_OS_MACOS)) || \ + (BOOST_OS_MACOS && (BOOST_OS_WINDOWS || BOOST_OS_LINUX)) || \ + (BOOST_OS_WINDOWS && (BOOST_OS_LINUX || BOOST_OS_MACOS)) +#error Multiple supported platforms appear active at once +#endif + namespace po = boost::program_options; namespace ripple { @@ -727,7 +736,7 @@ int run (int argc, char** argv) // int main (int argc, char** argv) { -#ifdef _MSC_VER +#if BOOST_OS_WINDOWS { // Work around for https://svn.boost.org/trac/boost/ticket/10657 // Reported against boost version 1.56.0. If an application's diff --git a/src/ripple/app/misc/NetworkOPs.cpp b/src/ripple/app/misc/NetworkOPs.cpp index 537f8d996..4be3b0b38 100644 --- a/src/ripple/app/misc/NetworkOPs.cpp +++ b/src/ripple/app/misc/NetworkOPs.cpp @@ -1084,7 +1084,7 @@ void NetworkOPsImp::apply (std::unique_lock& batchLock) if (isTemMalformed (e.result)) app_.getHashRouter().setFlags (e.transaction->getID(), SF_BAD); - #ifdef BEAST_DEBUG + #ifdef DEBUG if (e.result != tesSUCCESS) { std::string token, human; diff --git a/src/ripple/app/misc/impl/ValidatorList.cpp b/src/ripple/app/misc/impl/ValidatorList.cpp index d04e0b888..2b6f20452 100644 --- a/src/ripple/app/misc/impl/ValidatorList.cpp +++ b/src/ripple/app/misc/impl/ValidatorList.cpp @@ -27,6 +27,7 @@ #include +#include #include #include diff --git a/src/ripple/app/misc/impl/ValidatorSite.cpp b/src/ripple/app/misc/impl/ValidatorSite.cpp index 42921acb5..4dc00f0a2 100644 --- a/src/ripple/app/misc/impl/ValidatorSite.cpp +++ b/src/ripple/app/misc/impl/ValidatorSite.cpp @@ -47,12 +47,10 @@ ValidatorSite::Site::Resource::Resource (std::string uri_) if (!pUrl.domain.empty()) throw std::runtime_error("file URI cannot contain a hostname"); -#if _MSC_VER // MSVC: Windows paths need the leading / removed - { - if (pUrl.path[0] == '/') - pUrl.path = pUrl.path.substr(1); - - } +#if BOOST_OS_WINDOWS + // Paths on Windows need the leading / removed + if (pUrl.path[0] == '/') + pUrl.path = pUrl.path.substr(1); #endif if (pUrl.path.empty()) diff --git a/src/ripple/app/tx/impl/Transactor.cpp b/src/ripple/app/tx/impl/Transactor.cpp index 2c68badc0..3fcf68c5b 100644 --- a/src/ripple/app/tx/impl/Transactor.cpp +++ b/src/ripple/app/tx/impl/Transactor.cpp @@ -635,7 +635,7 @@ Transactor::operator()() { JLOG(j_.trace()) << "apply: " << ctx_.tx.getTransactionID (); -#ifdef BEAST_DEBUG +#ifdef DEBUG { Serializer ser; ctx_.tx.add (ser); diff --git a/src/ripple/basics/base_uint.h b/src/ripple/basics/base_uint.h index d45a28d1b..7635e0e9b 100644 --- a/src/ripple/basics/base_uint.h +++ b/src/ripple/basics/base_uint.h @@ -32,6 +32,7 @@ #include #include #include +#include #include #include diff --git a/src/ripple/basics/random.h b/src/ripple/basics/random.h index e07522296..8b55d29d1 100644 --- a/src/ripple/basics/random.h +++ b/src/ripple/basics/random.h @@ -20,7 +20,6 @@ #ifndef RIPPLE_BASICS_RANDOM_H_INCLUDED #define RIPPLE_BASICS_RANDOM_H_INCLUDED -#include #include #include #include diff --git a/src/ripple/basics/win32_workaround.h b/src/ripple/basics/win32_workaround.h deleted file mode 100644 index 173942905..000000000 --- a/src/ripple/basics/win32_workaround.h +++ /dev/null @@ -1,45 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of Beast: https://github.com/vinniefalco/Beast - Copyright 2015, Vinnie Falco - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - -#ifndef BEAST_WINDOWS_H_INCLUDED -#define BEAST_WINDOWS_H_INCLUDED - -#ifdef _MSC_VER -#pragma push_macro("NOMINMAX") -#pragma push_macro("UNICODE") -#pragma push_macro("STRICT") -# ifndef NOMINMAX -# define NOMINMAX -# endif -# ifndef UNICODE -# define UNICODE -# endif -# ifndef STRICT -# define STRICT -# endif -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# endif -# include -#pragma pop_macro("STRICT") -#pragma pop_macro("UNICODE") -#pragma pop_macro("NOMINMAX") - -#endif -#endif diff --git a/src/ripple/beast/container/detail/aged_unordered_container.h b/src/ripple/beast/container/detail/aged_unordered_container.h index 8b09db7ae..90f8b285f 100644 --- a/src/ripple/beast/container/detail/aged_unordered_container.h +++ b/src/ripple/beast/container/detail/aged_unordered_container.h @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include diff --git a/src/ripple/beast/core/BasicNativeHeaders.h b/src/ripple/beast/core/BasicNativeHeaders.h deleted file mode 100644 index 335a648e8..000000000 --- a/src/ripple/beast/core/BasicNativeHeaders.h +++ /dev/null @@ -1,302 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of Beast: https://github.com/vinniefalco/Beast - Copyright 2013, Vinnie Falco - - Portions of this file are from JUCE. - Copyright (c) 2013 - Raw Material Software Ltd. - Please visit http://www.juce.com - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - -#ifndef BEAST_MODULE_CORE_NATIVE_BASICNATIVEHEADERS_H_INCLUDED -#define BEAST_MODULE_CORE_NATIVE_BASICNATIVEHEADERS_H_INCLUDED - -#include - -#undef T - -//============================================================================== -#if BEAST_MAC || BEAST_IOS - - #if BEAST_IOS - #ifdef __OBJC__ - #import - #import - #import - #import - #endif - #include - #else - #ifdef __OBJC__ - #define Point CarbonDummyPointName - #define Component CarbonDummyCompName - #import - #import - #undef Point - #undef Component - #endif - #include - #endif - - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - -//============================================================================== -#elif BEAST_WINDOWS - #if BEAST_MSVC - #ifndef _CPPRTTI - #error "Beast requires RTTI!" - #endif - - #ifndef _CPPUNWIND - #error "Beast requires RTTI!" - #endif - - #pragma warning (push) - #pragma warning (disable : 4100 4201 4514 4312 4995) - #endif - - #define STRICT 1 - #define WIN32_LEAN_AND_MEAN 1 - #ifndef _WIN32_WINNT - #if BEAST_MINGW - #define _WIN32_WINNT 0x0501 - #else - #define _WIN32_WINNT 0x0600 - #endif - #endif - #define _UNICODE 1 - #define UNICODE 1 - #ifndef _WIN32_IE - #define _WIN32_IE 0x0400 - #endif - - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #pragma warning ( push ) - #pragma warning ( disable: 4091 ) - #include - #pragma warning ( pop ) - #include - #include - - #if BEAST_MINGW - #include - #else - #include - #include - #endif - - #undef PACKED - - #if BEAST_MSVC - #pragma warning (pop) - #pragma warning (4: 4511 4512 4100 /*4365*/) // (enable some warnings that are turned off in VC8) - #endif - - #if BEAST_MSVC && ! BEAST_DONT_AUTOLINK_TO_WIN32_LIBRARIES - #pragma comment (lib, "kernel32.lib") - #pragma comment (lib, "user32.lib") - #pragma comment (lib, "wininet.lib") - #pragma comment (lib, "advapi32.lib") - #pragma comment (lib, "ws2_32.lib") - #pragma comment (lib, "version.lib") - #pragma comment (lib, "shlwapi.lib") - #pragma comment (lib, "winmm.lib") - - #ifdef _NATIVE_WCHAR_T_DEFINED - #ifdef _DEBUG - #pragma comment (lib, "comsuppwd.lib") - #else - #pragma comment (lib, "comsuppw.lib") - #endif - #else - #ifdef _DEBUG - #pragma comment (lib, "comsuppd.lib") - #else - #pragma comment (lib, "comsupp.lib") - #endif - #endif - #endif - -//============================================================================== -#elif BEAST_LINUX || BEAST_BSD - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - - #if BEAST_BSD - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - - // This has to be in the global namespace - extern char** environ; - - #else - #include - #include - #include - #include - #endif - -//============================================================================== -#elif BEAST_ANDROID - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include -#endif - -// Need to clear various moronic redefinitions made by system headers.. -#undef max -#undef min -#undef direct -#undef check - -// Order matters, since headers don't have their own #include lines. -// Add new includes to the bottom. - -#include -#include - -#include -#include - -#if ! BEAST_BSD - #include -#endif - -#if ! BEAST_ANDROID - #include -#endif - -#if BEAST_WINDOWS - #include - #include - #include - - #if ! BEAST_MINGW - #pragma warning ( push ) - #pragma warning ( disable: 4091 ) - #include - #pragma warning ( pop ) - - #if ! BEAST_DONT_AUTOLINK_TO_WIN32_LIBRARIES - #pragma comment (lib, "DbgHelp.lib") - #endif - #endif - - #if BEAST_MINGW - #include - #endif - -#else - #if BEAST_LINUX || BEAST_ANDROID - #include - #include - #include - #include - #endif - - #if BEAST_LINUX - #include - #endif - - #include - #include - #include - #include - #include - #include - #include - #include -#endif - -#if BEAST_MAC || BEAST_IOS - #include - #include -#endif - -#if BEAST_ANDROID - #include -#endif - -#endif // BEAST_BASICNATIVEHEADERS_H_INCLUDED diff --git a/src/ripple/beast/core/Config.h b/src/ripple/beast/core/Config.h deleted file mode 100644 index c98951582..000000000 --- a/src/ripple/beast/core/Config.h +++ /dev/null @@ -1,31 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of Beast: https://github.com/vinniefalco/Beast - Copyright 2013, Vinnie Falco - - Portions of this file are from JUCE. - Copyright (c) 2013 - Raw Material Software Ltd. - Please visit http://www.juce.com - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - -#ifndef BEAST_CONFIG_H_INCLUDED -#define BEAST_CONFIG_H_INCLUDED - -#include -#include -#include - -#endif diff --git a/src/ripple/beast/core/ConfigCheck.h b/src/ripple/beast/core/ConfigCheck.h deleted file mode 100644 index 74423471d..000000000 --- a/src/ripple/beast/core/ConfigCheck.h +++ /dev/null @@ -1,31 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of Beast: https://github.com/vinniefalco/Beast - Copyright 2013, Vinnie Falco - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - -#ifndef BEAST_CONFIG_CONFIGCHECK_H_INCLUDED -#define BEAST_CONFIG_CONFIGCHECK_H_INCLUDED - -// -// Apply sensible defaults for the configuration settings -// - -#ifndef BEAST_DONT_AUTOLINK_TO_WIN32_LIBRARIES -#define BEAST_DONT_AUTOLINK_TO_WIN32_LIBRARIES 0 -#endif - -#endif diff --git a/src/ripple/beast/core/CurrentThreadName.cpp b/src/ripple/beast/core/CurrentThreadName.cpp index 21358d6f8..e6afd1054 100644 --- a/src/ripple/beast/core/CurrentThreadName.cpp +++ b/src/ripple/beast/core/CurrentThreadName.cpp @@ -22,111 +22,98 @@ //============================================================================== #include -#include -#include -#include -#include - -namespace beast { -namespace detail { - -static boost::thread_specific_ptr threadName; - -void saveThreadName (std::string name) -{ - threadName.reset (new std::string {std::move(name)}); -} - -} // detail - -boost::optional getCurrentThreadName () -{ - if (auto r = detail::threadName.get()) - return *r; - return boost::none; -} - -} // beast +#include //------------------------------------------------------------------------------ -#if BEAST_WINDOWS - +#if BOOST_OS_WINDOWS #include #include -#include -namespace beast { -namespace detail { +namespace beast::detail { -void setCurrentThreadNameImpl (std::string const& name) +inline void setCurrentThreadNameImpl (std::string_view name) { - #if BEAST_DEBUG && BEAST_MSVC - struct +#if DEBUG && BOOST_COMP_MSVC + // This technique is documented by Microsoft and works for all versions + // of Windows and Visual Studio provided that the process is being run + // under the Visual Studio debugger. For more details, see: + // https://docs.microsoft.com/en-us/visualstudio/debugger/how-to-set-a-thread-name-in-native-code + +#pragma pack(push,8) + struct THREADNAME_INFO { DWORD dwType; LPCSTR szName; DWORD dwThreadID; DWORD dwFlags; - } info; + }; +#pragma pack(pop) - info.dwType = 0x1000; - info.szName = name.c_str (); - info.dwThreadID = GetCurrentThreadId(); - info.dwFlags = 0; + THREADNAME_INFO ni; + ni.dwType = 0x1000; + ni.szName = name.data(); + ni.dwThreadID = GetCurrentThreadId(); + ni.dwFlags = 0; + +#pragma warning(push) +#pragma warning(disable: 6320 6322) __try { - RaiseException (0x406d1388 /*MS_VC_EXCEPTION*/, 0, sizeof (info) / sizeof (ULONG_PTR), (ULONG_PTR*) &info); + RaiseException (0x406d1388, 0, + sizeof(ni) / sizeof(ULONG_PTR), (ULONG_PTR*)&ni); } __except (EXCEPTION_CONTINUE_EXECUTION) {} - #else - (void) name; - #endif +#pragma warning(pop) +#endif } -} // detail -} // beast - -#elif BEAST_MAC +} // beast::detail +#endif // BOOST_OS_WINDOWS +#if BOOST_OS_MACOS #include -namespace beast { -namespace detail { +namespace beast::detail { -void setCurrentThreadNameImpl (std::string const& name) +inline void setCurrentThreadNameImpl (std::string_view name) { - pthread_setname_np(name.c_str()); + pthread_setname_np(name.data()); } -} // detail -} // beast - -#else // BEAST_LINUX +} // beast::detail +#endif // BOOST_OS_MACOS +#if BOOST_OS_LINUX #include +namespace beast::detail { + +inline void setCurrentThreadNameImpl (std::string_view name) +{ + pthread_setname_np(pthread_self(), name.data()); +} + +} // beast::detail +#endif // BOOST_OS_LINUX + namespace beast { + namespace detail { - -void setCurrentThreadNameImpl (std::string const& name) -{ - pthread_setname_np(pthread_self(), name.c_str()); -} - +thread_local std::string threadName; } // detail -} // beast -#endif // BEAST_LINUX - -namespace beast { - -void setCurrentThreadName (std::string name) +std::string getCurrentThreadName () { - detail::setCurrentThreadNameImpl (name); - detail::saveThreadName (std::move (name)); + return detail::threadName; +} + +void setCurrentThreadName (std::string_view name) +{ + detail::threadName = name; + detail::setCurrentThreadNameImpl(name); } } // beast diff --git a/src/ripple/beast/core/CurrentThreadName.h b/src/ripple/beast/core/CurrentThreadName.h index d114e075c..be9bb6928 100644 --- a/src/ripple/beast/core/CurrentThreadName.h +++ b/src/ripple/beast/core/CurrentThreadName.h @@ -24,7 +24,7 @@ #ifndef BEAST_CORE_CURRENT_THREAD_NAME_H_INCLUDED #define BEAST_CORE_CURRENT_THREAD_NAME_H_INCLUDED -#include +#include #include namespace beast { @@ -32,16 +32,17 @@ namespace beast { /** Changes the name of the caller thread. Different OSes may place different length or content limits on this name. */ -void setCurrentThreadName (std::string newThreadName); +void setCurrentThreadName (std::string_view newThreadName); /** Returns the name of the caller thread. The name returned is the name as set by a call to setCurrentThreadName(). If the thread name is set by an external force, then that name change - will not be reported. If no name has ever been set, then boost::none - is returned. + will not be reported. + + If no name has ever been set, then the empty string is returned. */ -boost::optional getCurrentThreadName (); +std::string getCurrentThreadName (); } diff --git a/src/ripple/beast/core/LexicalCast.h b/src/ripple/beast/core/LexicalCast.h index e104b94b7..ff1ad8e72 100644 --- a/src/ripple/beast/core/LexicalCast.h +++ b/src/ripple/beast/core/LexicalCast.h @@ -20,7 +20,6 @@ #ifndef BEAST_MODULE_CORE_TEXT_LEXICALCAST_H_INCLUDED #define BEAST_MODULE_CORE_TEXT_LEXICALCAST_H_INCLUDED -#include #include #include #include @@ -33,11 +32,13 @@ #include #include +#include + namespace beast { namespace detail { -#ifdef _MSC_VER +#if BOOST_COMP_MSVC #pragma warning(push) #pragma warning(disable: 4800) #pragma warning(disable: 4804) @@ -190,10 +191,10 @@ struct LexicalCast { // Convert the input to lowercase std::transform(in.begin (), in.end (), in.begin (), - [](auto c) - { - return ::tolower(static_cast(c)); - }); + [](auto c) + { + return ::tolower(static_cast(c)); + }); if (in == "1" || in == "true") { @@ -238,7 +239,7 @@ struct LexicalCast } }; -#ifdef _MSC_VER +#if BOOST_COMP_MSVC #pragma warning(pop) #endif diff --git a/src/ripple/beast/core/List.h b/src/ripple/beast/core/List.h index ee4018e25..7c0a128da 100644 --- a/src/ripple/beast/core/List.h +++ b/src/ripple/beast/core/List.h @@ -20,8 +20,6 @@ #ifndef BEAST_INTRUSIVE_LIST_H_INCLUDED #define BEAST_INTRUSIVE_LIST_H_INCLUDED -#include - #include #include diff --git a/src/ripple/beast/core/PlatformConfig.h b/src/ripple/beast/core/PlatformConfig.h deleted file mode 100644 index 12af9c889..000000000 --- a/src/ripple/beast/core/PlatformConfig.h +++ /dev/null @@ -1,211 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of Beast: https://github.com/vinniefalco/Beast - Copyright 2013, Vinnie Falco - - Portions of this file are from JUCE. - Copyright (c) 2013 - Raw Material Software Ltd. - Please visit http://www.juce.com - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - -#ifndef BEAST_CONFIG_PLATFORMCONFIG_H_INCLUDED -#define BEAST_CONFIG_PLATFORMCONFIG_H_INCLUDED - -//============================================================================== -/* This file figures out which platform is being built, and defines some macros - that the rest of the code can use for OS-specific compilation. - - Macros that will be set here are: - - - One of BEAST_WINDOWS, BEAST_MAC BEAST_LINUX, BEAST_IOS, BEAST_ANDROID, etc. - - Either BEAST_32BIT or BEAST_64BIT, depending on the architecture. - - Either BEAST_LITTLE_ENDIAN or BEAST_BIG_ENDIAN. - - Either BEAST_INTEL or BEAST_PPC - - Either BEAST_GCC or BEAST_MSVC -*/ - -//============================================================================== -#if (defined (_WIN32) || defined (_WIN64)) - #define BEAST_WIN32 1 - #define BEAST_WINDOWS 1 -#elif defined (BEAST_ANDROID) - #undef BEAST_ANDROID - #define BEAST_ANDROID 1 -#elif defined (LINUX) || defined (__linux__) - #define BEAST_LINUX 1 -#elif defined (__APPLE_CPP__) || defined(__APPLE_CC__) - #define Point CarbonDummyPointName // (workaround to avoid definition of "Point" by old Carbon headers) - #define Component CarbonDummyCompName - #include // (needed to find out what platform we're using) - #undef Point - #undef Component - - #if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR - #define BEAST_IPHONE 1 - #define BEAST_IOS 1 - #else - #define BEAST_MAC 1 - #endif -#elif defined (__FreeBSD__) - #define BEAST_BSD 1 -#else - #error "Unknown platform!" -#endif - -//============================================================================== -#if BEAST_WINDOWS - #ifdef _MSC_VER - #ifdef _WIN64 - #define BEAST_64BIT 1 - #else - #define BEAST_32BIT 1 - #endif - #endif - - #ifdef _DEBUG - #define BEAST_DEBUG 1 - #endif - - #ifdef __MINGW32__ - #define BEAST_MINGW 1 - #ifdef __MINGW64__ - #define BEAST_64BIT 1 - #else - #define BEAST_32BIT 1 - #endif - #endif - - /** If defined, this indicates that the processor is little-endian. */ - #define BEAST_LITTLE_ENDIAN 1 - - #define BEAST_INTEL 1 -#endif - -//============================================================================== -#if BEAST_MAC || BEAST_IOS - - #if defined (DEBUG) || defined (_DEBUG) || ! (defined (NDEBUG) || defined (_NDEBUG)) - #define BEAST_DEBUG 1 - #endif - - #ifdef __LITTLE_ENDIAN__ - #define BEAST_LITTLE_ENDIAN 1 - #else - #define BEAST_BIG_ENDIAN 1 - #endif -#endif - -#if BEAST_MAC - - #if defined (__ppc__) || defined (__ppc64__) - #define BEAST_PPC 1 - #elif defined (__arm__) - #define BEAST_ARM 1 - #else - #define BEAST_INTEL 1 - #endif - - #ifdef __LP64__ - #define BEAST_64BIT 1 - #else - #define BEAST_32BIT 1 - #endif - - #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_4 - #error "Building for OSX 10.3 is no longer supported!" - #endif - - #ifndef MAC_OS_X_VERSION_10_5 - #error "To build with 10.4 compatibility, use a 10.5 or 10.6 SDK and set the deployment target to 10.4" - #endif - -#endif - -//============================================================================== -#if BEAST_LINUX || BEAST_ANDROID || BEAST_BSD - - #ifdef _DEBUG - #define BEAST_DEBUG 1 - #endif - - // Allow override for big-endian Linux platforms - #if defined (__LITTLE_ENDIAN__) || ! defined (BEAST_BIG_ENDIAN) - #define BEAST_LITTLE_ENDIAN 1 - #undef BEAST_BIG_ENDIAN - #else - #undef BEAST_LITTLE_ENDIAN - #define BEAST_BIG_ENDIAN 1 - #endif - - #if defined (__LP64__) || defined (_LP64) - #define BEAST_64BIT 1 - #else - #define BEAST_32BIT 1 - #endif - - #if __MMX__ || __SSE__ || __amd64__ - #ifdef __arm__ - #define BEAST_ARM 1 - #else - #define BEAST_INTEL 1 - #endif - #endif -#endif - -//============================================================================== -// Compiler type macros. - -#ifdef __clang__ - #define BEAST_CLANG 1 -#elif defined (__GNUC__) - #define BEAST_GCC 1 -#elif defined (_MSC_VER) - #define BEAST_MSVC 1 - - #if _MSC_VER < 1500 - #define BEAST_VC8_OR_EARLIER 1 - - #if _MSC_VER < 1400 - #define BEAST_VC7_OR_EARLIER 1 - - #if _MSC_VER < 1300 - #warning "MSVC 6.0 is no longer supported!" - #endif - #endif - #endif - - #if BEAST_64BIT || ! BEAST_VC7_OR_EARLIER - #define BEAST_USE_INTRINSICS 1 - #endif -#else - #error unknown compiler -#endif - -//------------------------------------------------------------------------------ - -// Handy macro that lets pragma warnings be clicked in the output window -// -// Usage: #pragma message(BEAST_FILEANDLINE_ "Advertise here!") -// -// Note that a space following the macro is mandatory for C++11. -// -// This is here so it can be used in C compilations that include this directly. -// -#define BEAST_PP_STR2_(x) #x -#define BEAST_PP_STR1_(x) BEAST_PP_STR2_(x) -#define BEAST_FILEANDLINE_ __FILE__ "(" BEAST_PP_STR1_(__LINE__) "): warning:" - -#endif diff --git a/src/ripple/beast/core/StandardConfig.h b/src/ripple/beast/core/StandardConfig.h deleted file mode 100644 index c9e44a5b4..000000000 --- a/src/ripple/beast/core/StandardConfig.h +++ /dev/null @@ -1,73 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of Beast: https://github.com/vinniefalco/Beast - Copyright 2013, Vinnie Falco - - Portions of this file are from JUCE. - Copyright (c) 2013 - Raw Material Software Ltd. - Please visit http://www.juce.com - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - -#ifndef BEAST_CONFIG_STANDARDCONFIG_H_INCLUDED -#define BEAST_CONFIG_STANDARDCONFIG_H_INCLUDED - -// Now we'll include some common OS headers.. -#if BEAST_MSVC -#pragma warning (push) -#pragma warning (disable: 4514 4245 4100) -#endif - -#if BEAST_USE_INTRINSICS -#include -#endif - -#if BEAST_MAC || BEAST_IOS -#include -#endif - -#if BEAST_LINUX -#include -# if __INTEL_COMPILER -# if __ia64__ -#include -# else -#include -# endif -# endif -#endif - -#if BEAST_MSVC && BEAST_DEBUG -#include -#include -#include -#endif - -#if BEAST_MSVC -#pragma warning (pop) -#endif - -#if BEAST_ANDROID - #include - #include -#endif - -// undef symbols that are sometimes set by misguided 3rd-party headers.. -#undef check -#undef TYPE_BOOL -#undef max -#undef min - -#endif diff --git a/src/ripple/beast/core/StandardIncludes.h b/src/ripple/beast/core/StandardIncludes.h deleted file mode 100644 index a714de1c0..000000000 --- a/src/ripple/beast/core/StandardIncludes.h +++ /dev/null @@ -1,78 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of Beast: https://github.com/vinniefalco/Beast - Copyright 2013, Vinnie Falco - - Portions of this file are from JUCE. - Copyright (c) 2013 - Raw Material Software Ltd. - Please visit http://www.juce.com - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - -#ifndef BEAST_MODULE_CORE_SYSTEM_STANDARDINCLUDES_H_INCLUDED -#define BEAST_MODULE_CORE_SYSTEM_STANDARDINCLUDES_H_INCLUDED - -// Include some common OS headers.. -#if BEAST_MSVC -#pragma warning (push) -#pragma warning (disable: 4514 4245 4100) -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// undef symbols that are sometimes set by misguided 3rd-party headers.. -#undef check -#undef TYPE_BOOL -#undef max -#undef min - -#endif diff --git a/src/ripple/beast/core/core.unity.cpp b/src/ripple/beast/core/core.unity.cpp index 6acf2c2bc..db8bfc393 100644 --- a/src/ripple/beast/core/core.unity.cpp +++ b/src/ripple/beast/core/core.unity.cpp @@ -21,58 +21,6 @@ */ //============================================================================== -#include -#include -#include - -//------------------------------------------------------------------------------ - -// If the MSVC debug heap headers were included, disable -// the macros during the juce include since they conflict. -#ifdef _CRTDBG_MAP_ALLOC -#pragma push_macro("calloc") -#pragma push_macro("free") -#pragma push_macro("malloc") -#pragma push_macro("realloc") -#pragma push_macro("_recalloc") -#pragma push_macro("_aligned_free") -#pragma push_macro("_aligned_malloc") -#pragma push_macro("_aligned_offset_malloc") -#pragma push_macro("_aligned_realloc") -#pragma push_macro("_aligned_recalloc") -#pragma push_macro("_aligned_offset_realloc") -#pragma push_macro("_aligned_offset_recalloc") -#pragma push_macro("_aligned_msize") -#undef calloc -#undef free -#undef malloc -#undef realloc -#undef _recalloc -#undef _aligned_free -#undef _aligned_malloc -#undef _aligned_offset_malloc -#undef _aligned_realloc -#undef _aligned_recalloc -#undef _aligned_offset_realloc -#undef _aligned_offset_recalloc -#undef _aligned_msize -#endif - #include #include -#ifdef _CRTDBG_MAP_ALLOC -#pragma pop_macro("calloc") -#pragma pop_macro("free") -#pragma pop_macro("malloc") -#pragma pop_macro("realloc") -#pragma pop_macro("_recalloc") -#pragma pop_macro("_aligned_free") -#pragma pop_macro("_aligned_malloc") -#pragma pop_macro("_aligned_offset_malloc") -#pragma pop_macro("_aligned_realloc") -#pragma pop_macro("_aligned_recalloc") -#pragma pop_macro("_aligned_offset_realloc") -#pragma pop_macro("_aligned_offset_recalloc") -#pragma pop_macro("_aligned_msize") -#endif diff --git a/src/ripple/beast/unity/beast_insight_unity.cpp b/src/ripple/beast/unity/beast_insight_unity.cpp index fabc61c8e..8ff3d4160 100644 --- a/src/ripple/beast/unity/beast_insight_unity.cpp +++ b/src/ripple/beast/unity/beast_insight_unity.cpp @@ -17,8 +17,6 @@ */ //============================================================================== -#include - #include #include diff --git a/src/ripple/core/JobQueue.h b/src/ripple/core/JobQueue.h index 7b1dc4924..64b53ac86 100644 --- a/src/ripple/core/JobQueue.h +++ b/src/ripple/core/JobQueue.h @@ -21,7 +21,6 @@ #define RIPPLE_CORE_JOBQUEUE_H_INCLUDED #include -#include #include #include #include diff --git a/src/ripple/crypto/impl/RFC1751.cpp b/src/ripple/crypto/impl/RFC1751.cpp index 6cea9d0aa..f0166258c 100644 --- a/src/ripple/crypto/impl/RFC1751.cpp +++ b/src/ripple/crypto/impl/RFC1751.cpp @@ -393,25 +393,22 @@ int RFC1751::wsrch (std::string const& strWord, int iMin, int iMax) // -2 words OK but parity is wrong int RFC1751::etob (std::string& strData, std::vector vsHuman) { - int i, p, v, l; - char b[9]; - if (6 != vsHuman.size ()) return -1; - memset (b, 0, sizeof (b)); + int i, p = 0; + char b[9] = { 0 }; - p = 0; for (auto& strWord : vsHuman) { - l = strWord.length (); + int l = strWord.length (); if (l > 4 || l < 1) return -1; standard (strWord); - v = wsrch (strWord, + auto v = wsrch (strWord, l < 4 ? 0 : 571, l < 4 ? 570 : 2048); diff --git a/src/ripple/json/json_value.h b/src/ripple/json/json_value.h index 6550fa03e..1b111d69e 100644 --- a/src/ripple/json/json_value.h +++ b/src/ripple/json/json_value.h @@ -22,7 +22,6 @@ #include #include -#include #include #include #include diff --git a/src/ripple/net/impl/RegisterSSLCerts.cpp b/src/ripple/net/impl/RegisterSSLCerts.cpp index 3c5618819..58f62d49a 100644 --- a/src/ripple/net/impl/RegisterSSLCerts.cpp +++ b/src/ripple/net/impl/RegisterSSLCerts.cpp @@ -18,6 +18,7 @@ //============================================================================== #include #include + #if BOOST_OS_WINDOWS #include #include @@ -100,7 +101,6 @@ registerSSLCerts( SSL_CTX_set_cert_store(ctx.native_handle(), store.release()); #else - ctx.set_default_verify_paths(ec); #endif } diff --git a/src/ripple/nodestore/impl/EncodedBlob.cpp b/src/ripple/nodestore/impl/EncodedBlob.cpp index ba906a6c7..e86d81ec7 100644 --- a/src/ripple/nodestore/impl/EncodedBlob.cpp +++ b/src/ripple/nodestore/impl/EncodedBlob.cpp @@ -32,11 +32,11 @@ EncodedBlob::prepare ( auto ret = m_data.alloc(object->getData ().size () + 9); // the first 8 bytes are unused - memset (ret, 0, 8); + std::memset (ret, 0, 8); ret[8] = static_cast (object->getType ()); - memcpy (ret + 9, + std::memcpy (ret + 9, object->getData ().data(), object->getData ().size()); } diff --git a/src/ripple/nodestore/impl/codec.h b/src/ripple/nodestore/impl/codec.h index b2875b31f..a262e6e28 100644 --- a/src/ripple/nodestore/impl/codec.h +++ b/src/ripple/nodestore/impl/codec.h @@ -250,8 +250,7 @@ nodeobject_compress (void const* in, bit; bit >>= 1) { void const* const h = is(32); - if (std::memcmp( - h, zero32(), 32) == 0) + if (std::memcmp(h, zero32(), 32) == 0) continue; std::memcpy( vh.data() + 32 * n, h, 32); diff --git a/src/ripple/peerfinder/impl/Counts.h b/src/ripple/peerfinder/impl/Counts.h index 481ea361c..1bf1328ca 100644 --- a/src/ripple/peerfinder/impl/Counts.h +++ b/src/ripple/peerfinder/impl/Counts.h @@ -25,6 +25,8 @@ #include #include +#include + namespace ripple { namespace PeerFinder { diff --git a/src/ripple/peerfinder/impl/PrivateTypes.h b/src/ripple/peerfinder/impl/PrivateTypes.h deleted file mode 100644 index b0ac33023..000000000 --- a/src/ripple/peerfinder/impl/PrivateTypes.h +++ /dev/null @@ -1,37 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of rippled: https://github.com/ripple/rippled - Copyright (c) 2012, 2013 Ripple Labs Inc. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - -#ifndef RIPPLE_PEERFINDER_PRIVATETYPES_H_INCLUDED -#define RIPPLE_PEERFINDER_PRIVATETYPES_H_INCLUDED - -namespace ripple { -namespace PeerFinder { - -/** Indicates the action the logic will take after a handshake. */ -enum HandshakeAction -{ - doActivate, - doRedirect, - doClose -}; - -} -} - -#endif diff --git a/src/ripple/protocol/SecretKey.h b/src/ripple/protocol/SecretKey.h index 7565564ba..a9a77db36 100644 --- a/src/ripple/protocol/SecretKey.h +++ b/src/ripple/protocol/SecretKey.h @@ -27,6 +27,7 @@ #include #include #include +#include #include namespace ripple { @@ -100,8 +101,7 @@ operator== (SecretKey const& lhs, SecretKey const& rhs) { return lhs.size() == rhs.size() && - std::memcmp(lhs.data(), - rhs.data(), rhs.size()) == 0; + std::memcmp(lhs.data(), rhs.data(), rhs.size()) == 0; } inline diff --git a/src/ripple/protocol/Serializer.h b/src/ripple/protocol/Serializer.h index bf468576f..9944f95d5 100644 --- a/src/ripple/protocol/Serializer.h +++ b/src/ripple/protocol/Serializer.h @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include diff --git a/src/ripple/protocol/impl/BuildInfo.cpp b/src/ripple/protocol/impl/BuildInfo.cpp index 896e78fd1..0507db183 100644 --- a/src/ripple/protocol/impl/BuildInfo.cpp +++ b/src/ripple/protocol/impl/BuildInfo.cpp @@ -18,10 +18,11 @@ //============================================================================== #include -#include #include #include +#include + namespace ripple { namespace BuildInfo { @@ -42,7 +43,7 @@ char const* const versionString = "1.5.0-b1" #endif #ifdef SANITIZER - BEAST_PP_STR1_(SANITIZER) + BOOST_PP_STRINGIZE(SANITIZER) #endif #endif diff --git a/src/ripple/protocol/impl/ErrorCodes.cpp b/src/ripple/protocol/impl/ErrorCodes.cpp index c58ef9962..f07bc3c17 100644 --- a/src/ripple/protocol/impl/ErrorCodes.cpp +++ b/src/ripple/protocol/impl/ErrorCodes.cpp @@ -19,6 +19,7 @@ #include #include +#include namespace ripple { namespace RPC { diff --git a/src/ripple/protocol/impl/STAccount.cpp b/src/ripple/protocol/impl/STAccount.cpp index d34895a47..2d9f81f52 100644 --- a/src/ripple/protocol/impl/STAccount.cpp +++ b/src/ripple/protocol/impl/STAccount.cpp @@ -19,6 +19,8 @@ #include +#include + namespace ripple { STAccount::STAccount () diff --git a/src/ripple/rpc/handlers/AccountTx.cpp b/src/ripple/rpc/handlers/AccountTx.cpp index 41959d540..2496cd268 100644 --- a/src/ripple/rpc/handlers/AccountTx.cpp +++ b/src/ripple/rpc/handlers/AccountTx.cpp @@ -120,7 +120,7 @@ Json::Value doAccountTx (RPC::Context& context) if (params.isMember(jss::marker)) resumeToken = params[jss::marker]; -#ifndef BEAST_DEBUG +#ifndef DEBUG try { @@ -189,7 +189,7 @@ Json::Value doAccountTx (RPC::Context& context) ret[jss::marker] = resumeToken; return ret; -#ifndef BEAST_DEBUG +#ifndef DEBUG } catch (std::exception const&) { diff --git a/src/ripple/rpc/handlers/AccountTxOld.cpp b/src/ripple/rpc/handlers/AccountTxOld.cpp index bfa51820f..704e2ec26 100644 --- a/src/ripple/rpc/handlers/AccountTxOld.cpp +++ b/src/ripple/rpc/handlers/AccountTxOld.cpp @@ -132,7 +132,7 @@ Json::Value doAccountTxOld (RPC::Context& context) int count = 0; -#ifndef BEAST_DEBUG +#ifndef DEBUG try { @@ -217,7 +217,7 @@ Json::Value doAccountTxOld (RPC::Context& context) return ret; -#ifndef BEAST_DEBUG +#ifndef DEBUG } catch (std::exception const&) { diff --git a/src/ripple/unity/net.cpp b/src/ripple/unity/net.cpp index 1527f6708..ec15de382 100644 --- a/src/ripple/unity/net.cpp +++ b/src/ripple/unity/net.cpp @@ -17,9 +17,6 @@ */ //============================================================================== -#undef DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER -#define DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER /**/ - #include #include #include diff --git a/src/test/beast/beast_CurrentThreadName_test.cpp b/src/test/beast/beast_CurrentThreadName_test.cpp index c3a29014f..68e7b4360 100644 --- a/src/test/beast/beast_CurrentThreadName_test.cpp +++ b/src/test/beast/beast_CurrentThreadName_test.cpp @@ -41,7 +41,7 @@ private: *state = 1; // If there is an initial thread name then we failed. - if (initialThreadName) + if (!initialThreadName.empty()) return; // Wait until all threads have their names. diff --git a/src/test/beast/beast_Debug_test.cpp b/src/test/beast/beast_Debug_test.cpp deleted file mode 100644 index b5d168c74..000000000 --- a/src/test/beast/beast_Debug_test.cpp +++ /dev/null @@ -1,58 +0,0 @@ -//------------------------------------------------------------------------------ -/* -This file is part of rippled: https://github.com/ripple/rippled -Copyright (c) 2012, 2013 Ripple Labs Inc. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== -#include - -namespace beast { - -// A simple unit test to determine the diagnostic settings in a build. -// -class Debug_test : public unit_test::suite -{ -public: - static int envDebug() - { -#ifdef _DEBUG - return 1; -#else - return 0; -#endif - } - - static int beastDebug() - { -#ifdef BEAST_DEBUG - return BEAST_DEBUG; -#else - return 0; -#endif - } - - void run() override - { - log << - "_DEBUG = " << envDebug() << '\n' << - "BEAST_DEBUG = " << beastDebug() << '\n' << - "sizeof(std::size_t) = " << sizeof(std::size_t) << std::endl; - pass(); - } -}; - -BEAST_DEFINE_TESTSUITE(Debug, utility, beast); - -} diff --git a/src/test/net/SSLHTTPDownloader_test.cpp b/src/test/net/SSLHTTPDownloader_test.cpp index 77a574308..f8421e7d2 100644 --- a/src/test/net/SSLHTTPDownloader_test.cpp +++ b/src/test/net/SSLHTTPDownloader_test.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include diff --git a/src/test/unity/beast_test_unity1.cpp b/src/test/unity/beast_test_unity1.cpp index 064576528..390d16508 100644 --- a/src/test/unity/beast_test_unity1.cpp +++ b/src/test/unity/beast_test_unity1.cpp @@ -24,6 +24,5 @@ #include #include #include -#include #include #include