Misc clang 21 fixes

* Use -O3 and other flags instead of -Ofast
  - https://discourse.llvm.org/t/rfc-deprecate-ofast/78687
  - https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
* Find libunwind library based on C++ compiler type, not C compiler type
* In stack_trace.cpp, pass stream modifiers to `std::stringstream` first, then send string to log
* In stack_trace.cpp, remove dead code related to `stack_trace_log` path
* Remove `virtual` method attributues from `final` class `cryptonote::core`
* Remove unused `this` capture in cryptonote protocol handler
* Remove unused variable `bad` in net node
* Use `std::make_unsigned` instead of `boost::make_unsigned`
  - https://github.com/boostorg/type_traits/issues/171
  - https://github.com/boostorg/type_traits/issues/202
  - https://github.com/boostorg/type_traits/pull/199
* Cleanup `include`s in pair serialization
* Test convergence b/t `std::make_unsigned` and `boost::make_unsigned`

Fixes compilation and silences warnings on:
clang version 21.1.6
Linux 6.18.8-3-cachyos
This commit is contained in:
jeffro256
2026-02-09 09:42:32 -07:00
parent 74dd968cd9
commit c93c4fc829
10 changed files with 82 additions and 37 deletions
+4 -12
View File
@@ -35,6 +35,7 @@
#include <stdexcept>
#include <iomanip>
#include <sstream>
#ifdef USE_UNWIND
#define UNW_LOCAL_ONLY
#include <libunwind.h>
@@ -54,7 +55,9 @@
do { \
auto elpp = ELPP; \
if (elpp) { \
CINFO(el::base::Writer,el::base::DispatchAction::FileOnlyLog,MONERO_DEFAULT_LOG_CATEGORY) << x; \
std::stringstream ss; \
ss << x; \
CINFO(el::base::Writer,el::base::DispatchAction::FileOnlyLog,MONERO_DEFAULT_LOG_CATEGORY) << ss.str(); \
} \
else { \
std::cout << x << std::endl; \
@@ -105,19 +108,9 @@ void CXA_THROW(void *ex, CXA_THROW_INFO_T *info, void (*dest)(void*))
__real___cxa_throw(ex, info, dest);
}
namespace
{
std::string stack_trace_log;
}
namespace tools
{
void set_stack_trace_log(const std::string &log)
{
stack_trace_log = log;
}
void log_stack_trace(const char *msg)
{
#ifdef USE_UNWIND
@@ -127,7 +120,6 @@ void log_stack_trace(const char *msg)
unsigned level;
char sym[512], *dsym;
int status;
const char *log = stack_trace_log.empty() ? NULL : stack_trace_log.c_str();
#endif
if (msg)