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 2846C3857C7E for ; Sun, 29 Aug 2021 16:34:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2846C3857C7E Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:105:465:1:1: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 4GyJtd27TwzQjgJ; Sun, 29 Aug 2021 18:34:01 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter03.heinlein-hosting.de (spamfilter03.heinlein-hosting.de [80.241.56.117]) (amavisd-new, port 10030) with ESMTP id Kkdcdm95R4HO; Sun, 29 Aug 2021 18:33:54 +0200 (CEST) From: Iain Buclaw To: gcc-patches@gcc.gnu.org Subject: [committed] d: Convert convert_for_rvalue switch statement into if condition Date: Sun, 29 Aug 2021 18:33:53 +0200 Message-Id: <20210829163353.2036482-1-ibuclaw@gdcproject.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 57AB0188C X-Rspamd-UID: 89236b X-Spam-Status: No, score=-15.6 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_H2, 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: Sun, 29 Aug 2021 16:34:12 -0000 Hi, This patch replaces the switch statement in convert_for_rvalue with an if condition. In the D implementation of the D front-end, the condition value has been changed to an `enum class` type. Bootstrapped and regression tested on x86_64-linux-gnu/-m32/-mx32, committed to mainline. Regards, Iain --- gcc/d/ChangeLog: * d-convert.cc (convert_for_rvalue): Convert switch statement into if condition. --- gcc/d/d-convert.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/gcc/d/d-convert.cc b/gcc/d/d-convert.cc index d43485dca77..3b4790298a5 100644 --- a/gcc/d/d-convert.cc +++ b/gcc/d/d-convert.cc @@ -613,9 +613,8 @@ convert_for_rvalue (tree expr, Type *etype, Type *totype) Type *ebtype = etype->toBasetype (); Type *tbtype = totype->toBasetype (); - switch (ebtype->ty) + if (ebtype->ty == Tbool) { - case Tbool: /* If casting from bool, the result is either 0 or 1, any other value violates @safe code, so enforce that it is never invalid. */ if (CONSTANT_CLASS_P (expr)) @@ -633,7 +632,6 @@ convert_for_rvalue (tree expr, Type *etype, Type *totype) } result = convert (build_ctype (tbtype), result); - break; } return result ? result : convert_expr (expr, etype, totype); -- 2.30.2