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,12 +1735,9 @@ else if doingParameters then
if tPtr^.kind = functionType then begin {declare the identifier}
if variable <> nil then begin
t1 := variable^.itype;
if CompTypes(t1, tPtr) then begin
if t1^.prototyped and tPtr^.prototyped then begin
p2 := tptr^.parameterList;
if isPascal then begin
{reverse the parameter list}
p2 := tptr^.parameterList;
p1 := nil;
while p2 <> nil do begin
p3 := p2;
@ -1750,6 +1747,9 @@ if tPtr^.kind = functionType then begin {declare the identifier}
end; {while}
tPtr^.parameterList := p1;
end; {if}
t1 := variable^.itype;
if CompTypes(t1, tPtr) then begin
if t1^.prototyped and tPtr^.prototyped then begin
p2 := tPtr^.parameterList;
p1 := t1^.parameterList;
while (p1 <> nil) and (p2 <> nil) do begin
@ -1781,9 +1781,14 @@ if tPtr^.kind = functionType then begin {declare the identifier}
end; {while}
if p1 <> p2 then
Error(47);
p2 := tptr^.parameterList;
end; {if}
end {if}
else
Error(42);
1:
if isPascal then begin
{reverse the parameter list}
p2 := tptr^.parameterList;
p1 := nil;
while p2 <> nil do begin
p3 := p2;
@ -1794,11 +1799,6 @@ if tPtr^.kind = functionType then begin {declare the identifier}
tPtr^.parameterList := p1;
end; {if}
end; {if}
end {if}
else
Error(42);
1:
end; {if}
end; {if}
if tPtr^.kind = functionType then
state := declared;