+2009-04-10 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_prag.adb (Analyze_Pragma, case Task_Name): Do not expand argument
+ of pragma. It will be recopied and analyzed when used in call to
+ Create_Task.
+
+ * sem_res.adb (Resolve_Call): Clarify use of secondary stack within
+ initialization operations and recognize use of it in procedure calls
+ within init_procs.
+
+ * exp_ch9.adb (Make_Task_Create_Call): Copy full tree of Task_Name
+ argument, because it may have side-effects.
+
+ * exp_ch2.adb: Remove obsolete comments on default functions
+
+2009-04-10 Jose Ruiz <ruiz@adacore.com>
+
+ * adaint.c (RTX section): Do for RTX the same thing as we do for
+ Windows (include ctype.h and define a fallback ISALPHA if IN_RTS).
+
2009-04-10 Robert Dewar <dewar@adacore.com>
* sem_aux.ads, sem_aux.adb (Nearest_Current_Scope): New function.
end loop;
-- If the discriminant occurs within the default expression for a
- -- formal of an entry or protected operation, create a default
- -- function for it, and replace the discriminant with a reference to
- -- the discriminant of the formal of the default function. The
- -- discriminant entity is the one defined in the corresponding
- -- record.
+ -- formal of an entry or protected operation, replace it with a
+ -- reference to the discriminant of the formal of the enclosing
+ -- operation.
if Present (Parent_P)
and then Present (Corresponding_Spec (Parent_P))
Disc : Entity_Id;
begin
- -- Verify that we are within a default function: the type of
- -- its formal parameter is the same task or protected type.
+ -- Verify that we are within the body of an entry or protected
+ -- operation. Its first formal parameter is the synchronized
+ -- type itself.
if Present (Formal)
and then Etype (Formal) = Scope (Entity (N))
-- Create a transient scope if the resulting type requires it
- -- There are 4 notable exceptions: in init procs, the transient scope
- -- overhead is not needed and even incorrect due to the actual expansion
- -- of adjust calls; the second case is enumeration literal pseudo calls;
- -- the third case is intrinsic subprograms (Unchecked_Conversion and
- -- source information functions) that do not use the secondary stack
- -- even though the return type is unconstrained; the fourth case is a
- -- call to a build-in-place function, since such functions may allocate
- -- their result directly in a target object, and cases where the result
- -- does get allocated in the secondary stack are checked for within the
- -- specialized Exp_Ch6 procedures for expanding build-in-place calls.
-
- -- If this is an initialization call for a type whose initialization
- -- uses the secondary stack, we also need to create a transient scope
- -- for it, precisely because we will not do it within the init proc
- -- itself.
-
- -- If the subprogram is marked Inline_Always, then even if it returns
+ -- There are several notable exceptions:
+
+ -- a) in init procs, the transient scope overhead is not needed, and is
+ -- even incorrect when the call is a nested initialization call for a
+ -- component whose expansion may generate adjust calls. However, if the
+ -- call is some other procedure call within an initialization procedure
+ -- (for example a call to Create_Task in the init_proc of the task
+ -- run-time record) a transient scope must be created around this call.
+
+ -- b) enumeration literal pseudo-calls need no transient scope.
+
+ -- c) intrinsic subprograms (Unchecked_Conversion and source info
+ -- functions) do not use the secondary stack even though the return
+ -- type may be unconstrained;
+
+ -- d) calls to a build-in-place function, since such functions may
+ -- allocate their result directly in a target object, and cases where
+ -- the result does get allocated in the secondary stack are checked for
+ -- within the specialized Exp_Ch6 procedures for expanding those
+ -- build-in-place calls.
+
+ -- e) If the subprogram is marked Inline_Always, then even if it returns
-- an unconstrained type the call does not require use of the secondary
-- stack. However, inlining will only take place if the body to inline
-- is already present. It may not be available if e.g. the subprogram is
-- declared in a child instance.
+ -- If this is an initialization call for a type whose construction
+ -- uses the secondary stack, and it is not a nested call to initialize
+ -- a component, we do need to create a transient scope for it. We
+ -- check for this by traversing the type in Check_Initialization_Call.
+
if Is_Inlined (Nam)
and then Has_Pragma_Inline_Always (Nam)
and then Nkind (Unit_Declaration_Node (Nam)) = N_Subprogram_Declaration
then
null;
+ elsif Ekind (Nam) = E_Enumeration_Literal
+ or else Is_Build_In_Place_Function (Nam)
+ or else Is_Intrinsic_Subprogram (Nam)
+ then
+ null;
+
elsif Expander_Active
and then Is_Type (Etype (Nam))
and then Requires_Transient_Scope (Etype (Nam))
- and then not Is_Build_In_Place_Function (Nam)
- and then Ekind (Nam) /= E_Enumeration_Literal
- and then not Within_Init_Proc
- and then not Is_Intrinsic_Subprogram (Nam)
+ and then
+ (not Within_Init_Proc
+ or else
+ (not Is_Init_Proc (Nam) and then Ekind (Nam) /= E_Function))
then
Establish_Transient_Scope (N, Sec_Stack => True);