[7/8] Remove unneeded checks on type lengths.
Commit Message
Type lengths are unsigned, so are always greater than zero. A check
against the length of 'tgt_type' is retained to prevent dividing by zero.
---
gdb/ChangeLog | 4 ++++
gdb/v850-tdep.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
Comments
On Sat, Jun 11, 2016 at 9:48 PM, John Baldwin <jhb@freebsd.org> wrote:
> Type lengths are unsigned, so are always greater than zero. A check
The type length can be zero.
> against the length of 'tgt_type' is retained to prevent dividing by zero.
Your patch is good to me.
@@ -1,5 +1,9 @@
2016-06-11 John Baldwin <jhb@FreeBSD.org>
+ * v850-tdep.c (v850_use_struct_convention): Trim type length checks.
+
+2016-06-11 John Baldwin <jhb@FreeBSD.org>
+
* tui/tui-stack.c (tui_show_frame_info): Fix type mismatch.
2016-06-11 John Baldwin <jhb@FreeBSD.org>
@@ -559,7 +559,7 @@ v850_use_struct_convention (struct gdbarch *gdbarch, struct type *type)
if (TYPE_CODE (fld_type) == TYPE_CODE_ARRAY)
{
tgt_type = TYPE_TARGET_TYPE (fld_type);
- if (TYPE_LENGTH (fld_type) >= 0 && TYPE_LENGTH (tgt_type) >= 0
+ if (TYPE_LENGTH (tgt_type) > 0
&& TYPE_LENGTH (fld_type) / TYPE_LENGTH (tgt_type) > 2)
return 1;
}