public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [pushed] gdb: constify target_stack::is_pushed
@ 2022-09-29 20:42 Simon Marchi
  2022-09-29 22:42 ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Marchi @ 2022-09-29 20:42 UTC (permalink / raw)
  To: gdb-patches

The target_ops parameters here can be made const.

Change-Id: Ibc18b17d6b21d06145251a03e68aca90538117d6
---
 gdb/inferior.h | 2 +-
 gdb/target.h   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/inferior.h b/gdb/inferior.h
index 017800165b4b..bb3aec1e8f80 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -369,7 +369,7 @@ class inferior : public refcounted_object,
   int unpush_target (struct target_ops *t);
 
   /* Returns true if T is pushed in this inferior's target stack.  */
-  bool target_is_pushed (target_ops *t)
+  bool target_is_pushed (const target_ops *t)
   { return m_target_stack.is_pushed (t); }
 
   /* Find the target beneath T in this inferior's target stack.  */
diff --git a/gdb/target.h b/gdb/target.h
index 0b784278c4f8..8e13ada07b6a 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -1385,7 +1385,7 @@ class target_stack
   bool unpush (target_ops *t);
 
   /* Returns true if T is pushed on the target stack.  */
-  bool is_pushed (target_ops *t) const
+  bool is_pushed (const target_ops *t) const
   { return at (t->stratum ()) == t; }
 
   /* Return the target at STRATUM.  */

base-commit: ac9b8c676e9f52c5238bbc61a2cdd27e3d59db10
-- 
2.37.3


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [pushed] gdb: constify target_stack::is_pushed
  2022-09-29 20:42 [pushed] gdb: constify target_stack::is_pushed Simon Marchi
@ 2022-09-29 22:42 ` Tom Tromey
  2022-10-03 13:33   ` Simon Marchi
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2022-09-29 22:42 UTC (permalink / raw)
  To: Simon Marchi via Gdb-patches

>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:

Simon> The target_ops parameters here can be made const.

Simon> -  bool target_is_pushed (target_ops *t)
Simon> +  bool target_is_pushed (const target_ops *t)

Seems like this one could also be const-qualified, like this one is:

Simon> +  bool is_pushed (const target_ops *t) const
Simon>    { return at (t->stratum ()) == t; }

thanks,
Tom

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [pushed] gdb: constify target_stack::is_pushed
  2022-09-29 22:42 ` Tom Tromey
@ 2022-10-03 13:33   ` Simon Marchi
  0 siblings, 0 replies; 3+ messages in thread
From: Simon Marchi @ 2022-10-03 13:33 UTC (permalink / raw)
  To: Tom Tromey, Simon Marchi via Gdb-patches



On 2022-09-29 18:42, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
> 
> Simon> The target_ops parameters here can be made const.
> 
> Simon> -  bool target_is_pushed (target_ops *t)
> Simon> +  bool target_is_pushed (const target_ops *t)
> 
> Seems like this one could also be const-qualified, like this one is:
> 
> Simon> +  bool is_pushed (const target_ops *t) const
> Simon>    { return at (t->stratum ()) == t; }

Thanks, I just pushed a patch that does that.

Simon

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-03 13:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-29 20:42 [pushed] gdb: constify target_stack::is_pushed Simon Marchi
2022-09-29 22:42 ` Tom Tromey
2022-10-03 13:33   ` Simon Marchi

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).