diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2014-10-30 12:34:41 +0100 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2014-10-30 12:34:41 +0100 |
commit | 039538bc35b844d57ca526bf1a274c93d251b6f5 (patch) | |
tree | ae3d2ce7780de669626aac1dfe56ce4ac6df7aaa /gcc/ada/inline.adb | |
parent | 67848724e5d99bd27d69fc63b211658995aa9437 (diff) | |
download | gcc-039538bc35b844d57ca526bf1a274c93d251b6f5.zip gcc-039538bc35b844d57ca526bf1a274c93d251b6f5.tar.gz gcc-039538bc35b844d57ca526bf1a274c93d251b6f5.tar.bz2 |
[multiple changes]
2014-10-30 Yannick Moy <moy@adacore.com>
* inline.adb (Has_Single_Return_In_GNATprove_Mode):
Return False when return statement is inside one or more blocks.
2014-10-30 Hristian Kirtchev <kirtchev@adacore.com>
* exp_ch7.adb (Is_Subprogram_Call): Account for the case where an
object declaration initialized by a function call that returns
an unconstrained result may be rewritted as a renaming of the
secondary stack result.
2014-10-30 Hristian Kirtchev <kirtchev@adacore.com>
* aspects.adb: Add an entry for aspect Extensions_Visible in
table Canonical_Aspect.
* aspects.ads: Add entry for aspect Extensions_Visible in
tables Aspect_Argument, Aspect_Delay, Aspect_Id, Aspect_Names,
Implementation_Defined_Aspect.
* einfo.adb (Get_Pragma): Include pragma Extensions_Visible in
the list of contract pragmas.
* par-prag.adb Pragma Extensions_Visible does not require special
processing from the parser.
* sem_ch3.adb (Analyze_Object_Declaration): Prevent an
implicit class-wide conversion of a formal parameter
of a specific tagged type whose related subprogram is
subject to pragma Extensions_Visible with value "False".
(Check_Abstract_Overriding): Add various overriding checks
related to pragma Extensions_Visible.
(Derive_Subprogram):
A subprogram subject to pragma Extensions_Visible with value
False requires overriding if the subprogram has at least one
controlling OUT parameter.
(Is_EVF_Procedure): New routine.
* sem_ch4.adb (Analyze_Type_Conversion): A formal parameter of
a specific tagged type whose related subprogram is subject to
pragma Extensions_Visible with value "False" cannot appear in
a class-wide conversion.
* sem_ch6.adb (Analyze_Subprogram_Contract): Remove
the assertion to account for pragma Extensions_Visible.
(Check_Overriding_Indicator): An overriding subprogram
inherits the contact of the overridden subprogram.
(New_Overloaded_Entity): An overriding subprogram inherits the
contact of the overridden subprogram.
* sem_ch13.adb (Analyze_Aspect_Specifications): Add processing
for aspect Extensions_Visible.
(Check_Aspect_At_Freeze_Point): Aspect Extensions_Visible does not
require special processing at the freeze point.
* sem_prag.adb Add an entry for pragma Extensions_Visible in
table Sig_Flags.
(Analyze_Pragma): Ensure that various SPARK
pragmas lack identifiers in their arguments. Add processing for
pragma Extensions_Visible.
(Chain_CTC): Code reformatting.
* sem_res.adb (Resolve_Actuals): A formal parameter of a
specific tagged type whose related subprogram is subject to
pragma Extensions_Visible with value "False" cannot act as an
actual in a subprogram with value "True".
* sem_util.adb (Add_Classification): New routine.
(Add_Contract_Item): Account for pragma Extensions_Visible. Code
reformatting.
(Add_Contract_Test_Case): New routine.
(Add_Pre_Post_Condition): New routine.
(Extensions_Visible_Status): New routine.
(Inherit_Subprogram_Contract): New routine.
(Is_EVF_Expression): New routine.
(Is_Specific_Tagged_Type): New routine.
* sem_util.ads Add type Extensions_Visible_Mode and document all values.
(Add_Contract_Item): Add pragma Extensions_Visible to the
comment on usage.
(Inherit_Subprogram_Contract): New routine.
(Is_EVF_Expression): New routine.
(Is_Specific_Tagged_Type): New routine.
* sinfo.adb (Is_Inherited): New routine.
(Set_Is_Inherited): New routine.
* sinfo.ads Add flag Is_Inherited along with its usage in
nodes.
(Is_Inherited): New routine along with pragma Inline.
(Set_Is_Inherited): New routine along with pragma Inline.
* snames.ads-tmpl: Add predefined name "Extensions_Visible"
and a new Pragma_Id for the pragma.
From-SVN: r216919
Diffstat (limited to 'gcc/ada/inline.adb')
-rw-r--r-- | gcc/ada/inline.adb | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb index efb4e6c..8e2df38 100644 --- a/gcc/ada/inline.adb +++ b/gcc/ada/inline.adb @@ -933,7 +933,10 @@ package body Inline is function Has_Single_Return_In_GNATprove_Mode return Boolean; -- This function is called only in GNATprove mode, and it returns -- True if the subprogram has no return statement or a single return - -- statement as last statement. + -- statement as last statement. It returns False for subprogram with + -- a single return as last statement inside one or more blocks, as + -- inlining would generate gotos in that case as well (although the + -- goto is useless in that case). function Uses_Secondary_Stack (Bod : Node_Id) return Boolean; -- If the body of the subprogram includes a call that returns an @@ -1003,15 +1006,10 @@ package body Inline is -- Start of processing for Has_Single_Return_In_GNATprove_Mode begin - -- Retrieve last statement inside possible block statements + -- Retrieve the last statement Last_Statement := Last (Statements (Handled_Statement_Sequence (N))); - while Nkind (Last_Statement) = N_Block_Statement loop - Last_Statement := - Last (Statements (Handled_Statement_Sequence (Last_Statement))); - end loop; - -- Check that the last statement is the only possible return -- statement in the subprogram. @@ -2049,16 +2047,15 @@ package body Inline is OK : Boolean; begin - if Is_Compilation_Unit (P) + if Front_End_Inlining + and then Is_Compilation_Unit (P) and then not Is_Generic_Instance (P) then Bname := Get_Body_Name (Get_Unit_Name (Unit (N))); E := First_Entity (P); while Present (E) loop - if Has_Pragma_Inline_Always (E) - or else (Front_End_Inlining and then Has_Pragma_Inline (E)) - then + if Has_Pragma_Inline (E) then if not Is_Loaded (Bname) then Load_Needed_Body (N, OK); |