* require that "overload" is present in the interface if it's used in the

implementation (Delphi-compatible in case multiple overloads exist in
    the current unit, and in other cases avoids compiler crashes in case
    of circular implementation dependencies)
  * ignore other symbol options (deprecated, legacy, platform, ...) as far as
    the interface crc is concerned to avoid trouble in case they appear in the
    implementation but not in the interface (to prevent compiler crashes)

git-svn-id: trunk@19492 -
This commit is contained in:
Jonas Maebe 2011-10-15 14:47:45 +00:00
parent 73a084d662
commit d8b008b0b0
4 changed files with 36 additions and 2 deletions

1
.gitattributes vendored
View File

@ -8600,6 +8600,7 @@ tests/tbf/tb0218.pp svneol=native#text/plain
tests/tbf/tb0219.pp svneol=native#text/pascal
tests/tbf/tb0220.pp svneol=native#text/plain
tests/tbf/tb0221.pp svneol=native#text/plain
tests/tbf/tb0222.pp svneol=native#text/plain
tests/tbf/ub0115.pp svneol=native#text/plain
tests/tbf/ub0149.pp svneol=native#text/plain
tests/tbf/ub0158a.pp svneol=native#text/plain

View File

@ -3218,7 +3218,12 @@ const
po_comp:=[po_classmethod,po_methodpointer];
if ((po_comp * fwpd.procoptions)<>(po_comp * currpd.procoptions)) or
(fwpd.proctypeoption <> currpd.proctypeoption) then
(fwpd.proctypeoption <> currpd.proctypeoption) or
{ if the implementation version has an "overload" modifier,
the interface version must also have it (otherwise we can
get annoying crashes due to interface crc changes) }
(not(po_overload in fwpd.procoptions) and
(po_overload in currpd.procoptions)) then
begin
MessagePos1(currpd.fileinfo,parser_e_header_dont_match_forward,
fwpd.fullprocname(false));
@ -3358,7 +3363,7 @@ const
begin
MessagePos1(currpd.fileinfo,parser_e_no_overload_for_all_procs,currpd.procsym.realname);
break;
end;
end
end
else
begin

View File

@ -394,14 +394,26 @@ implementation
procedure tstoredsym.ppuwrite(ppufile:tcompilerppufile);
var
oldintfcrc : boolean;
begin
ppufile.putlongint(SymId);
ppufile.putstring(realname);
ppufile.putposinfo(fileinfo);
ppufile.putbyte(byte(visibility));
{ symoptions can differ between interface and implementation, except
for overload (this is checked in pdecsub.proc_add_definition() )
These differences can lead to compiler crashes, so ignore them.
This does mean that changing e.g. the "deprecated" state of a symbol
by itself will not trigger a recompilation of dependent units.
}
oldintfcrc:=ppufile.do_interface_crc;
ppufile.do_interface_crc:=false;
ppufile.putsmallset(symoptions);
if sp_has_deprecated_msg in symoptions then
ppufile.putstring(deprecatedmsg^);
ppufile.do_interface_crc:=oldintfcrc;
end;

16
tests/tbf/tb0222.pp Normal file
View File

@ -0,0 +1,16 @@
{ %fail }
unit tb0222;
{$mode delphi}
interface
procedure test;
implementation
procedure test; deprecated 'xxx';
begin
end;
end.