aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/inline.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2017-09-08 11:44:30 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2017-09-08 11:44:30 +0200
commit63a5b3dc89fa01e461c96bde32df592db5bf700f (patch)
tree286bbbee48bb1a6c769c7f09a02580d3bdac7e5a /gcc/ada/inline.adb
parent3815f967f9fa3655ee4e9cdc44d6292e09f411de (diff)
downloadgcc-63a5b3dc89fa01e461c96bde32df592db5bf700f.zip
gcc-63a5b3dc89fa01e461c96bde32df592db5bf700f.tar.gz
gcc-63a5b3dc89fa01e461c96bde32df592db5bf700f.tar.bz2
[multiple changes]
2017-09-08 Ed Schonberg <schonberg@adacore.com> * style.adb: Fix typo. 2017-09-08 Javier Miranda <miranda@adacore.com> * einfo.adb (Underlying_Type): Add missing support for class-wide types that come from the limited view. * exp_attr.adb (Attribute_Address): Check class-wide type interfaces using the underlying type to handle limited-withed types. (Attribute_Tag): Check class-wide type interfaces using the underlying type to handle limited-withed types. 2017-09-08 Ed Schonberg <schonberg@adacore.com> * exp_ch5.adb (Expand_Predicated_Loop): Handle properly a loop over a subtype of a type with a static predicate, taking into account the predicate function of the parent type and the bounds given in the loop specification. * sem_ch3.adb (Inherit_Predicate_Flags): For qn Itype created for a loop specification that is a subtype indication whose type mark is a type with a static predicate, inherit predicate function, used to build case statement for rewritten loop. 2017-09-08 Justin Squirek <squirek@adacore.com> * lib-load.adb: Modify printing of error message to exclude file line number. 2017-09-08 Arnaud Charlet <charlet@adacore.com> * inline.adb (Can_Be_Inlined_In_GNATprove_Mode): don't inline subprograms declared in both visible and private parts of a package. (In_Package_Spec): previously In_Package_Visible_Spec; now detects subprograms declared both in visible and private parts of a package spec. 2017-09-08 Ed Schonberg <schonberg@adacore.com> * exp_util.adb (Build_Invariant_Procedure_Declaration): If the type is an anonymous array in an object declaration, whose component type has an invariant, use the object declaration as the insertion point for the invariant procedure, given that there is no explicit type declaration for an anonymous array type. 2017-09-08 Bob Duff <duff@adacore.com> * a-cbprqu.ads, a-cbdlli.adb: Suppress warnings. From-SVN: r251876
Diffstat (limited to 'gcc/ada/inline.adb')
-rw-r--r--gcc/ada/inline.adb35
1 files changed, 15 insertions, 20 deletions
diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb
index bc0428e..ca9986d 100644
--- a/gcc/ada/inline.adb
+++ b/gcc/ada/inline.adb
@@ -1187,9 +1187,9 @@ package body Inline is
-- Returns True if subprogram Id defines a compilation unit
-- Shouldn't this be in Sem_Aux???
- function In_Package_Visible_Spec (Id : Node_Id) return Boolean;
- -- Returns True if subprogram Id is defined in the visible part of a
- -- package specification.
+ function In_Package_Spec (Id : Node_Id) return Boolean;
+ -- Returns True if subprogram Id is defined in the package
+ -- specification, either its visible or private part.
---------------------------------------------------
-- Has_Formal_With_Discriminant_Dependent_Fields --
@@ -1288,24 +1288,17 @@ package body Inline is
return False;
end Has_Some_Contract;
- -----------------------------
- -- In_Package_Visible_Spec --
- -----------------------------
+ ---------------------
+ -- In_Package_Spec --
+ ---------------------
- function In_Package_Visible_Spec (Id : Node_Id) return Boolean is
- Decl : Node_Id := Parent (Parent (Id));
- P : Node_Id;
+ function In_Package_Spec (Id : Node_Id) return Boolean is
+ P : constant Node_Id := Parent (Subprogram_Spec (Id));
+ -- Parent of the subprogram's declaration
begin
- if Nkind (Parent (Id)) = N_Defining_Program_Unit_Name then
- Decl := Parent (Decl);
- end if;
-
- P := Parent (Decl);
-
- return Nkind (P) = N_Package_Specification
- and then List_Containing (Decl) = Visible_Declarations (P);
- end In_Package_Visible_Spec;
+ return Nkind (Enclosing_Declaration (P)) = N_Package_Declaration;
+ end In_Package_Spec;
------------------------
-- Is_Unit_Subprogram --
@@ -1351,9 +1344,11 @@ package body Inline is
if Is_Unit_Subprogram (Id) then
return False;
- -- Do not inline subprograms declared in the visible part of a package
+ -- Do not inline subprograms declared in package specs, because they are
+ -- not local, i.e. can be called either from anywhere (if declared in
+ -- visible part) or from the child units (if declared in private part).
- elsif In_Package_Visible_Spec (Id) then
+ elsif In_Package_Spec (Id) then
return False;
-- Do not inline subprograms declared in other units. This is important