From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3009 invoked by alias); 21 Jan 2015 04:15:33 -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 2989 invoked by uid 89); 21 Jan 2015 04:15:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wi0-f177.google.com Received: from mail-wi0-f177.google.com (HELO mail-wi0-f177.google.com) (209.85.212.177) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 21 Jan 2015 04:15:30 +0000 Received: by mail-wi0-f177.google.com with SMTP id r20so21357910wiv.4 for ; Tue, 20 Jan 2015 20:15:27 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.194.7.103 with SMTP id i7mr37147228wja.53.1421813726972; Tue, 20 Jan 2015 20:15:26 -0800 (PST) Received: by 10.27.39.198 with HTTP; Tue, 20 Jan 2015 20:15:26 -0800 (PST) In-Reply-To: <878ugxt7i2.fsf@southwales.ac.uk> References: <878ugxt7i2.fsf@southwales.ac.uk> Date: Wed, 21 Jan 2015 04:15:00 -0000 Message-ID: Subject: Re: m2-typeprint.c:m2_range's use of TYPE_DOMAIN_TYPE: Eh? From: Doug Evans To: Gaius Mulley Cc: "gdb-patches@sourceware.org" Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-01/txt/msg00563.txt.bz2 On Tue, Jan 20, 2015 at 2:25 PM, Gaius Mulley wrote: > Doug Evans writes: > >> Hi. >> >> Does anyone know why m2_range uses TYPE_DOMAIN_TYPE here? >> >> [...] >> 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). Thanks. Alas cleaning up this code is non-obvious. What do I replace TYPE_DOMAIN_TYPE with? I'm tempted to just go with TYPE_TARGET_TYPE and let y'all fix it later if that's wrong. > >> 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