rtl: remove defines for v2.x compiler from the common part of the RTL. It's no longer suppported to build with that

git-svn-id: trunk@49036 -
This commit is contained in:
Károly Balogh 2021-03-23 09:32:49 +00:00
parent 6f5f8237c0
commit 45b5e9215c
17 changed files with 33 additions and 114 deletions

View File

@ -422,11 +422,7 @@ Function fpc_Char_To_UChar(const c : Char): UnicodeChar; compilerproc;
Function fpc_UChar_To_Char(const c : UnicodeChar): Char; compilerproc;
Function fpc_UChar_To_UnicodeStr(const c : UnicodeChar): UnicodeString; compilerproc;
Function fpc_UChar_To_AnsiStr(const c : UnicodeChar{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}): AnsiString; compilerproc;
{$ifdef VER2_6}
procedure fpc_UChar_To_ShortStr(out result : shortstring;const c : WideChar) compilerproc;
{$else}
function fpc_UChar_To_ShortStr(const c : WideChar): shortstring; compilerproc;
{$endif}
Function fpc_PWideChar_To_UnicodeStr(const p : pwidechar): unicodestring; compilerproc;
{$ifdef FPC_HAS_FEATURE_ANSISTRINGS}

View File

@ -156,7 +156,7 @@ const
SNoDynLibs = 'This binary has no dynamic library support compiled in.';
SRecompileWithDynLibs = 'Recompile the application with a dynamic-library-driver in the program uses clause before other units using dynamic libraries.';
Procedure NoDynLibsError; {$ifndef ver2_6}noreturn;{$endif}
Procedure NoDynLibsError; noreturn;
begin
{$ifndef EMBEDDED}
{$ifdef FPC_HAS_FEATURE_CONSOLEIO}
@ -170,32 +170,32 @@ begin
RunError(235)
end;
Function NoLoadLibraryU(const Name: UnicodeString): TLibHandle; {$ifndef ver2_6}noreturn;{$endif}
Function NoLoadLibraryU(const Name: UnicodeString): TLibHandle; noreturn;
begin
NoDynLibsError;
end;
Function NoLoadLibraryA(const Name: RawByteString): TLibHandle; {$ifndef ver2_6}noreturn;{$endif}
Function NoLoadLibraryA(const Name: RawByteString): TLibHandle; noreturn;
begin
NoDynLibsError;
end;
function NoGetProcAddress(Lib: TLibHandle; const Proc: AnsiString): {$ifdef cpui8086}FarPointer{$else}Pointer{$endif}; {$ifndef ver2_6}noreturn;{$endif}
function NoGetProcAddress(Lib: TLibHandle; const Proc: AnsiString): {$ifdef cpui8086}FarPointer{$else}Pointer{$endif}; noreturn;
begin
NoDynLibsError;
end;
function NoGetProcAddressOrdinal(Lib: TLibHandle; Ordinal: TOrdinalEntry): {$ifdef cpui8086}FarPointer{$else}Pointer{$endif}; {$ifndef ver2_6}noreturn;{$endif}
function NoGetProcAddressOrdinal(Lib: TLibHandle; Ordinal: TOrdinalEntry): {$ifdef cpui8086}FarPointer{$else}Pointer{$endif}; noreturn;
begin
NoDynLibsError;
end;
function NoGetLoadErrorStr: String; {$ifndef ver2_6}noreturn;{$endif}
function NoGetLoadErrorStr: String; noreturn;
begin
NoDynLibsError;
end;
function NoUnloadLibrary(Lib: TLibHandle): Boolean; {$ifndef ver2_6}noreturn;{$endif}
function NoUnloadLibrary(Lib: TLibHandle): Boolean; noreturn;
begin
NoDynLibsError;
end;

View File

@ -29,7 +29,7 @@ const
type
{ using packed makes the compiler to generate ugly code on some CPUs, further
using packed causes the compiler to handle arrays of text wrongly, see see tw0754 e.g. on arm }
FileRec = {$ifdef VER2_6} packed {$endif} Record
FileRec = Record
Handle : THandle;
{$if defined(CPU8) or defined(CPU16)}
Mode : Word;

