From patchwork Tue May 18 20:58:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Buclaw X-Patchwork-Id: 1480546 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=AAzCWHWj; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Fl7f739Hrz9sSs for ; Wed, 19 May 2021 06:59:11 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 377F8395C834; Tue, 18 May 2021 20:59:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 377F8395C834 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1621371549; bh=ISb0qu8OOs57UqQnblvFF75Bz6e0QliPRD6rkuuFc6E=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=AAzCWHWjFOycWmcVdQu04o9L3ofi+0TmIzrd3fFaMc29pAzKxbB06yN6trBU787MF orP36UA2/KxXfSQ1cggenZG+pDhv3HDroeFKrJ11+e+tLJg+rZG1poQbgefmhNctur OAjkV71yYZLQq3EA21ioeYMIEv03r90coNljrYUk= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) by sourceware.org (Postfix) with ESMTPS id 70C40395BC09 for ; Tue, 18 May 2021 20:59:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 70C40395BC09 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-101.mailbox.org (Postfix) with ESMTPS id 4Fl7dz6ntkzQjyW; Tue, 18 May 2021 22:59:03 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter03.heinlein-hosting.de (spamfilter03.heinlein-hosting.de [80.241.56.117]) (amavisd-new, port 10030) with ESMTP id vU26T17mLCGn; Tue, 18 May 2021 22:59:00 +0200 (CEST) To: gcc-patches@gcc.gnu.org Subject: [committed] d: Revert "Come up with startswith function." Date: Tue, 18 May 2021 22:58:58 +0200 Message-Id: <20210518205858.551540-1-ibuclaw@gdcproject.org> MIME-Version: 1.0 X-MBO-SPAM-Probability: * X-Rspamd-Score: 1.35 / 15.00 / 15.00 X-Rspamd-Queue-Id: 002331801 X-Rspamd-UID: d3a5dd X-Spam-Status: No, score=-15.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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-Patchwork-Original-From: Iain Buclaw via Gcc-patches From: Iain Buclaw Reply-To: Iain Buclaw Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Hi, This reverts changes to the DMD front-end in commit 6ba3079dce89d9b63bf5dbd5e320ea2bf96f196b. Changes were incorrectly committed directly to the GCC repo instead of the master repository. Committed to mainline. Regards, Iain. --- gcc/d/ChangeLog: * dmd/dinterpret.c (evaluateIfBuiltin): Revert last change. * dmd/dmangle.c: Likewise. * dmd/hdrgen.c: Likewise. * dmd/identifier.c (Identifier::toHChars2): Likewise. --- gcc/d/dmd/dinterpret.c | 2 +- gcc/d/dmd/dmangle.c | 2 +- gcc/d/dmd/hdrgen.c | 2 +- gcc/d/dmd/identifier.c | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gcc/d/dmd/dinterpret.c b/gcc/d/dmd/dinterpret.c index 9e74a0dbf1f..5e71f3b24a1 100644 --- a/gcc/d/dmd/dinterpret.c +++ b/gcc/d/dmd/dinterpret.c @@ -6881,7 +6881,7 @@ Expression *evaluateIfBuiltin(UnionExp *pue, InterState *istate, Loc loc, const char *id = fd->ident->toChars(); size_t idlen = strlen(id); if (nargs == 2 && (idlen == 10 || idlen == 11) && - startswith (id, "_aApply")) + !strncmp(id, "_aApply", 7)) { // Functions from aApply.d and aApplyR.d in the runtime bool rvs = (idlen == 11); // true if foreach_reverse diff --git a/gcc/d/dmd/dmangle.c b/gcc/d/dmd/dmangle.c index f112243cf5f..83f4c18bee8 100644 --- a/gcc/d/dmd/dmangle.c +++ b/gcc/d/dmd/dmangle.c @@ -673,7 +673,7 @@ public: cd == ClassDeclaration::object || cd == Type::typeinfoclass || cd == Module::moduleinfo || - startswith (cd->ident->toChars(), "TypeInfo_")) + strncmp(cd->ident->toChars(), "TypeInfo_", 9) == 0) { // Don't mangle parent ad->parent = NULL; diff --git a/gcc/d/dmd/hdrgen.c b/gcc/d/dmd/hdrgen.c index e72273b2dbd..9397b1e8abd 100644 --- a/gcc/d/dmd/hdrgen.c +++ b/gcc/d/dmd/hdrgen.c @@ -3212,7 +3212,7 @@ public: } else if (p->type->ty == Tident && strlen(((TypeIdentifier *)p->type)->ident->toChars()) > 3 && - startswith (((TypeIdentifier *)p->type)->ident->toChars(), "__T")) + strncmp(((TypeIdentifier *)p->type)->ident->toChars(), "__T", 3) == 0) { // print parameter name, instead of undetermined type parameter buf->writestring(p->ident->toChars()); diff --git a/gcc/d/dmd/identifier.c b/gcc/d/dmd/identifier.c index dd2c58fd657..197d288e532 100644 --- a/gcc/d/dmd/identifier.c +++ b/gcc/d/dmd/identifier.c @@ -73,11 +73,11 @@ const char *Identifier::toHChars2() { p = toChars(); if (*p == '_') { - if (startswith(p, "_staticCtor")) + if (strncmp(p, "_staticCtor", 11) == 0) p = "static this"; - else if (startswith(p, "_staticDtor")) + else if (strncmp(p, "_staticDtor", 11) == 0) p = "static ~this"; - else if (startswith(p, "__invariant")) + else if (strncmp(p, "__invariant", 11) == 0) p = "invariant"; } }