diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-11-19 10:57:20 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-11-19 10:57:20 +0000 |
commit | cb22648259a0fb6992dcd74e03e2e1a533544577 (patch) | |
tree | 180c6c1639dfdeda66e9fb2b12980eae5f2ba409 /gcc/ada/sem_ch4.adb | |
parent | 25ba8eb38bbbc147d86796ff8db54c44252709f7 (diff) | |
download | gcc-cb22648259a0fb6992dcd74e03e2e1a533544577.tar.gz |
* exp_ch4.adb (Expand_N_Selected_Component): If the component is the
discriminant of a constrained subtype, analyze the copy of the
corresponding constraint, because in some cases it may be only
partially analyzed.
Removes long-lived ??? comments.
* exp_ch7.adb (Establish_Transient_Scope): Remove complex code that
handled controlled or secondary-stack expressions within the
iteration_scheme of a loop.
* sem_ch5.adb (Analyze_Iteration_Scheme): Build a block to evaluate
bounds that may contain functions calls, to prevent memory leaks when
the bound contains a call to a function that uses the secondary stack.
(Check_Complex_Bounds): Subsidiary of Analyze_Iteration_Scheme, to
generate temporaries for loop bounds that might contain function calls
that require secondary stack and/or finalization actions.
* sem_ch4.adb (Analyze_Indexed_Component_Form): If the prefix is a
selected component and the selector is overloadable (not just a
function) treat as function call, Analyze_Call will disambiguate if
necessary.
(Analyze_Selected_Component): Do not generate an actual subtype for the
selected component if expansion is disabled. The actual subtype is only
needed for constraint checks.
(Analyze_Allocator): If restriction No_Streams is set, then do
not permit objects to be declared of a stream type, or of a
composite type containing a stream.
* restrict.ads: Remove the a-stream entry from Unit_Array, since
No_Streams no longer prohibits with'ing this package.
* sem_ch3.adb (Build_Derived_Record_Type): If the parent type has
discriminants, but the parent base has unknown discriminants, there is
no discriminant constraint to inherit. Such a discrepancy can arise
when the actual for a formal type with unknown discriminants is a
similar private type whose full view has discriminants.
(Analyze_Object_Declaration): If restriction No_Streams is set, then
do not permit objects to be declared of a stream type, or of a
composite type containing a stream.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@90906 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_ch4.adb')
-rw-r--r-- | gcc/ada/sem_ch4.adb | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index b71e1f9aaeb..2629396cf1b 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -324,7 +324,7 @@ package body Sem_Ch4 is procedure Analyze_Allocator (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Sav_Errs : constant Nat := Serious_Errors_Detected; - E : Node_Id := Expression (N); + E : Node_Id := Expression (N); Acc_Type : Entity_Id; Type_Id : Entity_Id; @@ -498,6 +498,18 @@ package body Sem_Ch4 is Check_Restriction (No_Task_Allocators, N); end if; + -- If the No_Streams restriction is set, check that the type of the + -- object is not, and does not contain, any subtype derived from + -- Ada.Streams.Root_Stream_Type. Note that we guard the call to + -- Has_Stream just for efficiency reasons. There is no point in + -- spending time on a Has_Stream check if the restriction is not set. + + if Restrictions.Set (No_Streams) then + if Has_Stream (Designated_Type (Acc_Type)) then + Check_Restriction (No_Streams, N); + end if; + end if; + Set_Etype (N, Acc_Type); if not Is_Library_Level_Entity (Acc_Type) then @@ -1662,7 +1674,7 @@ package body Sem_Ch4 is Process_Function_Call; elsif Nkind (P) = N_Selected_Component - and then Ekind (Entity (Selector_Name (P))) = E_Function + and then Is_Overloadable (Entity (Selector_Name (P))) then Process_Function_Call; @@ -2614,11 +2626,11 @@ package body Sem_Ch4 is or else (Nkind (Parent_N) = N_Attribute_Reference and then (Attribute_Name (Parent_N) = Name_First - or else + or else Attribute_Name (Parent_N) = Name_Last - or else + or else Attribute_Name (Parent_N) = Name_Length - or else + or else Attribute_Name (Parent_N) = Name_Range))) then Set_Etype (N, Etype (Comp)); @@ -2630,7 +2642,10 @@ package body Sem_Ch4 is -- not make an actual subtype, we end up getting a direct -- reference to a discriminant which will not do. - else + -- Comment needs revision, "in all other cases" does not + -- reasonably describe the situation below with an elsif??? + + elsif Expander_Active then Act_Decl := Build_Actual_Subtype_Of_Component (Etype (Comp), N); Insert_Action (N, Act_Decl); @@ -2652,6 +2667,9 @@ package body Sem_Ch4 is Set_Etype (N, Subt); end; end if; + + else + Set_Etype (N, Etype (Comp)); end if; return; |