aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/inline.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2017-09-06 13:02:33 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2017-09-06 13:02:33 +0200
commitb276ab7a45afb2181df553fcf064d1fc80a1a450 (patch)
treeccef384004066e3d6a99615da9190ace21b4287d /gcc/ada/inline.adb
parenta9e6f868cb1467dc53328ed3585156bc8bc0620f (diff)
downloadgcc-b276ab7a45afb2181df553fcf064d1fc80a1a450.zip
gcc-b276ab7a45afb2181df553fcf064d1fc80a1a450.tar.gz
gcc-b276ab7a45afb2181df553fcf064d1fc80a1a450.tar.bz2
[multiple changes]
2017-09-06 Yannick Moy <moy@adacore.com> * inline.adb: Add comments to Can_Be_Inlined_In_GNATprove_Mode. 2017-09-06 Javier Miranda <miranda@adacore.com> * exp_aggr.adb (Component_Not_OK_For_Backend): The C backend cannot handle a type conversion of an array as an aggregate component. 2017-09-06 Bob Duff <duff@adacore.com> * g-comlin.adb (Try_Help): Remove ".exe" so we get the same results on windows and unix. 2017-09-06 Justin Squirek <squirek@adacore.com> * exp_imgv.adb (Expand_Image_Attribute), (Expand_Wide_Image_Attribute), (Expand_Wide_Wide_Image_Attribute): Added case to handle new-style 'Image expansion (Rewrite_Object_Image): Moved from exp_attr.adb * exp_attr.adb (Expand_N_Attribute_Reference): Modified Image attribute cases so that the relevant subprograms in exp_imgv.adb handle all expansion. (Rewrite_Object_Reference_Image): Moved to exp_imgv.adb * sem_attr.adb (Analyze_Attribute): Modified Image attribute cases to call common function Analyze_Image_Attribute. (Analyze_Image_Attribute): Created as a common path for all image attributes (Check_Object_Reference_Image): Removed * sem_util.ads, sem_util.adb (Is_Image_Applied_To_Object): Removed and refactored into Is_Object_Image (Is_Object_Image): Created as a replacement for Is_Image_Applied_To_Object From-SVN: r251779
Diffstat (limited to 'gcc/ada/inline.adb')
-rw-r--r--gcc/ada/inline.adb13
1 files changed, 10 insertions, 3 deletions
diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb
index 6b6222b..0bbe9cf 100644
--- a/gcc/ada/inline.adb
+++ b/gcc/ada/inline.adb
@@ -1178,8 +1178,9 @@ package body Inline is
-- types.
function Has_Some_Contract (Id : Entity_Id) return Boolean;
- -- Returns True if subprogram Id has any contract (Pre, Post, Global,
- -- Depends, etc.)
+ -- Returns True if subprogram Id has any contract (Pre, Post,
+ -- Global, Depends, etc.) The presence of Extensions_Visible
+ -- or Volatile_Function is also considered as a contract here.
function Is_Unit_Subprogram (Id : Entity_Id) return Boolean;
-- Returns True if subprogram Id defines a compilation unit
@@ -1272,6 +1273,11 @@ package body Inline is
if Is_Subprogram_Or_Generic_Subprogram (Id) then
Items := Contract (Id);
+ -- Note that Classifications is not Empty when Extensions_Visible
+ -- or Volatile_Function is present, which causes such subprograms
+ -- to be considered to have a contract here. This is fine as we
+ -- want to avoid inlining these too.
+
return Present (Items)
and then (Present (Pre_Post_Conditions (Items)) or else
Present (Contract_Test_Cases (Items)) or else
@@ -1365,7 +1371,8 @@ package body Inline is
return False;
-- Do not inline subprograms that have a contract on the spec or the
- -- body. Use the contract(s) instead in GNATprove.
+ -- body. Use the contract(s) instead in GNATprove. This also prevents
+ -- inlining of subprograms with Extensions_Visible or Volatile_Function.
elsif (Present (Spec_Id) and then Has_Some_Contract (Spec_Id))
or else