From fa91ae464491eed18af726d9fcaee2fb3afe81f3 Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 30 Jun 2026 21:11:20 +0200 Subject: [PATCH] common: remove dead code Each symbol below has no references anywhere in the tree (src/, contrib/, tests/), and none on the in-flight FCMP++ (fcmp++-stage-new) or CARROT (carrot_impl) integration branches; the full build still links cleanly. Per-symbol history is given so the "why is this unused" is auditable (hashes are ancestors of HEAD). command_line: - parse_command_line template: boost wrapper used by the connectivity tool and wallet from the 2014 import; the last caller was removed in b8a08f199 (2017, "wallet: fix --log-file not working"). Not boost's own boost::program_options::parse_command_line, a different function still in use. download: - download_finished / download_error: dead on arrival - added 63f0e074e (2017, "download: async API") but never wired to any caller. perf_timer: - set_performance_timer_log_level: dead on arrival - added 74dfdb0b3 (2016), never called. It was the only writer of performance_timer_log_level, which is therefore never reassigned and stays at its default (el::Level::Info). Note: the unused PERF_TIMER_L / PERF_TIMER_UNIT_L macros are deliberately left in place - the FCMP++ wallet-scanning work (fcmp++-stage-new, wallet2.cpp) uses PERF_TIMER_L, so removing them would break that branch on rebase. --- src/common/command_line.h | 13 ------------- src/common/download.cpp | 14 -------------- src/common/download.h | 2 -- src/common/perf_timer.cpp | 11 ----------- src/common/perf_timer.h | 2 -- 5 files changed, 42 deletions(-) diff --git a/src/common/command_line.h b/src/common/command_line.h index 681eb903b..9c304fbda 100644 --- a/src/common/command_line.h +++ b/src/common/command_line.h @@ -219,19 +219,6 @@ namespace command_line description.add_options()(arg.name, boost::program_options::bool_switch(), arg.description); } - template - boost::program_options::basic_parsed_options parse_command_line(int argc, const charT* const argv[], - const boost::program_options::options_description& desc, bool allow_unregistered = false) - { - auto parser = boost::program_options::command_line_parser(argc, argv); - parser.options(desc); - if (allow_unregistered) - { - parser.allow_unregistered(); - } - return parser.run(); - } - template bool handle_error_helper(const boost::program_options::options_description& desc, F parser) { diff --git a/src/common/download.cpp b/src/common/download.cpp index 859c80219..fd8e11478 100644 --- a/src/common/download.cpp +++ b/src/common/download.cpp @@ -274,20 +274,6 @@ namespace tools return control; } - bool download_finished(const download_async_handle &control) - { - CHECK_AND_ASSERT_MES(control != 0, false, "NULL async download handle"); - boost::lock_guard lock(control->mutex); - return control->stopped; - } - - bool download_error(const download_async_handle &control) - { - CHECK_AND_ASSERT_MES(control != 0, false, "NULL async download handle"); - boost::lock_guard lock(control->mutex); - return !control->success; - } - bool download_wait(const download_async_handle &control) { CHECK_AND_ASSERT_MES(control != 0, false, "NULL async download handle"); diff --git a/src/common/download.h b/src/common/download.h index 8efd29a33..97d0a3f56 100644 --- a/src/common/download.h +++ b/src/common/download.h @@ -46,8 +46,6 @@ namespace tools bool download(const std::string &path, const std::string &url, std::function progress = NULL); download_async_handle download_async(const std::string &path, const std::string &url, std::function result, std::function progress = NULL); - bool download_error(const download_async_handle &h); - bool download_finished(const download_async_handle &h); bool download_wait(const download_async_handle &h); bool download_cancel(const download_async_handle &h); } diff --git a/src/common/perf_timer.cpp b/src/common/perf_timer.cpp index fae0d7478..30d0b557d 100644 --- a/src/common/perf_timer.cpp +++ b/src/common/perf_timer.cpp @@ -97,17 +97,6 @@ el::Level performance_timer_log_level = el::Level::Info; static thread_local std::vector *performance_timers = NULL; #endif -void set_performance_timer_log_level(el::Level level) -{ - if (level != el::Level::Debug && level != el::Level::Trace && level != el::Level::Info - && level != el::Level::Warning && level != el::Level::Error && level != el::Level::Fatal) - { - MERROR("Wrong log level: " << el::LevelHelper::convertToString(level) << ", using Info"); - level = el::Level::Info; - } - performance_timer_log_level = level; -} - PerformanceTimer::PerformanceTimer(bool paused): started(true), paused(paused) { if (paused) diff --git a/src/common/perf_timer.h b/src/common/perf_timer.h index 3e53adcb8..8e9e10055 100644 --- a/src/common/perf_timer.h +++ b/src/common/perf_timer.h @@ -75,8 +75,6 @@ private: el::Level level; }; -void set_performance_timer_log_level(el::Level level); - #define PERF_TIMER_NAME(name) pt_##name #define PERF_TIMER_UNIT(name, unit) tools::LoggingPerformanceTimer PERF_TIMER_NAME(name)(#name, "perf." MONERO_DEFAULT_LOG_CATEGORY, unit, tools::performance_timer_log_level) #define PERF_TIMER_UNIT_L(name, unit, l) tools::LoggingPerformanceTimer PERF_TIMER_NAME(name)t_##name(#name, "perf." MONERO_DEFAULT_LOG_CATEGORY, unit, l)