From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23377 invoked by alias); 31 Aug 2008 17:52:21 -0000 Received: (qmail 23215 invoked by uid 22791); 31 Aug 2008 17:52:17 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate7.de.ibm.com (HELO mtagate7.de.ibm.com) (195.212.29.156) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 31 Aug 2008 17:51:33 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate7.de.ibm.com (8.13.8/8.13.8) with ESMTP id m7VHpTxr613548 for ; Sun, 31 Aug 2008 17:51:29 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v9.0) with ESMTP id m7VHpUEN3743788 for ; Sun, 31 Aug 2008 19:51:30 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m7VHpTLs020149 for ; Sun, 31 Aug 2008 19:51:29 +0200 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id m7VHpTcC020146 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sun, 31 Aug 2008 19:51:29 +0200 Received: from tuxmaker.boeblingen.de.ibm.com (localhost.localdomain [127.0.0.1]) by tuxmaker.boeblingen.de.ibm.com (8.13.8/8.13.8) with ESMTP id m7VHpTiw002765 for ; Sun, 31 Aug 2008 19:51:29 +0200 Received: (from uweigand@localhost) by tuxmaker.boeblingen.de.ibm.com (8.13.8/8.13.8/Submit) id m7VHpTw7002764 for gdb-patches@sourceware.org; Sun, 31 Aug 2008 19:51:29 +0200 Message-Id: <20080831175129.167385000@de.ibm.com> References: <20080831175045.128504000@de.ibm.com> User-Agent: quilt/0.46-1 Date: Sun, 31 Aug 2008 17:52:00 -0000 From: uweigand@de.ibm.com To: gdb-patches@sourceware.org Subject: [rfc][19/37] Eliminate builtin_type_ macros: Ada range type handling Content-Disposition: inline; filename=diff-type-adaarray 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-08/txt/msg00683.txt.bz2 Hello, two more small changes to ada-lang.c: ada_array_length would simply use builtin_type_int as type of its return value, even though it should probably better use the type of the array bounds. Similarly, ada_evaluate_subexp at one place uses a builtin_type_int to hold bounds of a range type, instead of using the underlying scalar type. Bye, Ulrich ChangeLog: * ada-lang.c (ada_array_length): Use type of array bounds instead of builtin_type_int. (ada_evaluate_subexp): Likewise. Index: gdb-head/gdb/ada-lang.c =================================================================== --- gdb-head.orig/gdb/ada-lang.c +++ gdb-head/gdb/ada-lang.c @@ -2633,12 +2633,13 @@ ada_array_length (struct value *arr, int return value_from_longest (type, v); } else - return - value_from_longest (builtin_type_int, - value_as_long (desc_one_bound (desc_bounds (arr), - n, 1)) - - value_as_long (desc_one_bound (desc_bounds (arr), - n, 0)) + 1); + { + struct value *high = desc_one_bound (desc_bounds (arr), n, 1); + struct value *low = desc_one_bound (desc_bounds (arr), n, 0); + return value_from_longest (value_type (high), + value_as_long (high) + - value_as_long (low) + 1); + } } /* An empty array whose type is that of ARR_TYPE (an array type), @@ -8871,9 +8872,10 @@ ada_evaluate_subexp (struct type *expect return value_from_longest (type, (LONGEST) 1); case TYPE_CODE_RANGE: - arg2 = value_from_longest (builtin_type_int, TYPE_LOW_BOUND (type)); - arg3 = value_from_longest (builtin_type_int, - TYPE_HIGH_BOUND (type)); + arg2 = value_from_longest (TYPE_TARGET_TYPE (type), + TYPE_LOW_BOUND (type)); + arg3 = value_from_longest (TYPE_TARGET_TYPE (type), + TYPE_HIGH_BOUND (type)); binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2); binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg3); type = language_bool_type (exp->language_defn, exp->gdbarch); -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com