+ Removed all compatibility defines from compiler

git-svn-id: trunk@335 -
This commit is contained in:
michael 2005-06-09 21:14:22 +00:00
parent 1d9407f2f3
commit 7449f99d5f
10 changed files with 9 additions and 177 deletions

View File

@ -367,40 +367,26 @@ implementation
procedure tmemdebug.start; procedure tmemdebug.start;
{$ifdef HASGETHEAPSTATUS}
var var
status : TFPCHeapStatus; status : TFPCHeapStatus;
{$endif HASGETHEAPSTATUS}
begin begin
{$ifdef HASGETHEAPSTATUS}
status:=GetFPCHeapStatus; status:=GetFPCHeapStatus;
startmem:=status.CurrHeapUsed; startmem:=status.CurrHeapUsed;
{$else HASGETHEAPSTATUS}
startmem:=memavail;
{$endif HASGETHEAPSTATUS}
end; end;
procedure tmemdebug.stop; procedure tmemdebug.stop;
{$ifdef HASGETHEAPSTATUS}
var var
status : TFPCHeapStatus; status : TFPCHeapStatus;
{$endif HASGETHEAPSTATUS}
begin begin
{$ifdef HASGETHEAPSTATUS}
if startmem<>0 then if startmem<>0 then
begin begin
status:=GetFPCHeapStatus; status:=GetFPCHeapStatus;
inc(TotalMem,startmem-status.CurrHeapUsed); inc(TotalMem,startmem-status.CurrHeapUsed);
startmem:=0; startmem:=0;
end; end;
{$else HASGETHEAPSTATUS}
if startmem<>0 then
begin
inc(TotalMem,memavail-startmem);
startmem:=0;
end;
{$endif HASGETHEAPSTATUS}
end; end;

View File

@ -389,28 +389,12 @@ implementation
begin begin
delete:=false; delete:=false;
{ indexword in 1.0.x and 1.9.4 is broken } { indexword in 1.0.x and 1.9.4 is broken }
{$ifndef VER1_0}
{$ifndef VER1_9_4}
{$define USEINDEXWORD}
{$endif}
{$endif}
{$ifdef USEINDEXWORD}
i:=indexword(buf^,length,s); i:=indexword(buf^,length,s);
if i<>-1 then if i<>-1 then
begin begin
deleteidx(i); deleteidx(i);
delete := true; delete := true;
end; end;
{$else USEINDEXWORD}
for i:=1 to length do
if buf^[i-1]=s then
begin
deleteidx(i-1);
delete:=true;
break;
end;
{$endif USEINDEXWORD}
{$undef USEINDEXWORD}
end; end;

View File

@ -225,10 +225,8 @@ end;
****************************************************************************} ****************************************************************************}
function def_status:boolean; function def_status:boolean;
{$ifdef HASGETHEAPSTATUS}
var var
hstatus : TFPCHeapStatus; hstatus : TFPCHeapStatus;
{$endif HASGETHEAPSTATUS}
begin begin
def_status:=false; { never stop } def_status:=false; { never stop }
{ Status info?, Called every line } { Status info?, Called every line }
@ -239,12 +237,8 @@ begin
begin begin
if status.currentline>0 then if status.currentline>0 then
Write(status.currentline,' '); Write(status.currentline,' ');
{$ifdef HASGETHEAPSTATUS}
hstatus:=GetFPCHeapStatus; hstatus:=GetFPCHeapStatus;
WriteLn(DStr(hstatus.CurrHeapUsed shr 10),'/',DStr(hstatus.CurrHeapSize shr 10),' Kb Used'); WriteLn(DStr(hstatus.CurrHeapUsed shr 10),'/',DStr(hstatus.CurrHeapSize shr 10),' Kb Used');
{$else HASGETHEAPSTATUS}
WriteLn(DStr(memavail shr 10),'/',DStr(system.heapsize shr 10),' Kb Free');
{$endif HASGETHEAPSTATUS}
end; end;
end; end;
{$ifdef macos} {$ifdef macos}

