From 9e5a6ee7c81968a13169634a16aef746e540c679 Mon Sep 17 00:00:00 2001 From: Thomas Quinot Date: Wed, 30 Jul 2014 15:06:40 +0000 Subject: lib-load.ads: Minor reformatting. 2014-07-30 Thomas Quinot * lib-load.ads: Minor reformatting. * sinfo.ads (Library_Unit): Update comment. * lib.ads (Notes): Simplify. The Unit component in Notes_Entry is redundant. Instead used the pragma Node_Id directly as the element type. 2014-07-30 Thomas Quinot * lib.adb (Store_Note): Store only notes that do not come from an instance, and that are in the extended main source unit. * lib-writ (Write_Unit_Information): Annotations from subunits must be emitted along with those for the main unit, and they must carry a specific file name. * ali.ads (Notes_Record): Use a File_Name_Type instead of a Unit_Id for the source file containing the pragma, as in the case of annotations from subunits we might not have a readily available unit id. * ali.adb (Scan_ALI): Account for above change in data structure. From-SVN: r213295 --- gcc/ada/lib-writ.adb | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'gcc/ada/lib-writ.adb') diff --git a/gcc/ada/lib-writ.adb b/gcc/ada/lib-writ.adb index 5ca7b4b..92c4324 100644 --- a/gcc/ada/lib-writ.adb +++ b/gcc/ada/lib-writ.adb @@ -647,13 +647,26 @@ package body Lib.Writ is for J in 1 .. Notes.Last loop declare - N : constant Node_Id := Notes.Table (J).Pragma_Node; + N : constant Node_Id := Notes.Table (J); L : constant Source_Ptr := Sloc (N); - U : constant Unit_Number_Type := Notes.Table (J).Unit; + U : constant Unit_Number_Type := + Unit (Get_Source_File_Index (L)); C : Character; + Note_Unit : Unit_Number_Type; + -- The unit in whose U section this note must be emitted: + -- notes for subunits are emitted along with the main unit; + -- all other notes are emitted as part of the enclosing + -- compilation unit. + begin - if U = Unit_Num then + if Nkind (Unit (Cunit (U))) = N_Subunit then + Note_Unit := Main_Unit; + else + Note_Unit := U; + end if; + + if Note_Unit = Unit_Num then Write_Info_Initiate ('N'); Write_Info_Char (' '); @@ -677,6 +690,15 @@ package body Lib.Writ is Write_Info_Char (':'); Write_Info_Int (Int (Get_Column_Number (L))); + -- Indicate source file of annotation if different from + -- compilation unit source file (case of annotation coming + -- from a separate). + + if Get_Source_File_Index (L) /= Source_Index (Unit_Num) then + Write_Info_Char (':'); + Write_Info_Name (File_Name (Get_Source_File_Index (L))); + end if; + declare A : Node_Id; -- cgit v1.1