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

Sven Barth pascaldragon at googlemail.com
Sat Dec 29 20:31:38 CET 2018


Am Sa., 29. Dez. 2018, 15:23 hat Benito van der Zander <benito at benibela.de>
geschrieben:

> 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)
>

Correct. FPC 3.1.1 did neither warn nor inline in this case, 3.3.1 at least
warns (I think 3.2 already warns as well).

Regards,
Sven

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20181229/58c50ebf/attachment.html>


More information about the fpc-pascal mailing list