[binutils-gdb] Introduce opencl_notequal_operation

Tom Tromey tromey@sourceware.org
Mon Mar 8 14:50:19 GMT 2021


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2492ba36f690fa6ce584132dce3e2f26fbb89f87

commit 2492ba36f690fa6ce584132dce3e2f26fbb89f87
Author: Tom Tromey <tom@tromey.com>
Date:   Mon Mar 8 07:27:57 2021 -0700

    Introduce opencl_notequal_operation
    
    This adds the opencl_notequal_operation typedef, implementing "!=" for
    OpenCL.
    
    gdb/ChangeLog
    2021-03-08  Tom Tromey  <tom@tromey.com>
    
            * opencl-lang.c (opencl_logical_not): No longer static.  Change
            parameters.
            (evaluate_subexp_opencl): Update.
            * c-exp.h (opencl_notequal_operation): New typedef.

Diff:
---
 gdb/ChangeLog     | 7 +++++++
 gdb/c-exp.h       | 8 ++++++++
 gdb/opencl-lang.c | 8 +++++---
 3 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f463829b0cc..257f881e1cd 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2021-03-08  Tom Tromey  <tom@tromey.com>
+
+	* opencl-lang.c (opencl_logical_not): No longer static.  Change
+	parameters.
+	(evaluate_subexp_opencl): Update.
+	* c-exp.h (opencl_notequal_operation): New typedef.
+
 2021-03-08  Tom Tromey  <tom@tromey.com>
 
 	* opencl-lang.c (opencl_relop, eval_opencl_assign): No longer
diff --git a/gdb/c-exp.h b/gdb/c-exp.h
index dc92e7a49a8..1afe2d2fbee 100644
--- a/gdb/c-exp.h
+++ b/gdb/c-exp.h
@@ -38,6 +38,11 @@ extern struct value *opencl_relop (struct type *expect_type,
 				   struct expression *exp,
 				   enum noside noside, enum exp_opcode op,
 				   struct value *arg1, struct value *arg2);
+extern struct value *opencl_logical_not (struct type *expect_type,
+					 struct expression *exp,
+					 enum noside noside,
+					 enum exp_opcode op,
+					 struct value *arg);
 
 namespace expr
 {
@@ -162,6 +167,9 @@ using opencl_geq_operation = opencl_binop_operation<BINOP_GEQ,
 using opencl_leq_operation = opencl_binop_operation<BINOP_LEQ,
 						    opencl_relop>;
 
+using opencl_not_operation = unop_operation<UNOP_LOGICAL_NOT,
+					    opencl_logical_not>;
+
 }/* namespace expr */
 
 #endif /* C_EXP_H */
diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c
index 01456055015..8ddcd76c589 100644
--- a/gdb/opencl-lang.c
+++ b/gdb/opencl-lang.c
@@ -441,8 +441,10 @@ opencl_component_ref (struct expression *exp, struct value *val,
 
 /* Perform the unary logical not (!) operation.  */
 
-static struct value *
-opencl_logical_not (struct expression *exp, struct value *arg)
+struct value *
+opencl_logical_not (struct type *expect_type, struct expression *exp,
+		    enum noside noside, enum exp_opcode op,
+		    struct value *arg)
 {
   struct type *type = check_typedef (value_type (arg));
   struct type *rettype;
@@ -765,7 +767,7 @@ evaluate_subexp_opencl (struct type *expect_type, struct expression *exp,
 	return value_from_longest (builtin_type (exp->gdbarch)->
 				   builtin_int, 1);
 
-      return opencl_logical_not (exp, arg1);
+      return opencl_logical_not (expect_type, exp, noside, op, arg1);
 
     /* Handle the logical operator and(&&) and or(||).  */
     case BINOP_LOGICAL_AND:


More information about the Gdb-cvs mailing list