[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:
parent
de4899bb19
commit
d7d99211f9
|
@ -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>
|
2014-11-20 Ed Schonberg <schonberg@adacore.com>
|
||||||
|
|
||||||
* exp_ch3.adb (Expand_N_Object_Declaration): Handle properly
|
* exp_ch3.adb (Expand_N_Object_Declaration): Handle properly
|
||||||
|
|
|
@ -42,16 +42,24 @@ is
|
||||||
type Int is range System.Min_Int .. System.Max_Int;
|
type Int is range System.Min_Int .. System.Max_Int;
|
||||||
type UInt is mod System.Max_Binary_Modulus;
|
type UInt is mod System.Max_Binary_Modulus;
|
||||||
|
|
||||||
type Elements_Array_Ptr_Const is access constant Elements_Array;
|
|
||||||
|
|
||||||
procedure Free is
|
procedure Free is
|
||||||
new Ada.Unchecked_Deallocation (Elements_Array, Elements_Array_Ptr);
|
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
|
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
|
-- 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
|
function Get_Element
|
||||||
(Container : Vector;
|
(Container : Vector;
|
||||||
|
@ -257,19 +265,19 @@ is
|
||||||
-- Elements --
|
-- Elements --
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
function Elems (Container : in out Vector) return Elements_Array_Ptr is
|
function Elems (Container : in out Vector) return Maximal_Array_Ptr is
|
||||||
begin
|
begin
|
||||||
return (if Container.Elements_Ptr = null
|
return (if Container.Elements_Ptr = null
|
||||||
then Container.Elements'Unrestricted_Access
|
then Container.Elements'Unrestricted_Access
|
||||||
else Container.Elements_Ptr);
|
else Container.Elements_Ptr.all'Unrestricted_Access);
|
||||||
end Elems;
|
end Elems;
|
||||||
|
|
||||||
function Elemsc
|
function Elemsc
|
||||||
(Container : Vector) return Elements_Array_Ptr_Const is
|
(Container : Vector) return Maximal_Array_Ptr_Const is
|
||||||
begin
|
begin
|
||||||
return (if Container.Elements_Ptr = null
|
return (if Container.Elements_Ptr = null
|
||||||
then Container.Elements'Unrestricted_Access
|
then Container.Elements'Unrestricted_Access
|
||||||
else Elements_Array_Ptr_Const (Container.Elements_Ptr));
|
else Container.Elements_Ptr.all'Unrestricted_Access);
|
||||||
end Elemsc;
|
end Elemsc;
|
||||||
|
|
||||||
----------------
|
----------------
|
||||||
|
@ -632,8 +640,8 @@ is
|
||||||
|
|
||||||
Last := Index_Type (Last_As_Int);
|
Last := Index_Type (Last_As_Int);
|
||||||
|
|
||||||
return (Length, (others => New_Item), Last => Last,
|
return (Capacity => Length, Last => Last, Elements_Ptr => <>,
|
||||||
others => <>);
|
Elements => (others => New_Item));
|
||||||
end;
|
end;
|
||||||
end To_Vector;
|
end To_Vector;
|
||||||
|
|
||||||
|
|
|
@ -255,9 +255,9 @@ private
|
||||||
-- In the bounded case, the elements are stored in Elements. In the
|
-- In the bounded case, the elements are stored in Elements. In the
|
||||||
-- unbounded case, the elements are initially stored in Elements, until
|
-- unbounded case, the elements are initially stored in Elements, until
|
||||||
-- we run out of room, then we switch to Elements_Ptr.
|
-- we run out of room, then we switch to Elements_Ptr.
|
||||||
Elements : aliased Elements_Array (1 .. Capacity);
|
|
||||||
Last : Extended_Index := No_Index;
|
Last : Extended_Index := No_Index;
|
||||||
Elements_Ptr : Elements_Array_Ptr := null;
|
Elements_Ptr : Elements_Array_Ptr := null;
|
||||||
|
Elements : aliased Elements_Array (1 .. Capacity);
|
||||||
end record;
|
end record;
|
||||||
|
|
||||||
-- The primary reason Vector is limited is that in the unbounded case, once
|
-- The primary reason Vector is limited is that in the unbounded case, once
|
||||||
|
|
|
@ -148,7 +148,7 @@ package Einfo is
|
||||||
|
|
||||||
-- The Object_Size for base subtypes reflect the natural hardware
|
-- The Object_Size for base subtypes reflect the natural hardware
|
||||||
-- size in bits (see Ttypes and Cstand for integer types). For
|
-- 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.
|
-- 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
|
-- The Object_Size of a subtype is the same as the Object_Size of
|
||||||
|
|
|
@ -717,7 +717,7 @@ package Opt is
|
||||||
|
|
||||||
Generate_SCO_Instance_Table : Boolean := False;
|
Generate_SCO_Instance_Table : Boolean := False;
|
||||||
-- GNAT
|
-- 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.
|
-- instances is included in SCOs.
|
||||||
|
|
||||||
Generating_Code : Boolean := False;
|
Generating_Code : Boolean := False;
|
||||||
|
|
|
@ -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
|
-- This package defines some system dependent parameters for GNAT. These
|
||||||
-- are values that are referenced by the runtime library and are therefore
|
-- are values that are referenced by the runtime library and are therefore
|
||||||
|
|
|
@ -516,6 +516,12 @@ package body Sem_Elab is
|
||||||
Access_Case : constant Boolean := Nkind (N) = N_Attribute_Reference;
|
Access_Case : constant Boolean := Nkind (N) = N_Attribute_Reference;
|
||||||
-- Indicates if we have Access attribute case
|
-- 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
|
procedure Elab_Warning
|
||||||
(Msg_D : String;
|
(Msg_D : String;
|
||||||
Msg_S : 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
|
-- For a variable reference, just set Body_Acts_As_Spec to False
|
||||||
|
|
||||||
if Nkind (N) in N_Has_Entity
|
if Variable_Case then
|
||||||
and then Present (Entity (N))
|
|
||||||
and then Ekind (Entity (N)) = E_Variable
|
|
||||||
then
|
|
||||||
Body_Acts_As_Spec := False;
|
Body_Acts_As_Spec := False;
|
||||||
|
|
||||||
-- Additional checks for all other cases
|
-- Additional checks for all other cases
|
||||||
|
@ -879,7 +882,9 @@ package body Sem_Elab is
|
||||||
-- Loop to carefully follow renamings and derivations one step
|
-- Loop to carefully follow renamings and derivations one step
|
||||||
-- outside the current unit, but not further.
|
-- 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);
|
E_Scope := Alias (Ent);
|
||||||
else
|
else
|
||||||
E_Scope := Ent;
|
E_Scope := Ent;
|
||||||
|
@ -970,11 +975,7 @@ package body Sem_Elab is
|
||||||
|
|
||||||
-- Variable reference in SPARK mode
|
-- Variable reference in SPARK mode
|
||||||
|
|
||||||
elsif SPARK_Mode = On
|
elsif Variable_Case then
|
||||||
and then Nkind (N) in N_Has_Entity
|
|
||||||
and then Present (Entity (N))
|
|
||||||
and then Ekind (Entity (N)) = E_Variable
|
|
||||||
then
|
|
||||||
Error_Msg_NE
|
Error_Msg_NE
|
||||||
("reference to & during elaboration in SPARK", N, Ent);
|
("reference to & during elaboration in SPARK", N, Ent);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue