From 66432fd04e3d62d6ebf7ab1d1049c1ff90614eb3 Mon Sep 17 00:00:00 2001 From: Konstantin Akimov Date: Sun, 5 Nov 2023 23:36:12 +0700 Subject: [PATCH] fix: add cast to void to avoid gcc warning inside string_cast.cpp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It fixes this warning: ``` bench/string_cast.cpp:85:84: warning: ignoring return value of ‘std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&) [with _CharT = char; _Traits = char_traits; _Alloc = allocator]’, declared with attribute ‘nodiscard’ [-Wunused-result] ``` --- src/bench/string_cast.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/bench/string_cast.cpp b/src/bench/string_cast.cpp index 56f929e7fb..8f08d12103 100644 --- a/src/bench/string_cast.cpp +++ b/src/bench/string_cast.cpp @@ -59,12 +59,12 @@ static void strings_1_tostring(benchmark::Bench& bench) static void strings_2_multi_lexical_cast(benchmark::Bench& bench) { int i{0}; - bench.run([&] { + bench.run([&] { static_cast( boost::lexical_cast(i) + boost::lexical_cast(i+1) + boost::lexical_cast(i+2) + boost::lexical_cast(i+3) + - boost::lexical_cast(i+4); + boost::lexical_cast(i+4)); ++i; }); } @@ -72,8 +72,8 @@ static void strings_2_multi_lexical_cast(benchmark::Bench& bench) static void strings_2_multi_numberToString(benchmark::Bench& bench) { int i{0}; - bench.run([&] { - NumberToString(i) + NumberToString(i+1) + NumberToString(i+2) + NumberToString(i+3) + NumberToString(i+4); + bench.run([&] { static_cast( + NumberToString(i) + NumberToString(i+1) + NumberToString(i+2) + NumberToString(i+3) + NumberToString(i+4)); ++i; }); } @@ -81,8 +81,8 @@ static void strings_2_multi_numberToString(benchmark::Bench& bench) static void strings_2_multi_tostring(benchmark::Bench& bench) { int i{0}; - bench.run([&] { - ToString(i) + ToString(i+1) + ToString(i+2) + ToString(i+3) + ToString(i+4); + bench.run([&] { static_cast( + ToString(i) + ToString(i+1) + ToString(i+2) + ToString(i+3) + ToString(i+4)); ++i; }); }