]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Remove some unnecessary Ada expression code
authorTom Tromey <tromey@adacore.com>
Thu, 29 Feb 2024 19:07:28 +0000 (12:07 -0700)
committerTom Tromey <tromey@adacore.com>
Mon, 18 Mar 2024 14:32:14 +0000 (08:32 -0600)
ada_bitwise_operation differs from the "usual" bitwise operations only
in that it calls value_cast at the end.  However, because gdb is
generally fairly lax about integer types, and because (perhaps oddly)
C-style binary promotion is done here anyway, it seems to me that this
code isn't needed.

gdb/ada-exp.h
gdb/ada-exp.y

index 1d8615b2e87c3e1c67baffdbc795afd8c0439baf..9abdd6f3f70fdd9b7ec8adb27fe9dd9105a84c2f 100644 (file)
@@ -286,33 +286,6 @@ public:
   { return std::get<0> (m_storage); }
 };
 
-/* Bitwise operators for Ada.  */
-template<enum exp_opcode OP>
-class ada_bitwise_operation
-  : public maybe_constant_operation<operation_up, operation_up>
-{
-public:
-
-  using maybe_constant_operation::maybe_constant_operation;
-
-  value *evaluate (struct type *expect_type,
-                  struct expression *exp,
-                  enum noside noside) override
-  {
-    value *lhs = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
-    value *rhs = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
-    value *result = eval_op_binary (expect_type, exp, noside, OP, lhs, rhs);
-    return value_cast (lhs->type (), result);
-  }
-
-  enum exp_opcode opcode () const override
-  { return OP; }
-};
-
-using ada_bitwise_and_operation = ada_bitwise_operation<BINOP_BITWISE_AND>;
-using ada_bitwise_ior_operation = ada_bitwise_operation<BINOP_BITWISE_IOR>;
-using ada_bitwise_xor_operation = ada_bitwise_operation<BINOP_BITWISE_XOR>;
-
 /* Ada array- or string-slice operation.  */
 class ada_ternop_slice_operation
   : public maybe_constant_operation<operation_up, operation_up, operation_up>,
index ab936ae4733932bde021dca802198cf1055d0869..26963f78884caae71ab5fc3e899f0cdbb51b74d5 100644 (file)
@@ -800,10 +800,10 @@ exp       :       relation
 
 and_exp :
                relation _AND_ relation 
-                       { ada_wrap2<ada_bitwise_and_operation>
+                       { ada_wrap2<bitwise_and_operation>
                            (BINOP_BITWISE_AND); }
        |       and_exp _AND_ relation
-                       { ada_wrap2<ada_bitwise_and_operation>
+                       { ada_wrap2<bitwise_and_operation>
                            (BINOP_BITWISE_AND); }
        ;
 
@@ -818,10 +818,10 @@ and_then_exp :
 
 or_exp :
                relation OR relation 
-                       { ada_wrap2<ada_bitwise_ior_operation>
+                       { ada_wrap2<bitwise_ior_operation>
                            (BINOP_BITWISE_IOR); }
        |       or_exp OR relation
-                       { ada_wrap2<ada_bitwise_ior_operation>
+                       { ada_wrap2<bitwise_ior_operation>
                            (BINOP_BITWISE_IOR); }
        ;
 
@@ -833,10 +833,10 @@ or_else_exp :
        ;
 
 xor_exp :       relation XOR relation
-                       { ada_wrap2<ada_bitwise_xor_operation>
+                       { ada_wrap2<bitwise_xor_operation>
                            (BINOP_BITWISE_XOR); }
        |       xor_exp XOR relation
-                       { ada_wrap2<ada_bitwise_xor_operation>
+                       { ada_wrap2<bitwise_xor_operation>
                            (BINOP_BITWISE_XOR); }
        ;