libstdc++: Add unused attributes to shared_ptr functions
authorJonathan Wakely <jwakely@redhat.com>
Fri, 12 Feb 2021 10:36:18 +0000 (10:36 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Fri, 12 Feb 2021 14:30:14 +0000 (14:30 +0000)
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.

libstdc++-v3/include/bits/shared_ptr_base.h
libstdc++-v3/src/c++11/shared_ptr.cc

index 15707f8e74a52569a040284d62640eb47ae6735c..b24900b20084587de624950f42e3701f306f314f 100644 (file)
@@ -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
index 13e2d520199b431368e94dde1ee65be3ba60a084..4678fbeffe227c3743b5a3d2b1ac598849d41866 100644 (file)
@@ -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);