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 -
This commit is contained in:
svenbarth 2016-03-18 22:04:57 +00:00
parent f297b00f5b
commit 86b9381673
4 changed files with 9 additions and 3 deletions

View File

@ -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 : [];

View File

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

View File

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

View File

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