X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=gdb%2Fopencl-lang.c;h=5145cd4062efcab463ab00021e53693816744cd5;hb=7124770976d3f051532faf864013b76ab36249bf;hp=b283be173c455b6b826910420eef0b66f7a1288c;hpb=f2a98603a807101722f12b8d7a1aca9651deb133;p=binutils-gdb.git diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c index b283be173c4..5145cd4062e 100644 --- a/gdb/opencl-lang.c +++ b/gdb/opencl-lang.c @@ -1,5 +1,5 @@ /* OpenCL language support for GDB, the GNU debugger. - Copyright (C) 2010-2021 Free Software Foundation, Inc. + Copyright (C) 2010-2022 Free Software Foundation, Inc. Contributed by Ken Werner . @@ -139,8 +139,8 @@ lval_func_read (struct value *v) gdb_assert (n <= c->n); for (i = offset; i < n; i++) - memcpy (value_contents_raw (v) + j++ * elsize, - value_contents (c->val) + c->indices[i] * elsize, + memcpy (value_contents_raw (v).data () + j++ * elsize, + value_contents (c->val).data () + c->indices[i] * elsize, elsize); } @@ -179,8 +179,8 @@ lval_func_write (struct value *v, struct value *fromval) struct value *from_elm_val = allocate_value (eltype); struct value *to_elm_val = value_subscript (c->val, c->indices[i]); - memcpy (value_contents_writeable (from_elm_val), - value_contents (fromval) + j++ * elsize, + memcpy (value_contents_writeable (from_elm_val).data (), + value_contents (fromval).data () + j++ * elsize, elsize); value_assign (to_elm_val, from_elm_val); } @@ -254,6 +254,7 @@ static const struct lval_funcs opencl_value_funcs = { lval_func_read, lval_func_write, + nullptr, NULL, /* indirect */ NULL, /* coerce_ref */ lval_func_check_synthetic_pointer, @@ -314,9 +315,9 @@ create_value (struct gdbarch *gdbarch, struct value *val, enum noside noside, /* Copy src val contents into the destination value. */ for (i = 0; i < n; i++) - memcpy (value_contents_writeable (ret) + memcpy (value_contents_writeable (ret).data () + (i * TYPE_LENGTH (elm_type)), - value_contents (val) + value_contents (val).data () + (indices[i] * TYPE_LENGTH (elm_type)), TYPE_LENGTH (elm_type)); } @@ -472,7 +473,8 @@ opencl_logical_not (struct type *expect_type, struct expression *exp, value of its operand compares unequal to 0, and -1 (i.e. all bits set) if the value of its operand compares equal to 0. */ int tmp = value_logical_not (value_subscript (arg, i)) ? -1 : 0; - memset (value_contents_writeable (ret) + i * TYPE_LENGTH (eltype), + memset ((value_contents_writeable (ret).data () + + i * TYPE_LENGTH (eltype)), tmp, TYPE_LENGTH (eltype)); } } @@ -572,7 +574,8 @@ vector_relop (struct expression *exp, struct value *val1, struct value *val2, if the specified relation is true. */ int tmp = scalar_relop (value_subscript (val1, i), value_subscript (val2, i), op) ? -1 : 0; - memset (value_contents_writeable (ret) + i * TYPE_LENGTH (eltype1), + memset ((value_contents_writeable (ret).data () + + i * TYPE_LENGTH (eltype1)), tmp, TYPE_LENGTH (eltype1)); } @@ -681,7 +684,7 @@ eval_opencl_assign (struct type *expect_type, struct expression *exp, enum noside noside, enum exp_opcode op, struct value *arg1, struct value *arg2) { - if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS) + if (noside == EVAL_AVOID_SIDE_EFFECTS) return arg1; struct type *type1 = value_type (arg1); @@ -708,7 +711,7 @@ opencl_structop_operation::evaluate (struct type *expect_type, noside); else { - struct value *v = value_struct_elt (&arg1, NULL, + struct value *v = value_struct_elt (&arg1, {}, std::get<1> (m_storage).c_str (), NULL, "structure"); @@ -748,7 +751,7 @@ opencl_logical_binop_operation::evaluate (struct type *expect_type, /* For scalar built-in types, only evaluate the right hand operand if the left hand operand compares unequal(&&)/equal(||) to 0. */ - int tmp = value_logical_not (arg1); + bool tmp = value_logical_not (arg1); if (op == BINOP_LOGICAL_OR) tmp = !tmp; @@ -835,8 +838,8 @@ Cannot perform conditional operation on vectors with different sizes")); { tmp = value_logical_not (value_subscript (arg1, i)) ? value_subscript (arg3, i) : value_subscript (arg2, i); - memcpy (value_contents_writeable (ret) + - i * TYPE_LENGTH (eltype2), value_contents_all (tmp), + memcpy (value_contents_writeable (ret).data () + + i * TYPE_LENGTH (eltype2), value_contents_all (tmp).data (), TYPE_LENGTH (eltype2)); } @@ -973,11 +976,6 @@ public: enum macro_expansion macro_expansion () const override { return macro_expansion_c; } - - /* See language.h. */ - - const struct op_print *opcode_print_table () const override - { return c_op_print_tab; } }; /* Single instance of the OpenCL language class. */