public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-1092] ada: Remove special-case for parentheses in expansion for GNATprove
@ 2023-05-23  8:05 Marc Poulhi?s
  0 siblings, 0 replies; only message in thread
From: Marc Poulhi?s @ 2023-05-23  8:05 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:eceeb07b21483a1f150cba8d65ef9a762442d2d9

commit r14-1092-geceeb07b21483a1f150cba8d65ef9a762442d2d9
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Mon Feb 13 22:13:32 2023 +0100

    ada: Remove special-case for parentheses in expansion for GNATprove
    
    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.

Diff:
---
 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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-23  8:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-23  8:05 [gcc r14-1092] ada: Remove special-case for parentheses in expansion for GNATprove Marc Poulhi?s

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).