public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Remove dead code from scalar_binop
@ 2023-03-01 21:27 Tom Tromey
  2023-03-10 23:38 ` Kevin Buettner
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Tromey @ 2023-03-01 21:27 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

scalar_binop has code for "&&" and "||", but I think this code can't
currently be run -- and, furthermore, it doesn't make sense to have
this code here, as the point of these operators is to short-circuit
evaluation.

This patch removes the dead code.

Regression tested on x86-64 Fedora 36.
---
 gdb/valarith.c | 16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/gdb/valarith.c b/gdb/valarith.c
index 6ea0cd9e8d1..ad53febcedc 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -1331,14 +1331,6 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
 	      v = v1 ^ v2;
 	      break;
 
-	    case BINOP_LOGICAL_AND:
-	      v = v1 && v2;
-	      break;
-
-	    case BINOP_LOGICAL_OR:
-	      v = v1 || v2;
-	      break;
-
 	    case BINOP_MIN:
 	      v = v1 < v2 ? v1 : v2;
 	      break;
@@ -1492,14 +1484,6 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
 	      v = v1 ^ v2;
 	      break;
 
-	    case BINOP_LOGICAL_AND:
-	      v = v1 && v2;
-	      break;
-
-	    case BINOP_LOGICAL_OR:
-	      v = v1 || v2;
-	      break;
-
 	    case BINOP_MIN:
 	      v = v1 < v2 ? v1 : v2;
 	      break;
-- 
2.39.1


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

* Re: [PATCH] Remove dead code from scalar_binop
  2023-03-01 21:27 [PATCH] Remove dead code from scalar_binop Tom Tromey
@ 2023-03-10 23:38 ` Kevin Buettner
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Buettner @ 2023-03-10 23:38 UTC (permalink / raw)
  To: Tom Tromey via Gdb-patches; +Cc: Tom Tromey

On Wed,  1 Mar 2023 14:27:08 -0700
Tom Tromey via Gdb-patches <gdb-patches@sourceware.org> wrote:

> scalar_binop has code for "&&" and "||", but I think this code can't
> currently be run -- and, furthermore, it doesn't make sense to have
> this code here, as the point of these operators is to short-circuit
> evaluation.

Agreed, on both points.  (Though it took me a while to convince myself
that it couldn't currently be run.)

Approved-by: Kevin Buettner <kevinb@redhat.com>


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

end of thread, other threads:[~2023-03-10 23:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-01 21:27 [PATCH] Remove dead code from scalar_binop Tom Tromey
2023-03-10 23:38 ` Kevin Buettner

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