Commit 79185f5f by Arnaud Charlet

[multiple changes]

2014-07-30  Robert Dewar  <dewar@adacore.com>

	* sem_util.adb (Predicate_Tests_On_Arguments): Omit tests for
	some additional cases of internally generated routines.

2014-07-30  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch10.adb (Analyze_Proper_Body): When compiling for ASIS,
	if the compilation unit is a subunit, extend optional processing
	to all subunits of the current one. This allows gnatstub to
	supress generation of spurious bodies.

From-SVN: r213236
parent ec622246
2014-07-30 Robert Dewar <dewar@adacore.com>
* sem_util.adb (Predicate_Tests_On_Arguments): Omit tests for
some additional cases of internally generated routines.
2014-07-30 Ed Schonberg <schonberg@adacore.com>
* sem_ch10.adb (Analyze_Proper_Body): When compiling for ASIS,
if the compilation unit is a subunit, extend optional processing
to all subunits of the current one. This allows gnatstub to
supress generation of spurious bodies.
2014-07-30 Hristian Kirtchev <kirtchev@adacore.com> 2014-07-30 Hristian Kirtchev <kirtchev@adacore.com>
* a-cbmutr.adb (Insert_Child): Use local variable First to keep * a-cbmutr.adb (Insert_Child): Use local variable First to keep
......
...@@ -1624,6 +1624,7 @@ package body Sem_Ch10 is ...@@ -1624,6 +1624,7 @@ package body Sem_Ch10 is
Set_Corresponding_Stub (Unit (Comp_Unit), N); Set_Corresponding_Stub (Unit (Comp_Unit), N);
Analyze_Subunit (Comp_Unit); Analyze_Subunit (Comp_Unit);
Set_Library_Unit (N, Comp_Unit); Set_Library_Unit (N, Comp_Unit);
Set_Corresponding_Body (N, Defining_Entity (Unit (Comp_Unit)));
end if; end if;
elsif Unum = No_Unit elsif Unum = No_Unit
...@@ -1713,16 +1714,23 @@ package body Sem_Ch10 is ...@@ -1713,16 +1714,23 @@ package body Sem_Ch10 is
-- should be ignored, except that if we are building trees for ASIS -- should be ignored, except that if we are building trees for ASIS
-- usage we want to annotate the stub properly. If the main unit is -- usage we want to annotate the stub properly. If the main unit is
-- itself a subunit, another subunit is irrelevant unless it is a -- itself a subunit, another subunit is irrelevant unless it is a
-- subunit of the current one. -- subunit of the current one, that is to say appears in the current
-- source tree.
elsif Nkind (Unit (Cunit (Main_Unit))) = N_Subunit elsif Nkind (Unit (Cunit (Main_Unit))) = N_Subunit
and then Subunit_Name /= Unit_Name (Main_Unit) and then Subunit_Name /= Unit_Name (Main_Unit)
then then
if ASIS_Mode if ASIS_Mode then
and then Scope (Defining_Entity (N)) = Cunit_Entity (Main_Unit) declare
PB : constant Node_Id := Proper_Body (Unit (Cunit (Main_Unit)));
begin
if Nkind_In (PB, N_Package_Body, N_Subprogram_Body)
and then List_Containing (N) = Declarations (PB)
then then
Optional_Subunit; Optional_Subunit;
end if; end if;
end;
end if;
-- But before we return, set the flag for unloaded subunits. This -- But before we return, set the flag for unloaded subunits. This
-- will suppress junk warnings of variables in the same declarative -- will suppress junk warnings of variables in the same declarative
......
...@@ -14723,15 +14723,25 @@ package body Sem_Util is ...@@ -14723,15 +14723,25 @@ package body Sem_Util is
function Predicate_Tests_On_Arguments (Subp : Entity_Id) return Boolean is function Predicate_Tests_On_Arguments (Subp : Entity_Id) return Boolean is
begin begin
-- Always test predicates on indirect call
if Ekind (Subp) = E_Subprogram_Type then
return True;
-- Do not test predicates on call to generated default Finalize, since -- Do not test predicates on call to generated default Finalize, since
-- we are not interested in whether something we are finalizing (and -- we are not interested in whether something we are finalizing (and
-- typically destroying) satisfies its predicates. -- typically destroying) satisfies its predicates.
if Chars (Subp) = Name_Finalize elsif Chars (Subp) = Name_Finalize
and then not Comes_From_Source (Subp) and then not Comes_From_Source (Subp)
then then
return False; return False;
-- Do not test predicates on any internally generated routines
elsif Is_Internal_Name (Chars (Subp)) then
return False;
-- Do not test predicates on call to Init_Proc, since if needed the -- Do not test predicates on call to Init_Proc, since if needed the
-- predicate test will occur at some other point. -- predicate test will occur at some other point.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment