From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5553 invoked by alias); 1 Jul 2014 16:05:00 -0000 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 Received: (qmail 5534 invoked by uid 89); 1 Jul 2014 16:04:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 01 Jul 2014 16:04:57 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s61G4tlY010064 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 1 Jul 2014 12:04:55 -0400 Received: from barimba (ovpn-113-95.phx2.redhat.com [10.3.113.95]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s61G4rWp015602 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Tue, 1 Jul 2014 12:04:54 -0400 From: Tom Tromey To: Mark Wielaard Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Handle volatile array types in dwarf2read.c. References: <1404164071-24432-1-git-send-email-mjw@redhat.com> Date: Tue, 01 Jul 2014 16:05:00 -0000 In-Reply-To: <1404164071-24432-1-git-send-email-mjw@redhat.com> (Mark Wielaard's message of "Mon, 30 Jun 2014 23:34:31 +0200") Message-ID: <87simlrroa.fsf@fleche.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2014-07/txt/msg00014.txt.bz2 >>>>> "Mark" == Mark Wielaard writes: Mark> read_tag_const_type propagates the cv-qualifier to the array Mark> element type, but read_tag_volatile_type didn't. Make sure that Mark> both cv-qualifiers that apply to array types are handled the same. Thanks Mark. Mark> * gdb.base/constvars.c (violent, violet, vips, virgen, vulgar, Mark> vulture, vilify, villar): New volatile array constants. Mark> (vindictive, vegetation): New const volatile array constants. Lovely names. Mark> + the cv-qualifiers. This is mimics section 6.7.3 of the C99 Mark> + specification. */ "This is" -> "This". Mark> +static struct type * Mark> +add_array_cv_type (struct die_info *die, struct dwarf2_cu *cu, Mark> + struct type *base_type, int cnst, int voltl) gdb usually puts a blank line between the intro comment and the function head. Mark> + while (TYPE_CODE (TYPE_TARGET_TYPE (inner_array)) == TYPE_CODE_ARRAY) Mark> + { Mark> + TYPE_TARGET_TYPE (inner_array) = Mark> + copy_type (TYPE_TARGET_TYPE (inner_array)); Mark> + inner_array = TYPE_TARGET_TYPE (inner_array); Mark> + } I think this may be overly eager in the case where the underlying type already has the needed qualifications. Mark> + cnst |= TYPE_CONST (el_type); Mark> + voltl |= TYPE_VOLATILE (el_type); Mark> + TYPE_TARGET_TYPE (inner_array) = make_cv_type (cnst, voltl, el_type, NULL); make_cv_type preserves the already existing qualifiers so you don't need to track "cnst" and "voltl". You can just pass in the ones you want to add. Mark> + /* In case the volatile qualifier is applied to an array type, the Mark> + element type is so qualified, not the array type (section 6.7.3 Mark> + of C99). */ Mark> + if (TYPE_CODE (base_type) == TYPE_CODE_ARRAY) Mark> + return add_array_cv_type (die, cu, base_type, 0, 1); I wonder about typedefs to array type. Calling check_typedef here is probably not so great but I assume we can just ignore incomplete types. Tom