From: Arnaud Charlet Date: Mon, 27 Jan 2014 16:43:29 +0000 (+0100) Subject: [multiple changes] X-Git-Tag: upstream/12.2.0~65142 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=00ba7be81367fd082166105ab3e8b8f43d04051c;p=platform%2Fupstream%2Fgcc.git [multiple changes] 2014-01-27 Robert Dewar * exp_smem.adb: Minor reformatting. 2014-01-27 Thomas Quinot * a-calfor.ads: Fix incorrect reference to operator "-" in comment. 2014-01-27 Ed Schonberg * sem_res.adb (Make_Call_Into_Operator): In ASIS mode, relocate nodes for operands to the original node for the call, to preserve Original_Node pointers within the resolved operands, given that they may have been rewritten as well. Previous approach copied the operands into a new tree and lost those pointers. 2014-01-27 Claire Dross * a-cofove.adb, a-cofove.ads: Add Strict_Equal function to the API. 2014-01-27 Ed Schonberg * sem_util.adb (Check_Internal_Protected_Use): A call through an anonymous access parameter of the current protected function is not a potential modification of the current object. 2014-01-27 Ed Schonberg * a-cobove.adb (Reserve_Capacity): Procedure raises Capacity_Error, not Constraint_Error, when request cannot be satisfied. 2014-01-27 Vincent Celier * a-coorma.adb, a-cohama.adb (Assign): Copy the Source to the Target, not the Target to itself. 2014-01-27 Ed Schonberg * exp_ch4.adb (Expand_Concatenate): If the target of the concatenation is a library-level entity, always use the off-line version of concatenation, regardless of optimization level. This is space-efficient, and prevents linking problems when some units are compiled with different optimization levels. 2014-01-27 Ed Schonberg * sem_ch5.adb: Code clean up. 2014-01-27 Ed Schonberg * par-ch5.adb (P_Iterator_Specification): Improve error recovery when an array or container iterator includes a subtype indication, which is only legal in an element iterator. From-SVN: r207141 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index f50f691..fc60f65 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,59 @@ +2014-01-27 Robert Dewar + + * exp_smem.adb: Minor reformatting. + +2014-01-27 Thomas Quinot + + * a-calfor.ads: Fix incorrect reference to operator "-" in comment. + +2014-01-27 Ed Schonberg + + * sem_res.adb (Make_Call_Into_Operator): In ASIS mode, relocate + nodes for operands to the original node for the call, to preserve + Original_Node pointers within the resolved operands, given that + they may have been rewritten as well. Previous approach copied + the operands into a new tree and lost those pointers. + +2014-01-27 Claire Dross + + + * a-cofove.adb, a-cofove.ads: Add Strict_Equal function to the API. + +2014-01-27 Ed Schonberg + + * sem_util.adb (Check_Internal_Protected_Use): A call through + an anonymous access parameter of the current protected function + is not a potential modification of the current object. + +2014-01-27 Ed Schonberg + + * a-cobove.adb (Reserve_Capacity): Procedure raises + Capacity_Error, not Constraint_Error, when request cannot be + satisfied. + +2014-01-27 Vincent Celier + + * a-coorma.adb, a-cohama.adb (Assign): Copy the Source to the Target, + not the Target to itself. + +2014-01-27 Ed Schonberg + + * exp_ch4.adb (Expand_Concatenate): If the target of the + concatenation is a library-level entity, always use the off-line + version of concatenation, regardless of optimization level. This + is space-efficient, and prevents linking problems when some + units are compiled with different optimization levels. + +2014-01-27 Ed Schonberg + + * sem_ch5.adb: Code clean up. + +2014-01-27 Ed Schonberg + + * par-ch5.adb (P_Iterator_Specification): Improve error recovery + when an array or container iterator includes a subtype indication, + which is only legal in an element iterator. + 2014-01-27 Thomas Quinot * exp_ch7.adb: Minor reformatting. diff --git a/gcc/ada/a-calfor.ads b/gcc/ada/a-calfor.ads index d5cc934..8cfd6a4 100644 --- a/gcc/ada/a-calfor.ads +++ b/gcc/ada/a-calfor.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2005-2008, Free Software Foundation, Inc. -- +-- Copyright (C) 2005-2013, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. In accordance with the copyright of that document, you can freely -- @@ -70,7 +70,7 @@ package Ada.Calendar.Formatting is Sub_Second : Second_Duration := 0.0) return Day_Duration; -- Returns a Day_Duration value for the combination of the given Hour, -- Minute, Second, and Sub_Second. This value can be used in Ada.Calendar. - -- Time_Of as well as the argument to Calendar."+" and Calendar."–". If + -- Time_Of as well as the argument to Calendar."+" and Calendar."-". If -- Seconds_Of is called with a Sub_Second value of 1.0, the value returned -- is equal to the value of Seconds_Of for the next second with a Sub_ -- Second value of 0.0. diff --git a/gcc/ada/a-cobove.adb b/gcc/ada/a-cobove.adb index bcd6118..b2e75b5 100644 --- a/gcc/ada/a-cobove.adb +++ b/gcc/ada/a-cobove.adb @@ -2390,7 +2390,7 @@ package body Ada.Containers.Bounded_Vectors is is begin if Capacity > Container.Capacity then - raise Constraint_Error with "Capacity is out of range"; + raise Capacity_Error with "Capacity is out of range"; end if; end Reserve_Capacity; diff --git a/gcc/ada/a-cofove.adb b/gcc/ada/a-cofove.adb index 240715d..6789f71 100644 --- a/gcc/ada/a-cofove.adb +++ b/gcc/ada/a-cofove.adb @@ -1506,6 +1506,19 @@ package body Ada.Containers.Formal_Vectors is end; end Set_Length; + ------------------ + -- Strict_Equal -- + ------------------ + + function Strict_Equal (Left, Right : Vector) return Boolean is + begin + -- On bounded vectors, cursors are indexes. As a consequence, two + -- vectors always have the same cursor at the same position and + -- Strict_Equal is simply = + + return Left = Right; + end Strict_Equal; + ---------- -- Swap -- ---------- diff --git a/gcc/ada/a-cofove.ads b/gcc/ada/a-cofove.ads index 1f9b94f..2c451fb8 100644 --- a/gcc/ada/a-cofove.ads +++ b/gcc/ada/a-cofove.ads @@ -45,8 +45,9 @@ -- which is not possible if cursors encapsulate an access to the underlying -- container. --- There are two new functions: +-- There are three new functions: +-- function Strict_Equal (Left, Right : Vector) return Boolean; -- function Left (Container : Vector; Position : Cursor) return Vector; -- function Right (Container : Vector; Position : Cursor) return Vector; @@ -349,6 +350,11 @@ package Ada.Containers.Formal_Vectors is end Generic_Sorting; + function Strict_Equal (Left, Right : Vector) return Boolean; + -- Strict_Equal returns True if the containers are physically equal, i.e. + -- they are structurally equal (function "=" returns True) and that they + -- have the same set of cursors. + function Left (Container : Vector; Position : Cursor) return Vector with Pre => Has_Element (Container, Position) or else Position = No_Element; function Right (Container : Vector; Position : Cursor) return Vector with diff --git a/gcc/ada/a-cohama.adb b/gcc/ada/a-cohama.adb index 6af16ee..0616f43 100644 --- a/gcc/ada/a-cohama.adb +++ b/gcc/ada/a-cohama.adb @@ -167,7 +167,7 @@ package body Ada.Containers.Hashed_Maps is Target.Reserve_Capacity (Source.Length); end if; - Insert_Items (Target.HT); + Insert_Items (Source.HT); end Assign; -------------- diff --git a/gcc/ada/a-coorma.adb b/gcc/ada/a-coorma.adb index 52025bb..e451ec6 100644 --- a/gcc/ada/a-coorma.adb +++ b/gcc/ada/a-coorma.adb @@ -274,7 +274,7 @@ package body Ada.Containers.Ordered_Maps is end if; Target.Clear; - Insert_Items (Target.Tree); + Insert_Items (Source.Tree); end Assign; ------------- diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index 97368c0..d0288b2 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -3043,6 +3043,16 @@ package body Exp_Ch4 is -- Local Declarations + Lib_Level_Target : constant Boolean := + Nkind (Parent (Cnode)) = N_Object_Declaration + and then + Is_Library_Level_Entity (Defining_Identifier (Parent (Cnode))); + + -- If the concatenation declares a library level entity, we call the + -- built-in concatenation routines to prevent code bloat, regardless + -- of optimization level. This is space-efficient, and prevent linking + -- problems when units are compiled with different optimizations. + Opnd_Typ : Entity_Id; Ent : Entity_Id; Len : Uint; @@ -3571,8 +3581,10 @@ package body Exp_Ch4 is if Atyp = Standard_String and then NN in 2 .. 9 - and then (Opt.Optimization_Level = 0 or else Debug_Flag_Dot_CC) - and then not Debug_Flag_Dot_C + and then (Lib_Level_Target + or else + ((Opt.Optimization_Level = 0 or else Debug_Flag_Dot_CC) + and then not Debug_Flag_Dot_C)) then declare RR : constant array (Nat range 2 .. 9) of RE_Id := diff --git a/gcc/ada/exp_smem.adb b/gcc/ada/exp_smem.adb index 7fb40c4..8ee6702 100644 --- a/gcc/ada/exp_smem.adb +++ b/gcc/ada/exp_smem.adb @@ -195,7 +195,7 @@ package body Exp_Smem is procedure Add_Write_After (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Ent : constant Entity_Id := Entity (N); - Par : constant Node_Id := Insert_Node; + Par : constant Node_Id := Insert_Node; begin if Present (Shared_Var_Procs_Instance (Ent)) then if Nkind (Insert_Node) = N_Function_Call then diff --git a/gcc/ada/par-ch5.adb b/gcc/ada/par-ch5.adb index 8992f15..bf28e23 100644 --- a/gcc/ada/par-ch5.adb +++ b/gcc/ada/par-ch5.adb @@ -1736,6 +1736,19 @@ package body Ch5 is elsif Token = Tok_In then Scan; -- past IN + elsif Prev_Token = Tok_In + and then Present (Subtype_Indication (Node1)) + then + + -- Simplest recovery is to transform it into an element iterator. + -- Error message on 'in" has already been emitted when parsing the + -- optional constraint. + + Set_Of_Present (Node1); + Error_Msg_N + ("subtype indication is only legal on on element iterator", + Subtype_Indication (Node1)); + else return Error; end if; diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb index 581edf4..590d8ab 100644 --- a/gcc/ada/sem_ch5.adb +++ b/gcc/ada/sem_ch5.adb @@ -1814,7 +1814,7 @@ package body Sem_Ch5 is Set_Etype (Def_Id, Component_Type (Typ)); if Present (Subt) - and then Bas /= Base_Type (Component_Type (Typ)) + and then Base_Type (Bas) /= Base_Type (Component_Type (Typ)) then Error_Msg_N ("subtype indication does not match component type", Subt); diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 59986f5..7e2e55c 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -1585,17 +1585,20 @@ package body Sem_Res is -- If in ASIS_Mode, propagate operand types to original actuals of -- function call, which would otherwise not be fully resolved. If - -- the call has already been constant-folded, nothing to do. + -- the call has already been constant-folded, nothing to do. We + -- relocate the operand nodes rather than copy them, to preserve + -- original_node pointers, given that the operands themselves may + -- have been rewritten. if ASIS_Mode and then Nkind (N) in N_Op then if Is_Binary then Rewrite (First (Parameter_Associations (Original_Node (N))), - New_Copy_Tree (Left_Opnd (N))); + Relocate_Node (Left_Opnd (N))); Rewrite (Next (First (Parameter_Associations (Original_Node (N)))), - New_Copy_Tree (Right_Opnd (N))); + Relocate_Node (Right_Opnd (N))); else Rewrite (First (Parameter_Associations (Original_Node (N))), - New_Copy_Tree (Right_Opnd (N))); + Relocate_Node (Right_Opnd (N))); end if; Set_Parent (Original_Node (N), Parent (N)); diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index d41eb3a..284872b 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -2240,7 +2240,19 @@ package body Sem_Util is end loop; if Scope (Nam) = Prot and then Ekind (Nam) /= E_Function then - if Nkind (N) = N_Subprogram_Renaming_Declaration then + + -- An indirect function call (e.g. a callback within a protected + -- function body) is not statically illegal. If the access type is + -- anonymous and is the type of an access parameter, the scope of Nam + -- will be the protected type, but it is not a protected operation. + + if Ekind (Nam) = E_Subprogram_Type + and then + Nkind (Associated_Node_For_Itype (Nam)) = N_Function_Specification + then + null; + + elsif Nkind (N) = N_Subprogram_Renaming_Declaration then Error_Msg_N ("within protected function cannot use protected " & "procedure in renaming or as generic actual", N);