From patchwork Tue May 23 08:07:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 97872 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1978413vqo; Tue, 23 May 2023 01:22:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ517/feH23pNirKFNZ45veWgy00tWGfeAIvfsmqzwPzTPml/bm2GZubBGFdOgntwwxOv239 X-Received: by 2002:a17:906:fe04:b0:96a:9b5b:5d80 with SMTP id wy4-20020a170906fe0400b0096a9b5b5d80mr12002008ejb.13.1684830138533; Tue, 23 May 2023 01:22:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684830138; cv=none; d=google.com; s=arc-20160816; b=mZUus7TkUMDdMRDk0+HSDUlo2CsEv/w9F2Ieli2M2AyDp5zpIwnNueYNQs5tF1nB/S XI6sWipeKoa8+9NVg0Bg1aoBLEmtNFLfjcrSZAZaAOA4fj4YqGKFIBdCgbLcBZ1d/MNT d2a5M92wMIGlxT33rCTCCx2jtE7tBggV+VVN9QKK83O9FLW03mlPdxCwON0aVpMQESOM 2ZLCkhgte8AOScItcQxKVz0tChC7Ip6Wct2vcTM6UNee5lCeGgj9VXseLFwsMGCs6GbA 9WAmCtDd94HjrCt18Fs+EoroIxsT0H+yfEvwxibjRdd+OchnM5gcUJgi1GJXmttSxKic RNrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=IrPAj15j8RHz7QPokca/NMniHyv49av3fEZQzg5C2oM=; b=EObznVkq99cca/9VxdIyJGS5fRylj1unbPnpjhqvXQfvjugAtrh3AsX/QlWIWCnv5J /cWqjHCXXZwrhiLKUpd6rlcyP2aEC3weShXLnacSGOP61qylpJnTX15HVTdqC4xnMYfD xAiBH1psdgOCg9hyQ5Oet2de9Pig4RoI141R62r0bvh1Kkm8aU/WJPfIW9RaMXHo+2wb nVjaqeBqrM76Oy+DvFzWmlyuTUGyC0GQg6gvn4GsFcuMYGrtqgDbZVJbuPbQ+WO7TqYW s3epagTufVbHsNJWabYJ/EJXKeCBXZ34pTmMJtmP+eqaqffjDOHpcuP6sfDNuKLC5VFZ oxNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=fuN31MXZ; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id gv22-20020a170906f11600b0096f81ae0ac9si3821074ejb.34.2023.05.23.01.22.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 May 2023 01:22:18 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=fuN31MXZ; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 35572395B833 for ; Tue, 23 May 2023 08:14:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 35572395B833 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684829662; bh=IrPAj15j8RHz7QPokca/NMniHyv49av3fEZQzg5C2oM=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=fuN31MXZXlDItHewYbHhS9A65HPdPR8v5I45JNJe30Cbr4sRUvhUDTXLrcsP5z9KO joMPi9UfAMxKGk+9mbK3mxpnD5yfKdfMrPJnGK59UszYfvFq8pRVr7YlgfzLDwy5kg tfMqBDI+BPBKoadWWxB3ZI9L3M4oatQqRSK5DzVk= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by sourceware.org (Postfix) with ESMTPS id 447EA385483C for ; Tue, 23 May 2023 08:07:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 447EA385483C Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-30789a4c537so4628000f8f.0 for ; Tue, 23 May 2023 01:07:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684829278; x=1687421278; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=IrPAj15j8RHz7QPokca/NMniHyv49av3fEZQzg5C2oM=; b=keRgtP4tBHjv3WTbGvizag/nESO0c8Az28Y59jwgbPpcXHIu27lELXmw83rWy331iC 5Yryzu9a17un7azAgIttI9GXHlPqTQ+afJSWUocrTW8M3OO3tj/R5PYE/uRTtNDHCiky FvAfuymxdHlBMlNqA/9ZP4yH1TrJv1oPdN2HunIjt8OWCv9PTLpQ5qhrBp88xZQk5vKa iFFbm7oqhETHTfYRfNCsbmz27wA7mhN8CkbO7aO0C4LLCx38vfS5n8WkSzCOJVemG3FB UckR+PQJ+8JQj1mTk6txz1trqrIW3rldKB98hV1ZO6DmrsEF+Df5fXWYLAR8SUjZTfuY 7afA== X-Gm-Message-State: AC+VfDy7EKpnngy06gJA+7ZuRxb9Yar2a0oQBJx6jMEVbnb5I8ZfEMam gZvMai9vlXmCXpPvXSXl3fKIXNw+ODrSidmlcdU58w== X-Received: by 2002:a5d:58d9:0:b0:2f4:6574:5a93 with SMTP id o25-20020a5d58d9000000b002f465745a93mr9711639wrf.4.1684829278091; Tue, 23 May 2023 01:07:58 -0700 (PDT) Received: from poulhies-Precision-5550.telnowedge.local (lmontsouris-659-1-24-67.w81-250.abo.wanadoo.fr. [81.250.175.67]) by smtp.gmail.com with ESMTPSA id b4-20020a5d45c4000000b003047d5b8817sm10245468wrs.80.2023.05.23.01.07.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 May 2023 01:07:57 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED] ada: Ignore accessibility actuals in expression pretty-printer Date: Tue, 23 May 2023 10:07:56 +0200 Message-Id: <20230523080756.1873165-1-poulhies@adacore.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: =?utf-8?q?Marc_Poulhi=C3=A8s_via_Gcc-patches?= From: =?utf-8?q?Marc_Poulhi=C3=A8s?= Reply-To: =?utf-8?q?Marc_Poulhi=C3=A8s?= Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766672447178325332?= X-GMAIL-MSGID: =?utf-8?q?1766672447178325332?= From: Piotr Trojanek Extra actual parameters for accessibility checks are confusing for the expression pretty-printer that is used by CodePeer. It seems that nodes created for the accessibility checks should use the Sloc of the source expression of accessibility checks, not the target. However, this is problematic to achieve with the current implementation of accessibility checks, so with this patch we will simply ignore the accessibility actuals when computing Slocs for expression pretty-printing. gcc/ada/ * errout.adb (First_And_Last_Nodes): Ignore accessibility parameters. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/errout.adb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/gcc/ada/errout.adb b/gcc/ada/errout.adb index 0a36a1d7466..5c3e76c5eca 100644 --- a/gcc/ada/errout.adb +++ b/gcc/ada/errout.adb @@ -1769,6 +1769,24 @@ package body Errout is Loc : constant Source_Ptr := Sloc (Norig); begin + -- ??? For assignments that require accessiblity checks, e.g.: + -- + -- Y := Func (123); + -- + -- the function call gets an extra actual parameter association with + -- Sloc of the assigned name "Y": + -- + -- Y := Func (123, A8b => 2); + -- + -- We can simply ignore those extra actual parameters when + -- determining the Sloc range of the "Func (123)" expression. + + if Nkind (N) = N_Parameter_Association + and then Is_Accessibility_Actual (N) + then + return Skip; + end if; + -- Check for earlier if Loc < Eloc