Skip to content

Commit 59b4540

Browse files
committed
fix: suppress GCC false-positive -Wmaybe-uninitialized in tuple_rule
GCC 7+ at -O3 emits false -Wmaybe-uninitialized from variant2 union storage when deeply inlining constexpr functions. Wrap the affected parse_sequence code in tuple_rule.hpp with a diagnostic pragma. fix #979
1 parent b9db439 commit 59b4540

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

include/boost/url/detail/config.hpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -213,13 +213,6 @@
213213
#define BOOST_URL_MAX_SIZE ((std::size_t)UINT32_MAX - 1)
214214
#endif
215215

216-
// noinline attribute
217-
#ifdef BOOST_GCC
218-
#define BOOST_URL_NO_INLINE [[gnu::noinline]]
219-
#else
220-
#define BOOST_URL_NO_INLINE
221-
#endif
222-
223216
// libstdcxx copy-on-write strings
224217
#ifndef BOOST_URL_COW_STRINGS
225218
#if defined(BOOST_LIBSTDCXX_VERSION) && (BOOST_LIBSTDCXX_VERSION < 60000 || (defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0))

include/boost/url/grammar/impl/tuple_rule.hpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,12 @@ struct parse_sequence
160160
}
161161
};
162162

163+
// See error_types.hpp for details (#979)
164+
#if defined(BOOST_GCC) && BOOST_GCC >= 70000
165+
#pragma GCC diagnostic push
166+
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
167+
#endif
168+
163169
// returns a value_type
164170
template<class R0, class... Rn>
165171
struct parse_sequence<false, R0, Rn...>
@@ -218,7 +224,7 @@ struct parse_sequence<false, R0, Rn...>
218224
system::result<void> rv =
219225
grammar::parse(
220226
it, end, get<Ir>(rn));
221-
if( !rv )
227+
if( rv.has_error() )
222228
{
223229
v = rv.error();
224230
return;
@@ -273,6 +279,10 @@ struct parse_sequence<false, R0, Rn...>
273279
}
274280
};
275281

282+
#if defined(BOOST_GCC) && BOOST_GCC >= 70000
283+
#pragma GCC diagnostic pop
284+
#endif
285+
276286
} // detail
277287

278288
template<

0 commit comments

Comments
 (0)