[PATCH v2][PR gdb/24789] Allow pointer arithmetic with integer references
Hannes Domani
ssbssa@yahoo.de
Wed Apr 1 17:17:50 GMT 2020
Am Mittwoch, 1. April 2020, 18:36:47 MESZ hat Tom Tromey <tom@tromey.com> Folgendes geschrieben:
> >>>>> "Hannes" == Hannes Domani via Gdb-patches <gdb-patches@sourceware.org> writes:
>
> Hannes> 2020-04-01 Hannes Domani <ssbssa@yahoo.de>
>
> Hannes> PR gdb/24789
> Hannes> * eval.c (is_integral_or_integral_reference): New function.
> Hannes> (evaluate_subexp_standard): Allow integer references in
> Hannes> pointer arithmetic.
>
> Thank you.
>
> Hannes> +/* Return true if type is integral or reference to integral */
> Hannes> +
> Hannes> +static bool
> Hannes> +is_integral_or_integral_reference (struct type *type)
> Hannes> +{
> Hannes> + if (is_integral_type (type))
> Hannes> + return true;
> Hannes> +
> Hannes> + type = check_typedef (type);
> Hannes> + return type != nullptr
> Hannes> + && TYPE_IS_REFERENCE (type)
> Hannes> + && is_integral_type (TYPE_TARGET_TYPE (type));
>
> This needs parens around the multi-line expression, like:
>
>
> return (type != nullptr
> && TYPE_IS_REFERENCE (type)
> && is_integral_type (TYPE_TARGET_TYPE (type)));
>
>
> The patch is ok with this tweak.
Pushed with this change, thanks.
Hannes
More information about the Gdb-patches
mailing list