From: Bob Duff <d...@adacore.com>

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.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 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 ddbb58e7e0b..1d616db71f3 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);
-- 
2.43.0

Reply via email to