This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Inter-unit inlining of expression functions with -gnatn1


This enables inter-unit inlining of expression functions with -gnatn1, or more
simply with -O1/-O2 -gnatn.  These functions are automatically candidates for
inlining, but there were actually inlined across units only with -gnatn2, or
more simply -O3 -gnatn.

The following program must compile without warnings with -O -gnatn -Winline:

with Q; use Q;

procedure P (I : Integer) is
begin
  if Process (I) /= 2 * I then
    raise Program_Error;
  end if;
end;
package Q is

  function Process (I : Integer) return Integer;
  pragma Inline (Process);

end Q;
with R; use R;

package body Q is

  function Process (I : Integer) return Integer is
  begin
    return Process2 (I) + Process3 (I);
  end;

end Q;
package R is

  function Process2 (I : Integer) return Integer;

  function Process3 (I : Integer) return Integer is (I);

private

  function Process2 (I : Integer) return Integer is (I);

end R;

Tested on x86_64-pc-linux-gnu, committed on trunk

2014-11-20  Eric Botcazou  <ebotcazou@adacore.com>

	* inline.adb (Add_Inlined_Subprogram): Insert all programs
	generated as a body or whose declaration was provided along with
	the body.

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]