From: Arnaud Charlet Date: Thu, 20 Nov 2014 15:50:29 +0000 (+0100) Subject: [multiple changes] X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d7d99211f9001bd2c1c5874e1bcf8bbb460aa2dc;p=gcc.git [multiple changes] 2014-11-20 Arnaud Charlet * s-parame-ae653.ads: Update comments. 2014-11-20 Robert Dewar * 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 * 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 * opt.ads: Fix comment on Generate_SCO_Instance_Table wrt when it is set to true. From-SVN: r217879 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index e43d191f67a..ea570d92791 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,29 @@ +2014-11-20 Arnaud Charlet + + * s-parame-ae653.ads: Update comments. + +2014-11-20 Robert Dewar + + * 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 + + * 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 + + * opt.ads: Fix comment on Generate_SCO_Instance_Table wrt when + it is set to true. + 2014-11-20 Ed Schonberg * exp_ch3.adb (Expand_N_Object_Declaration): Handle properly diff --git a/gcc/ada/a-cofove.adb b/gcc/ada/a-cofove.adb index d9eb35639d0..04895432356 100644 --- a/gcc/ada/a-cofove.adb +++ b/gcc/ada/a-cofove.adb @@ -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; diff --git a/gcc/ada/a-cofove.ads b/gcc/ada/a-cofove.ads index 6ddd24b9fca..0f02017a53b 100644 --- a/gcc/ada/a-cofove.ads +++ b/gcc/ada/a-cofove.ads @@ -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 diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads index 5af839f20d7..4bb05c45c2c 100644 --- a/gcc/ada/einfo.ads +++ b/gcc/ada/einfo.ads @@ -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 diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads index a17d9fe5936..8eecbe48215 100644 --- a/gcc/ada/opt.ads +++ b/gcc/ada/opt.ads @@ -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; diff --git a/gcc/ada/s-parame-ae653.ads b/gcc/ada/s-parame-ae653.ads index 3cf170a4718..d833e586547 100644 --- a/gcc/ada/s-parame-ae653.ads +++ b/gcc/ada/s-parame-ae653.ads @@ -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 diff --git a/gcc/ada/sem_elab.adb b/gcc/ada/sem_elab.adb index c84d04b30c9..71883350cdf 100644 --- a/gcc/ada/sem_elab.adb +++ b/gcc/ada/sem_elab.adb @@ -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; diff --git a/gcc/ada/types.ads b/gcc/ada/types.ads index d723248821e..29caf1f851d 100644 --- a/gcc/ada/types.ads +++ b/gcc/ada/types.ads @@ -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;