]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Disable -gnatR2 output in case of object renamings
authorBob Duff <duff@adacore.com>
Fri, 16 May 2025 13:04:48 +0000 (09:04 -0400)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Tue, 1 Jul 2025 08:29:42 +0000 (10:29 +0200)
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.

gcc/ada/repinfo.adb

index ddbb58e7e0b0efa09143e86041e08e240a1bfe77..1d616db71f30f8fd43703c81a81858d0010eaab8 100644 (file)
@@ -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);