mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-08 16:28:24 +02:00
Merged revision(s) 28792 from branches/svenbarth/packages:
Provide a possibility to ignore duplicate symbols for exporting. export.pas, texportlib: + new property "ignoreduplicates" with which duplicate symbols are ignored upon insertion + new method "duplicatesymbol" which checks "ignoreduplicates" and generates an error if it is False (this method needs to be used if a duplicate was detected) expunix.pas, texportlibunix: * exportprocedure: use "duplicatesymbol" instead of always generating an error systems/t_beos.pas, texportlibbeos: * exportprocedure: use "duplicatesymbol" instead of always generating an error systems/t_haiku.pas, texportlibhaiku: * exportprocedure: use "duplicatesymbol" instead of always generating an error systems/t_nwl.pas, texportlibnetwlibc: * exportprocedure: use "duplicatesymbol" instead of always generating an error systems/t_nwm.pas, texportlibnetware: * exportprocedure: use "duplicatesymbol" instead of always generating an error systems/t_win.pas, texportlibwin: * exportfromlist: use "duplicatesymbol" instead of always generating an error ........ git-svn-id: trunk@32974 -
This commit is contained in:
parent
29aa8d6934
commit
716b3082e9
@ -53,9 +53,12 @@ type
|
||||
texportlib=class
|
||||
private
|
||||
notsupmsg : boolean;
|
||||
fignoreduplicates : boolean;
|
||||
finitname,
|
||||
ffininame : string;
|
||||
procedure NotSupported;
|
||||
protected
|
||||
procedure duplicatesymbol(const s:string);
|
||||
public
|
||||
constructor Create;virtual;
|
||||
destructor Destroy;override;
|
||||
@ -68,6 +71,7 @@ type
|
||||
|
||||
property initname: string read finitname;
|
||||
property fininame: string read ffininame;
|
||||
property ignoreduplicates : boolean read fignoreduplicates write fignoreduplicates;
|
||||
end;
|
||||
|
||||
TExportLibClass=class of TExportLib;
|
||||
@ -188,6 +192,7 @@ end;
|
||||
constructor texportlib.Create;
|
||||
begin
|
||||
notsupmsg:=false;
|
||||
fignoreduplicates:=false;
|
||||
end;
|
||||
|
||||
|
||||
@ -207,6 +212,15 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
procedure texportlib.duplicatesymbol(const s: string);
|
||||
begin
|
||||
{ only generate an error if the caller is not aware that it could generate
|
||||
duplicates (e.g. exporting from a package) }
|
||||
if not ignoreduplicates then
|
||||
Message1(parser_e_export_name_double,s);
|
||||
end;
|
||||
|
||||
|
||||
procedure texportlib.preparelib(const s:string);
|
||||
begin
|
||||
NotSupported;
|
||||
|
@ -102,7 +102,7 @@ begin
|
||||
if assigned(hp2) and (hp2.name^=hp.name^) then
|
||||
begin
|
||||
{ this is not allowed !! }
|
||||
Message1(parser_e_export_name_double,hp.name^);
|
||||
duplicatesymbol(hp.name^);
|
||||
exit;
|
||||
end;
|
||||
if hp2=texported_item(current_module._exports.first) then
|
||||
|
@ -107,7 +107,7 @@ begin
|
||||
if assigned(hp2) and (hp2.name^=hp.name^) then
|
||||
begin
|
||||
{ this is not allowed !! }
|
||||
Message1(parser_e_export_name_double,hp.name^);
|
||||
duplicatesymbol(hp.name^);
|
||||
exit;
|
||||
end;
|
||||
if hp2=texported_item(current_module._exports.first) then
|
||||
|
@ -108,7 +108,7 @@ begin
|
||||
if assigned(hp2) and (hp2.name^=hp.name^) then
|
||||
begin
|
||||
{ this is not allowed !! }
|
||||
Message1(parser_e_export_name_double,hp.name^);
|
||||
duplicatesymbol(hp.name^);
|
||||
exit;
|
||||
end;
|
||||
if hp2=texported_item(current_module._exports.first) then
|
||||
|
@ -185,7 +185,7 @@ begin
|
||||
if assigned(hp2) and (hp2.name^=hp.name^) then
|
||||
begin
|
||||
{ this is not allowed !! }
|
||||
Message1(parser_e_export_name_double,hp.name^);
|
||||
duplicatesymbol(hp.name^);
|
||||
exit;
|
||||
end;
|
||||
if hp2=texported_item(current_module._exports.first) then
|
||||
|
@ -187,7 +187,7 @@ begin
|
||||
if assigned(hp2) and (hp2.name^=hp.name^) then
|
||||
begin
|
||||
{ this is not allowed !! }
|
||||
Message1(parser_e_export_name_double,hp.name^);
|
||||
duplicatesymbol(hp.name^);
|
||||
exit;
|
||||
end;
|
||||
if hp2=texported_item(current_module._exports.first) then
|
||||
|
@ -681,7 +681,7 @@ implementation
|
||||
if hp2.name^=hp.name^ then
|
||||
begin
|
||||
{ this is not allowed !! }
|
||||
message1(parser_e_export_name_double,hp.name^);
|
||||
duplicatesymbol(hp.name^);
|
||||
exit;
|
||||
end;
|
||||
current_module._exports.insertbefore(hp,hp2);
|
||||
|
Loading…
Reference in New Issue
Block a user