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
This commit is contained in:
parent
3ea8f61e9f
commit
9e5a6ee7c8
|
@ -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>
|
2014-07-30 Vincent Celier <celier@adacore.com>
|
||||||
|
|
||||||
* makeutl.adb (Insert_Project_Sources): When the library project
|
* makeutl.adb (Insert_Project_Sources): When the library project
|
||||||
|
|
|
@ -2185,20 +2185,30 @@ package body ALI is
|
||||||
Notes.Table (Notes.Last).Pragma_Line := Get_Nat;
|
Notes.Table (Notes.Last).Pragma_Line := Get_Nat;
|
||||||
Checkc (':');
|
Checkc (':');
|
||||||
Notes.Table (Notes.Last).Pragma_Col := Get_Nat;
|
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
|
if At_Eol then
|
||||||
Notes.Table (Notes.Last).Pragma_Args := No_Name;
|
Notes.Table (Notes.Last).Pragma_Args := No_Name;
|
||||||
|
|
||||||
else
|
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 (' ');
|
Checkc (' ');
|
||||||
|
|
||||||
Name_Len := 0;
|
Name_Len := 0;
|
||||||
while not At_Eol loop
|
while not At_Eol loop
|
||||||
Add_Char_To_Name_Buffer (Getc);
|
Add_Char_To_Name_Buffer (Getc);
|
||||||
end loop;
|
end loop;
|
||||||
|
|
||||||
Notes.Table (Notes.Last).Pragma_Args := Name_Enter;
|
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
Skip_Eol;
|
Skip_Eol;
|
||||||
|
|
|
@ -669,8 +669,8 @@ package ALI is
|
||||||
Pragma_Col : Nat;
|
Pragma_Col : Nat;
|
||||||
-- Column number of pragma
|
-- Column number of pragma
|
||||||
|
|
||||||
Unit : Unit_Id;
|
Pragma_Source_File : File_Name_Type;
|
||||||
-- Unit_Id for the entry
|
-- Source file of pragma
|
||||||
|
|
||||||
Pragma_Args : Name_Id;
|
Pragma_Args : Name_Id;
|
||||||
-- Pragma arguments. No_Name if no arguments, otherwise a single
|
-- Pragma arguments. No_Name if no arguments, otherwise a single
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
-- --
|
-- --
|
||||||
-- S p e c --
|
-- 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 --
|
-- 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- --
|
-- terms of the GNU General Public License as published by the Free Soft- --
|
||||||
|
|
|
@ -647,13 +647,26 @@ package body Lib.Writ is
|
||||||
|
|
||||||
for J in 1 .. Notes.Last loop
|
for J in 1 .. Notes.Last loop
|
||||||
declare
|
declare
|
||||||
N : constant Node_Id := Notes.Table (J).Pragma_Node;
|
N : constant Node_Id := Notes.Table (J);
|
||||||
L : constant Source_Ptr := Sloc (N);
|
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;
|
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
|
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_Initiate ('N');
|
||||||
Write_Info_Char (' ');
|
Write_Info_Char (' ');
|
||||||
|
|
||||||
|
@ -677,6 +690,15 @@ package body Lib.Writ is
|
||||||
Write_Info_Char (':');
|
Write_Info_Char (':');
|
||||||
Write_Info_Int (Int (Get_Column_Number (L)));
|
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
|
declare
|
||||||
A : Node_Id;
|
A : Node_Id;
|
||||||
|
|
||||||
|
|
|
@ -1046,8 +1046,16 @@ package body Lib is
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
procedure Store_Note (N : Node_Id) is
|
procedure Store_Note (N : Node_Id) is
|
||||||
|
Sfile : constant Source_File_Index := Get_Source_File_Index (Sloc (N));
|
||||||
begin
|
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;
|
end Store_Note;
|
||||||
|
|
||||||
-------------------------------
|
-------------------------------
|
||||||
|
|
|
@ -826,13 +826,8 @@ private
|
||||||
|
|
||||||
-- The following table stores references to pragmas that generate Notes
|
-- 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 (
|
package Notes is new Table.Table (
|
||||||
Table_Component_Type => Notes_Entry,
|
Table_Component_Type => Node_Id,
|
||||||
Table_Index_Type => Integer,
|
Table_Index_Type => Integer,
|
||||||
Table_Low_Bound => 1,
|
Table_Low_Bound => 1,
|
||||||
Table_Initial => Alloc.Notes_Initial,
|
Table_Initial => Alloc.Notes_Initial,
|
||||||
|
|
|
@ -1685,6 +1685,8 @@ package Sinfo is
|
||||||
--
|
--
|
||||||
-- For a subunit, Library_Unit points to the compilation unit node of
|
-- For a subunit, Library_Unit points to the compilation unit node of
|
||||||
-- the parent body.
|
-- 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
|
-- 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
|
-- unit (which might in any case need to use it for some other purpose as
|
||||||
|
|
Loading…
Reference in New Issue