From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [80.241.56.152]) by sourceware.org (Postfix) with ESMTPS id EEBB4393F801 for ; Fri, 30 Jul 2021 11:01:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EEBB4393F801 Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:105:465:1:2:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4Gbkwl0BNczQk3S; Fri, 30 Jul 2021 13:01:27 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by gerste.heinlein-support.de (gerste.heinlein-support.de [91.198.250.173]) (amavisd-new, port 10030) with ESMTP id YS5jq6ZpXakA; Fri, 30 Jul 2021 13:01:24 +0200 (CEST) From: Iain Buclaw To: gcc-patches@gcc.gnu.org Subject: [committed 05/12] d: Use Identifier::idPool to generate anonymous field name. Date: Fri, 30 Jul 2021 13:01:04 +0200 Message-Id: <20210730110111.569140-5-ibuclaw@gdcproject.org> In-Reply-To: <20210730110111.569140-1-ibuclaw@gdcproject.org> References: <20210730110111.569140-1-ibuclaw@gdcproject.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3E6CA1823 X-Rspamd-UID: 73a85b X-Spam-Status: No, score=-15.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jul 2021 11:01:29 -0000 The self-hosted implementation of the D front-end does not export Identifier::generateId, so handle name generation inline instead. gcc/d/ChangeLog: * d-builtins.cc (build_frontend_type): Use Identifier::idPool to generate anonymous field name. --- gcc/d/d-builtins.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gcc/d/d-builtins.cc b/gcc/d/d-builtins.cc index 9db46c0c5ca..328711fc745 100644 --- a/gcc/d/d-builtins.cc +++ b/gcc/d/d-builtins.cc @@ -241,8 +241,8 @@ build_frontend_type (tree type) sdecl->type->merge2 (); /* Add both named and anonymous fields as members of the struct. - Anonymous fields still need a name in D, so call them "__pad%d". */ - int anonfield_id = 0; + Anonymous fields still need a name in D, so call them "__pad%u". */ + unsigned anonfield_id = 0; sdecl->members = new Dsymbols; for (tree field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field)) @@ -259,7 +259,11 @@ build_frontend_type (tree type) Identifier *fident; if (DECL_NAME (field) == NULL_TREE) - fident = Identifier::generateId ("__pad", anonfield_id++); + { + char name[16]; + snprintf (name, sizeof (name), "__pad%u", anonfield_id++); + fident = Identifier::idPool (name); + } else { const char *name = IDENTIFIER_POINTER (DECL_NAME (field)); -- 2.30.2