Procházet zdrojové kódy

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 -

svenbarth před 9 roky
rodič
revize
716b3082e9

+ 14 - 0
compiler/export.pas

@@ -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;

+ 1 - 1
compiler/expunix.pas

@@ -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

+ 1 - 1
compiler/systems/t_beos.pas

@@ -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

+ 1 - 1
compiler/systems/t_haiku.pas

@@ -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

+ 1 - 1
compiler/systems/t_nwl.pas

@@ -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

+ 1 - 1
compiler/systems/t_nwm.pas

@@ -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

+ 1 - 1
compiler/systems/t_win.pas

@@ -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);