From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29459 invoked by alias); 15 May 2009 15:01:43 -0000 Received: (qmail 28936 invoked by uid 22791); 15 May 2009 15:01:42 -0000 X-SWARE-Spam-Status: No, hits=-2.4 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; Fri, 15 May 2009 15:01:38 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 3FB972BAB61; Fri, 15 May 2009 11:01:36 -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 xYzV678UOR29; Fri, 15 May 2009 11:01:36 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 100C82BAB34; Fri, 15 May 2009 11:01:36 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id A6E96F5962; Fri, 15 May 2009 17:01:33 +0200 (CEST) Date: Fri, 15 May 2009 15:01:00 -0000 From: Joel Brobecker To: Ulrich Weigand Cc: gdb-patches@sourceware.org Subject: Re: [rfc] Ada simplification: desc_data_type Message-ID: <20090515150133.GM7292@adacore.com> References: <200905141137.n4EBbSwM004281@d12av02.megacenter.de.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200905141137.n4EBbSwM004281@d12av02.megacenter.de.ibm.com> User-Agent: Mutt/1.5.18 (2008-05-17) 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: 2009-05/txt/msg00325.txt.bz2 > * ada-lang.c (desc_data_type): Remove, replace by ... > (desc_data_target_type): ... this. > (thin_data_pntr): Use desc_data_target_type instead of desc_data_type. > (ada_is_array_descriptor_type): Likewise. > (ada_type_of_array): Likewise. > (ada_coerce_to_simple_array_type): Likewise. > (ada_array_element_type): Likewise. Yes, that looks good to me. Would you mind making a couple of tiny adjustments for me, please? > + { > + struct type *data_type = lookup_struct_elt_type (type, "P_ARRAY", 1); > + if (data_type > + && TYPE_CODE (ada_check_typedef (data_type)) == TYPE_CODE_PTR) > + return TYPE_TARGET_TYPE (data_type); > + } > + > + return NULL; > } Can you add an empty line after the declaration part? Mark usually requests us to follow this style, and I like it, so... > return > data_type != NULL > - && ((TYPE_CODE (data_type) == TYPE_CODE_PTR > - && TYPE_TARGET_TYPE (data_type) != NULL > - && TYPE_CODE (TYPE_TARGET_TYPE (data_type)) == TYPE_CODE_ARRAY) > - || TYPE_CODE (data_type) == TYPE_CODE_ARRAY) > + && TYPE_CODE (data_type) == TYPE_CODE_ARRAY > && desc_arity (desc_bounds_type (type)) > 0; > } Can you bracket the return condition in between parens? This is not strictly necessary, but I remember reading a coding style document that suggests it in order to help formatters such as GNU indent. Independently of gdbarch dependency, the code does look nicer this way. -- Joel