summaryrefslogtreecommitdiff
path: root/gcc/ada/exp_strm.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2005-09-05 08:00:11 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2005-09-05 08:00:11 +0000
commitf229c74b37e3ea2faa66e8ef8eda9795b1a81fda (patch)
tree7c78c56e9b191891fadab9eabdb8ced0b705ca95 /gcc/ada/exp_strm.adb
parentd91255814e700c33f1cffa6ddfa71ca0126f02e4 (diff)
downloadgcc-f229c74b37e3ea2faa66e8ef8eda9795b1a81fda.tar.gz
2005-09-01 Cyrille Comar <comar@adacore.com>
Gary Dismukes <dismukes@adacore.com> Ed Schonberg <schonberg@adacore.com> Javier Miranda <miranda@adacore.com> * sem_ch3.ads, sem_ch3.adb (Analyze_Object_Declaration): Go to the underlying type to check if a type is Constrained in cases related to code generation (rather than semantic checking) since otherwise we do not generate similar code for mutable private types depending if their discriminants are visible or not. (Check_Abstract_Overriding): Do not complain about failure to override the primitive operations used in dispatching selects since they will always be overriden at the freeze point of the type. (Access_Definition): Separate out handling for resetting the scope of an anonymous access function result type. Retrieve the scope of the associated function rather than using Current_Scope, which does not have a consistent value (depends on whether we're in the middle of analyzing formal parameters). Add ??? comment about finding a cleaner way to handle the special cases of scope setting. (Process_Incomplete_Dependents): A protected operation is never a dispatching operation (only its wrapper may be). (Build_Derived_Record_Type): In case of tagged private types that implement interfaces add derivation of predefined primitive operations. (Derive_Subprograms): Replace the Is_Interface_Derivation parameter by two parameters that are used in case of derivation from abstract interface types: No_Predefined_Prims is used to avoid the derivation of predefined primitives from the interface, and Predefined Prims_Only is used to complete the derivation predefined primitives in case of private tagged types implementing interfaces. Fix typo in comments (Find_Interface_In_Descendant): Protect the frontend against wrong code with large circularity chains. (Is_Private_Overriding): Add support for entities overriding interface subprograms. The test failed because Entities associated with overriden interface subprograms are always marked as hidden (and used to build the secondary dispatch table); in this case the overriden entity is available through the field abstract_interface_alias (cf. override_ dispatching_operation) (Access_Definition): Set the scope of the type to Current_Scope for the case of a function with an anonymous access result type. (Access_Subprogram_Declaration): Handle creation of the type entity for an access-to-function type with an anonymous access result. (Check_Anonymous_Access_Types): Change Subtype_Mark to Result_Definition in handling for N_Access_Function_Definition. (Analyze_Subtype_Declaration): Modify the text of error message. (Derived_Type_Declaration): Modify the text of error message. (Process_Subtype): Modify the text of error message plus cleanup of one redundant error message. (Analyze_Component_Declaration): Code cleanup. (Analyze_Object_Declaration): Code cleanup. (Analyze_Subtype_Declaration): Propagate the null-exclusion attribute in case of access types. Code cleanup. (Array_Type_Declaration): Code cleanup. (Process_Discriminants): Create the new null-excluding itype if required. Code cleanup. (Process_Subtype): Create the new null-excluding itype if required. Code cleanup. (Build_Derived_Record_Type): Code cleanup to avoid calling twice the subprogram derive_subprograms in case of private types that implement interfaces. In this particular case the subprogram Complete_Subprograms_Derivation already does the job associated with the second call. * exp_strm.adb (Build_Elementary_Input_Call): Add an explicit conversion to the full view when generating an operation for a discriminant whose type may currently be private. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@103881 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/exp_strm.adb')
-rw-r--r--gcc/ada/exp_strm.adb13
1 files changed, 9 insertions, 4 deletions
diff --git a/gcc/ada/exp_strm.adb b/gcc/ada/exp_strm.adb
index a48ae6f5a79..f6e5d5c61ad 100644
--- a/gcc/ada/exp_strm.adb
+++ b/gcc/ada/exp_strm.adb
@@ -26,7 +26,6 @@
with Atree; use Atree;
with Einfo; use Einfo;
-with Exp_Tss; use Exp_Tss;
with Namet; use Namet;
with Nlists; use Nlists;
with Nmake; use Nmake;
@@ -594,19 +593,25 @@ package body Exp_Strm is
-- to the actual type of the prefix. If the target is a discriminant,
-- and we are in the body of the default implementation of a 'Read
-- attribute, set target type to force a constraint check (13.13.2(35)).
+ -- If the type of the discriminant is currently private, add another
+ -- unchecked conversion from the full view.
if Nkind (Targ) = N_Identifier
and then Is_Internal_Name (Chars (Targ))
and then Is_TSS (Scope (Entity (Targ)), TSS_Stream_Read)
then
Res :=
- Unchecked_Convert_To (Base_Type (P_Type),
+ Unchecked_Convert_To (Base_Type (U_Type),
Make_Function_Call (Loc,
Name => New_Occurrence_Of (RTE (Lib_RE), Loc),
Parameter_Associations => New_List (
Relocate_Node (Strm))));
Set_Do_Range_Check (Res);
+ if Base_Type (P_Type) /= Base_Type (U_Type) then
+ Res := Unchecked_Convert_To (Base_Type (P_Type), Res);
+ end if;
+
return Res;
else
@@ -1327,7 +1332,7 @@ package body Exp_Strm is
return
Make_Attribute_Reference (Loc,
Prefix =>
- New_Occurrence_Of (Stream_Base_Type (Etype (C)), Loc),
+ New_Occurrence_Of (Field_Typ, Loc),
Attribute_Name => Nam,
Expressions => New_List (
Make_Identifier (Loc, Name_S),
@@ -1490,7 +1495,7 @@ package body Exp_Strm is
Subtype_Mark => New_Reference_To (
Class_Wide_Type (RTE (RE_Root_Stream_Type)), Loc)))),
- Subtype_Mark => New_Occurrence_Of (Typ, Loc));
+ Result_Definition => New_Occurrence_Of (Typ, Loc));
Decl :=
Make_Subprogram_Body (Loc,