Skip to content

Commit

Permalink
Improve build times (#2425)
Browse files Browse the repository at this point in the history
* Improve compile times

* Fix tests

* Use loopback address in config

* Fix config tests

* Hopefully fixes rpc.version test

* Fix -DNANO_TIMED_LOCKS build

* Formatting

* Formatting
  • Loading branch information
wezrule committed Dec 5, 2019
1 parent 270be3c commit 2704357
Show file tree
Hide file tree
Showing 209 changed files with 2,935 additions and 2,200 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ if (WIN32)
-DWINVER=0x0600
-DWIN32_LEAN_AND_MEAN
-DMINIUPNP_STATICLIB
-D_CRT_SECURE_NO_WARNINGS)
-D_CRT_SECURE_NO_WARNINGS
/EHsc)

if (${USING_TSAN} OR ${USING_ASAN} OR ${USING_ASAN_INT})
message (WARNING "Cannot use TSAN or ASAN on Windows, sanitizers ignored")
Expand Down
2 changes: 1 addition & 1 deletion ci/build-travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if [[ $(grep -rl --exclude="*asio.hpp" "asio::async_write" ./nano) ]]; then
fi

# prevent unsolicited use of std::lock_guard & std::unique_lock outside of allowed areas
if [[ $(grep -rl --exclude={"*random_pool.cpp","*random_pool.hpp","*locks.hpp","*locks.cpp"} "std::unique_lock\|std::lock_guard\|std::condition_variable" ./nano) ]]; then
if [[ $(grep -rl --exclude={"*random_pool.cpp","*random_pool.hpp","*random_pool_shuffle.hpp","*locks.hpp","*locks.cpp"} "std::unique_lock\|std::lock_guard\|std::condition_variable" ./nano) ]]; then
echo "using std::unique_lock, std::lock_guard or std::condition_variable is not permitted (except in nano/lib/locks.hpp and non-nano dependent libraries). Use the nano::* versions instead"
exit 1
fi
Expand Down
13 changes: 0 additions & 13 deletions nano/boost/asio.hpp

This file was deleted.

7 changes: 7 additions & 0 deletions nano/boost/asio/basic_stream_socket.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#include <nano/boost/private/macro_warnings.hpp>

DISABLE_ASIO_WARNINGS
#include <boost/asio/basic_stream_socket.hpp>
REENABLE_WARNINGS
7 changes: 7 additions & 0 deletions nano/boost/asio/bind_executor.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#include <nano/boost/private/macro_warnings.hpp>

DISABLE_ASIO_WARNINGS
#include <boost/asio/bind_executor.hpp>
REENABLE_WARNINGS
7 changes: 7 additions & 0 deletions nano/boost/asio/buffer.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#include <nano/boost/private/macro_warnings.hpp>

DISABLE_ASIO_WARNINGS
#include <boost/asio/buffer.hpp>
REENABLE_WARNINGS
7 changes: 7 additions & 0 deletions nano/boost/asio/connect.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#include <nano/boost/private/macro_warnings.hpp>

DISABLE_ASIO_WARNINGS
#include <boost/asio/connect.hpp>
REENABLE_WARNINGS
7 changes: 7 additions & 0 deletions nano/boost/asio/deadline_timer.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#include <nano/boost/private/macro_warnings.hpp>

DISABLE_ASIO_WARNINGS
#include <boost/asio/deadline_timer.hpp>
REENABLE_WARNINGS
7 changes: 7 additions & 0 deletions nano/boost/asio/dispatch.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#include <nano/boost/private/macro_warnings.hpp>

DISABLE_ASIO_WARNINGS
#include <boost/asio/dispatch.hpp>
REENABLE_WARNINGS
7 changes: 7 additions & 0 deletions nano/boost/asio/executor_work_guard.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#include <nano/boost/private/macro_warnings.hpp>

DISABLE_ASIO_WARNINGS
#include <boost/asio/executor_work_guard.hpp>
REENABLE_WARNINGS
7 changes: 7 additions & 0 deletions nano/boost/asio/io_context.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#include <nano/boost/private/macro_warnings.hpp>

DISABLE_ASIO_WARNINGS
#include <boost/asio/io_context.hpp>
REENABLE_WARNINGS
7 changes: 7 additions & 0 deletions nano/boost/asio/ip/address.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#include <nano/boost/private/macro_warnings.hpp>