View File

@ -3341,20 +3341,8 @@ function fpc_PopCnt_dword(AValue : DWord): DWord;[Public,Alias:'FPC_POPCNT_DWORD
{$ifndef FPC_SYSTEM_HAS_POPCNT_QWORD}
function fpc_PopCnt_qword(AValue : QWord): QWord;[Public,Alias:'FPC_POPCNT_QWORD'];compilerproc;
{$ifdef VER2_6}
var
i : SizeInt;
begin
Result:=0;
for i:=0 to 15 do
begin
inc(Result,PopCntData[AValue and $f]);
AValue:=AValue shr 4;
end;
{$else VER2_6}
begin
Result:=PopCnt(lo(AValue))+PopCnt(hi(AValue))
{$endif VER2_6}
end;
{$endif}

View File

@ -21,11 +21,7 @@ begin
{$else VER3_0}
typeInfo:=aligntoqword(typeInfo+2+PByte(typeInfo)[1]);
{$endif VER3_0}
{$ifdef VER2_6}
result:=PArrayInfo(typeInfo)^.Size*PArrayInfo(typeInfo)^.ElCount;
{$else}
result:=PArrayInfo(typeInfo)^.Size;
{$endif}
end;
function RTTIRecordSize(typeInfo: Pointer): SizeInt;
@ -148,23 +144,8 @@ end;
{ if you modify this procedure, fpc_copy must be probably modified as well }
{$ifdef VER2_6}
procedure ArrayRTTI(Data,TypeInfo:Pointer;rttiproc:TRTTIProc);
var
i: SizeInt;
begin
{$ifdef VER3_0}
typeInfo:=aligntoptr(typeInfo+2+PByte(typeInfo)[1]);
{$else VER3_0}
typeInfo:=aligntoqword(typeInfo+2+PByte(typeInfo)[1]);
{$endif VER3_0}
{ Process elements }
for I:=0 to PArrayInfo(typeInfo)^.ElCount-1 do
rttiproc(Data+(I*PArrayInfo(typeInfo)^.Size),PArrayInfo(typeInfo)^.ElInfo);
end;
{$else}
procedure ArrayRTTI(Data,TypeInfo:Pointer;rttiproc:TRTTIProc);
var
i,Count,ElSize: SizeInt;
Info: Pointer;
begin
@ -183,7 +164,6 @@ begin
for I:=0 to Count-1 do
rttiproc(Data+(I*ElSize),Info);
end;
{$endif}
Procedure fpc_Initialize (Data,TypeInfo : pointer);[Public,Alias : 'FPC_INITIALIZE']; compilerproc;
begin
@ -363,12 +343,6 @@ begin
{$else VER3_0}
Temp:=aligntoqword(typeInfo+2+PByte(typeInfo)[1]);
{$endif VER3_0}
{$ifdef VER2_6}
{ Process elements }
for I:=0 to PArrayInfo(Temp)^.ElCount-1 do
fpc_Copy_internal(Src+(I*PArrayInfo(Temp)^.Size),Dest+(I*PArrayInfo(Temp)^.Size),PArrayInfo(Temp)^.ElInfo);
Result:=PArrayInfo(Temp)^.Size*PArrayInfo(Temp)^.ElCount;
{$else}
Result:=PArrayInfo(Temp)^.Size;
EleCount:=PArrayInfo(Temp)^.ElCount;
{ no elements to process => exit }
@ -383,7 +357,6 @@ begin
fpc_Copy_internal(Src+Offset,Dest+Offset,Info);
inc(Offset,copiedsize);
end;
{$endif}
end;
{$ifdef FPC_HAS_FEATURE_OBJECTS}
tkobject,

View File

@ -19,9 +19,6 @@
{$ifndef FPC_REQUIRES_PROPER_ALIGNMENT}
{$define USE_PACKED}
{$endif}
{$ifdef VER2_6}
{$define USE_PACKED}
{$endif}
{$ifndef VER3_0}
{ 3.1.1 and newer also (re)stores $MinEnumSize and $PackSet upon $Push/$Pop }
@ -54,11 +51,7 @@ type
{$else}
TypeInfo: PPointer;
{$endif}
{$ifdef VER2_6}
Offset: Longint;
{$else}
Offset: SizeInt;
{$endif}
end;
PRecordInfoFull=^TRecordInfoFull;

View File

@ -1066,8 +1066,7 @@ type
end;
TInitFinalTable = record
TableCount,
InitCount : {$if defined(VER2)}longint
{$elseif defined(VER3_0)}sizeint
InitCount : {$if defined(VER3_0)}sizeint
{$else}ALUUInt{$endif}
;
Procs : array[1..maxunits] of TInitFinalRec;

View File

@ -82,11 +82,6 @@
{$define FPC_HAS_FEATURE_UNICODESTRINGS}
{$endif FPC_HAS_FEATURE_SUPPORT}
{ bootstrapping, the starting compiler cannot be a downstripped compiler without unicodestring support }
{$ifdef VER2_6}
{$define FPC_HAS_FEATURE_UNICODESTRINGS}
{$endif VER2_6}
{ for now, the presence of unicode strings is just an approximation,
USE_FILEREC_FULLNAME can be also enabled for other targets if
they need file names longer than 255 chars }
@ -140,9 +135,7 @@ Type
ValReal = Extended;
{$endif}
{$ifndef VER2_6}
FarPointer = NearFsPointer;
{$endif}
{$endif CPUI386}
{$ifdef CPUI8086}
@ -472,7 +465,7 @@ Type
TExitCode = Word;
{$endif CPU16}
{$if defined(VER2) or defined(VER3_0)}
{$if defined(VER3_0)}
{$if defined(CPU16)}
{$define CPUINT16}
{$elseif defined(CPU32)}
@ -480,7 +473,7 @@ Type
{$elseif defined(CPU64)}
{$define CPUINT64}
{$endif defined(CPU64)}
{$endif defined(VER2) or defined(VER3_0)}
{$endif defined(VER3_0)}
{$if defined(CPUINT8)}
ALUSInt = ShortInt;
@ -667,11 +660,6 @@ Type
TSystemCodePage = Word;
{$ifdef VER2_6}
{ the size of textrec/filerec is hardcoded in the 2.6 compiler binary }
{$define FPC_ANSI_TEXTFILEREC}
{$endif}
TFileTextRecChar = {$if defined(FPC_ANSI_TEXTFILEREC) or not(defined(FPC_HAS_FEATURE_WIDESTRINGS))}AnsiChar{$else}UnicodeChar{$endif};
PFileTextRecChar = ^TFileTextRecChar;

View File

@ -34,7 +34,7 @@ type
{ using packed makes the compiler to generate ugly code on some CPUs, further
using packed causes the compiler to handle arrays of text wrongly, see see tw0754 e.g. on arm }
TextRec = {$ifdef VER2_6} packed {$endif} Record
TextRec = Record
Handle : THandle;
{$if defined(CPU8) or defined(CPU16)}
Mode : Word;

View File

@ -20,7 +20,7 @@
unit Character;
interface
{$ifndef VER2_4}
{$mode objfpc}
{$H+}
{$PACKENUM 1}
@ -187,10 +187,10 @@ type
function ToLower(const AString : UnicodeString) : UnicodeString; overload;
function ToUpper(AChar : UnicodeChar) : UnicodeChar; overload;
function ToUpper(const AString : UnicodeString) : UnicodeString; overload;
{$endif VER2_4}
implementation
{$ifndef VER2_4}
uses
SysUtils,
RtlConsts;
@ -851,5 +851,4 @@ begin
raise EArgumentException.Create(SInvalidUnicodeCodePointSequence);
end;
{$endif VER2_4}
end.

View File

@ -11,7 +11,7 @@
**********************************************************************}
{$if defined(VER2_0) or not defined(FPC_TESTGENERICS)}
{$if not defined(FPC_TESTGENERICS)}
{****************************************************************************}
{* TFPListEnumerator *}

