[committed] libstdc++: Add always_inline to casting/forwarding functions in bits/move.h

Message ID 20250108130341.263199-1-jwakely@redhat.com
State New
Headers
Series [committed] libstdc++: Add always_inline to casting/forwarding functions in bits/move.h |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 fail Patch failed to apply
linaro-tcwg-bot/tcwg_gcc_build--master-arm fail Patch failed to apply

Commit Message

Jonathan Wakely Jan. 8, 2025, 1:03 p.m. UTC
  libstdc++-v3/ChangeLog:

	* include/bits/move.h (__addressof, forward, forward_like, move)
	(move_if_noexcept, addressof): Add always_inline attribute.
	Replace _GLIBCXX_NODISCARD with [[__nodiscard__]].
---

Tested x86_64-linux. Pushed to trunk.

 libstdc++-v3/include/bits/move.h | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
  

Patch

diff --git a/libstdc++-v3/include/bits/move.h b/libstdc++-v3/include/bits/move.h
index 55a969053d6a..e91b003e6955 100644
--- a/libstdc++-v3/include/bits/move.h
+++ b/libstdc++-v3/include/bits/move.h
@@ -47,6 +47,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
    *  @ingroup utilities
    */
   template<typename _Tp>
+    __attribute__((__always_inline__))
     inline _GLIBCXX_CONSTEXPR _Tp*
     __addressof(_Tp& __r) _GLIBCXX_NOEXCEPT
     { return __builtin_addressof(__r); }
@@ -66,7 +67,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
    *  @since C++11
    */
   template<typename _Tp>
-    _GLIBCXX_NODISCARD
+    [[__nodiscard__,__gnu__::__always_inline__]]
     constexpr _Tp&&
     forward(typename std::remove_reference<_Tp>::type& __t) noexcept
     { return static_cast<_Tp&&>(__t); }
@@ -79,7 +80,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
    *  @since C++11
    */
   template<typename _Tp>
-    _GLIBCXX_NODISCARD
+    [[__nodiscard__,__gnu__::__always_inline__]]
     constexpr _Tp&&
     forward(typename std::remove_reference<_Tp>::type&& __t) noexcept
     {
@@ -119,7 +120,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
    *  @since C++23
    */
   template<typename _Tp, typename _Up>
-  [[nodiscard]]
+  [[nodiscard,__gnu__::__always_inline__]]
   constexpr __like_t<_Tp, _Up>
   forward_like(_Up&& __x) noexcept
   { return static_cast<__like_t<_Tp, _Up>>(__x); }
@@ -132,7 +133,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
    *  @since C++11
   */
   template<typename _Tp>
-    _GLIBCXX_NODISCARD
+    [[__nodiscard__,__gnu__::__always_inline__]]
     constexpr typename std::remove_reference<_Tp>::type&&
     move(_Tp&& __t) noexcept
     { return static_cast<typename std::remove_reference<_Tp>::type&&>(__t); }
@@ -153,7 +154,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
    *  @since C++11
    */
   template<typename _Tp>
-    _GLIBCXX_NODISCARD
+    [[__nodiscard__,__gnu__::__always_inline__]]
     constexpr
     __conditional_t<__move_if_noexcept_cond<_Tp>::value, const _Tp&, _Tp&&>
     move_if_noexcept(_Tp& __x) noexcept
@@ -170,10 +171,10 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
    *  @since C++11
   */
   template<typename _Tp>
-    _GLIBCXX_NODISCARD
+    [[__nodiscard__,__gnu__::__always_inline__]]
     inline _GLIBCXX17_CONSTEXPR _Tp*
     addressof(_Tp& __r) noexcept
-    { return __builtin_addressof(__r); }
+    { return std::__addressof(__r); }
 
   // _GLIBCXX_RESOLVE_LIB_DEFECTS
   // 2598. addressof works on temporaries