From 93bfc8c003e7367f0f873b566833a12c092b2755 Mon Sep 17 00:00:00 2001 From: Gary Dismukes Date: Tue, 13 Aug 2019 08:07:51 +0000 Subject: [PATCH] [Ada] Do full name qualification of local exception names for LLVM Exceptions declared within subprograms are associated with objects allocated statically (at the global level), and it's helpful for the LLVM compiler (and likely others, such as CCG) if the exception name is fully qualified, to avoid link name clashes (gcc-based GNAT has always "uniquified" these names). GNAT was using the simple name for local exceptions (as for other local objects), but it now uses fully qualified names for all exceptions. When compiled with the command: gcc -c -gnatG local_exception.adb | grep "local_exception__local_exc" the following output is generated for the test further below: local_exception__local_exc : static exception := ( local_exception__local_exc'unrestricted_access)); procedure Local_Exception is Local_Exc : exception; begin null; end Local_Exception; 2019-08-13 Gary Dismukes gcc/ada/ * exp_dbug.adb (Fully_Qualify_Name): Add full name qualification for the E_Exception case. From-SVN: r274349 --- gcc/ada/ChangeLog | 5 +++++ gcc/ada/exp_dbug.adb | 1 + 2 files changed, 6 insertions(+) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 415f950464e..d9b75725257 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2019-08-13 Gary Dismukes + + * exp_dbug.adb (Fully_Qualify_Name): Add full name qualification + for the E_Exception case. + 2019-08-13 Gary Dismukes * exp_aggr.adb (Aggr_Size_OK): Compute the aggregate size using diff --git a/gcc/ada/exp_dbug.adb b/gcc/ada/exp_dbug.adb index f0df5e25baf..3dbe9ad7151 100644 --- a/gcc/ada/exp_dbug.adb +++ b/gcc/ada/exp_dbug.adb @@ -1539,6 +1539,7 @@ package body Exp_Dbug is elsif Is_Subprogram (Ent) or else Ekind (Ent) = E_Subprogram_Body or else Is_Type (Ent) + or else Ekind (Ent) = E_Exception then Fully_Qualify_Name (Ent); Name_Len := Full_Qualify_Len; -- 2.30.2