View File

@ -28,10 +28,6 @@ interface
uses
types, sysutils, sortbase;
{$IF defined(VER2_4)}
{$DEFINE OldSyntax}
{$IFEND}
const
MaxListSize = Maxint div 16;
@ -127,7 +123,8 @@ type
PT = ^T;
TTypeList = PT;
PTypeList = ^TTypeList;
{$ifndef OldSyntax}protected var{$else}var protected{$endif}
protected
var
FOnCompare: TCompareFunc;
procedure CopyItem(Src, Dest: Pointer); override;
procedure Deref(Item: Pointer); override;
@ -152,10 +149,8 @@ type
function IndexOf(const Item: T): Integer;
procedure Insert(Index: Integer; const Item: T); {$ifdef FGLINLINE} inline; {$endif}
property Last: T read GetLast write SetLast;
{$ifndef VER2_4}
procedure Assign(Source: TFPGList);
procedure AddList(Source: TFPGList);
{$endif VER2_4}
function Remove(const Item: T): Integer; {$ifdef FGLINLINE} inline; {$endif}
procedure Sort(Compare: TCompareFunc);
procedure Sort(Compare: TCompareFunc; SortingAlgorithm: PSortingAlgorithm);
@ -171,7 +166,8 @@ type
TTypeList = PT;
PTypeList = ^TTypeList;
TFPGListEnumeratorSpec = specialize TFPGListEnumerator<T>;
{$ifndef OldSyntax}protected var{$else}var protected{$endif}
protected
var
FOnCompare: TCompareFunc;
FFreeObjects: Boolean;
procedure CopyItem(Src, Dest: Pointer); override;
@ -193,10 +189,8 @@ type
function IndexOf(const Item: T): Integer;
procedure Insert(Index: Integer; const Item: T); {$ifdef FGLINLINE} inline; {$endif}
property Last: T read GetLast write SetLast;
{$ifndef VER2_4}
procedure AddList(Source: TFPGObjectList);
procedure Assign(Source: TFPGObjectList);
{$endif VER2_4}
function Remove(const Item: T): Integer; {$ifdef FGLINLINE} inline; {$endif}
procedure Sort(Compare: TCompareFunc);
procedure Sort(Compare: TCompareFunc; SortingAlgorithm: PSortingAlgorithm);
@ -213,7 +207,8 @@ type
TTypeList = PT;
PTypeList = ^TTypeList;
TFPGListEnumeratorSpec = specialize TFPGListEnumerator<T>;
{$ifndef OldSyntax}protected var{$else}var protected{$endif}
protected
var
FOnCompare: TCompareFunc;
procedure CopyItem(Src, Dest: Pointer); override;
procedure Deref(Item: Pointer); override;
@ -234,10 +229,8 @@ type
function IndexOf(const Item: T): Integer;
procedure Insert(Index: Integer; const Item: T); {$ifdef FGLINLINE} inline; {$endif}
property Last: T read GetLast write SetLast;
{$ifndef VER2_4}
procedure Assign(Source: TFPGInterfacedObjectList);
procedure AddList(Source: TFPGInterfacedObjectList);
{$endif VER2_4}
function Remove(const Item: T): Integer; {$ifdef FGLINLINE} inline; {$endif}
procedure Sort(Compare: TCompareFunc);
procedure Sort(Compare: TCompareFunc; SortingAlgorithm: PSortingAlgorithm);
@ -303,7 +296,8 @@ type
TDataCompareFunc = function(const Data1, Data2: TData): Integer;
PKey = ^TKey;
// unsed PData = ^TData;
{$ifndef OldSyntax}protected var{$else}var protected{$endif}
protected
var
FOnKeyCompare: TKeyCompareFunc;
FOnDataCompare: TDataCompareFunc;
procedure CopyItem(Src, Dest: Pointer); override;
@ -350,7 +344,8 @@ type
TDataCompareFunc = function(const Data1, Data2: TData): Integer;
PKey = ^TKey;
// unsed PData = ^TData;
{$ifndef OldSyntax}protected var{$else}var protected{$endif}
protected
var
FOnKeyCompare: TKeyCompareFunc;
FOnDataCompare: TDataCompareFunc;
FFreeObjects: Boolean;
@ -399,7 +394,8 @@ type
TDataCompareFunc = function(const Data1, Data2: TData): Integer;
PKey = ^TKey;
// unsed PData = ^TData;
{$ifndef OldSyntax}protected var{$else}var protected{$endif}
protected
var
FOnKeyCompare: TKeyCompareFunc;
FOnDataCompare: TDataCompareFunc;
procedure CopyItem(Src, Dest: Pointer); override;
@ -1009,7 +1005,6 @@ begin
inherited SetLast(@Value);
end;
{$ifndef VER2_4}
procedure TFPGList.AddList(Source: TFPGList);
var
@ -1036,7 +1031,6 @@ begin
else
Inherited Assign(TFPSList(source))
end;
{$endif VER2_4}
function TFPGList.Remove(const Item: T): Integer;
begin
@ -1149,7 +1143,6 @@ begin
inherited SetLast(@Value);
end;
{$ifndef VER2_4}
procedure TFPGObjectList.AddList(Source: TFPGObjectList);
var
i: Integer;
@ -1163,7 +1156,6 @@ begin
Clear;
AddList(Source);
end;
{$endif VER2_4}
function TFPGObjectList.Remove(const Item: T): Integer;
begin
@ -1279,7 +1271,6 @@ begin
inherited SetLast(@Value);
end;
{$ifndef VER2_4}
procedure TFPGInterfacedObjectList.Assign(Source: TFPGInterfacedObjectList);
begin
@ -1294,7 +1285,6 @@ begin
for I := 0 to Source.Count - 1 do
Add(Source[i]);
end;
{$endif VER2_4}
function TFPGInterfacedObjectList.Remove(const Item: T): Integer;
begin