View File

@ -359,9 +359,7 @@ function Compile(const cmd:string):longint;
var var
starttime : real; starttime : real;
{$ifdef SHOWUSEDMEM} {$ifdef SHOWUSEDMEM}
{$ifdef HASGETHEAPSTATUS}
hstatus : TFPCHeapStatus; hstatus : TFPCHeapStatus;
{$endif HASGETHEAPSTATUS}
{$endif SHOWUSEDMEM} {$endif SHOWUSEDMEM}
begin begin
try try
@ -451,12 +449,8 @@ begin
end; end;
end; end;
{$ifdef SHOWUSEDMEM} {$ifdef SHOWUSEDMEM}
{$ifdef HASGETHEAPSTATUS}
hstatus:=GetFPCHeapStatus; hstatus:=GetFPCHeapStatus;
Writeln('Max Memory used/heapsize: ',DStr(hstatus.MaxHeapUsed shr 10),'/',DStr(hstatus.MaxHeapSize shr 10),' Kb'); Writeln('Max Memory used/heapsize: ',DStr(hstatus.MaxHeapUsed shr 10),'/',DStr(hstatus.MaxHeapSize shr 10),' Kb');
{$else HASGETHEAPSTATUS}
Writeln('Memory used (heapsize): ',DStr(system.Heapsize shr 10),' Kb');
{$endif HASGETHEAPSTATUS}
{$endif SHOWUSEDMEM} {$endif SHOWUSEDMEM}
{ Set the return value if an error has occurred } { Set the return value if an error has occurred }

View File

