mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-19 11:29:41 +02:00
* synchronized with trunk
git-svn-id: branches/z80@45079 -
This commit is contained in:
commit
df65884b7e
@ -5232,7 +5232,13 @@ unit aoptx86;
|
|||||||
if not(RegUsedAfterInstruction(taicpu(p).oper[1]^.reg,hp1,TmpUsedRegs)) then
|
if not(RegUsedAfterInstruction(taicpu(p).oper[1]^.reg,hp1,TmpUsedRegs)) then
|
||||||
begin
|
begin
|
||||||
DebugMsg(SPeepholeOptimization + 'MovxMov2Movx',p);
|
DebugMsg(SPeepholeOptimization + 'MovxMov2Movx',p);
|
||||||
taicpu(p).loadreg(1,taicpu(hp1).oper[1]^.reg);
|
{$ifdef x86_64}
|
||||||
|
if (taicpu(p).opsize in [S_BL,S_WL]) and
|
||||||
|
(taicpu(hp1).opsize=S_Q) then
|
||||||
|
taicpu(p).loadreg(1,newreg(R_INTREGISTER,getsupreg(taicpu(hp1).oper[1]^.reg),R_SUBD))
|
||||||
|
else
|
||||||
|
{$endif x86_64}
|
||||||
|
taicpu(p).loadreg(1,taicpu(hp1).oper[1]^.reg);
|
||||||
asml.remove(hp1);
|
asml.remove(hp1);
|
||||||
hp1.Free;
|
hp1.Free;
|
||||||
end;
|
end;
|
||||||
|
@ -206,6 +206,7 @@ const
|
|||||||
nInferredTypeXFromDiffArgsMismatchFromMethodY = 3140;
|
nInferredTypeXFromDiffArgsMismatchFromMethodY = 3140;
|
||||||
nParamOfThisTypeCannotHaveDefVal = 3141;
|
nParamOfThisTypeCannotHaveDefVal = 3141;
|
||||||
nClassTypesAreNotRelatedXY = 3142;
|
nClassTypesAreNotRelatedXY = 3142;
|
||||||
|
nDirectiveXNotAllowedHere = 3143;
|
||||||
|
|
||||||
// using same IDs as FPC
|
// using same IDs as FPC
|
||||||
nVirtualMethodXHasLowerVisibility = 3250; // was 3050
|
nVirtualMethodXHasLowerVisibility = 3250; // was 3050
|
||||||
@ -359,6 +360,7 @@ resourcestring
|
|||||||
sInferredTypeXFromDiffArgsMismatchFromMethodY = 'Inferred type "%s" from different arguments mismatch for method "%s"';
|
sInferredTypeXFromDiffArgsMismatchFromMethodY = 'Inferred type "%s" from different arguments mismatch for method "%s"';
|
||||||
sParamOfThisTypeCannotHaveDefVal = 'Parameters of this type cannot have default values';
|
sParamOfThisTypeCannotHaveDefVal = 'Parameters of this type cannot have default values';
|
||||||
sClassTypesAreNotRelatedXY = 'Class types "%s" and "%s" are not related';
|
sClassTypesAreNotRelatedXY = 'Class types "%s" and "%s" are not related';
|
||||||
|
sDirectiveXNotAllowedHere = 'Directive "%s" not allowed here';
|
||||||
|
|
||||||
type
|
type
|
||||||
{ TResolveData - base class for data stored in TPasElement.CustomData }
|
{ TResolveData - base class for data stored in TPasElement.CustomData }
|
||||||
|
@ -5189,7 +5189,7 @@ begin
|
|||||||
fpkProc:
|
fpkProc:
|
||||||
// proc hides a non proc
|
// proc hides a non proc
|
||||||
if (Data^.Proc.GetModule=El.GetModule) then
|
if (Data^.Proc.GetModule=El.GetModule) then
|
||||||
// forbidden within same CurModule
|
// forbidden within same module
|
||||||
RaiseMsg(20170216151649,nDuplicateIdentifier,sDuplicateIdentifier,
|
RaiseMsg(20170216151649,nDuplicateIdentifier,sDuplicateIdentifier,
|
||||||
[El.Name,GetElementSourcePosStr(El)],Data^.Proc.ProcType)
|
[El.Name,GetElementSourcePosStr(El)],Data^.Proc.ProcType)
|
||||||
else
|
else
|
||||||
@ -6930,7 +6930,7 @@ begin
|
|||||||
RaiseInvalidProcModifier(20170216151637,Proc,pmOverride,Proc);
|
RaiseInvalidProcModifier(20170216151637,Proc,pmOverride,Proc);
|
||||||
if Proc.IsMessage then
|
if Proc.IsMessage then
|
||||||
RaiseInvalidProcModifier(20170216151638,Proc,pmMessage,Proc);
|
RaiseInvalidProcModifier(20170216151638,Proc,pmMessage,Proc);
|
||||||
if Proc.IsStatic then
|
if Proc.IsStatic and not HasDots then
|
||||||
RaiseInvalidProcTypeModifier(20170216151640,El,ptmStatic,El);
|
RaiseInvalidProcTypeModifier(20170216151640,El,ptmStatic,El);
|
||||||
if (not HasDots)
|
if (not HasDots)
|
||||||
and (Proc.GetProcTypeEnum in [
|
and (Proc.GetProcTypeEnum in [
|
||||||
@ -9205,11 +9205,11 @@ var
|
|||||||
DeclName, ImplName: String;
|
DeclName, ImplName: String;
|
||||||
ImplResult, DeclResult: TPasType;
|
ImplResult, DeclResult: TPasType;
|
||||||
ImplTemplType, DeclTemplType: TPasGenericTemplateType;
|
ImplTemplType, DeclTemplType: TPasGenericTemplateType;
|
||||||
|
NewImplPTMods: TProcTypeModifiers;
|
||||||
|
ptm: TProcTypeModifier;
|
||||||
begin
|
begin
|
||||||
if ImplProc.ClassType<>DeclProc.ClassType then
|
if ImplProc.ClassType<>DeclProc.ClassType then
|
||||||
RaiseXExpectedButYFound(20170216151729,DeclProc.TypeName,ImplProc.TypeName,ImplProc);
|
RaiseXExpectedButYFound(20170216151729,DeclProc.TypeName,ImplProc.TypeName,ImplProc);
|
||||||
if ImplProc.CallingConvention<>DeclProc.CallingConvention then
|
|
||||||
RaiseMsg(20170216151731,nCallingConventionMismatch,sCallingConventionMismatch,[],ImplProc);
|
|
||||||
|
|
||||||
DeclArgs:=DeclProc.ProcType.Args;
|
DeclArgs:=DeclProc.ProcType.Args;
|
||||||
ImplArgs:=ImplProc.ProcType.Args;
|
ImplArgs:=ImplProc.ProcType.Args;
|
||||||
@ -9273,6 +9273,15 @@ begin
|
|||||||
RaiseIncompatibleType(20170216151734,nResultTypeMismatchExpectedButFound,
|
RaiseIncompatibleType(20170216151734,nResultTypeMismatchExpectedButFound,
|
||||||
[],DeclResult,ImplResult,ImplProc);
|
[],DeclResult,ImplResult,ImplProc);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// modifiers
|
||||||
|
if ImplProc.CallingConvention<>DeclProc.CallingConvention then
|
||||||
|
RaiseMsg(20170216151731,nCallingConventionMismatch,sCallingConventionMismatch,[],ImplProc);
|
||||||
|
NewImplPTMods:=ImplProc.ProcType.Modifiers-DeclProc.ProcType.Modifiers;
|
||||||
|
if NewImplPTMods<>[] then
|
||||||
|
for ptm in NewImplPTMods do
|
||||||
|
RaiseMsg(20200425154821,nDirectiveXNotAllowedHere,sDirectiveXNotAllowedHere,
|
||||||
|
[ProcTypeModifiers[ptm]],ImplProc.ProcType);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPasResolver.ResolveImplBlock(Block: TPasImplBlock);
|
procedure TPasResolver.ResolveImplBlock(Block: TPasImplBlock);
|
||||||
|
@ -601,6 +601,7 @@ type
|
|||||||
Procedure TestClass_StaticWithoutClassFail;
|
Procedure TestClass_StaticWithoutClassFail;
|
||||||
Procedure TestClass_SelfInStaticFail;
|
Procedure TestClass_SelfInStaticFail;
|
||||||
Procedure TestClass_SelfDotInStaticFail;
|
Procedure TestClass_SelfDotInStaticFail;
|
||||||
|
Procedure TestClass_ProcStaticMismatchFail;
|
||||||
Procedure TestClass_PrivateProtectedInSameUnit;
|
Procedure TestClass_PrivateProtectedInSameUnit;
|
||||||
Procedure TestClass_PrivateInMainBeginFail;
|
Procedure TestClass_PrivateInMainBeginFail;
|
||||||
Procedure TestClass_PrivateInDescendantFail;
|
Procedure TestClass_PrivateInDescendantFail;
|
||||||
@ -8596,7 +8597,7 @@ begin
|
|||||||
'begin',
|
'begin',
|
||||||
' w:=w+1;',
|
' w:=w+1;',
|
||||||
'end;',
|
'end;',
|
||||||
'class procedure TRec.Create;',
|
'class procedure TRec.Create; static;',
|
||||||
'begin',
|
'begin',
|
||||||
' w:=w+1;',
|
' w:=w+1;',
|
||||||
'end;',
|
'end;',
|
||||||
@ -10513,6 +10514,21 @@ begin
|
|||||||
CheckResolverException('identifier not found "Self"',nIdentifierNotFound);
|
CheckResolverException('identifier not found "Self"',nIdentifierNotFound);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TTestResolver.TestClass_ProcStaticMismatchFail;
|
||||||
|
begin
|
||||||
|
StartProgram(false);
|
||||||
|
Add([
|
||||||
|
'type',
|
||||||
|
' TObject = class',
|
||||||
|
' procedure Run;',
|
||||||
|
' end;',
|
||||||
|
'procedure TObject.Run; static;',
|
||||||
|
'begin',
|
||||||
|
'end;',
|
||||||
|
'begin']);
|
||||||
|
CheckResolverException('Directive "static" not allowed here',nDirectiveXNotAllowedHere);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TTestResolver.TestClass_PrivateProtectedInSameUnit;
|
procedure TTestResolver.TestClass_PrivateProtectedInSameUnit;
|
||||||
begin
|
begin
|
||||||
StartProgram(false);
|
StartProgram(false);
|
||||||
|
@ -1 +1 @@
|
|||||||
'2020-04-21 rev 44899'
|
'2020-04-21 rev 44920'
|
||||||
|
Loading…
Reference in New Issue
Block a user