Add '==' and '!=' operators for the struct riscv_gdb_features,
allowing a small simplification.
gdb/ChangeLog:
* arch/riscv.h (riscv_gdb_features::operator==): New.
(riscv_gdb_features::operator!=): New.
* riscv-tdep.c (riscv_gdbarch_init): Make use of the inequality
operator.
+2018-11-30 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * arch/riscv.h (riscv_gdb_features::operator==): New.
+ (riscv_gdb_features::operator!=): New.
+ * riscv-tdep.c (riscv_gdbarch_init): Make use of the inequality
+ operator.
+
2018-11-30 Andrew Burgess <andrew.burgess@embecosm.com>
* arch/riscv.h (riscv_create_target_description): Make return type
this field is true then the hardware floating point abi is in use, and
values are passed in f-registers matching the size of FLEN. */
bool hw_float_abi = false;
+
+ /* Equality operator. */
+ bool operator== (const struct riscv_gdbarch_features &rhs) const
+ {
+ return (xlen == rhs.xlen && flen == rhs.flen
+ && hw_float_abi == rhs.hw_float_abi);
+ }
+
+ /* Inequality operator. */
+ bool operator!= (const struct riscv_gdbarch_features &rhs) const
+ {
+ return !((*this) == rhs);
+ }
};
/* Create and return a target description that is compatible with
gdbarch. */
struct gdbarch_tdep *other_tdep = gdbarch_tdep (arches->gdbarch);
- if (other_tdep->features.hw_float_abi != features.hw_float_abi
- || other_tdep->features.xlen != features.xlen
- || other_tdep->features.flen != features.flen)
+ if (other_tdep->features != features)
continue;
break;