From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27443 invoked by alias); 20 Jan 2015 22:25:17 -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 27428 invoked by uid 89); 20 Jan 2015 22:25:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: postbox.isd.glam.ac.uk Received: from postbox.isd.glam.ac.uk (HELO postbox.isd.glam.ac.uk) (81.87.34.17) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 20 Jan 2015 22:25:13 +0000 Received: from j228-gm.comp.glam.ac.uk ([193.63.148.84] helo=j228-gm) by postbox.isd.glam.ac.uk with esmtp (Exim 4.71) (envelope-from ) id 1YDhEU-0001dq-Ib; Tue, 20 Jan 2015 22:25:10 +0000 From: Gaius Mulley To: Doug Evans Cc: Subject: Re: m2-typeprint.c:m2_range's use of TYPE_DOMAIN_TYPE: Eh? References: Date: Tue, 20 Jan 2015 22:25:00 -0000 In-Reply-To: (Doug Evans's message of "Mon, 19 Jan 2015 10:29:43 -0800") Message-ID: <878ugxt7i2.fsf@southwales.ac.uk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2015-01/txt/msg00554.txt.bz2 Doug Evans writes: > Hi. > > Does anyone know why m2_range uses TYPE_DOMAIN_TYPE here? > > AFAICT, use of TYPE_DOMAIN_TYPE is wrong here. > It is only used for TYPE_CODE_{MEMBERPTR,METHODPTR,METHOD}. > > ref: gdbtypes.h: > > /* * For types with virtual functions (TYPE_CODE_STRUCT), > VPTR_BASETYPE is the base class which defined the virtual > function table pointer. > > For types that are pointer to member types (TYPE_CODE_METHODPTR, > TYPE_CODE_MEMBERPTR), VPTR_BASETYPE is the type that this pointer > is a member of. > > For method types (TYPE_CODE_METHOD), VPTR_BASETYPE is the aggregate > type that contains the method. > > Unused otherwise. */ > > struct type *vptr_basetype; > > I ask because one symbol table improvement I want to make > may be best implemented if I add a new field to struct main_type. > However, this struct is space-critical, so I'm trying to find > some cleanup that can be done. > Question: Why doesn't vptr_fieldno, vptr_basetype live in > type_specific.cplus_specific? > > Alas, vptr_basetype is overloaded and is used also for TYPE_DOMAIN_TYPE: > > #define TYPE_DOMAIN_TYPE(thistype) TYPE_MAIN_TYPE(thistype)->vptr_basetype > > hence wondering why in the world m2_range is using it. :-) Hi Doug, feel free to clean up the code and make it comply with other languages. I've a feeling that this code will need an overhaul against gm2-1.1.1 (grafted on gcc-4.7.4). The gcc/gm2 interface has pretty much all been rewritten since gm2-1.0 (which was grafted onto gcc-4.1.2). > For TYPE_CODE_{MEMBERPTR,METHODPTR,METHOD}, > any reason why their "domain type" (I'll want to rename that) > cannot live in type_specific? > > --- > > void > m2_range (struct type *type, struct ui_file *stream, int show, > int level, const struct type_print_options *flags) > { > if (TYPE_HIGH_BOUND (type) == TYPE_LOW_BOUND (type)) > m2_print_type (TYPE_DOMAIN_TYPE (type), "", stream, show, level, > flags); > else > { > struct type *target = TYPE_TARGET_TYPE (type); > > fprintf_filtered (stream, "["); > print_type_scalar (target, TYPE_LOW_BOUND (type), stream); > fprintf_filtered (stream, ".."); > print_type_scalar (target, TYPE_HIGH_BOUND (type), stream); > fprintf_filtered (stream, "]"); > } > } regards, Gaius