]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Fix -Wsystem-headers warnings
authorJonathan Wakely <jwakely@redhat.com>
Sat, 5 Nov 2022 12:35:55 +0000 (12:35 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Mon, 18 Mar 2024 13:50:57 +0000 (13:50 +0000)
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/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.

(cherry picked from commit 8f6d25f19bae521c3d028bcdcd69019540b8c3b9)

libstdc++-v3/include/bits/stl_tempbuf.h
libstdc++-v3/include/ext/functional
libstdc++-v3/include/std/spanstream
libstdc++-v3/libsupc++/exception_ptr.h

index db7cdb14ca97b2e3dd0c1196c3b9a802d36096e3..f8323d4ab718cc6afcc91baaef13ef8f5696edb4 100644 (file)
@@ -254,6 +254,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
          __ucr(__first, __last, __seed);
     }
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
   template<typename _ForwardIterator, typename _Tp>
     _Temporary_buffer<_ForwardIterator, _Tp>::
     _Temporary_buffer(_ForwardIterator __seed, size_type __original_len)
@@ -278,6 +280,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
            }
        }
     }
+#pragma GCC diagnostic pop
 
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace
index 19cd8d5b56312f6078949b7773f0bf67bcba5be5..11c2de1294b16348edad97deea9e9d89ac0f2fd1 100644 (file)
@@ -394,8 +394,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.
@@ -420,6 +418,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
 
index 5855b286efe377713b2990bdce930201e64711eb..8fd74b8f9cb748b7e28c4b790712a0dd12b18eb5 100644 (file)
@@ -134,7 +134,8 @@ template<typename _CharT, typename _Traits>
     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;
     }
 
index 6433f059e9c4f73a5b093bb05485a8d97ded156b..07e456237db257d92f87cfc4ecee02a3f5891ee8 100644 (file)
@@ -271,7 +271,7 @@ namespace std
   // instead of a working one compiled with RTTI and/or exceptions enabled.
   template<typename _Ex>
     __attribute__ ((__always_inline__))
-    exception_ptr
+    inline exception_ptr
     make_exception_ptr(_Ex) _GLIBCXX_USE_NOEXCEPT
     { return exception_ptr(); }
 #endif