From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [PATCH 3/4] Remove eval_op_concat
Date: Tue, 15 Mar 2022 07:24:59 -0600 [thread overview]
Message-ID: <20220315132500.1032991-4-tromey@adacore.com> (raw)
In-Reply-To: <20220315132500.1032991-1-tromey@adacore.com>
eval_op_concat has code to search for an operator overload of
BINOP_CONCAT. However, the operator overloading code is specific to
C++, which does not have this operator. And,
binop_types_user_defined_p rejects this case right at the start, and
value_x_binop does not handle this case. I think this code has been
dead for a very long time. This patch removes it and hoists the
remaining call into concatenation::evaluate, removing eval_op_concat
entirely.
---
gdb/eval.c | 12 ------------
gdb/expop.h | 6 +-----
gdb/valarith.c | 2 +-
3 files changed, 2 insertions(+), 18 deletions(-)
diff --git a/gdb/eval.c b/gdb/eval.c
index b7b8915fa89..266a4f7699f 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -1106,18 +1106,6 @@ eval_op_objc_selector (struct type *expect_type, struct expression *exp,
lookup_child_selector (exp->gdbarch, sel));
}
-/* Helper function that implements the body of BINOP_CONCAT. */
-
-struct value *
-eval_op_concat (struct type *expect_type, struct expression *exp,
- enum noside noside, struct value *arg1, struct value *arg2)
-{
- if (binop_user_defined_p (BINOP_CONCAT, arg1, arg2))
- return value_x_binop (arg1, arg2, BINOP_CONCAT, OP_NULL, noside);
- else
- return value_concat (arg1, arg2);
-}
-
/* A helper function for TERNOP_SLICE. */
struct value *
diff --git a/gdb/expop.h b/gdb/expop.h
index 1592568a857..d903ab0bb7e 100644
--- a/gdb/expop.h
+++ b/gdb/expop.h
@@ -83,10 +83,6 @@ extern struct value *eval_op_member (struct type *expect_type,
struct expression *exp,
enum noside noside,
struct value *arg1, struct value *arg2);
-extern struct value *eval_op_concat (struct type *expect_type,
- struct expression *exp,
- enum noside noside,
- struct value *arg1, struct value *arg2);
extern struct value *eval_op_add (struct type *expect_type,
struct expression *exp,
enum noside noside,
@@ -1158,7 +1154,7 @@ class concat_operation
= std::get<0> (m_storage)->evaluate_with_coercion (exp, noside);
value *rhs
= std::get<1> (m_storage)->evaluate_with_coercion (exp, noside);
- return eval_op_concat (expect_type, exp, noside, lhs, rhs);
+ return value_concat (lhs, rhs);
}
enum exp_opcode opcode () const override
diff --git a/gdb/valarith.c b/gdb/valarith.c
index e13db10ab55..791c1cd9a06 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -252,7 +252,7 @@ int
binop_types_user_defined_p (enum exp_opcode op,
struct type *type1, struct type *type2)
{
- if (op == BINOP_ASSIGN || op == BINOP_CONCAT)
+ if (op == BINOP_ASSIGN)
return 0;
type1 = check_typedef (type1);
--
2.34.1
next prev parent reply other threads:[~2022-03-15 13:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-15 13:24 [PATCH 0/4] Some wide string improvements for Ada Tom Tromey
2022-03-15 13:24 ` [PATCH 1/4] Remove eval_op_string Tom Tromey
2022-03-16 11:57 ` Andrew Burgess
2022-03-15 13:24 ` [PATCH 2/4] Ada support for wide strings Tom Tromey
2022-03-16 12:12 ` Andrew Burgess
2022-03-15 13:24 ` Tom Tromey [this message]
2022-03-16 13:32 ` [PATCH 3/4] Remove eval_op_concat Andrew Burgess
2022-03-15 13:25 ` [PATCH 4/4] Reimplement array concatenation for Ada and D Tom Tromey
2022-03-15 14:32 ` Eli Zaretskii
2022-03-16 13:55 ` Andrew Burgess
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=20220315132500.1032991-4-tromey@adacore.com \
--to=tromey@adacore.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).