This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] GNU vector unop support
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Ken Werner <ken at linux dot vnet dot ibm dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 6 Oct 2010 16:26:59 -0700
- Subject: Re: [patch] GNU vector unop support
- References: <201009171033.35808.ken@linux.vnet.ibm.com> <20100930185634.GC6213@adacore.com> <201010042251.57223.ken@linux.vnet.ibm.com>
> > 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