aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/exp_ch8.adb
diff options
context:
space:
mode:
authorRobert Dewar <dewar@adacore.com>2007-04-06 11:19:10 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2007-04-06 11:19:10 +0200
commitf937473fe94fce0786cf2a69337f402c49cb20e5 (patch)
tree12ed0014102d78ce0433f132d50d7cdaeaa18628 /gcc/ada/exp_ch8.adb
parent9dac0a42ea1bb2816ceac970652ddba6c88cd0cf (diff)
downloadgcc-f937473fe94fce0786cf2a69337f402c49cb20e5.zip
gcc-f937473fe94fce0786cf2a69337f402c49cb20e5.tar.gz
gcc-f937473fe94fce0786cf2a69337f402c49cb20e5.tar.bz2
einfo.ads, einfo.adb: (First_Component_Or_Discriminant): New function
2007-04-06 Robert Dewar <dewar@adacore.com> Thomas Quinot <quinot@adacore.com> Ed Schonberg <schonberg@adacore.com> Bob Duff <duff@adacore.com> * einfo.ads, einfo.adb: (First_Component_Or_Discriminant): New function (Next_Component_Or_Discriminant): New function and procedure (First_Index, First_Literal, Master_Id, Set_First_Index, Set_First_Literal, Set_Master_Id): Add missing Ekind assertions. (Is_Access_Protected_Subprogram_Type): New predicate. (Has_RACW): New entity flag, set on package entities to indicate that the package contains the declaration of a remote accecss-to-classwide type. (E_Return_Statement): This node type has the Finalization_Chain_Entity attribute, in case the result type has controlled parts. (Requires_Overriding): Add this new flag, because "requires overriding" is subtly different from "is abstract" (see AI-228). (Is_Abstract): Split Is_Abstract flag into Is_Abstract_Subprogram and Is_Abstract_Type. Make sure these are called only when appropriate. (Has_Pragma_Unreferenced_Objects): New flag * exp_ch5.adb (Expand_N_Assignment_Statement): If the left-hand side is class-wide, the tag of the right-hand side must be an exact match, not an ancestor of that of the object on left-hand side. (Move_Activation_Chain): New procedure to create the call to System.Tasking.Stages.Move_Activation_Chain. (Expand_N_Extended_Return_Statement): Generate code to call System.Finalization_Implementation.Move_Final_List at the end of a return statement if the function's result type has controlled parts. Move asserts to Build_In_Place_Formal. (Move_Final_List): New function to create the call statement. (Expand_N_Assignment_Statement): In case of assignment to a class-wide tagged type, replace generation of call to the run-time subprogram CW_Membership by call to Build_CW_Membership. (Expand_N_Return_Statement): Replace generation of call to the run-time subprogram Get_Access_Level by call to Build_Get_Access_Level. (Expand_N_Simple_Function_Return): Replace generation of call to the run-time subprogram Get_Access_Level by call to Build_Get_Access_Level. * exp_ch6.ads, exp_ch6.adb (Expand_Call): Use new predicate Is_Access_Protected_Subprogram_Type, to handle both named and anonymous access to protected operations. (Add_Task_Actuals_To_Build_In_Place_Call): New procedure to add the master and chain actual parameters to a build-in-place function call involving tasks. (BIP_Formal_Suffix): Add new enumeration literals to complete the case statement. (Make_Build_In_Place_Call_In_Allocator, Make_Build_In_Place_Call_In_Anonymous_Context, Make_Build_In_Place_Call_In_Assignment, Make_Build_In_Place_Call_In_Object_Declaration): Call Add_Task_Actuals_To_Build_In_Place_Call with the appropriate master. (Expand_Inlined_Call): If the subprogram is a null procedure, or a stubbed procedure with a null body, replace the call with a null statement without using the full inlining machinery, for efficiency and to avoid invalid values in source file table entries. * exp_ch8.adb (Expand_N_Object_Renaming_Declaration): Add support for renamings of calls to build-in-place functions. * rtsfind.adb (RTE_Record_Component_Available): New subprogram that provides the functionality of RTE_Available to record components. (RTU_Entity): The function Entity has been renamed to RTU_Entity to avoid undesired overloading. (Entity): New subprogram that returns the entity for the referened unit. If this unit has not been loaded, it returns Empty. (RE_Activation_Chain_Access, RE_Move_Activation_Chain): New entities. Remove no longer used entities. (RE_Finalizable_Ptr_Ptr, RE_Move_Final_List): New entities. (RE_Type_Specific_Data): New entity. (RE_Move_Any_Value): New entity. (RE_TA_A, RE_Get_Any_Type): New entities. (RE_Access_Level, RE_Dispatch_Table, E_Default_Prim_Op_Count, RE_Prims_Ptr, RE_RC_Offset, RE_Remotely_Callable, RE_DT_Typeinfo_Ptr_Size, RE_Cstring_Ptr, RE_DT_Expanded_Name): Added. (Entity): New subprogram that returns the entity for the referened unit. If this unit has not been loaded, it returns Empty. (RTE): Addition of a new formal that extends the search to the scopes of the record types found in the chain of the package. * sem_ch6.ads, sem_ch6.adb (Check_Overriding_Indicator): Print "abstract subprograms must be visible" message, whether or not the type is an interface; that is, remove the special case for interface types. (Analyze_Function_Return): Remove error message "return of task objects is not yet implemented" because this is now implemented. (Create_Extra_Formals): Add the extra master and activation chain formals in case the result type has tasks. Remove error message "return of limited controlled objects is not yet implemented". (Create_Extra_Formals): Add the extra caller's finalization list formal in case the result type has controlled parts. (Process_Formals): In case of access formal types there is no need to continue with the analysis of the formals if we already notified errors. (Check_Overriding_Indicator): Add code to check overriding of predefined operators. (Create_Extra_Formals): Prevent creation of useless Extra_Constrained flags for formals that do not require them,. (Enter_Overloaded_Entity): Do not give -gnatwh warning message unless hidden entity is use visible or directly visible. (Analyze_Abstract_Subprogram_Declaration,Analyze_Subprogram_Body, Analyze_Subprogram_Declaration,Analyze_Subprogram_Specification, Check_Conventions,Check_Delayed_Subprogram,Make_Inequality_Operator, New_Overloaded_Entity): Split Is_Abstract flag into Is_Abstract_Subprogram and Is_Abstract_Type. * s-finimp.ads, s-finimp.adb (Move_Final_List): New procedure to move a return statement's finalization list to the caller's list, used for build-in-place functions with result type with controlled parts. Remove no longer used entities. * s-taskin.ads (Activation_Chain): Remove pragma Volatile. It is no longer needed, because the full type is now limited, and therefore a pass-by-reference type. (Foreign_Task_Level): New constant. * s-tassta.ads, s-tassta.adb (Move_Activation_Chain): New procedure to move tasks from the activation chain belonging to a return statement to the one passed in by the caller, and update the master to the one passed in by the caller. (Vulnerable_Complete_Master, Check_Unactivated_Tasks): Check the master of unactivated tasks, so we don't kill the ones that are being returned by a build-in-place function. (Create_Task): Ignore AI-280 for foreign threads. From-SVN: r123558
Diffstat (limited to 'gcc/ada/exp_ch8.adb')
-rw-r--r--gcc/ada/exp_ch8.adb17
1 files changed, 16 insertions, 1 deletions
diff --git a/gcc/ada/exp_ch8.adb b/gcc/ada/exp_ch8.adb
index 846b10d..03408a7 100644
--- a/gcc/ada/exp_ch8.adb
+++ b/gcc/ada/exp_ch8.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2004 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2006, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -26,10 +26,12 @@
with Atree; use Atree;
with Einfo; use Einfo;
+with Exp_Ch6; use Exp_Ch6;
with Exp_Dbug; use Exp_Dbug;
with Exp_Util; use Exp_Util;
with Freeze; use Freeze;
with Nlists; use Nlists;
+with Opt; use Opt;
with Sem; use Sem;
with Sem_Ch8; use Sem_Ch8;
with Sinfo; use Sinfo;
@@ -268,6 +270,19 @@ package body Exp_Ch8 is
end if;
end if;
+ -- Ada 2005 (AI-318-02): If the renamed object is a call to a build-in-
+ -- place function, then a temporary return object needs to be created
+ -- and access to it must be passed to the function. Currently we limit
+ -- such functions to those with inherently limited result subtypes, but
+ -- eventually we plan to expand the functions that are treated as
+ -- build-in-place to include other composite result types.
+
+ if Ada_Version >= Ada_05
+ and then Is_Build_In_Place_Function_Call (Nam)
+ then
+ Make_Build_In_Place_Call_In_Anonymous_Context (Nam);
+ end if;
+
-- Create renaming entry for debug information
Decl := Debug_Renaming_Declaration (N);