[patch] GNU vector unop support
Joel Brobecker
brobecker@adacore.com
Wed Oct 6 23:27:00 GMT 2010
> > One question: Is it possible to have a non-array vector type?
> > In other words, can we just check for TYPE_VECTOR (type) instead
> > of TYPE_CODE (type) and TYPE_VECTOR (type)?
>
> No, not that I'm aware of. Even a GNU Vector with a single element
> only is an array underneath. My understanding is that querying the
> flag_vector is only legal if the type is an array.
I feel that this makes the check for the TYPE_CODE a little superfluous.
But at the same time, the code handling vectors then assumes that the
underlying type is an array.
> ChangeLog:
>
> 2010-10-04 Ken Werner <ken.werner@de.ibm.com>
>
> * valarith.c (value_pos, value_neg, value_complement): Handle
> vector types.
> * valops.c (value_one): Likewise.
>
> testsuite/ChangeLog:
>
> 2010-10-04 Ken Werner <ken.werner@de.ibm.com>
>
> * gdb.base/gnu_vector.exp: Add unary operator tests.
This is OK.
If it was just me, I'd probably wrap the checks for vector types
inside a function (such as type_is_vector or vector_type_p), with
a comment explaining the reason why we check for the TYPE_CODE
despite the fact that, normally, all types with the `vector' flag
should be arrays. (this is just a soft suggestion, and to be treated
as a followup patch, if not ignored)
--
Joel
More information about the Gdb-patches
mailing list