diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2022-01-25 10:22:42 +0000 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2022-01-25 21:05:16 +0000 |
commit | 5c1f274e3e090ee03bedc22dd7169b28e759974e (patch) | |
tree | 91f9c3138e620e19319856eca72d27f466c4fd7e | |
parent | e20486d508afdf22790a271e90ca76d8df5fa7a5 (diff) | |
download | gcc-5c1f274e3e090ee03bedc22dd7169b28e759974e.zip gcc-5c1f274e3e090ee03bedc22dd7169b28e759974e.tar.gz gcc-5c1f274e3e090ee03bedc22dd7169b28e759974e.tar.bz2 |
libstdc++: Avoid some more warnings [PR104019]
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.
-rw-r--r-- | libstdc++-v3/include/bits/istream.tcc | 62 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/shared_ptr_base.h | 3 |
2 files changed, 35 insertions, 30 deletions
diff --git a/libstdc++-v3/include/bits/istream.tcc b/libstdc++-v3/include/bits/istream.tcc index cfab5b4..a1a7d89 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(); - - 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); } + { + __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(); + + // _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 b2f955b..d9230b7 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; |