DISABLE_ASIO_WARNINGS
#include <boost/asio/ip/address.hpp>
REENABLE_WARNINGS
7 changes: 7 additions & 0 deletions nano/boost/asio/ip/address_v6.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#include <nano/boost/private/macro_warnings.hpp>

DISABLE_ASIO_WARNINGS
#include <boost/asio/ip/address_v6.hpp>
REENABLE_WARNINGS
7 changes: 7 additions & 0 deletions nano/boost/asio/ip/tcp.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#include <nano/boost/private/macro_warnings.hpp>

DISABLE_ASIO_WARNINGS
#include <boost/asio/ip/tcp.hpp>
REENABLE_WARNINGS
7 changes: 7 additions & 0 deletions nano/boost/asio/ip/udp.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#include <nano/boost/private/macro_warnings.hpp>

DISABLE_ASIO_WARNINGS
#include <boost/asio/ip/udp.hpp>
REENABLE_WARNINGS
7 changes: 7 additions & 0 deletions nano/boost/asio/local/stream_protocol.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#include <nano/boost/private/macro_warnings.hpp>

DISABLE_ASIO_WARNINGS
#include <boost/asio/local/stream_protocol.hpp>
REENABLE_WARNINGS
7 changes: 7 additions & 0 deletions nano/boost/asio/post.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#include <nano/boost/private/macro_warnings.hpp>

DISABLE_ASIO_WARNINGS
#include <boost/asio/post.hpp>
REENABLE_WARNINGS
7 changes: 7 additions & 0 deletions nano/boost/asio/read.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#include <nano/boost/private/macro_warnings.hpp>

DISABLE_ASIO_WARNINGS
#include <boost/asio/read.hpp>
REENABLE_WARNINGS
7 changes: 7 additions & 0 deletions nano/boost/asio/strand.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#include <nano/boost/private/macro_warnings.hpp>

DISABLE_ASIO_WARNINGS
#include <boost/asio/strand.hpp>
REENABLE_WARNINGS
7 changes: 7 additions & 0 deletions nano/boost/asio/thread_pool.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#include <nano/boost/private/macro_warnings.hpp>

DISABLE_ASIO_WARNINGS
#include <boost/asio/thread_pool.hpp>
REENABLE_WARNINGS
7 changes: 7 additions & 0 deletions nano/boost/asio/write.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#include <nano/boost/private/macro_warnings.hpp>

DISABLE_ASIO_WARNINGS
#include <boost/asio/write.hpp>
REENABLE_WARNINGS
13 changes: 0 additions & 13 deletions nano/boost/beast.hpp

This file was deleted.

7 changes: 7 additions & 0 deletions nano/boost/beast/core.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#include <nano/boost/private/macro_warnings.hpp>

DISABLE_BEAST_WARNINGS
#include <boost/beast/core.hpp>
REENABLE_WARNINGS
7 changes: 7 additions & 0 deletions nano/boost/beast/core/flat_buffer.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#include <nano/boost/private/macro_warnings.hpp>

DISABLE_BEAST_WARNINGS
#include <boost/beast/core/flat_buffer.hpp>
REENABLE_WARNINGS
7 changes: 7 additions & 0 deletions nano/boost/beast/http.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#include <nano/boost/private/macro_warnings.hpp>

DISABLE_BEAST_WARNINGS
#include <boost/beast/http.hpp>
REENABLE_WARNINGS
7 changes: 7 additions & 0 deletions nano/boost/beast/http/message.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#include <nano/boost/private/macro_warnings.hpp>

DISABLE_BEAST_WARNINGS
#include <boost/beast/http/message.hpp>
REENABLE_WARNINGS
7 changes: 7 additions & 0 deletions nano/boost/beast/http/string_body.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#include <nano/boost/private/macro_warnings.hpp>

DISABLE_BEAST_WARNINGS
#include <boost/beast/http/string_body.hpp>
REENABLE_WARNINGS
7 changes: 7 additions & 0 deletions nano/boost/beast/version.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#include <nano/boost/private/macro_warnings.hpp>

DISABLE_BEAST_WARNINGS
#include <boost/beast/version.hpp>
REENABLE_WARNINGS
7 changes: 7 additions & 0 deletions nano/boost/beast/websocket.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#include <nano/boost/private/macro_warnings.hpp>

