From 605ace764525d55938f7cfd38153c37acbf09b50 Mon Sep 17 00:00:00 2001 From: Mike Ellery Date: Mon, 5 Feb 2018 15:28:25 -0800 Subject: [PATCH] Unroll some unity files in the nounity build: FIXES: RIPD-1597 Add includes, remove unused getStackBacktrace() implementation. --- Builds/VisualStudio2015/RippleD.vcxproj | 3 - .../VisualStudio2015/RippleD.vcxproj.filters | 3 - CMakeLists.txt | 13 +- src/ripple/beast/core/SystemStats.cpp | 125 ------------------ src/ripple/beast/core/SystemStats.h | 8 -- src/ripple/beast/core/core.unity.cpp | 1 - src/ripple/resource/impl/Fees.cpp | 2 +- 7 files changed, 9 insertions(+), 146 deletions(-) delete mode 100644 src/ripple/beast/core/SystemStats.cpp diff --git a/Builds/VisualStudio2015/RippleD.vcxproj b/Builds/VisualStudio2015/RippleD.vcxproj index 559b7d59f4..ca1e12db90 100644 --- a/Builds/VisualStudio2015/RippleD.vcxproj +++ b/Builds/VisualStudio2015/RippleD.vcxproj @@ -1646,9 +1646,6 @@ - - True - diff --git a/Builds/VisualStudio2015/RippleD.vcxproj.filters b/Builds/VisualStudio2015/RippleD.vcxproj.filters index 3e084c1ee4..097a5e739d 100644 --- a/Builds/VisualStudio2015/RippleD.vcxproj.filters +++ b/Builds/VisualStudio2015/RippleD.vcxproj.filters @@ -2277,9 +2277,6 @@ ripple\beast\core - - ripple\beast\core - ripple\beast\core diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f4c0ec722..c7fd641aa0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -182,6 +182,7 @@ prepend(beast_unity_srcs src/ripple/beast/unity/ beast_insight_unity.cpp beast_net_unity.cpp +beast_hash_unity.cpp beast_utility_unity.cpp) prepend(ripple_unity_srcs @@ -207,6 +208,7 @@ overlay2.cpp peerfinder.cpp json.cpp protocol.cpp +resource.cpp rpcx1.cpp rpcx2.cpp shamap.cpp @@ -270,6 +272,7 @@ set(non_unity_srcs ${core_srcs}) foreach(curdir beast/clock beast/container + beast/hash beast/insight beast/net beast/utility @@ -285,6 +288,7 @@ foreach(curdir overlay peerfinder protocol + resource rpc server shamap) @@ -293,6 +297,9 @@ foreach(curdir list(APPEND non_unity_srcs "${cursrcs}") endforeach() +list(APPEND rippled_src_nonunity src/ripple/beast/hash/impl/xxhash.c) +set_source_files_properties(src/ripple/beast/hash/impl/xxhash.c PROPERTIES LANGUAGE CXX ) + file(GLOB_RECURSE nodestore_srcs src/ripple/nodestore/*.cpp src/test/nodestore/*.cpp) @@ -346,9 +353,7 @@ if(WIN32 OR is_xcode) beast/core beast/crypto beast/cxx17 - beast/hash proto - resource validators websocket) file(GLOB_RECURSE cursrcs src/ripple/${curdir}/*.cpp) @@ -404,12 +409,10 @@ add_with_props(rippled_src_all src/ripple/unity/secp256k1.cpp ) foreach(cursrc - src/ripple/beast/unity/beast_hash_unity.cpp src/ripple/unity/beast.cpp src/ripple/unity/lz4.c src/ripple/unity/protobuf.cpp - src/ripple/unity/ripple.proto.cpp - src/ripple/unity/resource.cpp) + src/ripple/unity/ripple.proto.cpp) add_with_props(rippled_src_all ${cursrc} ${rocks_db_system_header} diff --git a/src/ripple/beast/core/SystemStats.cpp b/src/ripple/beast/core/SystemStats.cpp deleted file mode 100644 index 69bc15d328..0000000000 --- a/src/ripple/beast/core/SystemStats.cpp +++ /dev/null @@ -1,125 +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. -*/ -//============================================================================== - -#include - -#include -#include -#include - -// Some basic tests, to keep an eye on things and make sure these types work ok -// on all platforms. - -#ifndef __INTELLISENSE__ -static_assert (sizeof (std::intptr_t) == sizeof (void*), "std::intptr_t must be the same size as void*"); - -static_assert (sizeof (std::int8_t) == 1, "std::int8_t must be exactly 1 byte!"); -static_assert (sizeof (std::int16_t) == 2, "std::int16_t must be exactly 2 bytes!"); -static_assert (sizeof (std::int32_t) == 4, "std::int32_t must be exactly 4 bytes!"); -static_assert (sizeof (std::int64_t) == 8, "std::int64_t must be exactly 8 bytes!"); - -static_assert (sizeof (std::uint8_t) == 1, "std::uint8_t must be exactly 1 byte!"); -static_assert (sizeof (std::uint16_t) == 2, "std::uint16_t must be exactly 2 bytes!"); -static_assert (sizeof (std::uint32_t) == 4, "std::uint32_t must be exactly 4 bytes!"); -static_assert (sizeof (std::uint64_t) == 8, "std::uint64_t must be exactly 8 bytes!"); -#endif - -namespace beast -{ -//============================================================================== -std::vector -getStackBacktrace() -{ - std::vector result; - -#if BEAST_ANDROID || BEAST_MINGW || BEAST_BSD - assert(false); // sorry, not implemented yet! - -#elif BEAST_WINDOWS - HANDLE process = GetCurrentProcess(); - SymInitialize (process, nullptr, TRUE); - - void* stack[128]; - int frames = (int) CaptureStackBackTrace (0, - std::distance(std::begin(stack), std::end(stack)), - stack, nullptr); - - // Allow symbols that are up to 1024 characters long. - std::size_t constexpr nameLength = 1024; - - alignas(SYMBOL_INFO) unsigned char symbuf[ - sizeof(SYMBOL_INFO) + nameLength * sizeof(SYMBOL_INFO::Name)]; - - auto symbol = reinterpret_cast(symbuf); - - for (int i = 0; i < frames; ++i) - { - DWORD64 displacement = 0; - - std::memset (symbol, 0, sizeof(symbuf)); - - symbol->SizeOfStruct = sizeof(SYMBOL_INFO); - symbol->MaxNameLen = nameLength; - - if (SymFromAddr (process, (DWORD64)stack[i], &displacement, symbol)) - { - std::string frame; - - frame.append (std::to_string (i) + ": "); - - IMAGEHLP_MODULE64 moduleInfo { sizeof(moduleInfo) }; - - if (::SymGetModuleInfo64 (process, symbol->ModBase, &moduleInfo)) - { - frame.append (moduleInfo.ModuleName); - frame.append (": "); - } - - frame.append (symbol->Name); - - if (displacement) - { - frame.append ("+"); - frame.append (std::to_string (displacement)); - } - - result.push_back (frame); - } - } - -#else - void* stack[128]; - int frames = backtrace (stack, - std::distance(std::begin(stack), std::end(stack))); - - std::unique_ptr frame { - backtrace_symbols (stack, frames), std::free }; - - for (int i = 0; i < frames; ++i) - result.push_back (frame[i]); -#endif - - return result; -} - -} // beast diff --git a/src/ripple/beast/core/SystemStats.h b/src/ripple/beast/core/SystemStats.h index 3069b5605d..7d6e5a16d9 100644 --- a/src/ripple/beast/core/SystemStats.h +++ b/src/ripple/beast/core/SystemStats.h @@ -34,14 +34,6 @@ namespace beast /** Returns the host-name of the computer. */ std::string getComputerName(); -//============================================================================== -/** Returns a backtrace of the current call-stack. - The usefulness of the result will depend on the level of debug symbols - that are available in the executable. -*/ -std::vector -getStackBacktrace(); - } // beast #endif // BEAST_SYSTEMSTATS_H_INCLUDED diff --git a/src/ripple/beast/core/core.unity.cpp b/src/ripple/beast/core/core.unity.cpp index 35a95a9ce0..6002302b81 100644 --- a/src/ripple/beast/core/core.unity.cpp +++ b/src/ripple/beast/core/core.unity.cpp @@ -192,7 +192,6 @@ #include #include -#include #include #ifdef _CRTDBG_MAP_ALLOC diff --git a/src/ripple/resource/impl/Fees.cpp b/src/ripple/resource/impl/Fees.cpp index 0ca4e4b41d..7863bde7ab 100644 --- a/src/ripple/resource/impl/Fees.cpp +++ b/src/ripple/resource/impl/Fees.cpp @@ -18,7 +18,7 @@ //============================================================================== #include -#include +#include namespace ripple { namespace Resource {