Build options cleanup (#5581)

As we no longer support old compiler versions, we are bringing back some warnings by removing no longer relevant `-Wno-...` options.
This commit is contained in:
Bronek Kozicki
2025-07-25 20:48:22 +01:00
committed by GitHub
parent 921aef9934
commit 7179ce9c58
11 changed files with 15 additions and 78 deletions

View File

@@ -90,28 +90,15 @@ if (MSVC)
-errorreport:none -errorreport:none
-machine:X64) -machine:X64)
else () else ()
# HACK : because these need to come first, before any warning demotion
string (APPEND CMAKE_CXX_FLAGS " -Wall -Wdeprecated")
if (wextra)
string (APPEND CMAKE_CXX_FLAGS " -Wextra -Wno-unused-parameter")
endif ()
# not MSVC
target_compile_options (common target_compile_options (common
INTERFACE INTERFACE
-Wall
-Wdeprecated
$<$<BOOL:${wextra}>:-Wextra -Wno-unused-parameter>
$<$<BOOL:${werr}>:-Werror> $<$<BOOL:${werr}>:-Werror>
$<$<COMPILE_LANGUAGE:CXX>:
-frtti
-Wnon-virtual-dtor
>
-Wno-sign-compare
-Wno-char-subscripts
-Wno-format
-Wno-unused-local-typedefs
-fstack-protector -fstack-protector
$<$<BOOL:${is_gcc}>: -Wno-sign-compare
-Wno-unused-but-set-variable -Wno-unused-but-set-variable
-Wno-deprecated
>
$<$<NOT:$<CONFIG:Debug>>:-fno-strict-aliasing> $<$<NOT:$<CONFIG:Debug>>:-fno-strict-aliasing>
# tweak gcc optimization for debug # tweak gcc optimization for debug
$<$<AND:$<BOOL:${is_gcc}>,$<CONFIG:Debug>>:-O0> $<$<AND:$<BOOL:${is_gcc}>,$<CONFIG:Debug>>:-O0>

View File

@@ -17,6 +17,9 @@ add_library(ed25519 STATIC
) )
add_library(ed25519::ed25519 ALIAS ed25519) add_library(ed25519::ed25519 ALIAS ed25519)
target_link_libraries(ed25519 PUBLIC OpenSSL::SSL) target_link_libraries(ed25519 PUBLIC OpenSSL::SSL)
if(NOT MSVC)
target_compile_options(ed25519 PRIVATE -Wno-implicit-fallthrough)
endif()
include(GNUInstallDirs) include(GNUInstallDirs)

View File

@@ -3257,7 +3257,6 @@ operator==(aged_unordered_container<
{ {
if (size() != other.size()) if (size() != other.size())
return false; return false;
using EqRng = std::pair<const_iterator, const_iterator>;
for (auto iter(cbegin()), last(cend()); iter != last;) for (auto iter(cbegin()), last(cend()); iter != last;)
{ {
auto const& k(extract(*iter)); auto const& k(extract(*iter));

View File

@@ -107,8 +107,9 @@ sliceToHex(Slice const& slice)
} }
for (int i = 0; i < slice.size(); ++i) for (int i = 0; i < slice.size(); ++i)
{ {
s += "0123456789ABCDEF"[((slice[i] & 0xf0) >> 4)]; constexpr char hex[] = "0123456789ABCDEF";
s += "0123456789ABCDEF"[((slice[i] & 0x0f) >> 0)]; s += hex[((slice[i] & 0xf0) >> 4)];
s += hex[((slice[i] & 0x0f) >> 0)];
} }
return s; return s;
} }

View File

@@ -671,12 +671,12 @@ isMemoOkay(STObject const& st, std::string& reason)
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"); "abcdefghijklmnopqrstuvwxyz");
for (char c : symbols) for (unsigned char c : symbols)
a[c] = 1; a[c] = 1;
return a; return a;
}(); }();
for (auto c : *optData) for (unsigned char c : *optData)
{ {
if (!allowedSymbols[c]) if (!allowedSymbols[c])
{ {

View File

@@ -544,7 +544,7 @@ b58_to_b256_be(std::string_view input, std::span<std::uint8_t> out)
XRPL_ASSERT( XRPL_ASSERT(
num_b_58_10_coeffs <= b_58_10_coeff.size(), num_b_58_10_coeffs <= b_58_10_coeff.size(),
"ripple::b58_fast::detail::b58_to_b256_be : maximum coeff"); "ripple::b58_fast::detail::b58_to_b256_be : maximum coeff");
for (auto c : input.substr(0, partial_coeff_len)) for (unsigned char c : input.substr(0, partial_coeff_len))
{ {
auto cur_val = ::ripple::alphabetReverse[c]; auto cur_val = ::ripple::alphabetReverse[c];
if (cur_val < 0) if (cur_val < 0)
@@ -558,7 +558,7 @@ b58_to_b256_be(std::string_view input, std::span<std::uint8_t> out)
{ {
for (int j = 0; j < num_full_coeffs; ++j) for (int j = 0; j < num_full_coeffs; ++j)
{ {
auto c = input[partial_coeff_len + j * 10 + i]; unsigned char c = input[partial_coeff_len + j * 10 + i];
auto cur_val = ::ripple::alphabetReverse[c]; auto cur_val = ::ripple::alphabetReverse[c];
if (cur_val < 0) if (cur_val < 0)
{ {

View File

@@ -229,7 +229,6 @@ class RCLValidations_test : public beast::unit_test::suite
// support for a ledger hash which is already in the trie. // support for a ledger hash which is already in the trie.
using Seq = RCLValidatedLedger::Seq; using Seq = RCLValidatedLedger::Seq;
using ID = RCLValidatedLedger::ID;
// Max known ancestors for each ledger // Max known ancestors for each ledger
Seq const maxAncestors = 256; Seq const maxAncestors = 256;

View File

@@ -703,10 +703,6 @@ aged_associative_container_test_base::checkContentsRefRef(
Values const& v) Values const& v)
{ {
using Cont = typename std::remove_reference<C>::type; using Cont = typename std::remove_reference<C>::type;
using Traits = TestTraits<
Cont::is_unordered::value,
Cont::is_multi::value,
Cont::is_map::value>;
using size_type = typename Cont::size_type; using size_type = typename Cont::size_type;
BEAST_EXPECT(c.size() == v.size()); BEAST_EXPECT(c.size() == v.size());
@@ -761,10 +757,6 @@ typename std::enable_if<!IsUnordered>::type
aged_associative_container_test_base::testConstructEmpty() aged_associative_container_test_base::testConstructEmpty()
{ {
using Traits = TestTraits<IsUnordered, IsMulti, IsMap>; using Traits = TestTraits<IsUnordered, IsMulti, IsMap>;
using Value = typename Traits::Value;
using Key = typename Traits::Key;
using T = typename Traits::T;
using Clock = typename Traits::Clock;
using Comp = typename Traits::Comp; using Comp = typename Traits::Comp;
using Alloc = typename Traits::Alloc; using Alloc = typename Traits::Alloc;
using MyComp = typename Traits::MyComp; using MyComp = typename Traits::MyComp;
@@ -802,10 +794,6 @@ typename std::enable_if<IsUnordered>::type
aged_associative_container_test_base::testConstructEmpty() aged_associative_container_test_base::testConstructEmpty()
{ {
using Traits = TestTraits<IsUnordered, IsMulti, IsMap>; using Traits = TestTraits<IsUnordered, IsMulti, IsMap>;
using Value = typename Traits::Value;
using Key = typename Traits::Key;
using T = typename Traits::T;
using Clock = typename Traits::Clock;
using Hash = typename Traits::Hash; using Hash = typename Traits::Hash;
using Equal = typename Traits::Equal; using Equal = typename Traits::Equal;
using Alloc = typename Traits::Alloc; using Alloc = typename Traits::Alloc;
@@ -870,10 +858,6 @@ typename std::enable_if<!IsUnordered>::type
aged_associative_container_test_base::testConstructRange() aged_associative_container_test_base::testConstructRange()
{ {
using Traits = TestTraits<IsUnordered, IsMulti, IsMap>; using Traits = TestTraits<IsUnordered, IsMulti, IsMap>;
using Value = typename Traits::Value;
using Key = typename Traits::Key;
using T = typename Traits::T;
using Clock = typename Traits::Clock;
using Comp = typename Traits::Comp; using Comp = typename Traits::Comp;
using Alloc = typename Traits::Alloc; using Alloc = typename Traits::Alloc;
using MyComp = typename Traits::MyComp; using MyComp = typename Traits::MyComp;
@@ -925,10 +909,6 @@ typename std::enable_if<IsUnordered>::type
aged_associative_container_test_base::testConstructRange() aged_associative_container_test_base::testConstructRange()
{ {
using Traits = TestTraits<IsUnordered, IsMulti, IsMap>; using Traits = TestTraits<IsUnordered, IsMulti, IsMap>;
using Value = typename Traits::Value;
using Key = typename Traits::Key;
using T = typename Traits::T;
using Clock = typename Traits::Clock;
using Hash = typename Traits::Hash; using Hash = typename Traits::Hash;
using Equal = typename Traits::Equal; using Equal = typename Traits::Equal;
using Alloc = typename Traits::Alloc; using Alloc = typename Traits::Alloc;
@@ -996,14 +976,6 @@ typename std::enable_if<!IsUnordered>::type
aged_associative_container_test_base::testConstructInitList() aged_associative_container_test_base::testConstructInitList()
{ {
using Traits = TestTraits<IsUnordered, IsMulti, IsMap>; using Traits = TestTraits<IsUnordered, IsMulti, IsMap>;
using Value = typename Traits::Value;
using Key = typename Traits::Key;
using T = typename Traits::T;
using Clock = typename Traits::Clock;
using Comp = typename Traits::Comp;
using Alloc = typename Traits::Alloc;
using MyComp = typename Traits::MyComp;
using MyAlloc = typename Traits::MyAlloc;
typename Traits::ManualClock clock; typename Traits::ManualClock clock;
// testcase (Traits::name() + " init-list"); // testcase (Traits::name() + " init-list");
@@ -1020,16 +992,6 @@ typename std::enable_if<IsUnordered>::type
aged_associative_container_test_base::testConstructInitList() aged_associative_container_test_base::testConstructInitList()
{ {
using Traits = TestTraits<IsUnordered, IsMulti, IsMap>; using Traits = TestTraits<IsUnordered, IsMulti, IsMap>;
using Value = typename Traits::Value;
using Key = typename Traits::Key;
using T = typename Traits::T;
using Clock = typename Traits::Clock;
using Hash = typename Traits::Hash;
using Equal = typename Traits::Equal;
using Alloc = typename Traits::Alloc;
using MyHash = typename Traits::MyHash;
using MyEqual = typename Traits::MyEqual;
using MyAlloc = typename Traits::MyAlloc;
typename Traits::ManualClock clock; typename Traits::ManualClock clock;
// testcase (Traits::name() + " init-list"); // testcase (Traits::name() + " init-list");
@@ -1050,7 +1012,6 @@ void
aged_associative_container_test_base::testCopyMove() aged_associative_container_test_base::testCopyMove()
{ {
using Traits = TestTraits<IsUnordered, IsMulti, IsMap>; using Traits = TestTraits<IsUnordered, IsMulti, IsMap>;
using Value = typename Traits::Value;
using Alloc = typename Traits::Alloc; using Alloc = typename Traits::Alloc;
typename Traits::ManualClock clock; typename Traits::ManualClock clock;
auto const v(Traits::values()); auto const v(Traits::values());
@@ -1121,8 +1082,6 @@ void
aged_associative_container_test_base::testIterator() aged_associative_container_test_base::testIterator()
{ {
using Traits = TestTraits<IsUnordered, IsMulti, IsMap>; using Traits = TestTraits<IsUnordered, IsMulti, IsMap>;
using Value = typename Traits::Value;
using Alloc = typename Traits::Alloc;
typename Traits::ManualClock clock; typename Traits::ManualClock clock;
auto const v(Traits::values()); auto const v(Traits::values());
@@ -1179,8 +1138,6 @@ typename std::enable_if<!IsUnordered>::type
aged_associative_container_test_base::testReverseIterator() aged_associative_container_test_base::testReverseIterator()
{ {
using Traits = TestTraits<IsUnordered, IsMulti, IsMap>; using Traits = TestTraits<IsUnordered, IsMulti, IsMap>;
using Value = typename Traits::Value;
using Alloc = typename Traits::Alloc;
typename Traits::ManualClock clock; typename Traits::ManualClock clock;
auto const v(Traits::values()); auto const v(Traits::values());
@@ -1190,7 +1147,6 @@ aged_associative_container_test_base::testReverseIterator()
typename Traits::template Cont<> c{clock}; typename Traits::template Cont<> c{clock};
using iterator = decltype(c.begin()); using iterator = decltype(c.begin());
using const_iterator = decltype(c.cbegin());
using reverse_iterator = decltype(c.rbegin()); using reverse_iterator = decltype(c.rbegin());
using const_reverse_iterator = decltype(c.crbegin()); using const_reverse_iterator = decltype(c.crbegin());
@@ -1394,7 +1350,6 @@ void
aged_associative_container_test_base::testChronological() aged_associative_container_test_base::testChronological()
{ {
using Traits = TestTraits<IsUnordered, IsMulti, IsMap>; using Traits = TestTraits<IsUnordered, IsMulti, IsMap>;
using Value = typename Traits::Value;
typename Traits::ManualClock clock; typename Traits::ManualClock clock;
auto const v(Traits::values()); auto const v(Traits::values());
@@ -1760,7 +1715,6 @@ typename std::enable_if<!IsUnordered>::type
aged_associative_container_test_base::testCompare() aged_associative_container_test_base::testCompare()
{ {
using Traits = TestTraits<IsUnordered, IsMulti, IsMap>; using Traits = TestTraits<IsUnordered, IsMulti, IsMap>;
using Value = typename Traits::Value;
typename Traits::ManualClock clock; typename Traits::ManualClock clock;
auto const v(Traits::values()); auto const v(Traits::values());
@@ -1832,8 +1786,6 @@ template <bool IsUnordered, bool IsMulti, bool IsMap>
void void
aged_associative_container_test_base::testMaybeUnorderedMultiMap() aged_associative_container_test_base::testMaybeUnorderedMultiMap()
{ {
using Traits = TestTraits<IsUnordered, IsMulti, IsMap>;
testConstructEmpty<IsUnordered, IsMulti, IsMap>(); testConstructEmpty<IsUnordered, IsMulti, IsMap>();
testConstructRange<IsUnordered, IsMulti, IsMap>(); testConstructRange<IsUnordered, IsMulti, IsMap>();
testConstructInitList<IsUnordered, IsMulti, IsMap>(); testConstructInitList<IsUnordered, IsMulti, IsMap>();

View File

@@ -313,7 +313,6 @@ class LedgerTrie_test : public beast::unit_test::suite
testSupport() testSupport()
{ {
using namespace csf; using namespace csf;
using Seq = Ledger::Seq;
LedgerTrie<Ledger> t; LedgerTrie<Ledger> t;
LedgerHistoryHelper h; LedgerHistoryHelper h;
@@ -596,7 +595,6 @@ class LedgerTrie_test : public beast::unit_test::suite
testRootRelated() testRootRelated()
{ {
using namespace csf; using namespace csf;
using Seq = Ledger::Seq;
// Since the root is a special node that breaks the no-single child // Since the root is a special node that breaks the no-single child
// invariant, do some tests that exercise it. // invariant, do some tests that exercise it.

View File

@@ -805,7 +805,6 @@ class Validations_test : public beast::unit_test::suite
Ledger ledgerACD = h["acd"]; Ledger ledgerACD = h["acd"];
using Seq = Ledger::Seq; using Seq = Ledger::Seq;
using ID = Ledger::ID;
auto pref = [](Ledger ledger) { auto pref = [](Ledger ledger) {
return std::make_pair(ledger.seq(), ledger.id()); return std::make_pair(ledger.seq(), ledger.id());

View File

@@ -44,7 +44,6 @@ doLogLevel(RPC::JsonContext& context)
Logs::toString(Logs::fromSeverity(context.app.logs().threshold())); Logs::toString(Logs::fromSeverity(context.app.logs().threshold()));
std::vector<std::pair<std::string, std::string>> logTable( std::vector<std::pair<std::string, std::string>> logTable(
context.app.logs().partition_severities()); context.app.logs().partition_severities());
using stringPair = std::map<std::string, std::string>::value_type;
for (auto const& [k, v] : logTable) for (auto const& [k, v] : logTable)
lev[k] = v; lev[k] = v;