From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 5C1DD385702E for ; Thu, 29 Oct 2020 22:52:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5C1DD385702E Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-567-nRwoQtj_NGmORqPQZc5qWw-1; Thu, 29 Oct 2020 18:52:07 -0400 X-MC-Unique: nRwoQtj_NGmORqPQZc5qWw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 44D3F1074643; Thu, 29 Oct 2020 22:52:06 +0000 (UTC) Received: from localhost (unknown [10.33.36.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id 99D771001281; Thu, 29 Oct 2020 22:52:05 +0000 (UTC) Date: Thu, 29 Oct 2020 22:52:04 +0000 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Fix some warnings in headers Message-ID: <20201029225204.GA2466113@redhat.com> MIME-Version: 1.0 X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/mixed; boundary="FCuugMFkClbJLl1L" Content-Disposition: inline X-Spam-Status: No, score=-14.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Oct 2020 22:52:11 -0000 --FCuugMFkClbJLl1L Content-Type: text/plain; charset=us-ascii Content-Disposition: inline These are usually suppressed in system headers, but should be fixed anyway. libstdc++-v3/ChangeLog: * include/bits/parse_numbers.h (_Select_int_base): Avoid narrowing conversion in constant expression. * include/experimental/buffer (buffer_copy): Avoid narrowing conversion. * include/experimental/internet (hash<>::operator()): Do not use deprecated 'argument_type' member. * include/std/variant (variant::emplace): Use cast instead of implicit conversion from size_t to narrower unsigned type. Tested powerpc64le-linux. Committed to trunk. --FCuugMFkClbJLl1L Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="patch.txt" commit d7aa21a3c78874743a42ffc1af3493ecb665496f Author: Jonathan Wakely Date: Thu Oct 29 22:47:22 2020 libstdc++: Fix some warnings in headers These are usually suppressed in system headers, but should be fixed anyway. libstdc++-v3/ChangeLog: * include/bits/parse_numbers.h (_Select_int_base): Avoid narrowing conversion in constant expression. * include/experimental/buffer (buffer_copy): Avoid narrowing conversion. * include/experimental/internet (hash<>::operator()): Do not use deprecated 'argument_type' member. * include/std/variant (variant::emplace): Use cast instead of implicit conversion from size_t to narrower unsigned type. diff --git a/libstdc++-v3/include/bits/parse_numbers.h b/libstdc++-v3/include/bits/parse_numbers.h index 5e80907af09..923a56c5a9f 100644 --- a/libstdc++-v3/include/bits/parse_numbers.h +++ b/libstdc++-v3/include/bits/parse_numbers.h @@ -266,7 +266,7 @@ namespace __select_int template struct _Select_int_base<_Val, _IntType, _Ints...> : conditional_t<(_Val <= __gnu_cxx::__int_traits<_IntType>::__max), - integral_constant<_IntType, _Val>, + integral_constant<_IntType, (_IntType)_Val>, _Select_int_base<_Val, _Ints...>> { }; diff --git a/libstdc++-v3/include/experimental/buffer b/libstdc++-v3/include/experimental/buffer index 8ccdb28cc5b..08d3a365e8d 100644 --- a/libstdc++-v3/include/experimental/buffer +++ b/libstdc++-v3/include/experimental/buffer @@ -315,7 +315,7 @@ inline namespace v1 inline size_t buffer_copy(const _MutableBufferSequence& __dest, const _ConstBufferSequence& __source) noexcept - { return net::buffer_copy(__dest, __source, size_t{-1}); } + { return net::buffer_copy(__dest, __source, size_t(-1)); } // buffer arithmetic: diff --git a/libstdc++-v3/include/experimental/internet b/libstdc++-v3/include/experimental/internet index f1153b8ff6a..1143ef41a5a 100644 --- a/libstdc++-v3/include/experimental/internet +++ b/libstdc++-v3/include/experimental/internet @@ -2393,7 +2393,7 @@ namespace ip : __hash_base { size_t - operator()(const argument_type& __a) const + operator()(const experimental::net::v1::ip::address& __a) const { if (__a.is_v4()) return _Hash_impl::hash(__a.to_v4()); @@ -2407,7 +2407,7 @@ namespace ip : __hash_base { size_t - operator()(const argument_type& __a) const + operator()(const experimental::net::v1::ip::address_v4& __a) const { return _Hash_impl::hash(__a.to_bytes()); } }; @@ -2415,7 +2415,7 @@ namespace ip : __hash_base { size_t - operator()(const argument_type& __a) const + operator()(const experimental::net::v1::ip::address_v6& __a) const { return _Hash_impl::hash(__a.to_bytes()); } }; diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant index 17f8bcd638b..4455ff4f073 100644 --- a/libstdc++-v3/include/std/variant +++ b/libstdc++-v3/include/std/variant @@ -1512,7 +1512,8 @@ namespace __variant } __catch (...) { - this->_M_index = variant_npos; + using __index_type = decltype(this->_M_index); + this->_M_index = static_cast<__index_type>(variant_npos); __throw_exception_again; } } @@ -1559,7 +1560,8 @@ namespace __variant } __catch (...) { - this->_M_index = variant_npos; + using __index_type = decltype(this->_M_index); + this->_M_index = static_cast<__index_type>(variant_npos); __throw_exception_again; } } --FCuugMFkClbJLl1L--