public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r12-6868] libstdc++: Avoid some more warnings [PR104019] Date: Tue, 25 Jan 2022 21:09:37 +0000 (GMT) [thread overview] Message-ID: <20220125210937.C9F45385E004@sourceware.org> (raw) https://gcc.gnu.org/g:5c1f274e3e090ee03bedc22dd7169b28e759974e commit r12-6868-g5c1f274e3e090ee03bedc22dd7169b28e759974e Author: Jonathan Wakely <jwakely@redhat.com> Date: Tue Jan 25 10:22:42 2022 +0000 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. Diff: --- libstdc++-v3/include/bits/istream.tcc | 62 +++++++++++++++-------------- 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 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(); - - 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 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;
reply other threads:[~2022-01-25 21:09 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220125210937.C9F45385E004@sourceware.org \ --to=redi@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ --cc=libstdc++-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).