* [pushed] Remove two unnecessary casts
@ 2022-12-13 15:59 Tom Tromey
0 siblings, 0 replies; 3+ messages in thread
From: Tom Tromey @ 2022-12-13 15:59 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
A couple of calls to parse_probe_linespec had an unnecessary cast. I
suspect this cast was never needed, but once commands were changed to
take a 'const' argument, they became completely obsolete. Tested by
rebuilding.
---
gdb/probe.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gdb/probe.c b/gdb/probe.c
index ec8845219fa..4193f9f936b 100644
--- a/gdb/probe.c
+++ b/gdb/probe.c
@@ -617,7 +617,7 @@ enable_probes_command (const char *arg, int from_tty)
{
std::string provider, probe_name, objname;
- parse_probe_linespec ((const char *) arg, &provider, &probe_name, &objname);
+ parse_probe_linespec (arg, &provider, &probe_name, &objname);
std::vector<bound_probe> probes
= collect_probes (objname, provider, probe_name, &any_static_probe_ops);
@@ -652,7 +652,7 @@ disable_probes_command (const char *arg, int from_tty)
{
std::string provider, probe_name, objname;
- parse_probe_linespec ((const char *) arg, &provider, &probe_name, &objname);
+ parse_probe_linespec (arg, &provider, &probe_name, &objname);
std::vector<bound_probe> probes
= collect_probes (objname, provider, probe_name, &any_static_probe_ops);
--
2.34.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [pushed] Remove two unnecessary casts
2024-02-26 20:52 Tom Tromey
@ 2024-02-27 23:17 ` John Baldwin
0 siblings, 0 replies; 3+ messages in thread
From: John Baldwin @ 2024-02-27 23:17 UTC (permalink / raw)
To: Tom Tromey, gdb-patches
On 2/26/24 12:52 PM, Tom Tromey wrote:
> I noticed a spot in ada-lang.c where the return value of
> value_as_address was cast to CORE_ADDR -- a no-op cast. I searched
> and found another. This patch fixes both.
> ---
> gdb/ada-lang.c | 2 +-
> gdb/eval.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
> index 3f398540010..1c26ebf7b30 100644
> --- a/gdb/ada-lang.c
> +++ b/gdb/ada-lang.c
> @@ -10993,7 +10993,7 @@ ada_unop_ind_operation::evaluate (struct type *expect_type,
> arg1));
> else
> return value_at_lazy (builtin_type (exp->gdbarch)->builtin_int,
> - (CORE_ADDR) value_as_address (arg1));
> + value_as_address (arg1));
> }
>
> if (ada_is_array_descriptor_type (type))
> diff --git a/gdb/eval.c b/gdb/eval.c
> index 4c438f927c0..2759b46a5df 100644
> --- a/gdb/eval.c
> +++ b/gdb/eval.c
> @@ -1685,7 +1685,7 @@ eval_op_ind (struct type *expect_type, struct expression *exp,
> BUILTIN_TYPE_LONGEST would seem to be a mistake. */
> if (type->code () == TYPE_CODE_INT)
> return value_at_lazy (builtin_type (exp->gdbarch)->builtin_int,
> - (CORE_ADDR) value_as_address (arg1));
> + value_as_address (arg1));
> return value_ind (arg1);
> }
>
LGTM
Approved-By: John Baldwin <jhb@FreeBSD.org>
--
John Baldwin
^ permalink raw reply [flat|nested] 3+ messages in thread
* [pushed] Remove two unnecessary casts
@ 2024-02-26 20:52 Tom Tromey
2024-02-27 23:17 ` John Baldwin
0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2024-02-26 20:52 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
I noticed a spot in ada-lang.c where the return value of
value_as_address was cast to CORE_ADDR -- a no-op cast. I searched
and found another. This patch fixes both.
---
gdb/ada-lang.c | 2 +-
gdb/eval.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 3f398540010..1c26ebf7b30 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -10993,7 +10993,7 @@ ada_unop_ind_operation::evaluate (struct type *expect_type,
arg1));
else
return value_at_lazy (builtin_type (exp->gdbarch)->builtin_int,
- (CORE_ADDR) value_as_address (arg1));
+ value_as_address (arg1));
}
if (ada_is_array_descriptor_type (type))
diff --git a/gdb/eval.c b/gdb/eval.c
index 4c438f927c0..2759b46a5df 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -1685,7 +1685,7 @@ eval_op_ind (struct type *expect_type, struct expression *exp,
BUILTIN_TYPE_LONGEST would seem to be a mistake. */
if (type->code () == TYPE_CODE_INT)
return value_at_lazy (builtin_type (exp->gdbarch)->builtin_int,
- (CORE_ADDR) value_as_address (arg1));
+ value_as_address (arg1));
return value_ind (arg1);
}
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-02-27 23:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-13 15:59 [pushed] Remove two unnecessary casts Tom Tromey
2024-02-26 20:52 Tom Tromey
2024-02-27 23:17 ` John Baldwin
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).