From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id BA7DC385842E; Wed, 5 Jan 2022 13:47:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BA7DC385842E MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r12-6261] libstdc++: Avoid -Wzero-as-null-pointer-constant warning [PR103848] X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: 917c7b136e8b556b0027223058006a6caeb56871 X-Git-Newrev: 76a45931ab7c831e32cebf13a6317e5e142f8151 Message-Id: <20220105134753.BA7DC385842E@sourceware.org> Date: Wed, 5 Jan 2022 13:47:53 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jan 2022 13:47:53 -0000 https://gcc.gnu.org/g:76a45931ab7c831e32cebf13a6317e5e142f8151 commit r12-6261-g76a45931ab7c831e32cebf13a6317e5e142f8151 Author: Jonathan Wakely Date: Tue Jan 4 21:57:16 2022 +0000 libstdc++: Avoid -Wzero-as-null-pointer-constant warning [PR103848] libstdc++-v3/ChangeLog: PR libstdc++/103848 * include/bits/stl_deque.h (operator-): Do not use 0 as null pointer constant. Diff: --- libstdc++-v3/include/bits/stl_deque.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libstdc++-v3/include/bits/stl_deque.h b/libstdc++-v3/include/bits/stl_deque.h index e4c53d56068..7fa9b0b3c09 100644 --- a/libstdc++-v3/include/bits/stl_deque.h +++ b/libstdc++-v3/include/bits/stl_deque.h @@ -370,7 +370,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER operator-(const _Self& __x, const _Self& __y) _GLIBCXX_NOEXCEPT { return difference_type(_S_buffer_size()) - * (__x._M_node - __y._M_node - int(__x._M_node != 0)) + * (__x._M_node - __y._M_node - bool(__x._M_node)) + (__x._M_cur - __x._M_first) + (__y._M_last - __y._M_cur); } @@ -383,10 +383,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER _GLIBCXX_NODISCARD friend difference_type operator-(const _Self& __x, - const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) _GLIBCXX_NOEXCEPT + const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) + _GLIBCXX_NOEXCEPT { return difference_type(_S_buffer_size()) - * (__x._M_node - __y._M_node - int(__x._M_node != 0)) + * (__x._M_node - __y._M_node - bool(__x._M_node)) + (__x._M_cur - __x._M_first) + (__y._M_last - __y._M_cur); }