public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: [committed] libstdc++: Add unused attributes to shared_ptr functions
Date: Fri, 12 Feb 2021 14:46:10 +0000	[thread overview]
Message-ID: <YCaUsu0ChpKRhUr9@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 367 bytes --]

This avoids some warnings when building with -fno-rtti because the
function parameters are only used when RTTI is enabled.

libstdc++-v3/ChangeLog:

	* include/bits/shared_ptr_base.h (__shared_ptr::_M_get_deleter):
	Add unused attribute to parameter.
	* src/c++11/shared_ptr.cc (_Sp_make_shared_tag::_S_eq):
	Likewise.

Tested powerpc64le-linux. Committed to trunk.


[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1585 bytes --]

commit 87eaa3c525eb65775e6d77403b83a273a2397099
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Feb 12 10:36:18 2021

    libstdc++: Add unused attributes to shared_ptr functions
    
    This avoids some warnings when building with -fno-rtti because the
    function parameters are only used when RTTI is enabled.
    
    libstdc++-v3/ChangeLog:
    
            * include/bits/shared_ptr_base.h (__shared_ptr::_M_get_deleter):
            Add unused attribute to parameter.
            * src/c++11/shared_ptr.cc (_Sp_make_shared_tag::_S_eq):
            Likewise.

diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h b/libstdc++-v3/include/bits/shared_ptr_base.h
index 15707f8e74a..b24900b2008 100644
--- a/libstdc++-v3/include/bits/shared_ptr_base.h
+++ b/libstdc++-v3/include/bits/shared_ptr_base.h
@@ -450,7 +450,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       }
 
       virtual void*
-      _M_get_deleter(const std::type_info& __ti) noexcept
+      _M_get_deleter(const type_info& __ti [[__gnu__::__unused__]]) noexcept
       {
 #if __cpp_rtti
 	// _GLIBCXX_RESOLVE_LIB_DEFECTS
diff --git a/libstdc++-v3/src/c++11/shared_ptr.cc b/libstdc++-v3/src/c++11/shared_ptr.cc
index 13e2d520199..4678fbeffe2 100644
--- a/libstdc++-v3/src/c++11/shared_ptr.cc
+++ b/libstdc++-v3/src/c++11/shared_ptr.cc
@@ -97,7 +97,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #endif
 
   bool
-  _Sp_make_shared_tag::_S_eq(const type_info& ti) noexcept
+  _Sp_make_shared_tag::_S_eq(const type_info& ti [[gnu::unused]]) noexcept
   {
 #if __cpp_rtti
     return ti == typeid(_Sp_make_shared_tag);

                 reply	other threads:[~2021-02-12 14:46 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=YCaUsu0ChpKRhUr9@redhat.com \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@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).