Browse Source

Add new Delphi compatible switch {$G+/-}, {$IMPORTEDDATA ON/OFF} which handles generation of indirect references for cross unit variable accesses if needed for the target.

globtype.pas:
  + tlocalswitch: extend by cs_imported_data
globals.pas:
  * default_settings: cs_imported_data is set by default (Delphi compatible)
switches.pas:
  * turboSwitchTable: G is used for cs_imported_data
scandir.pas:
  + new directive handler dir_importeddata
  * InitScannerDirectives: handle IMPORTEDDATA with dir_importeddata

git-svn-id: trunk@33281 -
svenbarth 9 năm trước cách đây
mục cha
commit
86b9381673
4 tập tin đã thay đổi với 9 bổ sung3 xóa
  1. 1 1
      compiler/globals.pas
  2. 1 1
      compiler/globtype.pas
  3. 6 0
      compiler/scandir.pas
  4. 1 1
      compiler/switches.pas

+ 1 - 1
compiler/globals.pas

@@ -395,7 +395,7 @@ interface
         globalswitches : [cs_check_unit_name,cs_link_static];
         targetswitches : [];
         moduleswitches : [cs_extsyntax,cs_implicit_exceptions];
-        localswitches : [cs_check_io,cs_typed_const_writable,cs_pointermath{$ifdef i8086},cs_force_far_calls{$endif}];
+        localswitches : [cs_check_io,cs_typed_const_writable,cs_pointermath,cs_imported_data{$ifdef i8086},cs_force_far_calls{$endif}];
         modeswitches : fpcmodeswitches;
         optimizerswitches : [];
         genwpoptimizerswitches : [];

+ 1 - 1
compiler/globtype.pas

@@ -141,7 +141,7 @@ interface
          cs_generate_stackframes,cs_do_assertion,cs_generate_rtti,
          cs_full_boolean_eval,cs_typed_const_writable,cs_allow_enum_calc,
          cs_do_inline,cs_fpu_fwait,cs_ieee_errors,
-         cs_check_low_addr_load,
+         cs_check_low_addr_load,cs_imported_data,
          { mmx }
          cs_mmx,cs_mmx_saturation,
          { parser }

+ 6 - 0
compiler/scandir.pas

@@ -490,6 +490,11 @@ unit scandir;
         do_moduleswitch(cs_implicit_exceptions);
       end;
 
+    procedure dir_importeddata;
+      begin
+        do_delphiswitch('G');
+      end;
+
     procedure dir_includepath;
       begin
         if not current_module.in_global then
@@ -1772,6 +1777,7 @@ unit scandir;
         AddDirective('IOCHECKS',directive_all, @dir_iochecks);
         AddDirective('IMAGEBASE',directive_all, @dir_imagebase);
         AddDirective('IMPLICITEXCEPTIONS',directive_all, @dir_implicitexceptions);
+        AddDirective('IMPORTEDDATA',directive_all, @dir_importeddata);
         AddDirective('INCLUDEPATH',directive_all, @dir_includepath);
         AddDirective('INFO',directive_all, @dir_info);
         AddDirective('INLINE',directive_all, @dir_inline);

+ 1 - 1
compiler/switches.pas

@@ -73,7 +73,7 @@ const
 {$else i8086}
    {F} (typesw:ignoredsw; setsw:ord(cs_localnone)),
 {$endif i8086}
-   {G} (typesw:ignoredsw; setsw:ord(cs_localnone)),
+   {G} (typesw:localsw; setsw:ord(cs_imported_data)),
    {H} (typesw:localsw; setsw:ord(cs_refcountedstrings)),
    {I} (typesw:localsw; setsw:ord(cs_check_io)),
    {J} (typesw:localsw; setsw:ord(cs_typed_const_writable)),