From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) by sourceware.org (Postfix) with ESMTPS id E96113858C60 for ; Wed, 15 Feb 2023 13:39:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E96113858C60 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f46.google.com with SMTP id z13so13362349wmp.2 for ; Wed, 15 Feb 2023 05:39:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZRdl6dJ5x5DB60DUQgLD7is082QE0Nmr6RdmI7r+jrg=; b=zbzNwZBt1BFjQtzY3yn236W0N65cB1cPq9+autQlWNLoIKd4QgY9MKcDF6leuRr2Na Y7bOnlXpZcN4zlS3iogseLwTRr5i/geovuYNV2TyxJyj8FKJ2PdfcbNG6x/B8wE5/ua8 oGVdgj1+MQIU9c21/vnHz9bCvDcNpDBP47QrsObuw2loKBNLv61OTSmCNIPgXel3LUPM uaMm7PxXNIypnX5DO2ahDxmtsBvOj+O8BNj7Vtp3ySmsQ8ZNvNXzW7NEfg830bbTnIPv heBih5L+ohzvO8x55jGTN68JplxKdAKFKiWddzJofTxMGHbKI0XhTmBjkTraNr4T4le9 OtJA== X-Gm-Message-State: AO0yUKXIUUVrH1ccjMPiZQMO1FiLS9Np06GovMoN2kuzhTcAFCFc9F4X HceqMHCINrLwSQ2U6H512Wg9zznFnamKMw== X-Google-Smtp-Source: AK7set8pkrUlszaY5tIlgsT2a21UCfh+sTns0CPnj/dsM4YTxoWVwk1MyqTg2egstEZP2Pc45o7x2w== X-Received: by 2002:a05:600c:1714:b0:3df:fff4:5f6f with SMTP id c20-20020a05600c171400b003dffff45f6fmr1891402wmn.36.1676468364199; Wed, 15 Feb 2023 05:39:24 -0800 (PST) Received: from ?IPv6:2001:8a0:f92b:9e00::1fe? ([2001:8a0:f92b:9e00::1fe]) by smtp.gmail.com with ESMTPSA id l9-20020a05600c4f0900b003e001afa274sm2496854wmq.2.2023.02.15.05.39.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 15 Feb 2023 05:39:23 -0800 (PST) Subject: Re: [PATCH 2/6] Make "ptype INTERNAL_FUNCTION" in Ada print like other languages To: Tom Tromey , Andrew Burgess via Gdb-patches Cc: Andrew Burgess References: <20230210233604.2228450-1-pedro@palves.net> <20230210233604.2228450-3-pedro@palves.net> <878rh1tuyt.fsf@redhat.com> <87y1p0tgcb.fsf@tromey.com> From: Pedro Alves Message-ID: <0165619c-2905-d164-954b-8a0237d1072b@palves.net> Date: Wed, 15 Feb 2023 13:38:58 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <87y1p0tgcb.fsf@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2023-02-14 3:30 p.m., Tom Tromey wrote: >>> Fix this by simply adding an early check for >>> TYPE_CODE_INTERNAL_FUNCTION. > > Andrew> I confess, this is not the solution I though you'd go with. I was > Andrew> expecting you to handle TYPE_CODE_INTERNAL_FUNCTION in the switch, just > Andrew> to leave things consistent. > > I think this would be better. My point with adding this check early is that these functions' type never has anything to do with Ada, so all that code at the beginning of ada_print_type, like decoded_type_name, ada_is_aligner_type, ada_is_constrained_packed_array_type, etc. is always a nop for internal functions, so might as well skip it all. I actually started out by considering moving TYPE_CODE_INTERNAL_FUNCTION printing to common code (say, rename the virtual language_defn::print_type to do_print_type, and add a new non-virtual wrapper language_defn::print_type method and print TYPE_CODE_INTERNAL_FUNCTION there), and I didn't pursue that as I couldn't really convince myself that a different language might want to print it differently (say, some other characters instead of "<>"), and I guess that's why I ended up with putting it at the start of the function, as that is the closest to putting it at the caller instead.