From patchwork Fri Jun 18 08:38:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Marie de Rodat X-Patchwork-Id: 1494145 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+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) 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 4G5sqc2chgz9sSs for ; Fri, 18 Jun 2021 18:42:20 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 11DE839DC4D8 for ; Fri, 18 Jun 2021 08:42:18 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from rock.gnat.com (rock.gnat.com [IPv6:2620:20:4000:0:a9e:1ff:fe9b:1d1]) by sourceware.org (Postfix) with ESMTPS id 1167039B4405 for ; Fri, 18 Jun 2021 08:38:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1167039B4405 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 1588C1179E2; Fri, 18 Jun 2021 04:38:27 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at gnat.com Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id mXj2ots-UJWY; Fri, 18 Jun 2021 04:38:27 -0400 (EDT) Received: from tron.gnat.com (tron.gnat.com [205.232.38.10]) by rock.gnat.com (Postfix) with ESMTP id F2A48117514; Fri, 18 Jun 2021 04:38:26 -0400 (EDT) Received: by tron.gnat.com (Postfix, from userid 4862) id F188D180; Fri, 18 Jun 2021 04:38:26 -0400 (EDT) Date: Fri, 18 Jun 2021 04:38:26 -0400 From: Pierre-Marie de Rodat To: gcc-patches@gcc.gnu.org Subject: [Ada] Remove dead code for overlapping actuals in prefix notation Message-ID: <20210618083826.GA128828@adacore.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, 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: , Cc: Piotr Trojanek Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Detection of overlapping actuals doesn't need to be special-cased for prefix notation, because it is done after prefixed calls have been rewritten into ordinary calls, both in normal compilation and semantic checking mode (with switch -gnatc). Behaviour is unaffected; the removed code was dead. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_warn.adb (Warn_On_Overlapping_Actuals): Remove dead branch for overlapping actuals in prefix notation. diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb --- a/gcc/ada/sem_warn.adb +++ b/gcc/ada/sem_warn.adb @@ -3839,45 +3839,15 @@ package body Sem_Warn is or else Error_To_Warning; - -- If the call was written in prefix notation, and thus - -- its prefix before rewriting was a selected component, - -- count only visible actuals in call. - - if Is_Entity_Name (First_Actual (N)) - and then Nkind (Original_Node (N)) = Nkind (N) - and then Nkind (Name (Original_Node (N))) = - N_Selected_Component - and then - Is_Entity_Name (Prefix (Name (Original_Node (N)))) - and then - Entity (Prefix (Name (Original_Node (N)))) = - Entity (First_Actual (N)) - then - if Act1 = First_Actual (N) then - Error_Msg_FE - ("