From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30617 invoked by alias); 9 Sep 2008 22:08:27 -0000 Received: (qmail 30514 invoked by uid 22791); 9 Sep 2008 22:08:26 -0000 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 09 Sep 2008 22:07:52 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 563652A966F; Tue, 9 Sep 2008 18:07:50 -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 pHB0ltYUPBZ6; Tue, 9 Sep 2008 18:07:50 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 1CC8C2A9657; Tue, 9 Sep 2008 18:07:50 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id CA5ECE7ACD; Wed, 10 Sep 2008 00:07:47 +0200 (CEST) Date: Tue, 09 Sep 2008 22:08:00 -0000 From: Joel Brobecker To: Ulrich Weigand Cc: gdb-patches@sourceware.org Subject: Re: [rfc][19/37] Eliminate builtin_type_ macros: Ada range type handling Message-ID: <20080909220747.GJ12222@adacore.com> References: <20080909175934.GE12222@adacore.com> <200809092016.m89KGp49023924@d12av02.megacenter.de.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200809092016.m89KGp49023924@d12av02.megacenter.de.ibm.com> User-Agent: Mutt/1.4.2.2i 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: 2008-09/txt/msg00199.txt.bz2 > > It just occured to me that, since this is a TYPE_CODE_RANGE, can't > > we just use its type? A TYPE_CODE_RANGE should always be some kind > > of "integer" type, so why not use that when calling value_from_longest? > > I have this awful feeling that we're missing something, but I don't > > see what. Do you see anything wrong with that? First, I need to correct myself - ranges are not just for integral types. You can have a range over any discrete type, which means things like this: type Digit is (Zero, One, Two, ...); subtype Binary is Digit range (Zero .. One); In this case, Binary would be defined as a subrange of the enumeration type. However, after thinking about it awhile, I don't think that enumeration types are that different from integral types in terms of comparison and range check. That being said: > Well, the only effect going through GDB values to perform the > comparison has is to do the appropriate type promotions. However, if > this doesn't actually apply for Ada, I'm wondering why we don't simply > do the comparison on integral LONGEST values directly, like in the > patch below? The only problem that I see is when the base type of the range type is unsigned. value_less is supposed to be able to handle such cases, whereas converting the bounds to a LONGEST might cause some problems, no? -- Joel