2
0
mirror of https://github.com/boostorg/parser.git synced 2026-01-19 04:22:13 +00:00

GCC warning mitigation.

This commit is contained in:
Zach Laine
2024-02-29 21:17:21 -06:00
parent ed9fcc6f3a
commit 64e76e7b58
5 changed files with 23 additions and 15 deletions

View File

@@ -35,6 +35,7 @@ int main()
auto const result = parse("X 9 X", parser, bp::ws);
assert(result && *result == 9);
//]
(void)result;
//[ self_filling_symbol_table_after_parse
assert(!parse("X", symbols));

View File

@@ -2844,7 +2844,7 @@ namespace boost { namespace parser {
for (int64_t end = detail::resolve(context, min_); count != end;
++count) {
detail::skip(first, last, skip, flags);
attr_t attr;
attr_t attr{};
parser_.call(
use_cbs,
first,
@@ -2892,7 +2892,7 @@ namespace boost { namespace parser {
}
detail::skip(first, last, skip, flags);
attr_t attr;
attr_t attr{};
parser_.call(
use_cbs,
first,
@@ -3154,7 +3154,7 @@ namespace boost { namespace parser {
// nope if unwrapped_types is empty.
using result_t = detail::to_hana_tuple_or_type_t<unwrapped_types>;
result_t retval;
result_t retval{};
call(use_cbs, first, last, context, skip, flags, success, retval);
return retval;
}
@@ -3708,7 +3708,8 @@ namespace boost { namespace parser {
auto temp_result = make_temp_result(
use_cbs, first, last, context, skip, flags, success);
std::decay_t<decltype(parser::get(temp_result, llong<0>{}))> retval;
std::decay_t<decltype(parser::get(temp_result, llong<0>{}))>
retval{};
auto _ = detail::scoped_trace(
*this,
@@ -3820,7 +3821,7 @@ namespace boost { namespace parser {
0 < max_index_t::value && detail::is_constructible_from_tuple_v<
Attribute,
temp_result_attr_t>) {
temp_result_attr_t temp_retval;
temp_result_attr_t temp_retval{};
call_impl(
use_cbs,
first,
@@ -3841,7 +3842,7 @@ namespace boost { namespace parser {
}
} else {
// call_impl requires a tuple, so we must wrap this scalar.
tuple<Attribute> temp_retval;
tuple<Attribute> temp_retval{};
call_impl(
use_cbs,
first,
@@ -4702,7 +4703,7 @@ namespace boost { namespace parser {
detail::flags flags,
bool & success) const
{
T retval;
T retval{};
call(use_cbs, first, last, context, skip, flags, success, retval);
return retval;
}
@@ -5968,7 +5969,7 @@ namespace boost { namespace parser {
detail::flags flags,
bool & success) const -> attribute_type<decltype(*first)>
{
attribute_type<decltype(*first)> retval;
attribute_type<decltype(*first)> retval{};
call(use_cbs, first, last, context, skip, flags, success, retval);
return retval;
}
@@ -6136,7 +6137,7 @@ namespace boost { namespace parser {
detail::flags flags,
bool & success) const -> attribute_type<decltype(*first)>
{
attribute_type<decltype(*first)> retval;
attribute_type<decltype(*first)> retval{};
call(use_cbs, first, last, context, skip, flags, success, retval);
return retval;
}
@@ -6288,7 +6289,7 @@ namespace boost { namespace parser {
detail::flags flags,
bool & success) const -> attribute_type<decltype(*first)>
{
attribute_type<decltype(*first)> retval;
attribute_type<decltype(*first)> retval{};
call(use_cbs, first, last, context, skip, flags, success, retval);
return retval;
}
@@ -6372,7 +6373,7 @@ namespace boost { namespace parser {
detail::flags flags,
bool & success) const -> attribute_type<decltype(*first)>
{
attribute_type<decltype(*first)> retval;
attribute_type<decltype(*first)> retval{};
call(use_cbs, first, last, context, skip, flags, success, retval);
return retval;
}
@@ -6773,7 +6774,7 @@ namespace boost { namespace parser {
detail::flags flags,
bool & success) const
{
bool retval;
bool retval{};
call(use_cbs, first, last, context, skip, flags, success, retval);
return retval;
}
@@ -6858,7 +6859,7 @@ namespace boost { namespace parser {
detail::flags flags,
bool & success) const
{
T retval;
T retval{};
call(use_cbs, first, last, context, skip, flags, success, retval);
return retval;
}
@@ -6970,7 +6971,7 @@ namespace boost { namespace parser {
detail::flags flags,
bool & success) const
{
T retval;
T retval{};
call(use_cbs, first, last, context, skip, flags, success, retval);
return retval;
}
@@ -7058,7 +7059,7 @@ namespace boost { namespace parser {
detail::flags flags,
bool & success) const
{
T retval;
T retval = 0;
call(use_cbs, first, last, context, skip, flags, success, retval);
return retval;
}

View File

@@ -23,6 +23,9 @@ TEST(no_case, doc_example)
auto const alpha_parser = bp::no_case[bp::char_('a', 'z')];
assert(bp::parse("a" | bp::as_utf32, bp::no_case[alpha_parser])); // Match!
assert(bp::parse("B" | bp::as_utf32, bp::no_case[alpha_parser])); // Match!
(void)street_parser;
(void)alpha_parser;
}

View File

@@ -1998,6 +1998,7 @@ TEST(parser, attr_out_param_compat)
using namespace bp::literals;
assert(success);
(void)success;
assert(bp::get(result, 0_c) == std::vector<int>({'r', U'ô', 'l', 'e'}));
assert(bp::get(result, 1_c) == "foo");
}
@@ -2015,6 +2016,7 @@ TEST(parser, attr_out_param_compat)
using namespace bp::literals;
assert(success);
(void)success;
// The 4 code points "rôle" get transcoded to 5 UTF-8 code points to fit in the std::string.
assert(bp::get(result, 0_c) == std::vector<char>({'r', (char)0xc3, (char)0xb4, 'l', 'e'}));
assert(bp::get(result, 1_c) == "foo");

View File

@@ -739,6 +739,7 @@ TEST(search, doc_examples)
assert(
std::string_view(result.begin(), result.end() - result.begin()) ==
"XYZ");
(void)result;
}
{
auto r = "XYZaaXYZbaabaXYZXYZ" | bp::search_all(bp::lit("XYZ"));