From b11ac6d5c1089f6d64f7f0c143cc7b1468f25515 Mon Sep 17 00:00:00 2001 From: charlet Date: Tue, 12 Jun 2012 10:14:44 +0000 Subject: [PATCH] 2012-06-12 Robert Dewar * xref_lib.adb, sem_ch13.adb, lib-xref.adb: Minor reformatting. 2012-06-12 Javier Miranda * lib-xref.ads Adding missing documentation. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@188439 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 8 ++++++++ gcc/ada/lib-xref.adb | 2 +- gcc/ada/lib-xref.ads | 27 ++++++++++++++++++++------- gcc/ada/sem_ch13.adb | 39 ++++++++++++++++++++++++++++----------- gcc/ada/xref_lib.adb | 4 ++-- 5 files changed, 59 insertions(+), 21 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 8ffc81c..42f3653 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,11 @@ +2012-06-12 Robert Dewar + + * xref_lib.adb, sem_ch13.adb, lib-xref.adb: Minor reformatting. + +2012-06-12 Javier Miranda + + * lib-xref.ads Adding missing documentation. + 2012-06-12 Hristian Kirtchev * exp_ch7.adb (Create_Finalizer): Add the diff --git a/gcc/ada/lib-xref.adb b/gcc/ada/lib-xref.adb index 6927529..bbf1a3d 100644 --- a/gcc/ada/lib-xref.adb +++ b/gcc/ada/lib-xref.adb @@ -2443,7 +2443,7 @@ package body Lib.Xref is if Is_Overloadable (XE.Key.Ent) then if (Is_Imported (XE.Key.Ent) and then XE.Key.Typ = 'b') - or else + or else (Is_Exported (XE.Key.Ent) and then XE.Key.Typ = 'i') then Output_Import_Export_Info (XE.Key.Ent); diff --git a/gcc/ada/lib-xref.ads b/gcc/ada/lib-xref.ads index 7bdc158..c0fd316 100644 --- a/gcc/ada/lib-xref.ads +++ b/gcc/ada/lib-xref.ads @@ -565,22 +565,35 @@ package Lib.Xref is -- y abstract function entry or entry family -- z generic formal parameter (unused) - -------------------------------------- - -- Handling of Imported Subprograms -- - -------------------------------------- + --------------------------------------------------- + -- Handling of Imported and Exported Subprograms -- + --------------------------------------------------- -- If a pragma Import or Interface applies to a subprogram, the pragma is -- the completion of the subprogram. This is noted in the ALI file by -- making the occurrence of the subprogram in the pragma into a body -- reference ('b') and by including the external name of the subprogram and -- its language, bracketed by '<' and '>' in that reference. For example: - -- - -- 3U13*elsewhere 4b21 - -- - -- indicates that procedure elsewhere, declared at line 3, has a pragma + + -- 3U13*imported_proc 4b21 + + -- indicates that procedure imported_proc, declared at line 3, has a pragma -- Import at line 4, that its body is in C, and that the link name as given -- in the pragma is "there". + -- If a pragma Export applies to a subprogram exported to a foreign + -- language (ie. the pragma has convention different from Ada), then the + -- pragma is annotated in the ALI file by making the occurrence of the + -- subprogram in the pragma into an implicit reference ('i') and by + -- including the external name of the subprogram and its language, + -- bracketed by '<' and '>' in that reference. For example: + + -- 3U13*exported_proc 4i21 + + -- indicates that procedure exported_proc, declared at line 3, has a pragma + -- Export at line 4, that its body is exported to C, and that the link name + -- as given in the pragma is "here". + ---------------------- -- Alfa Information -- ---------------------- diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 1d8e268..9acce0f 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -950,14 +950,11 @@ package body Sem_Ch13 is goto Continue; - elsif A_Id = Aspect_Import - or else A_Id = Aspect_Export - then - - -- Verify that there is an aspect Convention that will - -- incorporate the Import/Export aspect, and eventual - -- Link/External names. + -- For Import/Export, Verify that there is an aspect + -- Convention that will incorporate the Import/Export + -- aspect, and eventual Link/External names. + elsif A_Id = Aspect_Import or else A_Id = Aspect_Export then declare A : Node_Id; @@ -1218,36 +1215,56 @@ package body Sem_Ch13 is L_Assoc := Empty; E_Assoc := Empty; + -- Loop to look for Import/Export/Link_Name/External_Name + A := First (L); while Present (A) loop A_Name := Chars (Identifier (A)); + -- Import/Export + if A_Name = Name_Import - or else A_Name = Name_Export + or else + A_Name = Name_Export then + -- Forbid duplicates, at most one can appear + if Found then - Error_Msg_N ("conflicting", A); + Error_Msg_Name_1 := A_Name; + Error_Msg_Name_2 := P_Name; + Error_Msg_N + ("% aspect conflicts with previous % aspect", + A); else Found := True; end if; + -- Record name of pragma to generate + P_Name := A_Name; + -- Capture Link_Name + elsif A_Name = Name_Link_Name then L_Assoc := Make_Pragma_Argument_Association (Loc, - Chars => A_Name, + Chars => A_Name, Expression => Relocate_Node (Expression (A))); + -- Capture External_Name + elsif A_Name = Name_External_Name then E_Assoc := Make_Pragma_Argument_Association (Loc, - Chars => A_Name, + Chars => A_Name, Expression => Relocate_Node (Expression (A))); end if; Next (A); end loop; + -- Construct pragma + Arg_List := New_List (Relocate_Node (Expr), Ent); + if Present (L_Assoc) then Append_To (Arg_List, L_Assoc); end if; diff --git a/gcc/ada/xref_lib.adb b/gcc/ada/xref_lib.adb index 4ff1cdc..30180af 100644 --- a/gcc/ada/xref_lib.adb +++ b/gcc/ada/xref_lib.adb @@ -1103,8 +1103,8 @@ package body Xref_Lib is Ptr := Ptr + 1; end if; - -- Imported entities might special indication as to their external - -- name: + -- Imported entities may have an indication specifying information + -- about the corresponding external name: -- 5U14*Foo2 5>20 6b22 # Imported entity -- 5U14*Foo2 5>20 6i22 # Exported entity -- 2.7.4