DISABLE_BEAST_WARNINGS
#include <boost/beast/websocket.hpp>
REENABLE_WARNINGS
30 changes: 30 additions & 0 deletions nano/boost/private/macro_warnings.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#pragma once

#ifdef _WIN32
#define DISABLE_ASIO_WARNINGS \
__pragma (warning (push)) \
__pragma (warning (disable : 4191)) \
__pragma (warning (disable : 4242))

#else
#define DISABLE_ASIO_WARNINGS
#endif

#ifdef _WIN32
#define REENABLE_WARNINGS \
__pragma (warning (pop))
#else
#define REENABLE_WARNINGS
#endif

#define DISABLE_BEAST_WARNINGS DISABLE_ASIO_WARNINGS

#ifdef _WIN32
#define DISABLE_PROCESS_WARNINGS \
__pragma (warning (push)) \
__pragma (warning (disable : 4191)) \
__pragma (warning (disable : 4242)) \
__pragma (warning (disable : 4244))
#else
#define DISABLE_PROCESS_WARNINGS
#endif
22 changes: 0 additions & 22 deletions nano/boost/process.hpp

This file was deleted.

7 changes: 7 additions & 0 deletions nano/boost/process/child.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#include <nano/boost/private/macro_warnings.hpp>

DISABLE_BEAST_WARNINGS
#include <boost/process/child.hpp>
REENABLE_WARNINGS
2 changes: 1 addition & 1 deletion nano/core_test/active_transactions.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <nano/core_test/testutil.hpp>
#include <nano/lib/jsonconfig.hpp>
#include <nano/node/election.hpp>
#include <nano/node/testing.hpp>

#include <gtest/gtest.h>
Expand Down Expand Up @@ -544,7 +545,6 @@ TEST (active_transactions, update_difficulty)
ASSERT_FALSE (ec);

auto modify_election = [&node1](auto block) {
auto root_l (block->root ());
auto hash (block->hash ());
nano::lock_guard<std::mutex> active_guard (node1.active.mutex);
auto existing (node1.active.roots.find (block->qualified_root ()));
Expand Down
4 changes: 1 addition & 3 deletions nano/core_test/block.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
#include <nano/core_test/testutil.hpp>
#include <nano/node/common.hpp>
#include <nano/node/node.hpp>
#include <nano/secure/buffer.hpp>

#include <gtest/gtest.h>

#include <boost/property_tree/json_parser.hpp>

#include <fstream>

#include <crypto/ed25519-donna/ed25519.h>

TEST (ed25519, signing)
Expand Down
13 changes: 11 additions & 2 deletions nano/core_test/block_store.cpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
#include <nano/core_test/testutil.hpp>
#include <nano/crypto_lib/random_pool.hpp>
#include <nano/lib/stats.hpp>
#include <nano/lib/utility.hpp>
#include <nano/lib/work.hpp>
#include <nano/node/common.hpp>
#include <nano/node/node.hpp>
#include <nano/secure/ledger.hpp>
#include <nano/secure/utility.hpp>
#include <nano/secure/versioning.hpp>

#include <boost/filesystem.hpp>

#if NANO_ROCKSDB
#include <nano/node/rocksdb/rocksdb.hpp>
#endif

#include <nano/lib/logger_mt.hpp>
#include <nano/node/lmdb/lmdb.hpp>

#include <gtest/gtest.h>

#include <fstream>
#include <unordered_set>

#include <stdlib.h>

Expand Down Expand Up @@ -1503,7 +1512,7 @@ TEST (block_store, peers)

TEST (block_store, endpoint_key_byte_order)
{
boost::asio::ip::address_v6 address (boost::asio::ip::address_v6::from_string ("::ffff:127.0.0.1"));
boost::asio::ip::address_v6 address (boost::asio::ip::make_address_v6 ("::ffff:127.0.0.1"));
uint16_t port = 100;
nano::endpoint_key endpoint_key (address.to_bytes (), port);

Expand Down
1 change: 1 addition & 0 deletions nano/core_test/bootstrap.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <nano/core_test/testutil.hpp>
#include <nano/node/bootstrap/bootstrap_frontier.hpp>
#include <nano/node/testing.hpp>

#include <gtest/gtest.h>
Expand Down
Loading

0 comments on commit 2704357

Please sign in to comment.