aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sinput-l.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2013-10-10 12:37:53 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2013-10-10 12:37:53 +0200
commitcd38efa560f565cb02cba62fe919e591dc110b74 (patch)
tree4eae409e43f75727ce132480e1c6fc7592638197 /gcc/ada/sinput-l.adb
parentd6394e2bbc175f53f60e71fccc5a9be4542ce68e (diff)
downloadgcc-cd38efa560f565cb02cba62fe919e591dc110b74.zip
gcc-cd38efa560f565cb02cba62fe919e591dc110b74.tar.gz
gcc-cd38efa560f565cb02cba62fe919e591dc110b74.tar.bz2
[multiple changes]
2013-10-10 Robert Dewar <dewar@adacore.com> * sem_ch3.adb: Minor reformatting. 2013-10-10 Robert Dewar <dewar@adacore.com> * sinput-c.adb (Load_File): Ensure Source_Align alignment. * sinput-d.adb (Create_Debug_Source): Ensure Source_Align alignment. * sinput-l.adb (Create_Instantiation_Source): Ensure Source_Align alignment. (Load_File): Ditto. * sinput.ads, sinput.adb (Get_Source_File_Index): New optimized (single line) version. * types.ads (Source_Align): New definition. (Source_Buffer): Document new alignment requirement. 2013-10-10 Robert Dewar <dewar@adacore.com> * sem_prag.adb (Analyze_Pragma, case Linker_Section): Allow this for types. 2013-10-10 Robert Dewar <dewar@adacore.com> * gnat_rm.texi: Minor adjustment to doc for To_Address attribute. 2013-10-10 Vadim Godunko <godunko@adacore.com> * s-stopoo.ads (Root_Storage_Pool): Add pragma Preelaborable_Initialization. From-SVN: r203343
Diffstat (limited to 'gcc/ada/sinput-l.adb')
-rw-r--r--gcc/ada/sinput-l.adb29
1 files changed, 18 insertions, 11 deletions
diff --git a/gcc/ada/sinput-l.adb b/gcc/ada/sinput-l.adb
index 64a7cdb..b722788 100644
--- a/gcc/ada/sinput-l.adb
+++ b/gcc/ada/sinput-l.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, 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- --
@@ -112,7 +112,6 @@ package body Sinput.L is
procedure Complete_Source_File_Entry is
CSF : constant Source_File_Index := Current_Source_File;
-
begin
Trim_Lines_Table (CSF);
Source_File.Table (CSF).Source_Checksum := Checksum;
@@ -158,7 +157,6 @@ package body Sinput.L is
Snew.Inlined_Call := Sloc (Inst_Node);
else
-
-- If the spec has been instantiated already, and we are now
-- creating the instance source for the corresponding body now,
-- retrieve the instance id that was assigned to the spec, which
@@ -167,10 +165,10 @@ package body Sinput.L is
Inst_Spec := Instance_Spec (Inst_Node);
if Present (Inst_Spec) then
declare
- Inst_Spec_Ent : Entity_Id;
+ Inst_Spec_Ent : Entity_Id;
-- Instance spec entity
- Inst_Spec_Sloc : Source_Ptr;
+ Inst_Spec_Sloc : Source_Ptr;
-- Virtual sloc of the spec instance source
Inst_Spec_Inst_Id : Instance_Id;
@@ -188,12 +186,13 @@ package body Sinput.L is
-- The specification of the instance entity has a virtual
-- sloc within the instance sloc range.
+
-- ??? But the Unit_Declaration_Node has the sloc of the
-- instantiation, which is somewhat of an oddity.
- Inst_Spec_Sloc :=
- Sloc (Specification (Unit_Declaration_Node
- (Inst_Spec_Ent)));
+ Inst_Spec_Sloc :=
+ Sloc
+ (Specification (Unit_Declaration_Node (Inst_Spec_Ent)));
Inst_Spec_Inst_Id :=
Source_File.Table
(Get_Source_File_Index (Inst_Spec_Sloc)).Instance;
@@ -209,11 +208,16 @@ package body Sinput.L is
end if;
end if;
- -- Now we need to compute the new values of Source_First,
+ -- Now we need to compute the new values of Source_First and
-- Source_Last and adjust the source file pointer to have the
-- correct virtual origin for the new range of values.
- Snew.Source_First := Source_File.Table (Xnew - 1).Source_Last + 1;
+ -- Source_First must be greater than the last Source_Last value
+ -- and also must be a multiple of Source_Align
+
+ Snew.Source_First :=
+ ((Source_File.Table (Xnew - 1).Source_Last + Source_Align) /
+ Source_Align) * Source_Align;
A.Adjust := Snew.Source_First - A.Lo;
Snew.Source_Last := A.Hi + A.Adjust;
@@ -398,10 +402,13 @@ package body Sinput.L is
Source_File.Increment_Last;
X := Source_File.Last;
+ -- Compute starting index, respecting alignment requirement
+
if X = Source_File.First then
Lo := First_Source_Ptr;
else
- Lo := Source_File.Table (X - 1).Source_Last + 1;
+ Lo := ((Source_File.Table (X - 1).Source_Last + Source_Align) /
+ Source_Align) * Source_Align;
end if;
Osint.Read_Source_File (N, Lo, Hi, Src, T);