The change to istream.tcc looks large but is just adding { and } and re-indenting everything between them. Tested x86_64-linux, pushed to trunk.
With -fno-exceptions we get a -Wmisleading-indentation warning for: if (cond) __try {} __catch (...) {} This is because the __catch(...) expands to if (false), but is indented as though it is controlled by the preceding 'if'. Surround it in braces. The new make_shared<T[]> code triggers a bogus warning due to PR 61596, which can be disabled with a pragma. libstdc++-v3/ChangeLog: PR libstdc++/104019 * include/bits/istream.tcc (basic_istream::sentry): Add braces around try-block. * include/bits/shared_ptr_base.h (_Sp_counted_array_base::_M_init): Add pragmas to disable bogus warnings from PR 61596. --- libstdc++-v3/include/bits/istream.tcc | 58 +++++++++++---------- libstdc++-v3/include/bits/shared_ptr_base.h | 3 ++ 2 files changed, 33 insertions(+), 28 deletions(-) diff --git a/libstdc++-v3/include/bits/istream.tcc b/libstdc++-v3/include/bits/istream.tcc index cfab5b4f684..a1a7d89335e 100644 --- a/libstdc++-v3/include/bits/istream.tcc +++ b/libstdc++-v3/include/bits/istream.tcc @@ -48,36 +48,38 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { ios_base::iostate __err = ios_base::goodbit; if (__in.good()) - __try - { - if (__in.tie()) - __in.tie()->flush(); - if (!__noskip && bool(__in.flags() & ios_base::skipws)) - { - const __int_type __eof = traits_type::eof(); - __streambuf_type* __sb = __in.rdbuf(); - __int_type __c = __sb->sgetc(); + { + __try + { + if (__in.tie()) + __in.tie()->flush(); + if (!__noskip && bool(__in.flags() & ios_base::skipws)) + { + const __int_type __eof = traits_type::eof(); + __streambuf_type* __sb = __in.rdbuf(); + __int_type __c = __sb->sgetc(); - const __ctype_type& __ct = __check_facet(__in._M_ctype); - while (!traits_type::eq_int_type(__c, __eof) - && __ct.is(ctype_base::space, - traits_type::to_char_type(__c))) - __c = __sb->snextc(); + const __ctype_type& __ct = __check_facet(__in._M_ctype); + while (!traits_type::eq_int_type(__c, __eof) + && __ct.is(ctype_base::space, + traits_type::to_char_type(__c))) + __c = __sb->snextc(); - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 195. Should basic_istream::sentry's constructor ever - // set eofbit? - if (traits_type::eq_int_type(__c, __eof)) - __err |= ios_base::eofbit; - } - } - __catch(__cxxabiv1::__forced_unwind&) - { - __in._M_setstate(ios_base::badbit); - __throw_exception_again; - } - __catch(...) - { __in._M_setstate(ios_base::badbit); } + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 195. Should basic_istream::sentry's constructor ever + // set eofbit? + if (traits_type::eq_int_type(__c, __eof)) + __err |= ios_base::eofbit; + } + } + __catch(__cxxabiv1::__forced_unwind&) + { + __in._M_setstate(ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { __in._M_setstate(ios_base::badbit); } + } if (__in.good() && __err == ios_base::goodbit) _M_ok = true; diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h b/libstdc++-v3/include/bits/shared_ptr_base.h index b2f955b41f7..d9230b72203 100644 --- a/libstdc++-v3/include/bits/shared_ptr_base.h +++ b/libstdc++-v3/include/bits/shared_ptr_base.h @@ -762,6 +762,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION std::__uninitialized_fill_n_a(__p, _M_n, *__init, _M_alloc); else { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-local-typedefs" struct _Iter { using value_type = _Up; @@ -783,6 +785,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION bool operator==(const _Iter& __i) const { return _M_pos == __i._M_pos; } }; +#pragma GCC diagnostic pop _Iter __first{_S_first_elem(__init), sizeof(_Tp) / sizeof(_Up)}; _Iter __last = __first; -- 2.31.1