[fpc-pascal] inlining functions depending on implementation only functions

Benito van der Zander benito at benibela.de
Sat Dec 29 15:16:19 CET 2018


Hi,

after updating from fpc 3.1 to fpc 3.3, I am getting a lot of "function 
was not inlined" warnings, e.g. when an inline function depends on a 
function not declared in the interface part like:

unit inlinetest;

{$mode objfpc}{$H+}

interface

uses
   Classes, SysUtils;


function strContains(const str, searched: string): boolean; inline;

implementation

function strContainsFrom(const str, searched: string; from: SizeInt): 
boolean;
begin
   result:=Pos(searched, str, from) > 0;
end;


function strContains(const str, searched: string): boolean; inline;
begin
   result := strContainsFrom(str, searched, 1);
end;

end.



Is that supposed to happen?

Fpc 3.1 did not show any warning in this case (although now that I 
investigate it, fpc 3.1 also did not seem to inline it despite not 
showing the warning)


Bye,

Benito





More information about the fpc-pascal mailing list