aboutsummaryrefslogtreecommitdiff
path: root/gcc
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
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')
-rw-r--r--gcc/ada/ChangeLog21
-rw-r--r--gcc/ada/ali.adb16
-rw-r--r--gcc/ada/ali.ads4
-rw-r--r--gcc/ada/lib-load.ads18
-rw-r--r--gcc/ada/lib-writ.adb28
-rw-r--r--gcc/ada/lib.adb10
-rw-r--r--gcc/ada/lib.ads7
-rw-r--r--gcc/ada/sinfo.ads2
8 files changed, 82 insertions, 24 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 2efa3d6..febc9a8 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,24 @@
+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.
+
2014-07-30 Vincent Celier <celier@adacore.com>
* makeutl.adb (Insert_Project_Sources): When the library project
diff --git a/gcc/ada/ali.adb b/gcc/ada/ali.adb
index d94cb7e..a899ca7 100644
--- a/gcc/ada/ali.adb
+++ b/gcc/ada/ali.adb
@@ -2185,20 +2185,30 @@ package body ALI is
Notes.Table (Notes.Last).Pragma_Line := Get_Nat;
Checkc (':');
Notes.Table (Notes.Last).Pragma_Col := Get_Nat;
- Notes.Table (Notes.Last).Unit := Units.Last;
+
+ if not At_Eol and then Nextc = ':' then
+ Checkc (':');
+ Notes.Table (Notes.Last).Pragma_Source_File :=
+ Get_File_Name (Lower => True);
+ else
+ Notes.Table (Notes.Last).Pragma_Source_File :=
+ Units.Table (Units.Last).Sfile;
+ end if;
if At_Eol then
Notes.Table (Notes.Last).Pragma_Args := No_Name;
else
+ -- Note: can't use Get_Name here as the remainder of the
+ -- line is unstructured text whose syntax depends on the
+ -- particular pragma used.
+
Checkc (' ');
Name_Len := 0;
while not At_Eol loop
Add_Char_To_Name_Buffer (Getc);
end loop;
-
- Notes.Table (Notes.Last).Pragma_Args := Name_Enter;
end if;
Skip_Eol;
diff --git a/gcc/ada/ali.ads b/gcc/ada/ali.ads
index 1b05ba6..130284b 100644
--- a/gcc/ada/ali.ads
+++ b/gcc/ada/ali.ads
@@ -669,8 +669,8 @@ package ALI is
Pragma_Col : Nat;
-- Column number of pragma
- Unit : Unit_Id;
- -- Unit_Id for the entry
+ Pragma_Source_File : File_Name_Type;
+ -- Source file of pragma
Pragma_Args : Name_Id;
-- Pragma arguments. No_Name if no arguments, otherwise a single
diff --git a/gcc/ada/lib-load.ads b/gcc/ada/lib-load.ads
index 3ae9cca..a8f779d 100644
--- a/gcc/ada/lib-load.ads
+++ b/gcc/ada/lib-load.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2014, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -103,14 +103,14 @@ package Lib.Load is
-- and then closed on return.
function Load_Unit
- (Load_Name : Unit_Name_Type;
- Required : Boolean;
- Error_Node : Node_Id;
- Subunit : Boolean;
- Corr_Body : Unit_Number_Type := No_Unit;
- Renamings : Boolean := False;
- With_Node : Node_Id := Empty;
- PMES : Boolean := False) return Unit_Number_Type;
+ (Load_Name : Unit_Name_Type;
+ Required : Boolean;
+ Error_Node : Node_Id;
+ Subunit : Boolean;
+ Corr_Body : Unit_Number_Type := No_Unit;
+ Renamings : Boolean := False;
+ With_Node : Node_Id := Empty;
+ PMES : Boolean := False) return Unit_Number_Type;
-- This function loads and parses the unit specified by Load_Name (or
-- returns the unit number for the previously constructed units table
-- entry if this is not the first call for this unit). Required indicates
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;
diff --git a/gcc/ada/lib.adb b/gcc/ada/lib.adb
index 296a6b9..04a0d39 100644
--- a/gcc/ada/lib.adb
+++ b/gcc/ada/lib.adb
@@ -1046,8 +1046,16 @@ package body Lib is
----------------
procedure Store_Note (N : Node_Id) is
+ Sfile : constant Source_File_Index := Get_Source_File_Index (Sloc (N));
begin
- Notes.Append ((Pragma_Node => N, Unit => Current_Sem_Unit));
+ -- Notes for a generic are emitted when processing the template, never
+ -- in instances.
+
+ if In_Extended_Main_Code_Unit (N)
+ and then Instance (Sfile) = No_Instance_Id
+ then
+ Notes.Append (N);
+ end if;
end Store_Note;
-------------------------------
diff --git a/gcc/ada/lib.ads b/gcc/ada/lib.ads
index 0de88fe..a2a2410 100644
--- a/gcc/ada/lib.ads
+++ b/gcc/ada/lib.ads
@@ -826,13 +826,8 @@ private
-- The following table stores references to pragmas that generate Notes
- type Notes_Entry is record
- Pragma_Node : Node_Id;
- Unit : Unit_Number_Type;
- end record;
-
package Notes is new Table.Table (
- Table_Component_Type => Notes_Entry,
+ Table_Component_Type => Node_Id,
Table_Index_Type => Integer,
Table_Low_Bound => 1,
Table_Initial => Alloc.Notes_Initial,
diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads
index f51f9c5..211e009 100644
--- a/gcc/ada/sinfo.ads
+++ b/gcc/ada/sinfo.ads
@@ -1685,6 +1685,8 @@ package Sinfo is
--
-- For a subunit, Library_Unit points to the compilation unit node of
-- the parent body.
+ -- ??? not (always) true, in (at least some, maybe all?) cases it points
+ -- to the corresponding spec for the parent body.
--
-- Note that this field is not used to hold the parent pointer for child
-- unit (which might in any case need to use it for some other purpose as