mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-11 10:20:53 +01:00
Support more calling conventions. Issue #39405, patch by Pavel.
This commit is contained in:
parent
2befd9dd7f
commit
7ca9ba2fb6
@ -873,6 +873,10 @@ begin
|
||||
Add('ASSEMBLER' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('ASYNC' ,{$ifdef FPC}@{$endif}AllwaysTrue); // pas2js
|
||||
Add('CDECL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('SYSV_ABI_CDECL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('SYSV_ABI_DEFAULT',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('MS_ABI_DEFAULT' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('MS_ABI_CDECL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('EXTDECL' ,{$ifdef FPC}@{$endif}AllwaysTrue); // often used for macros
|
||||
ADD('MWPASCAL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('NOSTACKFRAME' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
@ -910,6 +914,10 @@ begin
|
||||
Add('ASSEMBLER' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('ASYNC' ,{$ifdef FPC}@{$endif}AllwaysTrue); // pas2js
|
||||
Add('CDECL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('SYSV_ABI_CDECL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('SYSV_ABI_DEFAULT',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('MS_ABI_DEFAULT' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('MS_ABI_CDECL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('COMPILERPROC' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('DEPRECATED' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('DISCARDRESULT',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
@ -955,6 +963,10 @@ begin
|
||||
Add('REGISTER' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('POPSTACK' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('CDECL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('SYSV_ABI_CDECL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('SYSV_ABI_DEFAULT',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('MS_ABI_DEFAULT' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('MS_ABI_CDECL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('EXTDECL' ,{$ifdef FPC}@{$endif}AllwaysTrue); // used often for macros
|
||||
ADD('MWPASCAL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('PASCAL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
@ -980,6 +992,10 @@ begin
|
||||
Add('ASSEMBLER' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('ASYNC' ,{$ifdef FPC}@{$endif}AllwaysTrue); // pas2js
|
||||
Add('CDECL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('SYSV_ABI_CDECL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('SYSV_ABI_DEFAULT',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('MS_ABI_DEFAULT' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('MS_ABI_CDECL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('EXTDECL' ,{$ifdef FPC}@{$endif}AllwaysTrue); // used often for macros
|
||||
Add('FAR' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
ADD('MWPASCAL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
@ -998,6 +1014,10 @@ begin
|
||||
KeyWordLists.Add(IsKeyWordCallingConvention);
|
||||
with IsKeyWordCallingConvention do begin
|
||||
Add('CDECL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('SYSV_ABI_CDECL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('SYSV_ABI_DEFAULT',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('MS_ABI_DEFAULT' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('MS_ABI_CDECL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('STDCALL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('REGISTER' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('EXTDECL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
|
||||
@ -540,12 +540,12 @@ type
|
||||
end;
|
||||
|
||||
const
|
||||
{ the longest token 'resourcestring' = 14 chars }
|
||||
LONGEST_KEYWORD_LEN = 14;
|
||||
{ the longest token 'sysv_abi_default' = 16 chars }
|
||||
LONGEST_KEYWORD_LEN = 16;
|
||||
|
||||
{ a value larger than the number of keywords,
|
||||
used as an initial size for the dynamic array }
|
||||
INITIAL_MAX_KEYWORDS = 230;
|
||||
INITIAL_MAX_KEYWORDS = 234;
|
||||
|
||||
var
|
||||
{ final number of keywords added }
|
||||
@ -695,6 +695,10 @@ begin
|
||||
AddKeyword('public', wtReservedWordDirective, ttPublic);
|
||||
AddKeyword('virtual', wtReservedWordDirective, ttVirtual);
|
||||
AddKeyword('cdecl', wtReservedWordDirective, ttCdecl);
|
||||
AddKeyword('ms_abi_default', wtReservedWordDirective, ttCdecl);
|
||||
AddKeyword('ms_abi_cdecl', wtReservedWordDirective, ttCdecl);
|
||||
AddKeyword('sysv_abi_default', wtReservedWordDirective, ttCdecl);
|
||||
AddKeyword('sysv_abi_cdecl', wtReservedWordDirective, ttCdecl);
|
||||
AddKeyword('message', wtReservedWordDirective, ttMessage);
|
||||
AddKeyword('published', wtReservedWordDirective, ttPublished);
|
||||
AddKeyword('write', wtReservedWordDirective, ttWrite);
|
||||
|
||||
@ -106,7 +106,8 @@ type
|
||||
tkShl, tkShr, tkSlash, tkSlashesComment, tkSquareClose, tkSquareOpen,
|
||||
tkSpace, tkStar, tkStdcall, tkStored, tkString, tkStringresource, tkSymbol,
|
||||
tkThen, tkThreadvar, tkTo, tkTry, tkType, tkUnit, tkUnknown, tkUntil, tkUses,
|
||||
tkVar, tkVectorcall, tkVirtual, tkWhile, tkWith, tkWrite, tkWriteonly, tkXor);
|
||||
tkVar, tkVectorcall, tkVirtual, tkWhile, tkWith, tkWrite, tkWriteonly, tkXor,
|
||||
tkMsAbiDefault,tkMsAbiCdecl,tkSysvAbiDefault,tkSysvAbiCdecl);
|
||||
|
||||
TCommentState=(csAnsi, csBor, csNo);
|
||||
|
||||
@ -460,7 +461,9 @@ function TmwPasLex.Func32: TTokenKind;
|
||||
begin
|
||||
if KeyComp('File')then Result:=tkFile else
|
||||
if KeyComp('Label')then Result:=tkLabel else
|
||||
if KeyComp('Mod')then Result:=tkMod else Result:=tkIdentifier;
|
||||
if KeyComp('Mod')then Result:=tkMod else
|
||||
if KeyComp('Ms_abi_default')then Result:=tkMsAbiDefault else
|
||||
if KeyComp('Ms_abi_cdecl')then Result:=tkMsAbiCdecl else Result:=tkIdentifier;
|
||||
end;
|
||||
|
||||
function TmwPasLex.Func33: TTokenKind;
|
||||
@ -669,7 +672,9 @@ end;
|
||||
function TmwPasLex.Func85: TTokenKind;
|
||||
begin
|
||||
if KeyComp('Library')then Result:=tkLibrary else
|
||||
if KeyComp('Forward')then Result:=tkForward else Result:=tkIdentifier;
|
||||
if KeyComp('Forward')then Result:=tkForward else
|
||||
if KeyComp('Sysv_abi_default')then Result:=tkSysvAbiDefault else
|
||||
if KeyComp('Sysv_abi_cdecl')then Result:=tkSysvAbiCdecl else Result:=tkIdentifier;
|
||||
end;
|
||||
|
||||
function TmwPasLex.Func87: TTokenKind;
|
||||
|
||||
@ -338,7 +338,7 @@ type
|
||||
Run: LongInt;// current parser postion in fLine
|
||||
fStringLen: Integer;// current length of hash
|
||||
fToIdent: integer;// start of current identifier in fLine
|
||||
fIdentFuncTable: array[0..191] of TIdentFuncTableFunc;
|
||||
fIdentFuncTable: array[0..220] of TIdentFuncTableFunc;
|
||||
fTokenPos: Integer;// start of current token in fLine
|
||||
FTokenID: TtkTokenKind;
|
||||
FTokenIsCaseLabel: Boolean;
|
||||
@ -456,8 +456,10 @@ type
|
||||
function Func167: TtkTokenKind;
|
||||
function Func168: TtkTokenKind;
|
||||
function Func170: TtkTokenKind;
|
||||
function Func178: TtkTokenKind;
|
||||
function Func181: TtkTokenKind;
|
||||
function Func191: TtkTokenKind;
|
||||
function Func220: TtkTokenKind;
|
||||
function AltFunc: TtkTokenKind;
|
||||
procedure InitIdent;
|
||||
function IdentKind(p: integer): TtkTokenKind;
|
||||
@ -824,8 +826,10 @@ begin
|
||||
fIdentFuncTable[167] := @Func167;
|
||||
fIdentFuncTable[168] := @Func168;
|
||||
fIdentFuncTable[170] := @Func170;
|
||||
fIdentFuncTable[178] := @Func178;
|
||||
fIdentFuncTable[181] := @Func181;
|
||||
fIdentFuncTable[191] := @Func191;
|
||||
fIdentFuncTable[220] := @Func220;
|
||||
end;
|
||||
|
||||
function TSynPasSyn.KeyHash: Integer;
|
||||
@ -2075,6 +2079,9 @@ function TSynPasSyn.Func125: TtkTokenKind;
|
||||
begin
|
||||
if KeyComp('NoReturn') and (TopPascalCodeFoldBlockType in ProcModifierAllowed) then
|
||||
Result := tkKey
|
||||
else
|
||||
if KeyComp('Ms_abi_cdecl') and (TopPascalCodeFoldBlockType in ProcModifierAllowed) then
|
||||
Result := tkKey
|
||||
else
|
||||
Result := tkIdentifier;
|
||||
end;
|
||||
@ -2314,6 +2321,9 @@ function TSynPasSyn.Func167: TtkTokenKind;
|
||||
begin
|
||||
if (FStringKeywordMode in [spsmDefault]) and KeyComp('Shortstring') then
|
||||
Result := tkKey
|
||||
else
|
||||
if KeyComp('Ms_abi_default') and (TopPascalCodeFoldBlockType in ProcModifierAllowed) then
|
||||
Result := tkKey
|
||||
else
|
||||
Result := tkIdentifier;
|
||||
end;
|
||||
@ -2369,6 +2379,22 @@ begin
|
||||
Result := tkIdentifier;
|
||||
end;
|
||||
|
||||
function TSynPasSyn.Func178: TtkTokenKind;
|
||||
begin
|
||||
if KeyComp('Sysv_abi_cdecl') and (TopPascalCodeFoldBlockType in ProcModifierAllowed) then
|
||||
Result := tkKey
|
||||
else
|
||||
Result := tkIdentifier;
|
||||
end;
|
||||
|
||||
function TSynPasSyn.Func220: TtkTokenKind;
|
||||
begin
|
||||
if KeyComp('Sysv_abi_default') and (TopPascalCodeFoldBlockType in ProcModifierAllowed) then
|
||||
Result := tkKey
|
||||
else
|
||||
Result := tkIdentifier;
|
||||
end;
|
||||
|
||||
function TSynPasSyn.AltFunc: TtkTokenKind;
|
||||
begin
|
||||
Result := tkIdentifier;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user