Fix testing build errors in Errata.
diff --git a/code/include/swoc/DiscreteRange.h b/code/include/swoc/DiscreteRange.h
index 6e2494d..2835154 100644
--- a/code/include/swoc/DiscreteRange.h
+++ b/code/include/swoc/DiscreteRange.h
@@ -1267,7 +1267,7 @@
, F&& blender) -> self_type& {
// Do a base check for the color to use on unmapped values. If self blending on @a color
// is @c false, then do not color currently unmapped values.
- PAYLOAD plain_color; // color to paint uncolored metrics.
+ [[maybe_unused]] PAYLOAD plain_color{}; // color to paint uncolored metrics.
bool plain_color_p = blender(plain_color, color); // start with default and blend in @a color.
auto node_cleaner = [&](Node *ptr) -> void { _fa.destroy(ptr); };
diff --git a/code/include/swoc/Errata.h b/code/include/swoc/Errata.h
index 95fe32e..334c254 100644
--- a/code/include/swoc/Errata.h
+++ b/code/include/swoc/Errata.h
@@ -955,3 +955,7 @@
}
}} // namespace swoc
+
+namespace std {
+ using swoc::get; // Import specialized overloads to standard namespace.
+}
diff --git a/unit_tests/ex_Lexicon.cc b/unit_tests/ex_Lexicon.cc
index 34281a7..25c319f 100644
--- a/unit_tests/ex_Lexicon.cc
+++ b/unit_tests/ex_Lexicon.cc
@@ -88,6 +88,7 @@
// doc.lookup.begin
auto && [ range, flags ] = *space.find(addr);
// doc.lookup.end
+ static_cast<void>(range);
REQUIRE(flags == bits);
}
// doc.lookup.end
diff --git a/unit_tests/test_Errata.cc b/unit_tests/test_Errata.cc
index 088f93a..28bd22b 100644
--- a/unit_tests/test_Errata.cc
+++ b/unit_tests/test_Errata.cc
@@ -102,6 +102,7 @@
REQUIRE(result == 17); // Local copy binding, no update.
auto &[r_result, r_erratum] = zret;
+ REQUIRE(r_erratum.is_ok() == false);
REQUIRE(r_result == 38);
zret = 56;
@@ -109,10 +110,11 @@
auto const &[cr_result, cr_erratum] = zret;
REQUIRE(cr_result == 56);
+ REQUIRE(cr_erratum.is_ok() == false);
auto test = [](Rv<int> const &rvc) {
- auto const &[cv_result, cv_erratum] = rvc;
- REQUIRE(cv_result == 56);
+ auto n = std::get<0>(rvc);
+ REQUIRE(n == 56);
};
test(zret); // invoke it.
@@ -142,4 +144,5 @@
auto &&[tr2, te2]{maker()};
REQUIRE(tr2->s == "made"sv);
+ REQUIRE(te2.is_ok() == true);
};
diff --git a/unit_tests/test_Lexicon.cc b/unit_tests/test_Lexicon.cc
index a72bd72..95aaeed 100644
--- a/unit_tests/test_Lexicon.cc
+++ b/unit_tests/test_Lexicon.cc
@@ -72,7 +72,9 @@
{Radio::DELTA, {"Delta"}}});
// test structured binding for iteration.
- for ([[maybe_unused]] auto const &[key, name] : lex) {
+ for (auto const &[key, name] : lex) {
+ static_cast<void>(key);
+ static_cast<void>(name);
}
};
diff --git a/unit_tests/test_ip.cc b/unit_tests/test_ip.cc
index ba81bc6..2195a61 100644
--- a/unit_tests/test_ip.cc
+++ b/unit_tests/test_ip.cc
@@ -756,6 +756,7 @@
// Verify that earlier ranges are still valid after the double blend.
for (auto &&[text, value] : r2) {
IPRange range{text};
+ static_cast<void>(value);
REQUIRE(space.end() != space.find(range.min()));
REQUIRE(space.end() != space.find(range.max()));
}
@@ -765,6 +766,7 @@
// Verify all the data is in the ranges.
for (auto &&[text, value] : r2) {
IPRange range{text};
+ static_cast<void>(value);
REQUIRE(space.end() != space.find(range.min()));
REQUIRE(space.end() != space.find(range.max()));
}
@@ -777,6 +779,7 @@
}
{
auto && [ r, p ] = *space.find(IPAddr{"2001:4997:58:400::1E"});
+ static_cast<void>(p);
REQUIRE(true == r.empty());
}
}
@@ -808,8 +811,10 @@
// Check that if an IPv4 lookup misses, it doesn't pass on to the first IPv6
auto && [ r1, p1 ] = *(space.find(IP4Addr{"172.28.56.100"}));
+ static_cast<void>(p1);
REQUIRE(true == r1.empty());
auto && [ r2, p2 ] = *(space.find(IPAddr{"172.28.56.100"}));
+ static_cast<void>(p2);
REQUIRE(true == r2.empty());
}
@@ -864,6 +869,7 @@
idx = 0;
for (auto const&[range, bits] : space) {
+ static_cast<void>(range);
REQUIRE(idx < results.size());
CHECK(bits == make_bits(results[idx]));
++idx;
@@ -872,6 +878,7 @@
idx = results.size();
for (auto spot = space.end(); spot != space.begin();) {
auto const&[range, bits]{*--spot};
+ static_cast<void>(range);
REQUIRE(idx > 0);
--idx;
CHECK(bits == make_bits(results[idx]));
@@ -885,6 +892,7 @@
for (auto spot = space.begin(); spot != space.end() ; ++spot) {
iter = spot;
std::tie(range, bits) = *iter;
+ static_cast<void>(range);
REQUIRE(idx < results.size());
CHECK(bits == make_bits(results[idx]));
++idx;
@@ -1500,10 +1508,14 @@
auto spot = space.begin();
auto [ r1, p1 ] = *++spot;
auto [ r2, p2 ] = *++spot;
+ static_cast<void>(p1);
+ static_cast<void>(p2);
REQUIRE(r1.max() < r2.min()); // This is supposed to be an invariant! Make sure.
auto back = space.end();
auto [ br1, bp1 ] = *--back;
auto [ br2, bp2 ] = *--back;
+ static_cast<void>(bp1);
+ static_cast<void>(bp2);
REQUIRE(br2.max() < br1.min()); // This is supposed to be an invariant! Make sure.
}
}