@ -41,11 +41,6 @@ interface
var var
internalerrorproc : procedure(i:longint); internalerrorproc : procedure(i:longint);
{$ifndef HASGETFPCHEAPSTATUS}
type
TFPCHeapStatus = THeapStatus;
function GetFPCHeapStatus:TFPCHeapStatus;
{$endif HASGETFPCHEAPSTATUS}
{# Returns the minimal value between @var(a) and @var(b) } {# Returns the minimal value between @var(a) and @var(b) }
function min(a,b : longint) : longint;{$ifdef USEINLINE}inline;{$endif} function min(a,b : longint) : longint;{$ifdef USEINLINE}inline;{$endif}
@ -150,14 +145,6 @@ uses
; ;
{$ifndef HASGETFPCHEAPSTATUS}
function GetFPCHeapStatus:TFPCHeapStatus;
begin
GetHeapStatus(result);
end;
{$endif HASGETFPCHEAPSTATUS}
var var
uppertbl, uppertbl,
lowertbl : array[char] of char; lowertbl : array[char] of char;

View File

@ -11,32 +11,13 @@
{ This reduces the memory requirements a lot } { This reduces the memory requirements a lot }
{$PACKENUM 1} {$PACKENUM 1}
{$ifndef VER1_0} { We don't use exceptions, so turn off the implicit
{ We don't use exceptions, so turn off the implicit exceptions in the constructors }
exceptions in the constructors } {$IMPLICITEXCEPTIONS OFF}
{$IMPLICITEXCEPTIONS OFF} { Inline small functions, but not when EXTDEBUG is used }
{ Inline small functions, but not when EXTDEBUG is used } {$ifndef EXTDEBUG}
{$ifndef EXTDEBUG} {$define USEINLINE}
{$define USEINLINE} {$endif EXTDEBUG}
{$endif EXTDEBUG}
{$else}
{ Optimizer is broken when compiling with optimizations using 1.0.x }
{$ifndef USEOPT}
{$define NOOPT}
{$endif}
{ 1.0.x generates broken code for sysutils }
{$ifndef FORCE_SYSUTILS}
{$undef USE_SYSUTILS}
{$endif}
{$endif VER1_0}
{$ifdef VER1_9_4}
{ 1.9.4 generates broken code for sysutils }
{$ifndef FORCE_SYSUTILS}
{$undef USE_SYSUTILS}
{$endif}
{$endif}
{$define USEEXCEPT} {$define USEEXCEPT}

View File

@ -1763,61 +1763,11 @@ begin
def_system_macro('VER'+version_nr+'_'+release_nr+'_'+patch_nr); def_system_macro('VER'+version_nr+'_'+release_nr+'_'+patch_nr);
{ Temporary defines, until things settle down } { Temporary defines, until things settle down }
def_system_macro('HASWIDECHAR');
def_system_macro('HASWIDESTRING');
def_system_macro('HASOUT');
def_system_macro('HASGLOBALPROPERTY');
def_system_macro('FPC_HASPREFETCH');
def_system_macro('FPC_LINEEND_IN_TEXTREC');
def_system_macro('FPC_ALIGNSRTTI');
def_system_macro('FPC_HASNOFARPOINTER');
def_system_macro('FPC_HASUSERDATA32');
{$ifdef i386}
def_system_macro('HASINTF');
def_system_macro('HASVARIANT');
{$endif i386}
{$ifdef x86_64}
def_system_macro('HASINTF');
def_system_macro('HASVARIANT');
{$endif x86_64}
{$ifdef powerpc} {$ifdef powerpc}
def_system_macro('HASINTF');
def_system_macro('HASVARIANT');
def_system_macro('FPC_MTFSB0_CORRECTED'); def_system_macro('FPC_MTFSB0_CORRECTED');
{$endif powerpc} {$endif powerpc}
{$ifdef arm}
def_system_macro('HASINTF');
def_system_macro('HASVARIANT');
{$endif arm}
{$ifdef sparc}
def_system_macro('HASINTF');
def_system_macro('HASVARIANT');
{$endif sparc}
def_system_macro('INTERNSETLENGTH');
def_system_macro('INTERNLENGTH');
def_system_macro('INTERNCOPY');
def_system_macro('INT64FUNCRESOK');
def_system_macro('HAS_ADDR_STACK_ON_STACK');
def_system_macro('NOBOUNDCHECK');
def_system_macro('HASCOMPILERPROC');
def_system_macro('INTERNCONSTINTF');
def_system_macro('VALUEGETMEM');
def_system_macro('VALUEFREEMEM');
def_system_macro('HASCURRENCY');
def_system_macro('HASTHREADVAR');
def_system_macro('HAS_GENERICCONSTRUCTOR');
def_system_macro('NOCLASSHELPERS');
if pocall_default = pocall_register then if pocall_default = pocall_register then
def_system_macro('REGCALL'); def_system_macro('REGCALL');
def_system_macro('DECRREFNOTNIL');
def_system_macro('HAS_INTERNAL_INTTYPES');
def_system_macro('STR_USES_VALINT');
def_system_macro('NOSAVEREGISTERS');
def_system_macro('SHORTSTRCOMPAREINREG');
def_system_macro('HASGETHEAPSTATUS');
def_system_macro('HASGETFPCHEAPSTATUS');
def_system_macro('HASFUNCTIONCOPYDYNARR');
def_system_macro('HASOVERLOADASSIGNBYUNIQUERESULT');
{ using a case is pretty useless here (FK) } { using a case is pretty useless here (FK) }
{ some stuff for TP compatibility } { some stuff for TP compatibility }

View File

@ -116,16 +116,6 @@ implementation
end; end;
{$ifdef VER1_0}
function get_extra_info(p : pointer) : string;
begin
with pextra_info(p)^ do
begin
get_extra_info:=getfilename(fileindex)+'('+tostr(line)+','+tostr(col)+
') ';
end;
end;
{$else}
procedure show_extra_info(var t : text;p : pointer); procedure show_extra_info(var t : text;p : pointer);
begin begin
with pextra_info(p)^ do with pextra_info(p)^ do
@ -133,7 +123,6 @@ implementation
writeln(t,getfilename(fileindex)+'('+tostr(line)+','+tostr(col)+') '); writeln(t,getfilename(fileindex)+'('+tostr(line)+','+tostr(col)+') ');
end; end;
end; end;
{$endif}
const const
@ -145,13 +134,9 @@ implementation
begin begin
keepreleased:=true; keepreleased:=true;
SetHeapTraceOutput('heap.log'); SetHeapTraceOutput('heap.log');
{$ifdef VER1_0}
SetExtraInfoString(@get_extra_info);
{$else}
SetHeapExtraInfo(sizeof(textra_info), SetHeapExtraInfo(sizeof(textra_info),
@set_extra_info, @set_extra_info,
@show_extra_info); @show_extra_info);
{$endif}
end; end;
pp_heap_inited:=true; pp_heap_inited:=true;
end; end;

View File

@ -187,20 +187,9 @@ implementation
else if is_constrealnode(p) and else if is_constrealnode(p) and
(torddef(t.def).typ=scurrency) (torddef(t.def).typ=scurrency)
{ allow bootstrapping } { allow bootstrapping }
{$ifdef VER1_0}
{ I get IE 10 here. I guess it's no problem if a 1.0 bootstrapped
compiler doesn't display the error here.
and (trealconstnode(p).value_real*10000 >= real(low(int64))) and
(trealconstnode(p).value_real*10000 <= real(high(int64)))}
{$endif VER1_0}
then then
begin begin
{$ifdef VER1_0}
{ only trunc is 64 bit in 1.0.x so use trunc here to allow bootstrapping }
intvalue:=trunc(trealconstnode(p).value_real*10000);
{$else VER1_0}
intvalue:=round(trealconstnode(p).value_real*10000); intvalue:=round(trealconstnode(p).value_real*10000);
{$endif VER1_0}
end end
else else
begin begin
@ -237,18 +226,11 @@ implementation
s80real : s80real :
curconstSegment.concat(Tai_real_80bit.Create(value)); curconstSegment.concat(Tai_real_80bit.Create(value));
{$ifdef ver1_0}
s64comp :
curconstSegment.concat(Tai_comp_64bit.Create(value));
s64currency:
curconstSegment.concat(Tai_comp_64bit.Create(value*10000));
{$else ver1_0}
{ the round is necessary for native compilers where comp isn't a float } { the round is necessary for native compilers where comp isn't a float }
s64comp : s64comp :
curconstSegment.concat(Tai_comp_64bit.Create(round(value))); curconstSegment.concat(Tai_comp_64bit.Create(round(value)));
s64currency: s64currency:
curconstSegment.concat(Tai_comp_64bit.Create(round(value*10000))); curconstSegment.concat(Tai_comp_64bit.Create(round(value*10000)));
{$endif ver1_0}
s128real: s128real:
curconstSegment.concat(Tai_real_128bit.Create(value)); curconstSegment.concat(Tai_real_128bit.Create(value));
else else

View File

@ -145,7 +145,6 @@ begin
end; end;
{$ifdef interncopy}
function fpc_char_copy(c:char;index : SizeInt;count : SizeInt): shortstring;compilerproc; function fpc_char_copy(c:char;index : SizeInt;count : SizeInt): shortstring;compilerproc;
begin begin
if (index=1) and (Count>0) then if (index=1) and (Count>0) then
@ -153,16 +152,6 @@ begin
else else
fpc_char_Copy:=''; fpc_char_Copy:='';
end; end;
{$else}
function copy(c:char;index : SizeInt;count : SizeInt): shortstring;
begin
if (index=1) and (Count>0) then
Copy:=c
else
Copy:='';
end;
{$endif}
function pos(const substr : shortstring;c:char): SizeInt; function pos(const substr : shortstring;c:char): SizeInt;
begin begin