Do not give a spurious error for redeclarations of a pascal function.

This could occur with strict type checking on, because the parameter types were compared at a point where they had been reversed for the original declaration but not for the subsequent one.

Here is an example that would give an error:

#pragma ignore 24
extern pascal void func(int, long);
extern pascal void func(int, long);
This commit is contained in:
Stephen Heumann 2022-01-11 21:12:27 -06:00
parent 4e59f4569f
commit b5b276d0f4

View File

@ -1735,21 +1735,21 @@ else if doingParameters then
if tPtr^.kind = functionType then begin {declare the identifier} if tPtr^.kind = functionType then begin {declare the identifier}
if variable <> nil then begin if variable <> nil then begin
if isPascal then begin
{reverse the parameter list}
p2 := tptr^.parameterList;
p1 := nil;
while p2 <> nil do begin
p3 := p2;
p2 := p2^.next;
p3^.next := p1;
p1 := p3;
end; {while}
tPtr^.parameterList := p1;
end; {if}
t1 := variable^.itype; t1 := variable^.itype;
if CompTypes(t1, tPtr) then begin if CompTypes(t1, tPtr) then begin
if t1^.prototyped and tPtr^.prototyped then begin if t1^.prototyped and tPtr^.prototyped then begin
p2 := tptr^.parameterList;
if isPascal then begin
{reverse the parameter list}
p1 := nil;
while p2 <> nil do begin
p3 := p2;
p2 := p2^.next;
p3^.next := p1;
p1 := p3;
end; {while}
tPtr^.parameterList := p1;
end; {if}
p2 := tPtr^.parameterList; p2 := tPtr^.parameterList;
p1 := t1^.parameterList; p1 := t1^.parameterList;
while (p1 <> nil) and (p2 <> nil) do begin while (p1 <> nil) and (p2 <> nil) do begin
@ -1781,23 +1781,23 @@ if tPtr^.kind = functionType then begin {declare the identifier}
end; {while} end; {while}
if p1 <> p2 then if p1 <> p2 then
Error(47); Error(47);
p2 := tptr^.parameterList;
if isPascal then begin
{reverse the parameter list}
p1 := nil;
while p2 <> nil do begin
p3 := p2;
p2 := p2^.next;
p3^.next := p1;
p1 := p3;
end; {while}
tPtr^.parameterList := p1;
end; {if}
end; {if} end; {if}
end {if} end {if}
else else
Error(42); Error(42);
1: 1:
if isPascal then begin
{reverse the parameter list}
p2 := tptr^.parameterList;
p1 := nil;
while p2 <> nil do begin
p3 := p2;
p2 := p2^.next;
p3^.next := p1;
p1 := p3;
end; {while}
tPtr^.parameterList := p1;
end; {if}
end; {if} end; {if}
end; {if} end; {if}
if tPtr^.kind = functionType then if tPtr^.kind = functionType then