I forgot to include fixes for review comments I got before pushing the
previous commits (or I pushed the wrong commits). This one fixes it.
- Return {} instead of false in get_discrete_low_bound and
get_discrete_high_bound.
- Compute high bound after confirming low bound is valid in
get_discrete_bounds.
gdb/ChangeLog:
* gdbtypes.c (get_discrete_low_bound, get_discrete_high_bound):
Return {} instead of false.
(get_discrete_bounds): Compute high bound only if low bound is
valid.
Change-Id: I5f9a66b3672adfac9441068c899ab113ab2c331a
+2020-12-09 Simon Marchi <simon.marchi@polymtl.ca>
+
+ * gdbtypes.c (get_discrete_low_bound, get_discrete_high_bound):
+ Return {} instead of false.
+ (get_discrete_bounds): Compute high bound only if low bound is
+ valid.
+
2020-12-09 Simon Marchi <simon.marchi@efficios.com>
PR 26875, PR 26901
case TYPE_CODE_INT:
if (TYPE_LENGTH (type) > sizeof (LONGEST)) /* Too big */
- return false;
+ return {};
if (!type->is_unsigned ())
return -(1 << (TYPE_LENGTH (type) * TARGET_CHAR_BIT - 1));
return 0;
default:
- return false;
+ return {};
}
}
case TYPE_CODE_INT:
if (TYPE_LENGTH (type) > sizeof (LONGEST)) /* Too big */
- return false;
+ return {};
if (!type->is_unsigned ())
{
}
default:
- return false;
+ return {};
}
}
get_discrete_bounds (struct type *type, LONGEST *lowp, LONGEST *highp)
{
gdb::optional<LONGEST> low = get_discrete_low_bound (type);
- gdb::optional<LONGEST> high = get_discrete_high_bound (type);
+ if (!low.has_value ())
+ return false;
- if (!low.has_value () || !high.has_value ())
+ gdb::optional<LONGEST> high = get_discrete_high_bound (type);
+ if (!high.has_value ())
return false;
*lowp = *low;