Commit 9cc6b3f8 by Eric Botcazou Committed by Arnaud Charlet

sem_ch6.adb (Analyze_Subprogram_Body_Helper): Remove redundant test, adjust…

sem_ch6.adb (Analyze_Subprogram_Body_Helper): Remove redundant test, adjust comments and formatting.

2016-07-07  Eric Botcazou  <ebotcazou@adacore.com>

	* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Remove redundant test,
	adjust comments and formatting.
	* sem_prag.adb (Inlining_Not_Possible): Do not test Front_End_Inlining
	here but...
	(Make_Inline): ...here before calling Inlining_Not_Possible instead.
	(Set_Inline_Flags): Remove useless test.
	(Analyze_Pragma) <Pragma_Inline>: Add comment about -gnatn switch.

From-SVN: r238113
parent 7119f1b1
2016-07-07 Eric Botcazou <ebotcazou@adacore.com>
* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Remove redundant test,
adjust comments and formatting.
* sem_prag.adb (Inlining_Not_Possible): Do not test Front_End_Inlining
here but...
(Make_Inline): ...here before calling Inlining_Not_Possible instead.
(Set_Inline_Flags): Remove useless test.
(Analyze_Pragma) <Pragma_Inline>: Add comment about -gnatn switch.
2016-07-07 Ed Schonberg <schonberg@adacore.com>
* sem_prag.ads, sem_prag.adb (Build_Classwide_Expression): Include
......
......@@ -3731,7 +3731,7 @@ package body Sem_Ch6 is
return;
end if;
-- Handle front-end inlining
-- Handle inlining
-- Note: Normally we don't do any inlining if expansion is off, since
-- we won't generate code in any case. An exception arises in GNATprove
......@@ -3748,15 +3748,14 @@ package body Sem_Ch6 is
if not Back_End_Inlining then
if (Has_Pragma_Inline_Always (Spec_Id)
and then not Opt.Disable_FE_Inline_Always)
or else
(Has_Pragma_Inline (Spec_Id) and then Front_End_Inlining
and then not Opt.Disable_FE_Inline)
and then not Opt.Disable_FE_Inline_Always)
or else (Front_End_Inlining
and then not Opt.Disable_FE_Inline)
then
Build_Body_To_Inline (N, Spec_Id);
end if;
-- New implementation (relying on backend inlining)
-- New implementation (relying on back-end inlining)
else
if Has_Pragma_Inline_Always (Spec_Id)
......
......@@ -3932,7 +3932,7 @@ package body Sem_Prag is
-- Enabled: inlining is requested/required for the subprogram
procedure Process_Inline (Status : Inline_Status);
-- Common processing for Inline, Inline_Always and No_Inline. Parameter
-- Common processing for No_Inline, Inline and Inline_Always. Parameter
-- indicates the inline status specified by the pragma.
procedure Process_Interface_Name
......@@ -8791,21 +8791,20 @@ package body Sem_Prag is
-- processing the arguments of the pragma.
procedure Make_Inline (Subp : Entity_Id);
-- Subp is the defining unit name of the subprogram declaration. Set
-- the flag, as well as the flag in the corresponding body, if there
-- is one present.
-- Subp is the defining unit name of the subprogram declaration. If
-- the pragma is valid, call Set_Inline_Flags on Subp, as well as on
-- the corresponding body, if there is one present.
procedure Set_Inline_Flags (Subp : Entity_Id);
-- Sets Is_Inlined and Has_Pragma_Inline flags for Subp and also
-- Has_Pragma_Inline_Always for the Inline_Always case.
-- Set Has_Pragma_{No_Inline,Inline,Inline_Always} flag on Subp.
-- Also set or clear Is_Inlined flag on Subp depending on Status.
function Inlining_Not_Possible (Subp : Entity_Id) return Boolean;
-- Returns True if it can be determined at this stage that inlining
-- is not possible, for example if the body is available and contains
-- exception handlers, we prevent inlining, since otherwise we can
-- get undefined symbols at link time. This function also emits a
-- warning if front-end inlining is enabled and the pragma appears
-- too late.
-- warning if the pragma appears too late.
--
-- ??? is business with link symbols still valid, or does it relate
-- to front end ZCX which is being phased out ???
......@@ -8827,9 +8826,7 @@ package body Sem_Prag is
elsif Nkind (Decl) = N_Subprogram_Declaration
and then Present (Corresponding_Body (Decl))
then
if Front_End_Inlining
and then Analyzed (Corresponding_Body (Decl))
then
if Analyzed (Corresponding_Body (Decl)) then
Error_Msg_N ("pragma appears too late, ignored??", N);
return True;
......@@ -8879,6 +8876,7 @@ package body Sem_Prag is
-- If inlining is not possible, for now do not treat as an error
elsif Status /= Suppressed
and then Front_End_Inlining
and then Inlining_Not_Possible (Subp)
then
Applies := True;
......@@ -9048,9 +9046,7 @@ package body Sem_Prag is
end if;
end if;
if not Has_Pragma_Inline (Subp) then
Set_Has_Pragma_Inline (Subp);
end if;
Set_Has_Pragma_Inline (Subp);
end if;
-- Then adjust the Is_Inlined flag. It can never be set if the
......@@ -16398,7 +16394,23 @@ package body Sem_Prag is
if not GNATprove_Mode then
-- Inline status is Enabled if inlining option is active
-- Inline status is Enabled if option -gnatn is specified.
-- However this status determines only the value of the
-- Is_Inlined flag on the subprogram and does not prevent
-- the pragma itself from being recorded for later use,
-- in particular for a later modification of Is_Inlined
-- independently of the -gnatn option.
-- In other words, if -gnatn is specified for a unit, then
-- all Inline pragmas processed for the compilation of this
-- unit, including those in the spec of other units, are
-- activated, so subprograms will be inlined across units.
-- If -gnatn is not specified, no Inline pragma is activated
-- here, which means that subprograms will not be inlined
-- across units. The Is_Inlined flag will nevertheless be
-- set later when bodies are analyzed, so subprograms will
-- be inlined within the unit.
if Inline_Active then
Process_Inline (Enabled);
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