+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.
-- 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
-- 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
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
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 (
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.
-- 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,
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))));
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.