aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/lib-writ.adb
diff options
context:
space:
mode:
authorThomas Quinot <quinot@adacore.com>2014-07-30 15:06:40 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2014-07-30 17:06:40 +0200
commit9e5a6ee7c81968a13169634a16aef746e540c679 (patch)
tree46db6c49f7ba8ac1fa6a4df8a2f682e1e8fccfed /gcc/ada/lib-writ.adb
parent3ea8f61e9fcdc8e9b558d5c03cafdec439de0147 (diff)
downloadgcc-9e5a6ee7c81968a13169634a16aef746e540c679.zip
gcc-9e5a6ee7c81968a13169634a16aef746e540c679.tar.gz
gcc-9e5a6ee7c81968a13169634a16aef746e540c679.tar.bz2
lib-load.ads: Minor reformatting.
2014-07-30 Thomas Quinot <quinot@adacore.com> * 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 <quinot@adacore.com> * 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
Diffstat (limited to 'gcc/ada/lib-writ.adb')
-rw-r--r--gcc/ada/lib-writ.adb28
1 files changed, 25 insertions, 3 deletions
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;