From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 8FAC9385800B; Tue, 8 Nov 2022 17:46:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8FAC9385800B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667929573; bh=by2/kj5pW9wcf/7skwKFSCtHHtD6CFlBtUakF6bZdBY=; h=From:To:Subject:Date:From; b=MG2RFgyc6QtvHIG81ay8bche1jlkrbzL/ox8ZRZbNj4IrDPpNVD20OtzzccB64ETm p7rIiDCmc1tcjZ1M2DfdNj8q4T5mEWqoevGIJZahaVPxmdXnyS59WFY9lEoQl2Sl4f MHR7tT0W3WCgCfBEXrOfLZjfFNKhowdQgRLwO+IA= 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 r13-3817] libstdc++: Fix -Wsystem-headers warnings X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: 9d549401ae8ab334c8cba1c1339dbd3c8e695685 X-Git-Newrev: 8f6d25f19bae521c3d028bcdcd69019540b8c3b9 Message-Id: <20221108174613.8FAC9385800B@sourceware.org> Date: Tue, 8 Nov 2022 17:46:13 +0000 (GMT) List-Id: https://gcc.gnu.org/g:8f6d25f19bae521c3d028bcdcd69019540b8c3b9 commit r13-3817-g8f6d25f19bae521c3d028bcdcd69019540b8c3b9 Author: Jonathan Wakely Date: Sat Nov 5 12:35:55 2022 +0000 libstdc++: Fix -Wsystem-headers warnings 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. Diff: --- 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