public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r12-10273] libstdc++: Fix -Wsystem-headers warnings
Date: Mon, 18 Mar 2024 14:07:58 +0000 (GMT)	[thread overview]
Message-ID: <20240318140758.B12903858005@sourceware.org> (raw)

https://gcc.gnu.org/g:2d174d4181896129d465cbf42dc454f4f906892b

commit r12-10273-g2d174d4181896129d465cbf42dc454f4f906892b
Author: Jonathan Wakely <jwakely@redhat.com>
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/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)

Diff:
---
 libstdc++-v3/include/bits/stl_tempbuf.h | 3 +++
 libstdc++-v3/include/ext/functional     | 4 ++--
 libstdc++-v3/include/std/spanstream     | 3 ++-
 libstdc++-v3/libsupc++/exception_ptr.h  | 2 +-
 4 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/libstdc++-v3/include/bits/stl_tempbuf.h b/libstdc++-v3/include/bits/stl_tempbuf.h
index db7cdb14ca9..f8323d4ab71 100644
--- a/libstdc++-v3/include/bits/stl_tempbuf.h
+++ b/libstdc++-v3/include/bits/stl_tempbuf.h
@@ -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
diff --git a/libstdc++-v3/include/ext/functional b/libstdc++-v3/include/ext/functional
index 19cd8d5b563..11c2de1294b 100644
--- a/libstdc++-v3/include/ext/functional
+++ b/libstdc++-v3/include/ext/functional
@@ -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
 
diff --git a/libstdc++-v3/include/std/spanstream b/libstdc++-v3/include/std/spanstream
index 5855b286efe..8fd74b8f9cb 100644
--- a/libstdc++-v3/include/std/spanstream
+++ b/libstdc++-v3/include/std/spanstream
@@ -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;
     }
 
diff --git a/libstdc++-v3/libsupc++/exception_ptr.h b/libstdc++-v3/libsupc++/exception_ptr.h
index 6433f059e9c..07e456237db 100644
--- a/libstdc++-v3/libsupc++/exception_ptr.h
+++ b/libstdc++-v3/libsupc++/exception_ptr.h
@@ -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

                 reply	other threads:[~2024-03-18 14:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240318140758.B12903858005@sourceware.org \
    --to=redi@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).