mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-23 00:50:28 +02:00
+ inline01.pp inline test
This commit is contained in:
parent
6d002dbc36
commit
b440e794b6
121
tests/test/inline01.pp
Normal file
121
tests/test/inline01.pp
Normal file
@ -0,0 +1,121 @@
|
||||
program inline01;
|
||||
|
||||
var
|
||||
starti: longint;
|
||||
i:longint;
|
||||
|
||||
|
||||
{$INLINE ON}
|
||||
|
||||
procedure kkainl(var c: longint); inline;
|
||||
begin
|
||||
if c <> starti then
|
||||
begin
|
||||
writeln('bug');
|
||||
halt(1);
|
||||
end;
|
||||
writeln('kka ',c);
|
||||
c:=c+1;
|
||||
if i <> starti+1 then
|
||||
begin
|
||||
writeln('bug');
|
||||
halt(1);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure kka(var c:longint);
|
||||
begin
|
||||
if c <> starti then
|
||||
begin
|
||||
writeln('bug');
|
||||
halt(1);
|
||||
end;
|
||||
writeln('kka ',c);
|
||||
c:=c+1;
|
||||
if i <> starti+1 then
|
||||
begin
|
||||
writeln('bug');
|
||||
halt(1);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure kkb(var c:longint);inline;
|
||||
begin
|
||||
if c <> starti then
|
||||
begin
|
||||
writeln('bug');
|
||||
halt(1);
|
||||
end;
|
||||
kka(c);
|
||||
if i <> starti+1 then
|
||||
begin
|
||||
writeln('bug');
|
||||
halt(1);
|
||||
end;
|
||||
writeln('kkb ',c);
|
||||
end;
|
||||
|
||||
procedure kkb2(var c:longint);inline;
|
||||
begin
|
||||
if c <> starti then
|
||||
begin
|
||||
writeln('bug');
|
||||
halt(1);
|
||||
end;
|
||||
kkainl(c);
|
||||
if i <> starti+1 then
|
||||
begin
|
||||
writeln('bug');
|
||||
halt(1);
|
||||
end;
|
||||
writeln('kkb ',c);
|
||||
end;
|
||||
|
||||
procedure kkc(var c: longint);
|
||||
begin
|
||||
if c <> starti then
|
||||
begin
|
||||
writeln('bug');
|
||||
halt(1);
|
||||
end;
|
||||
kkb(c);
|
||||
if i <> starti+1 then
|
||||
begin
|
||||
writeln('bug');
|
||||
halt(1);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure kkcinl(var c: longint); inline;
|
||||
begin
|
||||
if c <> starti then
|
||||
begin
|
||||
writeln('bug');
|
||||
halt(1);
|
||||
end;
|
||||
kkb2(c);
|
||||
if i <> starti+1 then
|
||||
begin
|
||||
writeln('bug');
|
||||
halt(1);
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
i:=5;
|
||||
starti := 5;
|
||||
kkc(i);
|
||||
starti := i;
|
||||
kkc(i);
|
||||
starti := i;
|
||||
kkb(i);
|
||||
starti := i;
|
||||
kkb(i);
|
||||
starti := i;
|
||||
kka(i);
|
||||
starti := i;
|
||||
kkcinl(i);
|
||||
starti := i;
|
||||
kkb2(i);
|
||||
end.
|
||||
|
@ -32,3 +32,7 @@ case .................. testcase.pp tests case statements with byte and word
|
||||
Arrays ................ testarr1.pp small test for open arrays with classes
|
||||
Enumerations .......... testenm1.pp tests assignments of subrange
|
||||
enumerations
|
||||
Inline ................ inline01.pp tests recursive inlining, inlining
|
||||
a procedure multiple times and
|
||||
inlining procedures in other
|
||||
inline procedures.
|
||||
|
Loading…
Reference in New Issue
Block a user