From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 4D3443858D1E for ; Mon, 13 Mar 2023 21:02:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4D3443858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678741365; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=Cg6CFgpHlwfqwJ/fcl1J0pySNN/Tja0rDl001S75+JU=; b=LTG8E0o4KPRc4Q60fAA0u3VN8tB4tWT+mu1g3orPoZYIoN6WNvSNacEnvEpAkSTTj6+M3t mq485/JTG1yABIeOqtdbOmWQgWKTLv9goMEfc3V6xte40o12F19OgzeRaMIhEvmZxBC44e zF8he+doeN2Z9AVlkZ7JvazXpDvKpjg= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-50-ldcxeJpPMS6fANf6m3RrUw-1; Mon, 13 Mar 2023 17:02:44 -0400 X-MC-Unique: ldcxeJpPMS6fANf6m3RrUw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E22A485CBE2 for ; Mon, 13 Mar 2023 21:02:43 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A242B492C13; Mon, 13 Mar 2023 21:02:43 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 32DL2fuR2628864 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 13 Mar 2023 22:02:41 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 32DL2eZt2628863; Mon, 13 Mar 2023 22:02:40 +0100 Date: Mon, 13 Mar 2023 22:02:40 +0100 From: Jakub Jelinek To: Jason Merrill , Jonathan Wakely Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH RFA] tree: define tree_code_type in C++11/14 [PR108634] Message-ID: Reply-To: Jakub Jelinek References: <20230313201512.151814-1-jason@redhat.com> MIME-Version: 1.0 In-Reply-To: <20230313201512.151814-1-jason@redhat.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham 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 Mon, Mar 13, 2023 at 04:15:12PM -0400, Jason Merrill wrote: > The r13-6577 change to use tree_code_type_tmpl in earlier C++ dialects broke > gdbhooks, which expects tree_code_type to always be available. I considered > trying to make gdbhooks more robust, but it seemed simpler to define > tree_code_type as a reference to the template. This still ends up with a > definition of the reference in each translation unit, but that's allowed by the > ODR because it always refers to the same entity, and is much smaller than > having the whole table in each TU. > > PR plugins/108634 > > gcc/ChangeLog: > > * tree-core.h (tree_code_type, tree_code_length): > Define even without inline variable support. > * tree.h (TREE_CODE_CLASS, TREE_CODE_LENGTH): > Only one definition. I think it would be better to change gdbhooks.py to match what the code does. We should adjust the # extern const enum tree_code_class tree_code_type[]; # #define TREE_CODE_CLASS(CODE) tree_code_type[(int) (CODE)] comment because that isn't true even for new bootstrap compiler. And, I just wonder if val_tree_code_type = gdb.parse_and_eval('tree_code_type') couldn't be replaced with try: val_tree_code_type = gdb.parse_and_eval('tree_code_type') except; val_tree_code_type = gdb.parse_and_eval('tree_code_type_tmpl<0>::tree_code_type') or so. Jakub