From e7333b420e35054d9302f9c58fd47b6152cbd35f Mon Sep 17 00:00:00 2001 From: Ben Woosley Date: Mon, 6 Mar 2023 17:22:33 +0100 Subject: [PATCH 1/2] refactor: Extract util/exception from util/system This is a minimal extraction of a single function, but also the only use of std::exception in util/system. The background of this commit is an ongoing effort to decouple the libbitcoinkernel library from the ArgsManager defined in system.h. Moving the function out of system.h allows including it from a separate source file without including the ArgsManager definitions from system.h. --- ci/test/06_script_b.sh | 1 + src/Makefile.am | 3 +++ src/bitcoin-cli.cpp | 1 + src/bitcoin-tx.cpp | 3 ++- src/bitcoin-util.cpp | 1 + src/bitcoin-wallet.cpp | 1 + src/bitcoind.cpp | 1 + src/qt/bitcoin.cpp | 1 + src/qt/guiutil.cpp | 1 + src/qt/initexecutor.cpp | 2 +- src/util/exception.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ src/util/exception.h | 14 ++++++++++++++ src/util/system.cpp | 23 ----------------------- src/util/system.h | 4 ---- src/util/thread.cpp | 2 +- 15 files changed, 69 insertions(+), 30 deletions(-) create mode 100644 src/util/exception.cpp create mode 100644 src/util/exception.h diff --git a/ci/test/06_script_b.sh b/ci/test/06_script_b.sh index 7d47f6651c..7a01672d18 100755 --- a/ci/test/06_script_b.sh +++ b/ci/test/06_script_b.sh @@ -69,6 +69,7 @@ if [ "${RUN_TIDY}" = "true" ]; then " src/util/bytevectorhash.cpp"\ " src/util/check.cpp"\ " src/util/error.cpp"\ + " src/util/exception.cpp"\ " src/util/getuniquepath.cpp"\ " src/util/hasher.cpp"\ " src/util/message.cpp"\ diff --git a/src/Makefile.am b/src/Makefile.am index 7dc5594cf2..a0c1670287 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -279,6 +279,7 @@ BITCOIN_CORE_H = \ util/check.h \ util/epochguard.h \ util/error.h \ + util/exception.h \ util/fastrange.h \ util/fees.h \ util/getuniquepath.h \ @@ -699,6 +700,7 @@ libbitcoin_util_a_SOURCES = \ util/bytevectorhash.cpp \ util/check.cpp \ util/error.cpp \ + util/exception.cpp \ util/fees.cpp \ util/getuniquepath.cpp \ util/hasher.cpp \ @@ -942,6 +944,7 @@ libbitcoinkernel_la_SOURCES = \ txmempool.cpp \ uint256.cpp \ util/check.cpp \ + util/exception.cpp \ util/getuniquepath.cpp \ util/hasher.cpp \ util/moneystr.cpp \ diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 77613f389c..eb52b30ae4 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp index 57ca2bbe8a..f36b6054bb 100644 --- a/src/bitcoin-tx.cpp +++ b/src/bitcoin-tx.cpp @@ -12,14 +12,15 @@ #include #include #include -#include #include +#include #include #include #include