From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-30789a4c537so4628000f8f.0 for ; Tue, 23 May 2023 01:07:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1684829278; x=1687421278; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=IrPAj15j8RHz7QPokca/NMniHyv49av3fEZQzg5C2oM=; b=Z5QHlVkmQqWSDCZhk7NnqhY39mxd4+pAdy1+nDEMtWwkSZqzY6PJ7mWHjzjBgAMhqz 2WpEy79i569XxgeVIZzum9Ue/eCJOQtTlzXGxEUD+fQwfGt3JrK8kHKz52MSJrJ+k1DX 2D4QIcjgK4aJmpzHIZEdMd4ZXW3ii2WuJcQfE2qtZEy20t45+e+NSjrS87Ue/GocmFfn xRm7qIchmeknWh/LmQP69r115ZEzfoMKDAW8JqF+4Q8DemnYaPaQVSgFUqzb/MjmXsHe K6bW0lc7clBEUTu0oTt+zXkUDPaLzz4qUeZ0ZgV/EijOUiN4qedEcDBx1CyPy/actauf U6yA== 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-Google-Smtp-Source: ACHHUZ7bOsIulXILSx2aU0XEKxY3DTQ458iw8z12iXkapfd50TwIxRjVaICbXPP0nvaBFc3X+c+spA== 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) From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= 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 Content-Transfer-Encoding: 8bit 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 List-Id: 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 -- 2.40.0