From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15937 invoked by alias); 1 Dec 2017 15:12:01 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 15900 invoked by uid 89); 1 Dec 2017 15:11:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.5 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,KAM_LOTSOFHASH,KB_WAM_FROM_NAME_SINGLEWORD,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=rope, sk:nested_, money_get X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 01 Dec 2017 15:11:58 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6330780480; Fri, 1 Dec 2017 15:11:57 +0000 (UTC) Received: from localhost (unknown [10.33.36.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 15F766031E; Fri, 1 Dec 2017 15:11:56 +0000 (UTC) Date: Fri, 01 Dec 2017 15:12:00 -0000 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [PATCH] Fix -Wsystem-header warnings in libstdc++ Message-ID: <20171201151156.GW31922@redhat.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="EVcIhgQsEzAXu06J" Content-Disposition: inline X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.9.1 (2017-09-22) X-SW-Source: 2017-12/txt/msg00048.txt.bz2 --EVcIhgQsEzAXu06J Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline Content-length: 116 This fixes a number of warnings that show up with -Wsystem-headers Tested powerpc64le-linux, committed to trunk. --EVcIhgQsEzAXu06J Content-Type: text/x-patch; charset=us-ascii Content-Disposition: attachment; filename="patch.txt" Content-length: 6371 commit cc833c247c3b334c56feff8898bd02c8f9f3fc6a Author: Jonathan Wakely Date: Fri Dec 1 14:13:47 2017 +0000 Add comment to fix -Wfallthrough warning * include/bits/locale_facets_nonio.tcc (money_get::_M_extract): Add fallthrough comment. diff --git a/libstdc++-v3/include/bits/locale_facets_nonio.tcc b/libstdc++-v3/include/bits/locale_facets_nonio.tcc index a449c41e6b8..135dd0b9d8f 100644 --- a/libstdc++-v3/include/bits/locale_facets_nonio.tcc +++ b/libstdc++-v3/include/bits/locale_facets_nonio.tcc @@ -282,6 +282,7 @@ _GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11 ++__beg; else __testvalid = false; + // fallthrough case money_base::none: // Only if not at the end of the pattern. if (__i != 3) commit 98e449432c7ceddb157ccc5e94e6c2886c5d33e1 Author: Jonathan Wakely Date: Thu Nov 30 16:57:20 2017 +0000 Fix -Wempty-body warnings for debug assertions * include/bits/node_handle.h (_Node_handle_common::operator=) (_Node_handle_common::_M_swap): Add braces around debug assertions. diff --git a/libstdc++-v3/include/bits/node_handle.h b/libstdc++-v3/include/bits/node_handle.h index 7f109ada6f1..8a1e465893e 100644 --- a/libstdc++-v3/include/bits/node_handle.h +++ b/libstdc++-v3/include/bits/node_handle.h @@ -87,10 +87,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION || !this->_M_alloc) this->_M_alloc = std::move(__nh._M_alloc); else - __glibcxx_assert(this->_M_alloc == __nh._M_alloc); + { + __glibcxx_assert(this->_M_alloc == __nh._M_alloc); + } } else - __glibcxx_assert(_M_alloc); + { + __glibcxx_assert(_M_alloc); + } __nh._M_ptr = nullptr; __nh._M_alloc = nullopt; return *this; @@ -109,7 +113,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION || !_M_alloc || !__nh._M_alloc) _M_alloc.swap(__nh._M_alloc); else - __glibcxx_assert(_M_alloc == __nh._M_alloc); + { + __glibcxx_assert(_M_alloc == __nh._M_alloc); + } } private: commit 93ebef15310e0ebed92041ebbc6c860c1b06e2a6 Author: Jonathan Wakely Date: Thu Nov 30 20:14:31 2017 +0000 Use const char* to fix -Wwrite-strings warning * include/ext/ropeimpl.h (rope::_S_dump): Use const char*. diff --git a/libstdc++-v3/include/ext/ropeimpl.h b/libstdc++-v3/include/ext/ropeimpl.h index 9e88ce14c18..4842034c1e8 100644 --- a/libstdc++-v3/include/ext/ropeimpl.h +++ b/libstdc++-v3/include/ext/ropeimpl.h @@ -1139,7 +1139,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } else { - char* __kind; + const char* __kind; switch (__r->_M_tag) { commit 3a05b2c46c829bc7c3698d3d432372c9b70881c7 Author: Jonathan Wakely Date: Thu Nov 30 20:18:47 2017 +0000 Add [[noreturn]] attributes to fix warning * libsupc++/nested_exception.h (__throw_with_nested_impl): Add noreturn attribute. diff --git a/libstdc++-v3/libsupc++/nested_exception.h b/libstdc++-v3/libsupc++/nested_exception.h index 43970b4ef86..27bccfce35f 100644 --- a/libstdc++-v3/libsupc++/nested_exception.h +++ b/libstdc++-v3/libsupc++/nested_exception.h @@ -92,6 +92,7 @@ namespace std // Throw an exception of unspecified type that is publicly derived from // both remove_reference_t<_Tp> and nested_exception. template + [[noreturn]] inline void __throw_with_nested_impl(_Tp&& __t, true_type) { @@ -100,6 +101,7 @@ namespace std } template + [[noreturn]] inline void __throw_with_nested_impl(_Tp&& __t, false_type) { throw std::forward<_Tp>(__t); } commit a82e6e608b99d5be038869b3745d1f49ddfc022b Author: Jonathan Wakely Date: Fri Dec 1 13:59:59 2017 +0000 Remove stray semi-colons at namespace scope * include/bits/regex_executor.tcc (_Executor::_M_rep_once_more): Remove semi-colon after function body. * include/bits/uniform_int_dist.h (_Power_of_2): Likewise. diff --git a/libstdc++-v3/include/bits/regex_executor.tcc b/libstdc++-v3/include/bits/regex_executor.tcc index 2ceba35e7b8..008ffa0e836 100644 --- a/libstdc++-v3/include/bits/regex_executor.tcc +++ b/libstdc++-v3/include/bits/regex_executor.tcc @@ -170,7 +170,7 @@ namespace __detail // visited more than twice. It's `twice` instead of `once` because // we need to spare one more time for potential group capture. template + bool __dfs_mode> void _Executor<_BiIter, _Alloc, _TraitsT, __dfs_mode>:: _M_rep_once_more(_Match_mode __match_mode, _StateIdT __i) { @@ -193,7 +193,7 @@ namespace __detail __rep_count.second--; } } - }; + } // _M_alt branch is "match once more", while _M_next is "get me out // of this quantifier". Executing _M_next first or _M_alt first don't diff --git a/libstdc++-v3/include/bits/uniform_int_dist.h b/libstdc++-v3/include/bits/uniform_int_dist.h index 16509c4ef8a..c64c02c245e 100644 --- a/libstdc++-v3/include/bits/uniform_int_dist.h +++ b/libstdc++-v3/include/bits/uniform_int_dist.h @@ -46,7 +46,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _Power_of_2(_Tp __x) { return ((__x - 1) & __x) == 0; - }; + } } /** commit 13b4b8dab56d73faa858926cdcf16dc839455657 Author: Jonathan Wakely Date: Thu Nov 30 18:03:06 2017 +0000 Use value-init syntax in std::__detail::__airy * include/tr1/modified_bessel_func.tcc (__airy): Use value-init not list-init. diff --git a/libstdc++-v3/include/tr1/modified_bessel_func.tcc b/libstdc++-v3/include/tr1/modified_bessel_func.tcc index 3910b95bd28..f39ff6c82d2 100644 --- a/libstdc++-v3/include/tr1/modified_bessel_func.tcc +++ b/libstdc++-v3/include/tr1/modified_bessel_func.tcc @@ -384,11 +384,11 @@ namespace tr1 __Bip = __Aip = __Bi = __Ai = std::numeric_limits<_Tp>::quiet_NaN(); else if (__z == _S_inf) { - __Aip = __Ai = _Tp{0}; + __Aip = __Ai = _Tp(0); __Bip = __Bi = _S_inf; } else if (__z == -_S_inf) - __Bip = __Aip = __Bi = __Ai = _Tp{0}; + __Bip = __Aip = __Bi = __Ai = _Tp(0); else if (__x > _Tp(0)) { _Tp __I_nu, __Ip_nu, __K_nu, __Kp_nu; --EVcIhgQsEzAXu06J--