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

commit r16-1869-ged0e710f222d9e5893d69e32a84caf363ac8415b
Author: Bob Duff <d...@adacore.com>
Date:   Fri May 16 09:04:48 2025 -0400

    ada: Disable -gnatR2 output in case of object renamings
    
    Such output was unnecessary, and in some cases harmful.
    In particular, we generate renamings in the expanded
    code for protected types, with internally-generated names,
    which could be confusing to the user. In addition, in the
    JSON output (-gnatR2j), these generated renamings could have
    duplicate source locatations, which confused SPARK.
    
    gcc/ada/ChangeLog:
    
            * repinfo.adb (List_Entities):
            Disable output in case of object renamings.

Diff:
---
 gcc/ada/repinfo.adb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/repinfo.adb b/gcc/ada/repinfo.adb
index ddbb58e7e0b0..1d616db71f30 100644
--- a/gcc/ada/repinfo.adb
+++ b/gcc/ada/repinfo.adb
@@ -533,11 +533,13 @@ package body Repinfo is
                      List_Type_Info (E);
                   end if;
 
-               --  Note that formals are not annotated so we skip them here
+               --  Formals and renamings are not annotated, so we skip them
+               --  here.
 
                elsif Ekind (E) in E_Constant
                                 | E_Loop_Parameter
                                 | E_Variable
+                 and then Nkind (Parent (E)) /= N_Object_Renaming_Declaration
                then
                   if List_Representation_Info >= 2 then
                      List_Object_Info (E);

Reply via email to