View File

@ -370,7 +370,7 @@ Type
end;
TResStrInitTable = packed record
Count: {$ifdef VER2_6}longint{$else}sizeint{$endif};
Count: sizeint;
Tables: packed array[1..{$ifdef cpu16}8191{$else cpu16}32767{$endif cpu16}] of PResStrInitEntry;
end;
PResStrInitTable = ^TResStrInitTable;

View File

@ -1248,7 +1248,6 @@ begin
result := StrPas(@ResultBuffer[0]);
end ;
Function DateTimeToFileDate(DateTime : TDateTime) : Int64;
Var YY,MM,DD,H,m,s,msec : Word;
@ -1257,6 +1256,7 @@ begin
Decodedate (DateTime,YY,MM,DD);
DecodeTime (DateTime,h,m,s,msec);
{$ifndef unix}
{.$ifndef hasamiga}
If (YY<1980) or (YY>2099) then
Result:=0
else
@ -1264,6 +1264,9 @@ begin
Result:=(s shr 1) or (m shl 5) or (h shl 11);
Result:=Result or longint(DD shl 16 or (MM shl 21) or (word(YY-1980) shl 25));
end;
{.$else hasamiga}
// Result:=LocalToAmigaFileDate(yy,mm,dd,h,m,s);
{.$endif}
{$else unix}
Result:=LocalToEpoch(yy,mm,dd,h,m,s);
{$endif unix}

View File

@ -12,7 +12,6 @@
*********************************************************************
}
{$ifndef VER2_4}
{ TEncoding }
class function TEncoding.GetANSI: TEncoding;
@ -856,5 +855,3 @@ begin
Inc(I, 2);
end;
end;
{$endif VER2_4}

View File

@ -12,7 +12,6 @@
*********************************************************************
}
{$ifndef VER2_4}
type
EEncodingError = class(Exception);
@ -189,4 +188,3 @@ type
function Clone: TEncoding; override;
function GetPreamble: TBytes; override;
end;
{$endif VER2_4}

View File

@ -1394,11 +1394,6 @@ const
maxdigits = 15;
{$endif}
{ deactive aligned function for 2.6 }
{$ifdef VER2_6}
{$macro on}
{$define aligned:= }
{$endif VER2_6}
Function FloatToStrFIntl(const Value; format: TFloatFormat; Precision, Digits: Integer; ValueType: TFloatValue; Const FormatSettings: TFormatSettings): String;
Var
P, PE, Q, Exponent: Integer;