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 [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id AA77A385828F for ; Tue, 8 Nov 2022 17:46:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AA77A385828F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667929605; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=k65/nejMA4HKZQLLt5GDzMEYX4xr0wk3ws7sAjPwEW4=; b=THeT48nWC3DSy0ogdbeaH//XDTJdVg1K4oRrwXie6h//smjuriTYMnp1hppBHKi3Wd4Zai TjToemTxiSb14jY37MV0VUVBVApGANRaddWM+3G71HePUV5Ta8D16a5hLqb3wJV1ihdbyK siFIS9c8cM562IVzOFGhw3mu/I7ZpxU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-642-GagGf4xgNBuhUvl0KfyHdA-1; Tue, 08 Nov 2022 12:46:42 -0500 X-MC-Unique: GagGf4xgNBuhUvl0KfyHdA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0EFB985A583; Tue, 8 Nov 2022 17:46:42 +0000 (UTC) Received: from localhost (unknown [10.33.37.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id CB892140EBF3; Tue, 8 Nov 2022 17:46:41 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Fix -Wsystem-headers warnings Date: Tue, 8 Nov 2022 17:46:41 +0000 Message-Id: <20221108174641.1764608-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.8 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_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Tested x86_64-linux. Pushed to trunk. -- >8 -- Fix some problems noticed with -Wsystem-headers. libstdc++-v3/ChangeLog: * include/bits/stl_tempbuf.h (_Temporary_buffer): Disable warnings about get_temporary_buffer being deprecated. * include/ext/functional (mem_fun1, mem_fun1_ref): Disable warnings about mem_fun1_t, const_mem_fun1_t, mem_fun1_ref_t and const_mem_fun1_ref_t being deprecated. * include/std/array (__array_traits): Remove artificial attributes which give warnings about being ignored. * include/std/spanstream (basic_spanbuf::setbuf): Add assertion and adjust to avoid narrowing warning. * libsupc++/exception_ptr.h [!__cpp_rtti && !__cpp_exceptions] (make_exception_ptr): Add missing inline specifier. --- libstdc++-v3/include/bits/stl_tempbuf.h | 3 +++ libstdc++-v3/include/ext/functional | 4 ++-- libstdc++-v3/include/std/array | 4 ++-- libstdc++-v3/include/std/spanstream | 3 ++- libstdc++-v3/libsupc++/exception_ptr.h | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/libstdc++-v3/include/bits/stl_tempbuf.h b/libstdc++-v3/include/bits/stl_tempbuf.h index b13aa3b0fcc..f3d4dd73073 100644 --- a/libstdc++-v3/include/bits/stl_tempbuf.h +++ b/libstdc++-v3/include/bits/stl_tempbuf.h @@ -257,6 +257,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __ucr(__first, __last, __seed); } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" template _Temporary_buffer<_ForwardIterator, _Tp>:: _Temporary_buffer(_ForwardIterator __seed, size_type __original_len) @@ -281,6 +283,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } } } +#pragma GCC diagnostic pop _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/include/ext/functional b/libstdc++-v3/include/ext/functional index 9cf864d9290..a947ee6384d 100644 --- a/libstdc++-v3/include/ext/functional +++ b/libstdc++-v3/include/ext/functional @@ -396,8 +396,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { _M_initialize(161803398u); } }; -#pragma GCC diagnostic pop - // Mem_fun adaptor helper functions mem_fun1 and mem_fun1_ref, // provided for backward compatibility, they are no longer part of // the C++ standard. @@ -422,6 +420,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION mem_fun1_ref(_Ret (_Tp::*__f)(_Arg) const) { return std::const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); } +#pragma GCC diagnostic pop + _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/include/std/array b/libstdc++-v3/include/std/array index 7ba92d0e90d..e26390e6f80 100644 --- a/libstdc++-v3/include/std/array +++ b/libstdc++-v3/include/std/array @@ -64,11 +64,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION struct _Type { // Indexing is undefined. - __attribute__((__always_inline__,__artificial__,__noreturn__)) + __attribute__((__always_inline__,__noreturn__)) _Tp& operator[](size_t) const noexcept { __builtin_trap(); } // Conversion to a pointer produces a null pointer. - __attribute__((__always_inline__,__artificial__)) + __attribute__((__always_inline__)) operator _Tp*() const noexcept { return nullptr; } }; diff --git a/libstdc++-v3/include/std/spanstream b/libstdc++-v3/include/std/spanstream index 6abf013d41b..483996b274f 100644 --- a/libstdc++-v3/include/std/spanstream +++ b/libstdc++-v3/include/std/spanstream @@ -136,7 +136,8 @@ template basic_streambuf<_CharT, _Traits>* setbuf(_CharT* __s, streamsize __n) override { - span({__s, __n}); + __glibcxx_assert(__n >= 0); + this->span(std::span<_CharT>(__s, __n)); return this; } diff --git a/libstdc++-v3/libsupc++/exception_ptr.h b/libstdc++-v3/libsupc++/exception_ptr.h index fd9ceec88d4..b0118102123 100644 --- a/libstdc++-v3/libsupc++/exception_ptr.h +++ b/libstdc++-v3/libsupc++/exception_ptr.h @@ -280,7 +280,7 @@ namespace std _GLIBCXX_VISIBILITY(default) // instead of a working one compiled with RTTI and/or exceptions enabled. template __attribute__ ((__always_inline__)) - exception_ptr + inline exception_ptr make_exception_ptr(_Ex) _GLIBCXX_USE_NOEXCEPT { return exception_ptr(); } #endif -- 2.38.1