diff options
-rw-r--r-- | gcc/ada/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/ada/lib-xref.adb | 2 | ||||
-rw-r--r-- | gcc/ada/lib-xref.ads | 27 | ||||
-rw-r--r-- | gcc/ada/sem_ch13.adb | 39 | ||||
-rw-r--r-- | gcc/ada/xref_lib.adb | 4 |
5 files changed, 59 insertions, 21 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 8ffc81c6b8d..42f3653906a 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,11 @@ +2012-06-12 Robert Dewar <dewar@adacore.com> + + * xref_lib.adb, sem_ch13.adb, lib-xref.adb: Minor reformatting. + +2012-06-12 Javier Miranda <miranda@adacore.com> + + * lib-xref.ads Adding missing documentation. + 2012-06-12 Hristian Kirtchev <kirtchev@adacore.com> * exp_ch7.adb (Create_Finalizer): Add the diff --git a/gcc/ada/lib-xref.adb b/gcc/ada/lib-xref.adb index 692752944ca..bbf1a3db4fb 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 7bdc1582b5e..c0fd31653d9 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 4b<c,there>21 - -- - -- indicates that procedure elsewhere, declared at line 3, has a pragma + + -- 3U13*imported_proc 4b<c,there>21 + + -- 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 4i<c,here>21 + + -- 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 1d8e268dd6b..9acce0f163c 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 4ff1cdc4fcf..30180af042d 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 6b<c,myfoo2>22 # Imported entity -- 5U14*Foo2 5>20 6i<c,myfoo2>22 # Exported entity |