diff --git a/compiler/globtype.pas b/compiler/globtype.pas index 33d7e47e58..d1879f8cbb 100644 --- a/compiler/globtype.pas +++ b/compiler/globtype.pas @@ -146,7 +146,8 @@ interface cs_zerobasedstrings, { i8086 specific } cs_force_far_calls, - cs_hugeptr_arithmetic_normalization + cs_hugeptr_arithmetic_normalization, + cs_hugeptr_comparison_normalization ); tlocalswitches = set of tlocalswitch; diff --git a/compiler/scandir.pas b/compiler/scandir.pas index 43d25481b7..66e92024e3 100644 --- a/compiler/scandir.pas +++ b/compiler/scandir.pas @@ -1573,15 +1573,55 @@ unit scandir; end; procedure dir_hugepointernormalization; + var + hs : string; begin if target_info.system<>system_i8086_msdos then begin Message1(scanner_w_directive_ignored_on_target, 'HUGEPOINTERNORMALIZATION'); exit; end; + current_scanner.skipspace; + hs:=current_scanner.readid; + case hs of + 'BORLANDC': + begin + recordpendinglocalswitch(cs_hugeptr_arithmetic_normalization,'+'); + recordpendinglocalswitch(cs_hugeptr_comparison_normalization,'+'); + end; + 'MICROSOFTC': + begin + recordpendinglocalswitch(cs_hugeptr_arithmetic_normalization,'-'); + recordpendinglocalswitch(cs_hugeptr_comparison_normalization,'-'); + end; + 'WATCOMC': + begin + recordpendinglocalswitch(cs_hugeptr_arithmetic_normalization,'-'); + recordpendinglocalswitch(cs_hugeptr_comparison_normalization,'+'); + end; + end; + end; + + procedure dir_hugepointerarithmeticnormalization; + begin + if target_info.system<>system_i8086_msdos then + begin + Message1(scanner_w_directive_ignored_on_target, 'HUGEPOINTERARITHMETICNORMALIZATION'); + exit; + end; do_localswitch(cs_hugeptr_arithmetic_normalization); end; + procedure dir_hugepointercomparisonnormalization; + begin + if target_info.system<>system_i8086_msdos then + begin + Message1(scanner_w_directive_ignored_on_target, 'HUGEPOINTERCOMPARISONNORMALIZATION'); + exit; + end; + do_localswitch(cs_hugeptr_comparison_normalization); + end; + procedure dir_weakpackageunit; begin end; @@ -1686,6 +1726,8 @@ unit scandir; AddDirective('HPPEMIT',directive_all, @dir_hppemit); AddDirective('HUGECODE',directive_all, @dir_hugecode); AddDirective('HUGEPOINTERNORMALIZATION',directive_all,@dir_hugepointernormalization); + AddDirective('HUGEPOINTERARITHMETICNORMALIZATION',directive_all,@dir_hugepointerarithmeticnormalization); + AddDirective('HUGEPOINTERCOMPARISONNORMALIZATION',directive_all,@dir_hugepointercomparisonnormalization); AddDirective('IEEEERRORS',directive_all,@dir_ieeeerrors); AddDirective('IOCHECKS',directive_all, @dir_iochecks); AddDirective('IMAGEBASE',directive_all, @dir_imagebase);