aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/exp_ch7.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2011-08-02 15:39:08 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2011-08-02 15:39:08 +0200
commitdb72f10a75e878cf0c678e21bdc4b7222acca271 (patch)
treebb14d06f938e48886c3a29d49cfcab4c8a831a20 /gcc/ada/exp_ch7.adb
parent23685ae6ecac53a9365195feaf56c986d7c2eae0 (diff)
downloadgcc-db72f10a75e878cf0c678e21bdc4b7222acca271.zip
gcc-db72f10a75e878cf0c678e21bdc4b7222acca271.tar.gz
gcc-db72f10a75e878cf0c678e21bdc4b7222acca271.tar.bz2
[multiple changes]
2011-08-02 Hristian Kirtchev <kirtchev@adacore.com> * exp_ch5.adb (Expand_Iterator_Loop): Code cleanup and refactoring. When a container is provided via a function call, generate a renaming of the function result. This avoids the creation of a transient scope and the premature finalization of the container. * exp_ch7.adb (Is_Container_Cursor): Removed. (Wrap_Transient_Declaration): Remove the supression of the finalization of the list controller when the declaration denotes a container cursor, it is not needed. 2011-08-02 Yannick Moy <moy@adacore.com> * restrict.adb (Check_Formal_Restriction): only issue a warning if the node is from source, instead of the original node being from source. * sem_aggr.adb (Resolve_Array_Aggregate): refine the check for a static expression, to recognize also static ranges * sem_ch3.adb, sem_ch3.ads (Analyze_Component_Declaration, Array_Type_Declaration): postpone the test for the type being a subtype mark after the type has been resolved, so that component-selection and expanded-name are discriminated. (Make_Index, Process_Range_Expr_In_Decl): add a parameter In_Iter_Schm to distinguish the case of an iteration scheme, so that an error is issed on a non-static range in SPARK except in an iteration scheme. * sem_ch5.adb (Analyze_Iteration_Scheme): call Make_Index with In_Iter_Schm = True. * sem_ch6.adb (Analyze_Subprogram_Specification): refine the check for user-defined operators so that they are allowed in renaming * sem_ch8.adb (Find_Selected_Component): refine the check for prefixing of operators so that they are allowed in renaming. Move the checks for restrictions on selector name after analysis discriminated between component-selection and expanded-name. * sem_res.adb (Resolve_Op_Concat_Arg): do not issue a warning on concatenation argument of string type if it is static. * sem_util.adb, sem_util.ads (Check_Later_Vs_Basic_Declarations): add a new function Is_Later_Declarative_Item to decice which declarations are allowed as later items, in the two different modes Ada 83 and SPARK. In the SPARK mode, add that renamings are considered as later items. (Enclosing_Package): new function to return the enclosing package (Enter_Name): correct the rule for homonyms in SPARK (Is_SPARK_Initialization_Expr): default to returning True on nodes not from source (result of expansion) to avoid issuing wrong warnings. 2011-08-02 Ed Schonberg <schonberg@adacore.com> * errout.adb: On anything but an expression First_Node returns its argument. From-SVN: r177152
Diffstat (limited to 'gcc/ada/exp_ch7.adb')
-rw-r--r--gcc/ada/exp_ch7.adb51
1 files changed, 0 insertions, 51 deletions
diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb
index a344d93..4d64b84 100644
--- a/gcc/ada/exp_ch7.adb
+++ b/gcc/ada/exp_ch7.adb
@@ -3427,36 +3427,6 @@ package body Exp_Ch7 is
S : Entity_Id;
Uses_SS : Boolean;
- function Is_Container_Cursor (Decl : Node_Id) return Boolean;
- -- Determine whether object declaration Decl is a cursor used to iterate
- -- over an Ada 2005/12 container.
-
- -------------------------
- -- Is_Container_Cursor --
- -------------------------
-
- function Is_Container_Cursor (Decl : Node_Id) return Boolean is
- Def_Id : constant Entity_Id := Defining_Identifier (Decl);
- Expr : constant Node_Id := Expression (Decl);
-
- begin
- -- A cursor declaration appears in the following form:
- --
- -- Index : Pack.Cursor := First (...);
-
- return
- Chars (Etype (Def_Id)) = Name_Cursor
- and then Present (Expr)
- and then Nkind (Expr) = N_Function_Call
- and then Chars (Name (Expr)) = Name_First
- and then
- (Nkind (Parent (Decl)) = N_Expression_With_Actions
- or else
- Nkind (Related_Expression (Def_Id)) = N_Loop_Statement);
- end Is_Container_Cursor;
-
- -- Start of processing for Wrap_Transient_Declaration
-
begin
S := Current_Scope;
Enclosing_S := Scope (S);
@@ -3534,27 +3504,6 @@ package body Exp_Ch7 is
then
null;
- -- The declaration of a container cursor is a special context where
- -- the finalization of the list controller needs to be supressed. In
- -- the following simplified example:
- --
- -- LC : Simple_List_Controller;
- -- Temp : Ptr_Typ := Container_Creator_Function'Reference;
- -- Deep_Tag_Attach (Temp, LC);
- -- Obj : Pack.Cursor := First (Temp.all);
- -- Finalize (LC);
- -- <execute the loop>
- --
- -- the finalization of the list controller destroys the contents of
- -- container Temp, and as a result Obj points to nothing. Note that
- -- Temp will be finalized by the finalization list of the enclosing
- -- scope.
-
- elsif Ada_Version >= Ada_2012
- and then Is_Container_Cursor (N)
- then
- null;
-
-- Finalize the list controller
else