[multiple changes]

2014-11-20  Arnaud Charlet  <charlet@adacore.com>

	* s-parame-ae653.ads: Update comments.

2014-11-20  Robert Dewar  <dewar@adacore.com>

	* types.ads, einfo.ads: Minor reformatting.
	* sem_elab.adb (Check_A_Call): Add guard for reference to Alias
	for variable case.

2014-11-20  Bob Duff  <duff@adacore.com>

	* a-cofove.adb (Elems,Elemsc): Use access-to-constrained arrays
	instead of access-to-unconstrained, because the latter doesn't
	work with 'Unrestricted_Access when the result is returned from
	a function.
	* a-cofove.ads (Vector): Move the discriminant-dependent array
	after the other components for efficiency. Otherwise the compiler
	will generate a lot of code to calculate the offset of the other
	components every time they're accessed.

2014-11-20  Olivier Hainque  <hainque@adacore.com>

	* opt.ads: Fix comment on Generate_SCO_Instance_Table wrt when
	it is set to true.

From-SVN: r217879
This commit is contained in:
Arnaud Charlet 2014-11-20 16:50:29 +01:00
parent de4899bb19
commit d7d99211f9
8 changed files with 64 additions and 29 deletions

View File

@ -1,3 +1,29 @@
2014-11-20 Arnaud Charlet <charlet@adacore.com>
* s-parame-ae653.ads: Update comments.
2014-11-20 Robert Dewar <dewar@adacore.com>
* types.ads, einfo.ads: Minor reformatting.
* sem_elab.adb (Check_A_Call): Add guard for reference to Alias
for variable case.
2014-11-20 Bob Duff <duff@adacore.com>
* a-cofove.adb (Elems,Elemsc): Use access-to-constrained arrays
instead of access-to-unconstrained, because the latter doesn't
work with 'Unrestricted_Access when the result is returned from
a function.
* a-cofove.ads (Vector): Move the discriminant-dependent array
after the other components for efficiency. Otherwise the compiler
will generate a lot of code to calculate the offset of the other
components every time they're accessed.
2014-11-20 Olivier Hainque <hainque@adacore.com>
* opt.ads: Fix comment on Generate_SCO_Instance_Table wrt when
it is set to true.
2014-11-20 Ed Schonberg <schonberg@adacore.com>
* exp_ch3.adb (Expand_N_Object_Declaration): Handle properly

View File

