From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18588 invoked by alias); 6 Oct 2010 23:27:10 -0000 Received: (qmail 18580 invoked by uid 22791); 6 Oct 2010 23:27:09 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 06 Oct 2010 23:27:04 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 1F7132BAC37; Wed, 6 Oct 2010 19:27:03 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id xJCv8qhX8XJI; Wed, 6 Oct 2010 19:27:03 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id E14AB2BAC35; Wed, 6 Oct 2010 19:27:02 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 5D81CF5895; Wed, 6 Oct 2010 16:26:59 -0700 (PDT) Date: Wed, 06 Oct 2010 23:27:00 -0000 From: Joel Brobecker To: Ken Werner Cc: gdb-patches@sourceware.org Subject: Re: [patch] GNU vector unop support Message-ID: <20101006232659.GC12651@adacore.com> References: <201009171033.35808.ken@linux.vnet.ibm.com> <20100930185634.GC6213@adacore.com> <201010042251.57223.ken@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201010042251.57223.ken@linux.vnet.ibm.com> User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-10/txt/msg00100.txt.bz2 > > 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 > > * valarith.c (value_pos, value_neg, value_complement): Handle > vector types. > * valops.c (value_one): Likewise. > > testsuite/ChangeLog: > > 2010-10-04 Ken Werner > > * 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