From 2b4cc19bd58b3957ed8b95b4d67b135233c147a1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Krystian=20Ku=C5=BAniarek?= Date: Thu, 10 Sep 2020 17:09:15 +0100 Subject: [PATCH] libstdc++: Add unused attributes to suppress warnings libstdc++-v3/ChangeLog: * include/bits/atomic_base.h: Fix -Wunused-variable warnings. * include/ext/new_allocator.h: Fix -Wunused-parameter warnings. --- libstdc++-v3/include/bits/atomic_base.h | 66 ++++++++++++++++-------- libstdc++-v3/include/ext/new_allocator.h | 2 +- 2 files changed, 45 insertions(+), 23 deletions(-) diff --git a/libstdc++-v3/include/bits/atomic_base.h b/libstdc++-v3/include/bits/atomic_base.h index 015acef83c4..2cdd2bd6cae 100644 --- a/libstdc++-v3/include/bits/atomic_base.h +++ b/libstdc++-v3/include/bits/atomic_base.h @@ -231,7 +231,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_ALWAYS_INLINE void clear(memory_order __m = memory_order_seq_cst) noexcept { - memory_order __b = __m & __memory_order_mask; + memory_order __b __attribute__ ((__unused__)) + = __m & __memory_order_mask; __glibcxx_assert(__b != memory_order_consume); __glibcxx_assert(__b != memory_order_acquire); __glibcxx_assert(__b != memory_order_acq_rel); @@ -242,7 +243,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_ALWAYS_INLINE void clear(memory_order __m = memory_order_seq_cst) volatile noexcept { - memory_order __b = __m & __memory_order_mask; + memory_order __b __attribute__ ((__unused__)) + = __m & __memory_order_mask; __glibcxx_assert(__b != memory_order_consume); __glibcxx_assert(__b != memory_order_acquire); __glibcxx_assert(__b != memory_order_acq_rel); @@ -416,7 +418,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_ALWAYS_INLINE void store(__int_type __i, memory_order __m = memory_order_seq_cst) noexcept { - memory_order __b = __m & __memory_order_mask; + memory_order __b __attribute__ ((__unused__)) + = __m & __memory_order_mask; __glibcxx_assert(__b != memory_order_acquire); __glibcxx_assert(__b != memory_order_acq_rel); __glibcxx_assert(__b != memory_order_consume); @@ -428,7 +431,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION store(__int_type __i, memory_order __m = memory_order_seq_cst) volatile noexcept { - memory_order __b = __m & __memory_order_mask; + memory_order __b __attribute__ ((__unused__)) + = __m & __memory_order_mask; __glibcxx_assert(__b != memory_order_acquire); __glibcxx_assert(__b != memory_order_acq_rel); __glibcxx_assert(__b != memory_order_consume); @@ -439,7 +443,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_ALWAYS_INLINE __int_type load(memory_order __m = memory_order_seq_cst) const noexcept { - memory_order __b = __m & __memory_order_mask; + memory_order __b __attribute__ ((__unused__)) + = __m & __memory_order_mask; __glibcxx_assert(__b != memory_order_release); __glibcxx_assert(__b != memory_order_acq_rel); @@ -449,7 +454,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_ALWAYS_INLINE __int_type load(memory_order __m = memory_order_seq_cst) const volatile noexcept { - memory_order __b = __m & __memory_order_mask; + memory_order __b __attribute__ ((__unused__)) + = __m & __memory_order_mask; __glibcxx_assert(__b != memory_order_release); __glibcxx_assert(__b != memory_order_acq_rel); @@ -475,8 +481,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION compare_exchange_weak(__int_type& __i1, __int_type __i2, memory_order __m1, memory_order __m2) noexcept { - memory_order __b2 = __m2 & __memory_order_mask; - memory_order __b1 = __m1 & __memory_order_mask; + memory_order __b2 __attribute__ ((__unused__)) + = __m2 & __memory_order_mask; + memory_order __b1 __attribute__ ((__unused__)) + = __m1 & __memory_order_mask; __glibcxx_assert(__b2 != memory_order_release); __glibcxx_assert(__b2 != memory_order_acq_rel); __glibcxx_assert(__b2 <= __b1); @@ -490,8 +498,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION memory_order __m1, memory_order __m2) volatile noexcept { - memory_order __b2 = __m2 & __memory_order_mask; - memory_order __b1 = __m1 & __memory_order_mask; + memory_order __b2 __attribute__ ((__unused__)) + = __m2 & __memory_order_mask; + memory_order __b1 __attribute__ ((__unused__)) + = __m1 & __memory_order_mask; __glibcxx_assert(__b2 != memory_order_release); __glibcxx_assert(__b2 != memory_order_acq_rel); __glibcxx_assert(__b2 <= __b1); @@ -520,8 +530,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION compare_exchange_strong(__int_type& __i1, __int_type __i2, memory_order __m1, memory_order __m2) noexcept { - memory_order __b2 = __m2 & __memory_order_mask; - memory_order __b1 = __m1 & __memory_order_mask; + memory_order __b2 __attribute__ ((__unused__)) + = __m2 & __memory_order_mask; + memory_order __b1 __attribute__ ((__unused__)) + = __m1 & __memory_order_mask; __glibcxx_assert(__b2 != memory_order_release); __glibcxx_assert(__b2 != memory_order_acq_rel); __glibcxx_assert(__b2 <= __b1); @@ -535,8 +547,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION memory_order __m1, memory_order __m2) volatile noexcept { - memory_order __b2 = __m2 & __memory_order_mask; - memory_order __b1 = __m1 & __memory_order_mask; + memory_order __b2 __attribute__ ((__unused__)) + = __m2 & __memory_order_mask; + memory_order __b1 __attribute__ ((__unused__)) + = __m1 & __memory_order_mask; __glibcxx_assert(__b2 != memory_order_release); __glibcxx_assert(__b2 != memory_order_acq_rel); @@ -736,7 +750,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION store(__pointer_type __p, memory_order __m = memory_order_seq_cst) noexcept { - memory_order __b = __m & __memory_order_mask; + memory_order __b __attribute__ ((__unused__)) + = __m & __memory_order_mask; __glibcxx_assert(__b != memory_order_acquire); __glibcxx_assert(__b != memory_order_acq_rel); @@ -749,7 +764,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION store(__pointer_type __p, memory_order __m = memory_order_seq_cst) volatile noexcept { - memory_order __b = __m & __memory_order_mask; + memory_order __b __attribute__ ((__unused__)) + = __m & __memory_order_mask; __glibcxx_assert(__b != memory_order_acquire); __glibcxx_assert(__b != memory_order_acq_rel); __glibcxx_assert(__b != memory_order_consume); @@ -760,7 +776,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_ALWAYS_INLINE __pointer_type load(memory_order __m = memory_order_seq_cst) const noexcept { - memory_order __b = __m & __memory_order_mask; + memory_order __b __attribute__ ((__unused__)) + = __m & __memory_order_mask; __glibcxx_assert(__b != memory_order_release); __glibcxx_assert(__b != memory_order_acq_rel); @@ -770,7 +787,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_ALWAYS_INLINE __pointer_type load(memory_order __m = memory_order_seq_cst) const volatile noexcept { - memory_order __b = __m & __memory_order_mask; + memory_order __b __attribute__ ((__unused__)) + = __m & __memory_order_mask; __glibcxx_assert(__b != memory_order_release); __glibcxx_assert(__b != memory_order_acq_rel); @@ -797,8 +815,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION memory_order __m1, memory_order __m2) noexcept { - memory_order __b2 = __m2 & __memory_order_mask; - memory_order __b1 = __m1 & __memory_order_mask; + memory_order __b2 __attribute__ ((__unused__)) + = __m2 & __memory_order_mask; + memory_order __b1 __attribute__ ((__unused__)) + = __m1 & __memory_order_mask; __glibcxx_assert(__b2 != memory_order_release); __glibcxx_assert(__b2 != memory_order_acq_rel); __glibcxx_assert(__b2 <= __b1); @@ -812,8 +832,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION memory_order __m1, memory_order __m2) volatile noexcept { - memory_order __b2 = __m2 & __memory_order_mask; - memory_order __b1 = __m1 & __memory_order_mask; + memory_order __b2 __attribute__ ((__unused__)) + = __m2 & __memory_order_mask; + memory_order __b1 __attribute__ ((__unused__)) + = __m1 & __memory_order_mask; __glibcxx_assert(__b2 != memory_order_release); __glibcxx_assert(__b2 != memory_order_acq_rel); diff --git a/libstdc++-v3/include/ext/new_allocator.h b/libstdc++-v3/include/ext/new_allocator.h index 131718b8b2f..2e21a98409f 100644 --- a/libstdc++-v3/include/ext/new_allocator.h +++ b/libstdc++-v3/include/ext/new_allocator.h @@ -117,7 +117,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // __p is not permitted to be a null pointer. void - deallocate(_Tp* __p, size_type __t) + deallocate(_Tp* __p, size_type __t __attribute__ ((__unused__))) { #if __cpp_aligned_new if (alignof(_Tp) > __STDCPP_DEFAULT_NEW_ALIGNMENT__) -- 2.30.2