@ -42,16 +42,24 @@ is
type Int is range System.Min_Int .. System.Max_Int;
type UInt is mod System.Max_Binary_Modulus;
type Elements_Array_Ptr_Const is access constant Elements_Array;
procedure Free is
new Ada.Unchecked_Deallocation (Elements_Array, Elements_Array_Ptr);
function Elems (Container : in out Vector) return Elements_Array_Ptr;
type Maximal_Array_Ptr is access all Elements_Array (Capacity_Range)
with Storage_Size => 0;
type Maximal_Array_Ptr_Const is access constant
Elements_Array (Capacity_Range)
with Storage_Size => 0;
function Elems (Container : in out Vector) return Maximal_Array_Ptr;
function Elemsc
(Container : Vector) return Elements_Array_Ptr_Const;
(Container : Vector) return Maximal_Array_Ptr_Const;
-- Returns a pointer to the Elements array currently in use -- either
-- Container.Elements_Ptr or a pointer to Container.Elements.
-- Container.Elements_Ptr or a pointer to Container.Elements. We work with
-- pointers to a bogus array subtype that is constrained with the maximum
-- possible bounds. This means that the pointer is a thin pointer. This is
-- necessary because 'Unrestricted_Access doesn't work when it produces
-- access-to-unconstrained and is returned from a function.
function Get_Element
(Container : Vector;
@ -257,19 +265,19 @@ is
-- Elements --
--------------
function Elems (Container : in out Vector) return Elements_Array_Ptr is
function Elems (Container : in out Vector) return Maximal_Array_Ptr is
begin
return (if Container.Elements_Ptr = null
then Container.Elements'Unrestricted_Access
else Container.Elements_Ptr);
else Container.Elements_Ptr.all'Unrestricted_Access);
end Elems;
function Elemsc
(Container : Vector) return Elements_Array_Ptr_Const is
(Container : Vector) return Maximal_Array_Ptr_Const is
begin
return (if Container.Elements_Ptr = null
then Container.Elements'Unrestricted_Access
else Elements_Array_Ptr_Const (Container.Elements_Ptr));
else Container.Elements_Ptr.all'Unrestricted_Access);
end Elemsc;
----------------
@ -632,8 +640,8 @@ is
Last := Index_Type (Last_As_Int);
return (Length, (others => New_Item), Last => Last,
others => <>);
return (Capacity => Length, Last => Last, Elements_Ptr => <>,
Elements => (others => New_Item));
end;
end To_Vector;

View File

@ -255,9 +255,9 @@ private
-- In the bounded case, the elements are stored in Elements. In the
-- unbounded case, the elements are initially stored in Elements, until
-- we run out of room, then we switch to Elements_Ptr.
Elements : aliased Elements_Array (1 .. Capacity);
Last : Extended_Index := No_Index;
Elements_Ptr : Elements_Array_Ptr := null;
Elements : aliased Elements_Array (1 .. Capacity);
end record;
-- The primary reason Vector is limited is that in the unbounded case, once

View File

@ -148,7 +148,7 @@ package Einfo is
-- The Object_Size for base subtypes reflect the natural hardware
-- size in bits (see Ttypes and Cstand for integer types). For
-- enumeration and fixed-point base subtypes have 8. 16. 32 or 64
-- enumeration and fixed-point base subtypes have 8, 16, 32, or 64
-- bits for this size, depending on the range of values to be stored.
-- The Object_Size of a subtype is the same as the Object_Size of

View File

@ -717,7 +717,7 @@ package Opt is
Generate_SCO_Instance_Table : Boolean := False;
-- GNAT
-- True when switch -fdebug-instances is used. When True, a table of
-- True when switch -fdump-scos is used. When True, a table of
-- instances is included in SCOs.
Generating_Code : Boolean := False;

View File

@ -29,7 +29,7 @@
-- --
------------------------------------------------------------------------------
-- This is the default VxWorks AE 653 version of the package
-- Version is used by VxWorks 653, VxWorks MILS, and VxWorks6 cert Ravenscar
-- This package defines some system dependent parameters for GNAT. These
-- are values that are referenced by the runtime library and are therefore

View File

@ -516,6 +516,12 @@ package body Sem_Elab is
Access_Case : constant Boolean := Nkind (N) = N_Attribute_Reference;
-- Indicates if we have Access attribute case
Variable_Case : constant Boolean :=
Nkind (N) in N_Has_Entity
and then Present (Entity (N))
and then Ekind (Entity (N)) = E_Variable;
-- Indicates if we have variable reference case
procedure Elab_Warning
(Msg_D : String;
Msg_S : String;
@ -617,10 +623,7 @@ package body Sem_Elab is
-- For a variable reference, just set Body_Acts_As_Spec to False
if Nkind (N) in N_Has_Entity
and then Present (Entity (N))
and then Ekind (Entity (N)) = E_Variable
then
if Variable_Case then
Body_Acts_As_Spec := False;
-- Additional checks for all other cases
@ -879,7 +882,9 @@ package body Sem_Elab is
-- Loop to carefully follow renamings and derivations one step
-- outside the current unit, but not further.
if not Inst_Case and then Present (Alias (Ent)) then
if not (Inst_Case or Variable_Case)
and then Present (Alias (Ent))
then
E_Scope := Alias (Ent);
else
E_Scope := Ent;
@ -970,11 +975,7 @@ package body Sem_Elab is
-- Variable reference in SPARK mode
elsif SPARK_Mode = On
and then Nkind (N) in N_Has_Entity
and then Present (Entity (N))
and then Ekind (Entity (N)) = E_Variable
then
elsif Variable_Case then
Error_Msg_NE
("reference to & during elaboration in SPARK", N, Ent);
@ -1265,9 +1266,9 @@ package body Sem_Elab is
elsif Nkind (N) not in N_Subprogram_Call
and then Nkind (N) /= N_Attribute_Reference
and then (SPARK_Mode /= On
or else Nkind (N) not in N_Has_Entity
or else No (Entity (N))
or else Ekind (Entity (N)) /= E_Variable)
or else Nkind (N) not in N_Has_Entity
or else No (Entity (N))
or else Ekind (Entity (N)) /= E_Variable)
then
return;

View File

@ -659,7 +659,7 @@ package Types is
type Check_Id is new Nat;
-- Type used to represent a check id
No_Check_Id : constant := 0;
No_Check_Id : constant := 0;
-- Check_Id value used to indicate no check
Access_Check : constant := 1;