Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH 8/9] Use std::forward in fortran_array_walker
Date: Sat, 04 Jul 2026 16:05:22 -0600	[thread overview]
Message-ID: <20260704-print-opts-cleanup-v1-8-fb54a5112a8d@tromey.com> (raw)
In-Reply-To: <20260704-print-opts-cleanup-v1-0-fb54a5112a8d@tromey.com>

This changes fortran_array_walker to std::forward some arguments.
This isn't needed in the current tree, but is needed to make the next
patch work correctly.

Sometime earlier this year I had a patch where I ended up removing the
use of std::forward.  After debugging this case, I tend to think that
if a function uses variadic template parameters, then it should always
use the "&&" and std::forward to pass them on, just because this is
more future-proof -- one never knows when one might need this.
---
 gdb/f-array-walker.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/f-array-walker.h b/gdb/f-array-walker.h
index 4392e54013b..e7deef8ac5a 100644
--- a/gdb/f-array-walker.h
+++ b/gdb/f-array-walker.h
@@ -195,10 +195,10 @@ class fortran_array_walker
      template parameter class IMPL.  */
   template <typename ...Args>
   fortran_array_walker (struct type *type, CORE_ADDR address,
-			Args... args)
+			Args&&... args)
     : m_type (type),
       m_address (address),
-      m_impl (type, address, args...),
+      m_impl (type, address, std::forward<Args> (args)...),
       m_ndimensions (calc_f77_array_dims (m_type)),
       m_nss (0)
   { /* Nothing.  */ }

-- 
2.49.0


  parent reply	other threads:[~2026-07-04 22:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-04 22:05 [PATCH 0/9] Some cleanups and C++-ification of value_print_options Tom Tromey
2026-07-04 22:05 ` [PATCH 1/9] Return value_print_options from get_formatted_print_options Tom Tromey
2026-07-04 22:05 ` [PATCH 2/9] Return value_print_options from get_no_prettyformat_print_options Tom Tromey
2026-07-04 22:05 ` [PATCH 3/9] Convert get_user_print_options Tom Tromey
2026-07-04 22:05 ` [PATCH 4/9] Return a const reference from gdbpy_get_print_options Tom Tromey
2026-07-04 22:05 ` [PATCH 5/9] Return value_print_options from varobj_formatted_print_options Tom Tromey
2026-07-04 22:05 ` [PATCH 6/9] Use 'const' with some value_print_options Tom Tromey
2026-07-04 22:05 ` [PATCH 7/9] Don't use 'struct' keyword with value_print_options Tom Tromey
2026-07-04 22:05 ` Tom Tromey [this message]
2026-07-04 22:05 ` [PATCH 9/9] Use references for value_print_options Tom Tromey

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=20260704-print-opts-cleanup-v1-8-fb54a5112a8d@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.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