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] Lift limitation on inter-unit inlining of instantiated subprograms


This change makes it so that instantiations of generic subprograms marked as
inline are considered for inter-unit inlining.  This was not previously the
case because of a technical limitation that was too broadly enforced (unlike
the associated comment which was more accurate) and excluded instantiations.

The call to Q.Compare must be inlined if the code is compiled with -O -gnatn:

with Q;

function F (A, B : Integer) return Boolean is
begin
  return Q.Compare (A, B);
end;
with G;

package Q is

  function Compare is new G (Integer);

end Q;
generic
  type T is (<>);
function G (Left,Right : T) return Boolean;
pragma Inline (G);
function G (Left,Right : T) return Boolean is
begin
  return Left /= Right;
end;

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

	* inline.adb (List_Inlining_Info): Minor tweaks.
	(Add_Inlined_Body): Inline the enclosing package
	if it is not internally generated, even if it doesn't come
	from source.

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]