From patchwork Tue May 23 08:07:54 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: 1784951 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.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=BKcpaJb1; dkim-atps=neutral Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QQRrk050Jz2020 for ; Tue, 23 May 2023 18:12:53 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 081C43952017 for ; Tue, 23 May 2023 08:12:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 081C43952017 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684829572; bh=/D36ewrDbnxzUzshk6kFEX8iKBSXKhb+4gbfvGQsBiA=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=BKcpaJb1JNMKa+tiTl/Xx1tlFw0ROPVe0oPtKY/3SPlyhFkqFsyGZ7rXOzJZGzpWM PhZZ/p30XNhvabUTRDL0uYuQ3pdLGh74jScirlUxYW6oLt5UAsAC8edwVaL0/k8n9u AWb4TkrKbeg9JZwMnPTu1fHyN/hPk5pUkNfLPIYI= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by sourceware.org (Postfix) with ESMTPS id EECD2385702F for ; Tue, 23 May 2023 08:07:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EECD2385702F Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-3095557dd99so4312173f8f.1 for ; Tue, 23 May 2023 01:07:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684829275; x=1687421275; 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=/D36ewrDbnxzUzshk6kFEX8iKBSXKhb+4gbfvGQsBiA=; b=SM+gCyqUs/8M5UAeDwT/0knFk6WVOeJVd5Nw7XSxfOcy5EWrUZT+YfzLoqvnL9zA1V TTNk4vIpxVSIDjfOkMVTKdFFZap82I0Dzt33u3A2KzY/0jZeQc4kbAH3yGZiUBpWTPu5 sm0i/DbaiG6Bx0B2ZseNYTWuJyqWb8VSD1IjRoQYJSBNDahl1uNNf1ZaTA2HoBQVAYOL tLTywQ2qHKpT2GbB+gBOhjlYlGmyIg+zk+juhQxUgqy1UgYp8Uc3h+cdQqz9Zg6KheN6 Un1SfqW0xDT01fPWjpi3EBBlBEdl8YtLH0aCyiIoQnsm+I7m/9M4YTk5MqdM5sOC/f72 QPlw== X-Gm-Message-State: AC+VfDxte7FaEfmZ2gSm7V6ekwKide1auW7dwwnjsq2/FxHpqIi4zEzq LVN9mCIxtdwoGnqAjl7yzJFHGPplmLlCnAVnv9wXuA== X-Google-Smtp-Source: ACHHUZ7XE8J4tMzqTxX9rRguowQG+GZFmNQVWTwSraIwKBDgOSJbekC0do42tDGHFsmlWDcaP3qzlg== X-Received: by 2002:adf:cd04:0:b0:30a:3498:a360 with SMTP id w4-20020adfcd04000000b0030a3498a360mr6000435wrm.24.1684829275810; Tue, 23 May 2023 01:07:55 -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 o14-20020a5d58ce000000b003062675d4c9sm10109243wrf.39.2023.05.23.01.07.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 May 2023 01:07:55 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED] ada: Remove special-case for parentheses in expansion for GNATprove Date: Tue, 23 May 2023 10:07:54 +0200 Message-Id: <20230523080754.1873095-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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" From: Piotr Trojanek When expanding of inequality operators for GNAT we were adding extra parens, supposedly to "fix Sprint output" (source print); for GNATprove we didn't, as these extra parens were leading to wrong columns for check messages. Adding these extra parens couldn't be a right, because Sprint should produce reasonable output regardless of the parens, especially since we don't care about parens when creating AST in expansion. Avoiding them for GNATprove couldn't be right either, because source printing should work regardless of the GNAT/GNATprove mode. The proper fix for GNAT is rather to not add parens at all and tune source printing, if necessary. The proper fix for GNATprove is not have them either, as it confuses the heuristic in First_Sloc, which is then used by Compute_Sloc. gcc/ada/ * exp_ch4.adb (Expand_N_Op_Ne): Simply don't add extra parens. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_ch4.adb | 8 -------- 1 file changed, 8 deletions(-) diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index f197c2ef570..70e779d0406 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -10119,14 +10119,6 @@ package body Exp_Ch4 is Left_Opnd => Left_Opnd (N), Right_Opnd => Right_Opnd (N))); - -- The level of parentheses is useless in GNATprove mode, and - -- bumping its level here leads to wrong columns being used in - -- check messages, hence skip it in this mode. - - if not GNATprove_Mode then - Set_Paren_Count (Right_Opnd (Neg), 1); - end if; - if Scope (Ne) /= Standard_Standard then Set_Entity (Right_Opnd (Neg), Corresponding_Equality (Ne)); end if;