[multiple changes]

2015-05-12  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch3.adb (Build_Derived_Enumeration_Type): The anonymous base
	created for a derived enumeration type is not a first subtype,
	even though it is defined through a full type declaration.
	* sem_ch13.adb (Analyze_Aspects_At_Freeze_Point): Do not process
	aspects for the anonymous base type constructed for a derived
	scalar type, because they will be set when the first subtype
	is frozen.
	(Inherit_Aspects_At_Freeze_Point): Fix typos on handling of
	Default_Value and Default_Component_Value, that prevented the
	proper inheritance of these aspects.

2015-05-12  Gary Dismukes  <dismukes@adacore.com>

	* exp_ch6.adb, exp_unst.adb: Minor typo fixes.

From-SVN: r223045
This commit is contained in:
Arnaud Charlet 2015-05-12 10:54:42 +02:00
parent f8dae9bb29
commit 731261c334
5 changed files with 46 additions and 7 deletions

View File

@ -1,3 +1,20 @@
2015-05-12 Ed Schonberg <schonberg@adacore.com>
* sem_ch3.adb (Build_Derived_Enumeration_Type): The anonymous base
created for a derived enumeration type is not a first subtype,
even though it is defined through a full type declaration.
* sem_ch13.adb (Analyze_Aspects_At_Freeze_Point): Do not process
aspects for the anonymous base type constructed for a derived
scalar type, because they will be set when the first subtype
is frozen.
(Inherit_Aspects_At_Freeze_Point): Fix typos on handling of
Default_Value and Default_Component_Value, that prevented the
proper inheritance of these aspects.
2015-05-12 Gary Dismukes <dismukes@adacore.com>
* exp_ch6.adb, exp_unst.adb: Minor typo fixes.
2015-05-12 Robert Dewar <dewar@adacore.com>
* sem_ch3.adb: Minor reformatting.

View File

@ -87,7 +87,7 @@ package body Exp_Ch6 is
-- we are in Unnest_Subprogram_Mode, then we record the subprogram entity
-- and the body in this table, to later be passed to Unnest_Subprogram.
-- We need this delaying mechanism, because we have to wait untiil all
-- We need this delaying mechanism, because we have to wait until all
-- instantiated bodies have been inserted before doing the unnesting.
type Unest_Entry is record

View File

@ -95,7 +95,7 @@ package body Exp_Unst is
-- This flag is set True if there is a call path from the outer level
-- subprogram to this subprogram. If Reachable is False, it means that
-- the subprogram is declared but not actually referenced. We remove
-- such suprograms from the tree, which simplifies our task, because
-- such subprograms from the tree, which simplifies our task, because
-- we don't have to worry about e.g. uplevel references from such an
-- unreferenced subpogram, which might require (useless) activation
-- records to be created. This is computed by setting the outer level
@ -118,7 +118,7 @@ package body Exp_Unst is
Declares_AREC : Boolean;
-- This is set True for a subprogram which include the declarations
-- for a local activation record to bew passed on downward calls. It
-- for a local activation record to be passed on downward calls. It
-- is set True for the target level of an uplevel reference, and for
-- all intervening nested subprograms. For example, if a subprogram X
-- at level 5 makes an uplevel reference to an entity declared in a
@ -225,7 +225,7 @@ package body Exp_Unst is
Callee : Entity_Id;
-- The entity for the subprogram containing the referenced entity. Note
-- that the level of Callee must be less than the level of Caller, since
-- this is uplevel reference.
-- this is an uplevel reference.
end record;
package Urefs is new Table.Table (

View File

@ -1130,7 +1130,20 @@ package body Sem_Ch13 is
when Aspect_Default_Value |
Aspect_Default_Component_Value =>
Analyze_Aspect_Default_Value (ASN);
-- Do not inherit aspect for anonymous base type of a
-- scalar or array type, because they apply to the first
-- subtype of the type, and will be processed when that
-- first subtype is frozen.
if Is_Derived_Type (E)
and then not Comes_From_Source (E)
and then E /= First_Subtype (E)
then
null;
else
Analyze_Aspect_Default_Value (ASN);
end if;
-- Ditto for iterator aspects, because the corresponding
-- attributes may not have been analyzed yet.
@ -10910,9 +10923,12 @@ package body Sem_Ch13 is
-- Default_Component_Value
-- Verify that there is no rep_item declared for the type, and there
-- is one coming from an ancestor.
if Is_Array_Type (Typ)
and then Is_Base_Type (Typ)
and then Has_Rep_Item (Typ, Name_Default_Component_Value, False)
and then not Has_Rep_Item (Typ, Name_Default_Component_Value, False)
and then Has_Rep_Item (Typ, Name_Default_Component_Value)
then
Set_Default_Aspect_Component_Value (Typ,
@ -10924,9 +10940,10 @@ package body Sem_Ch13 is
if Is_Scalar_Type (Typ)
and then Is_Base_Type (Typ)
and then Has_Rep_Item (Typ, Name_Default_Value, False)
and then not Has_Rep_Item (Typ, Name_Default_Value, False)
and then Has_Rep_Item (Typ, Name_Default_Value)
then
Set_Has_Default_Aspect (Typ);
Set_Default_Aspect_Value (Typ,
Default_Aspect_Value
(Entity (Get_Rep_Item (Typ, Name_Default_Value))));

View File

@ -6553,6 +6553,11 @@ package body Sem_Ch3 is
Insert_Before (N, Type_Decl);
Analyze (Type_Decl);
-- The anonymous base now has a full declaration, but this base
-- is not a first subtype.
Set_Is_First_Subtype (Implicit_Base, False);
-- After the implicit base is analyzed its Etype needs to be changed
-- to reflect the fact that it is derived from the parent type which
-- was ignored during analysis. We also set the size at this point.