Skip to content

Commit 06a3b47

Browse files
Fix testing build errors in Errata.
1 parent 5b3ee27 commit 06a3b47

File tree

5 files changed

+25
-4
lines changed

5 files changed

+25
-4
lines changed

code/include/swoc/DiscreteRange.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1267,7 +1267,7 @@ DiscreteSpace<METRIC, PAYLOAD>::blend(DiscreteSpace::range_type const& range, U
12671267
, F&& blender) -> self_type& {
12681268
// Do a base check for the color to use on unmapped values. If self blending on @a color
12691269
// is @c false, then do not color currently unmapped values.
1270-
PAYLOAD plain_color; // color to paint uncolored metrics.
1270+
[[maybe_unused]] PAYLOAD plain_color{}; // color to paint uncolored metrics.
12711271
bool plain_color_p = blender(plain_color, color); // start with default and blend in @a color.
12721272

12731273
auto node_cleaner = [&](Node *ptr) -> void { _fa.destroy(ptr); };

code/include/swoc/Errata.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -955,3 +955,7 @@ get(swoc::Rv<R> const& rv) {
955955
}
956956

957957
}} // namespace swoc
958+
959+
namespace std {
960+
using swoc::get; // Import specialized overloads to standard namespace.
961+
}

unit_tests/test_Errata.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,17 +102,19 @@ TEST_CASE("Rv", "[libswoc][Errata]")
102102
REQUIRE(result == 17); // Local copy binding, no update.
103103

104104
auto &[r_result, r_erratum] = zret;
105+
REQUIRE(r_erratum.is_ok() == false);
105106

106107
REQUIRE(r_result == 38);
107108
zret = 56;
108109
REQUIRE(r_result == 56); // reference binding, update.
109110

110111
auto const &[cr_result, cr_erratum] = zret;
111112
REQUIRE(cr_result == 56);
113+
REQUIRE(cr_erratum.is_ok() == false);
112114

113115
auto test = [](Rv<int> const &rvc) {
114-
auto const &[cv_result, cv_erratum] = rvc;
115-
REQUIRE(cv_result == 56);
116+
auto n = std::get<0>(rvc);
117+
REQUIRE(n == 56);
116118
};
117119

118120
test(zret); // invoke it.
@@ -142,4 +144,5 @@ TEST_CASE("Rv", "[libswoc][Errata]")
142144

143145
auto &&[tr2, te2]{maker()};
144146
REQUIRE(tr2->s == "made"sv);
147+
REQUIRE(te2.is_ok() == true);
145148
};

unit_tests/test_Lexicon.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ TEST_CASE("Lexicon", "[libts][Lexicon]")
7272
{Radio::DELTA, {"Delta"}}});
7373

7474
// test structured binding for iteration.
75-
for ([[maybe_unused]] auto const &[key, name] : lex) {
75+
for (auto const &[key, name] : lex) {
76+
static_cast<void>(key);
77+
static_cast<void>(name);
7678
}
7779
};
7880

unit_tests/test_ip.cc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,7 @@ TEST_CASE("IP Space Int", "[libswoc][ip][ipspace]") {
756756
// Verify that earlier ranges are still valid after the double blend.
757757
for (auto &&[text, value] : r2) {
758758
IPRange range{text};
759+
static_cast<void>(value);
759760
REQUIRE(space.end() != space.find(range.min()));
760761
REQUIRE(space.end() != space.find(range.max()));
761762
}
@@ -765,6 +766,7 @@ TEST_CASE("IP Space Int", "[libswoc][ip][ipspace]") {
765766
// Verify all the data is in the ranges.
766767
for (auto &&[text, value] : r2) {
767768
IPRange range{text};
769+
static_cast<void>(value);
768770
REQUIRE(space.end() != space.find(range.min()));
769771
REQUIRE(space.end() != space.find(range.max()));
770772
}
@@ -777,6 +779,7 @@ TEST_CASE("IP Space Int", "[libswoc][ip][ipspace]") {
777779
}
778780
{
779781
auto && [ r, p ] = *space.find(IPAddr{"2001:4997:58:400::1E"});
782+
static_cast<void>(p);
780783
REQUIRE(true == r.empty());
781784
}
782785
}
@@ -808,8 +811,10 @@ TEST_CASE("IPSpace bitset", "[libswoc][ipspace][bitset]") {
808811

809812
// Check that if an IPv4 lookup misses, it doesn't pass on to the first IPv6
810813
auto && [ r1, p1 ] = *(space.find(IP4Addr{"172.28.56.100"}));
814+
static_cast<void>(p1);
811815
REQUIRE(true == r1.empty());
812816
auto && [ r2, p2 ] = *(space.find(IPAddr{"172.28.56.100"}));
817+
static_cast<void>(p2);
813818
REQUIRE(true == r2.empty());
814819
}
815820

@@ -864,6 +869,7 @@ TEST_CASE("IPSpace docJJ", "[libswoc][ipspace][docJJ]") {
864869

865870
idx = 0;
866871
for (auto const&[range, bits] : space) {
872+
static_cast<void>(range);
867873
REQUIRE(idx < results.size());
868874
CHECK(bits == make_bits(results[idx]));
869875
++idx;
@@ -872,6 +878,7 @@ TEST_CASE("IPSpace docJJ", "[libswoc][ipspace][docJJ]") {
872878
idx = results.size();
873879
for (auto spot = space.end(); spot != space.begin();) {
874880
auto const&[range, bits]{*--spot};
881+
static_cast<void>(range);
875882
REQUIRE(idx > 0);
876883
--idx;
877884
CHECK(bits == make_bits(results[idx]));
@@ -885,6 +892,7 @@ TEST_CASE("IPSpace docJJ", "[libswoc][ipspace][docJJ]") {
885892
for (auto spot = space.begin(); spot != space.end() ; ++spot) {
886893
iter = spot;
887894
std::tie(range, bits) = *iter;
895+
static_cast<void>(range);
888896
REQUIRE(idx < results.size());
889897
CHECK(bits == make_bits(results[idx]));
890898
++idx;
@@ -1500,10 +1508,14 @@ TEST_CASE("IPSpace Uthira", "[libswoc][ipspace][uthira]") {
15001508
auto spot = space.begin();
15011509
auto [ r1, p1 ] = *++spot;
15021510
auto [ r2, p2 ] = *++spot;
1511+
static_cast<void>(p1);
1512+
static_cast<void>(p2);
15031513
REQUIRE(r1.max() < r2.min()); // This is supposed to be an invariant! Make sure.
15041514
auto back = space.end();
15051515
auto [ br1, bp1 ] = *--back;
15061516
auto [ br2, bp2 ] = *--back;
1517+
static_cast<void>(bp1);
1518+
static_cast<void>(bp2);
15071519
REQUIRE(br2.max() < br1.min()); // This is supposed to be an invariant! Make sure.
15081520
}
15091521
}

0 commit comments

Comments
 (0)