* opt.ads, sem.adb, sem_elab.adb: Minor reformatting
2010-06-14 Robert Dewar <dewar@adacore.com>
* exp_aggr.adb (Has_Address_Clause): Moved to Exp_Util, and there it
is renamed as Has_Following_Address_Clause.
* exp_ch3.adb (Needs_Simple_Initialization): Add Consider_IS argument
to allow the caller to avoid Initialize_Scalars having an effect.
(Expand_N_Object_Declaration): Do not do Initialize_Scalars stuff for
scalars with an address clause specified.
* exp_ch3.ads (Needs_Simple_Initialization): Add Consider_IS argument
to allow the caller to avoid Initialize_Scalars having an effect.
* exp_util.adb (Has_Following_Address_Clause): Moved here from Exp_Aggr
(where it was called Has_Address_Clause).
* exp_util.ads (Has_Following_Address_Clause): Moved here from Exp_Aggr
(where it was called Has_Address_Clause).
* freeze.adb (Warn_Overlay): Suppress message about overlaying causing
problems for Initialize_Scalars (since we no longer initialize objects
with an address clause.
2010-06-14 Robert Dewar <dewar@adacore.com>
* exp_prag.adb (Expand_Pragma_Check): Set Loc of generated code from
condition.
2010-06-14 Gary Dismukes <dismukes@adacore.com>
* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Set Debug_Info_Needed
on the entity of an implicitly generated postcondition procedure.
2010-06-14 Thomas Quinot <quinot@adacore.com>
* sem_ch7.adb (Preserve_Full_Attributes): Propagate
Discriminant_Constraint elist from full view to private view.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160720
138bc75d-0d04-0410-961f-
82ee72b054a4
2010-06-14 Robert Dewar <dewar@adacore.com>
+ * opt.ads, sem.adb, sem_elab.adb: Minor reformatting
+
+2010-06-14 Robert Dewar <dewar@adacore.com>
+
+ * exp_aggr.adb (Has_Address_Clause): Moved to Exp_Util, and there it
+ is renamed as Has_Following_Address_Clause.
+ * exp_ch3.adb (Needs_Simple_Initialization): Add Consider_IS argument
+ to allow the caller to avoid Initialize_Scalars having an effect.
+ (Expand_N_Object_Declaration): Do not do Initialize_Scalars stuff for
+ scalars with an address clause specified.
+ * exp_ch3.ads (Needs_Simple_Initialization): Add Consider_IS argument
+ to allow the caller to avoid Initialize_Scalars having an effect.
+ * exp_util.adb (Has_Following_Address_Clause): Moved here from Exp_Aggr
+ (where it was called Has_Address_Clause).
+ * exp_util.ads (Has_Following_Address_Clause): Moved here from Exp_Aggr
+ (where it was called Has_Address_Clause).
+ * freeze.adb (Warn_Overlay): Suppress message about overlaying causing
+ problems for Initialize_Scalars (since we no longer initialize objects
+ with an address clause.
+
+2010-06-14 Robert Dewar <dewar@adacore.com>
+
+ * exp_prag.adb (Expand_Pragma_Check): Set Loc of generated code from
+ condition.
+
+2010-06-14 Gary Dismukes <dismukes@adacore.com>
+
+ * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Set Debug_Info_Needed
+ on the entity of an implicitly generated postcondition procedure.
+
+2010-06-14 Thomas Quinot <quinot@adacore.com>
+
+ * sem_ch7.adb (Preserve_Full_Attributes): Propagate
+ Discriminant_Constraint elist from full view to private view.
+
+2010-06-14 Robert Dewar <dewar@adacore.com>
+
* sem_res.adb: Minor reformatting
2010-06-14 Ed Schonberg <schonberg@adacore.com>
-- array sub-aggregate we start the computation from. Dim is the
-- dimension corresponding to the sub-aggregate.
- function Has_Address_Clause (D : Node_Id) return Boolean;
- -- If the aggregate is the expression in an object declaration, it
- -- cannot be expanded in place. This function does a lookahead in the
- -- current declarative part to find an address clause for the object
- -- being declared.
-
function In_Place_Assign_OK return Boolean;
-- Simple predicate to determine whether an aggregate assignment can
-- be done in place, because none of the new values can depend on the
end Compute_Others_Present;
------------------------
- -- Has_Address_Clause --
- ------------------------
-
- function Has_Address_Clause (D : Node_Id) return Boolean is
- Id : constant Entity_Id := Defining_Identifier (D);
- Decl : Node_Id;
-
- begin
- Decl := Next (D);
- while Present (Decl) loop
- if Nkind (Decl) = N_At_Clause
- and then Chars (Identifier (Decl)) = Chars (Id)
- then
- return True;
-
- elsif Nkind (Decl) = N_Attribute_Definition_Clause
- and then Chars (Decl) = Name_Address
- and then Chars (Name (Decl)) = Chars (Id)
- then
- return True;
- end if;
-
- Next (Decl);
- end loop;
-
- return False;
- end Has_Address_Clause;
-
- ------------------------
-- In_Place_Assign_OK --
------------------------
Build_Activation_Chain_Entity (N);
end if;
+ -- Should document these individual tests ???
+
if not Has_Default_Init_Comps (N)
and then Comes_From_Source (Parent (N))
and then Nkind (Parent (N)) = N_Object_Declaration
and then N = Expression (Parent (N))
and then not Is_Bit_Packed_Array (Typ)
and then not Has_Controlled_Component (Typ)
- and then not Has_Address_Clause (Parent (N))
+
+ -- If the aggregate is the expression in an object declaration, it
+ -- cannot be expanded in place. Lookahead in the current declarative
+ -- part to find an address clause for the object being declared. If
+ -- one is present, we cannot build in place. Unclear comment???
+
+ and then not Has_Following_Address_Clause (Parent (N))
then
Tmp := Defining_Identifier (Parent (N));
Set_No_Initialization (Parent (N));
-- it will be assigned subsequently. In particular, there is no point
-- in applying Initialize_Scalars to such a temporary.
- elsif Needs_Simple_Initialization (Typ)
+ elsif Needs_Simple_Initialization
+ (Typ,
+ Initialize_Scalars
+ and then not Has_Following_Address_Clause (N))
and then not Is_Internal (Def_Id)
and then not Has_Init_Expression (N)
then
-- Needs_Simple_Initialization --
---------------------------------
- function Needs_Simple_Initialization (T : Entity_Id) return Boolean is
+ function Needs_Simple_Initialization
+ (T : Entity_Id;
+ Consider_IS : Boolean := True) return Boolean
+ is
+ Consider_IS_NS : constant Boolean :=
+ Normalize_Scalars
+ or (Initialize_Scalars and Consider_IS);
+
begin
-- Check for private type, in which case test applies to the underlying
-- type of the private type.
-- types.
elsif Is_Access_Type (T)
- or else (Init_Or_Norm_Scalars and then (Is_Scalar_Type (T)))
+ or else (Consider_IS_NS and then (Is_Scalar_Type (T)))
then
return True;
-- expanding an aggregate (since in the latter case they will be
-- filled with appropriate initializing values before they are used).
- elsif Init_Or_Norm_Scalars
+ elsif Consider_IS_NS
and then
(Root_Type (T) = Standard_String
or else Root_Type (T) = Standard_Wide_String
-- then tags components located at variable positions of Target are
-- initialized.
- function Needs_Simple_Initialization (T : Entity_Id) return Boolean;
+ function Needs_Simple_Initialization
+ (T : Entity_Id;
+ Consider_IS : Boolean := True) return Boolean;
-- Certain types need initialization even though there is no specific
-- initialization routine. In this category are access types (which need
-- initializing to null), packed array types whose implementation is a
-- modular type, and all scalar types if Normalize_Scalars is set, as well
-- as private types whose underlying type is present and meets any of these
-- criteria. Finally, descendants of String and Wide_String also need
- -- initialization in Initialize/Normalize_Scalars mode.
+ -- initialization in Initialize/Normalize_Scalars mode. Consider_IS is
+ -- normally True. If it is False, the Initialize_Scalars is not considered
+ -- in determining whether simple initialization is needed.
function Get_Simple_Init_Val
(T : Entity_Id;
--------------------------
procedure Expand_Pragma_Check (N : Node_Id) is
- Loc : constant Source_Ptr := Sloc (N);
Cond : constant Node_Id := Arg2 (N);
+ Loc : constant Source_Ptr := Sloc (Cond);
Nam : constant Name_Id := Chars (Arg1 (N));
Msg : Node_Id;
return False;
end Has_Controlled_Coextensions;
+ ------------------------
+ -- Has_Address_Clause --
+ ------------------------
+
+ -- Should this function check the private part in a package ???
+
+ function Has_Following_Address_Clause (D : Node_Id) return Boolean is
+ Id : constant Entity_Id := Defining_Identifier (D);
+ Decl : Node_Id;
+
+ begin
+ Decl := Next (D);
+ while Present (Decl) loop
+ if Nkind (Decl) = N_At_Clause
+ and then Chars (Identifier (Decl)) = Chars (Id)
+ then
+ return True;
+
+ elsif Nkind (Decl) = N_Attribute_Definition_Clause
+ and then Chars (Decl) = Name_Address
+ and then Chars (Name (Decl)) = Chars (Id)
+ then
+ return True;
+ end if;
+
+ Next (Decl);
+ end loop;
+
+ return False;
+ end Has_Following_Address_Clause;
+
--------------------
-- Homonym_Number --
--------------------
-- Determine whether a record type has anonymous access discriminants with
-- a controlled designated type.
+ function Has_Following_Address_Clause (D : Node_Id) return Boolean;
+ -- D is the node for an object declaration. This function searches the
+ -- current declarative part to look for an address clause for the object
+ -- being declared, and returns True if one is found.
+
function Homonym_Number (Subp : Entity_Id) return Nat;
-- Here subp is the entity for a subprogram. This routine returns the
-- homonym number used to disambiguate overloaded subprograms in the same
-- We only give the warning for non-imported entities of a type for
-- which a non-null base init proc is defined, or for objects of access
- -- types with implicit null initialization, or when Initialize_Scalars
+ -- types with implicit null initialization, or when Normalize_Scalars
-- applies and the type is scalar or a string type (the latter being
-- tested for because predefined String types are initialized by inline
- -- code rather than by an init_proc).
+ -- code rather than by an init_proc). Note that we do not give the
+ -- warning for Initialize_Scalars, since we suppressed initialization
+ -- in this case.
if Present (Expr)
and then not Is_Imported (Ent)
and then (Has_Non_Null_Base_Init_Proc (Typ)
or else Is_Access_Type (Typ)
- or else (Init_Or_Norm_Scalars
+ or else (Normalize_Scalars
and then (Is_Scalar_Type (Typ)
or else Is_String_Type (Typ))))
then
Bind_For_Library : Boolean := False;
-- GNATBIND
- -- Set to True if the binder needs to generate a file designed for
- -- building a library. May be set to True by Gnatbind.Scan_Bind_Arg.
+ -- Set to True if the binder needs to generate a file designed for building
+ -- a library. May be set to True by Gnatbind.Scan_Bind_Arg.
Bind_Only : Boolean := False;
-- GNATMAKE, GPRMAKE, GPRBUILD
if Is_Child_Unit (Cunit_Entity (Main_Unit)) then
Child := Cunit_Entity (Main_Unit);
-
while Is_Child_Unit (Child) loop
Parent_CU :=
Cunit (Get_Cunit_Entity_Unit_Number (Scope (Child)));
end if;
end if;
- -- Mark presence of postcondition proc in current scope
+ -- Mark presence of postcondition procedure in current scope and mark
+ -- the procedure itself as needing debug info. The latter is important
+ -- when analyzing decision coverage (for example, for MC/DC coverage).
if Chars (Body_Id) = Name_uPostconditions then
Set_Has_Postconditions (Current_Scope);
+ Set_Debug_Info_Needed (Body_Id);
end if;
-- Place subprogram on scope stack, and make formals visible. If there
end if;
Set_Has_Discriminants (Priv, Has_Discriminants (Full));
+ if Has_Discriminants (Full) then
+ Set_Discriminant_Constraint (Priv,
+ Discriminant_Constraint (Full));
+ end if;
end if;
end Preserve_Full_Attributes;
elsif In_Task_Activation then
return;
- -- Nothing to do if call is within a generic unit.
+ -- Nothing to do if call is within a generic unit
elsif Inside_A_Generic then
return;