* prettify the "Use of +offset(%ebp) is not compatible with regcall convention"

and "Use of +offset(%ebp) for parameters invalid here" warning messages by
  showing the exact register used (bp, ebp or rbp) and using the original asm
  syntax (Intel: [EBP+offset]; AT&T: +offset(%ebp) )

git-svn-id: trunk@42207 -
This commit is contained in:
nickysn 2019-06-10 15:08:46 +00:00
parent 49fed0c710
commit 1e07606cbf
4 changed files with 286 additions and 260 deletions

View File

@ -2758,10 +2758,10 @@ asmr_w_unable_to_determine_reference_size_using_byte=07101_W_No size specified a
% the compiler is unable to determine what size (byte,word,dword,etc.) it
% should use for the reference. This warning is only used in Delphi mode where
% it falls back to use BYTE as default.
asmr_w_no_direct_ebp_for_parameter=07102_W_Use of +offset(%ebp) for parameters invalid here
asmr_w_no_direct_ebp_for_parameter=07102_W_Use of $1 for parameters invalid here
% Using direct 8(%ebp) reference for function/procedure parameters is invalid
% if parameters are in registers.
asmr_w_direct_ebp_for_parameter_regcall=07103_W_Use of +offset(%ebp) is not compatible with regcall convention
asmr_w_direct_ebp_for_parameter_regcall=07103_W_Use of $1 is not compatible with regcall convention
% Using direct 8(%ebp) reference for function/procedure parameters is invalid
% if parameters are in registers.
asmr_w_direct_ebp_neg_offset=07104_W_Use of -offset(%ebp) is not recommended for local variable access

View File

@ -1110,7 +1110,7 @@ const
option_info=11024;
option_help_pages=11025;
MsgTxtSize = 83042;
MsgTxtSize = 83020;
MsgIdxMax : array[1..20] of longint=(
28,106,351,126,99,61,142,34,221,67,

File diff suppressed because it is too large Load Diff

View File

@ -248,7 +248,8 @@ begin
end;
Function Tx86Operand.CheckOperand: boolean;
var
ErrorRefStr: string;
begin
result:=true;
if (opr.typ=OPR_Reference) then
@ -257,10 +258,36 @@ begin
begin
if (getsupreg(opr.ref.base)=RS_EBP) and (opr.ref.offset>0) then
begin
if current_procinfo.procdef.proccalloption=pocall_register then
message(asmr_w_no_direct_ebp_for_parameter)
if current_settings.asmmode in [asmmode_i8086_intel,asmmode_i386_intel,asmmode_x86_64_intel] then
begin
case getsubreg(opr.ref.base) of
R_SUBW:
ErrorRefStr:='[BP+offset]';
R_SUBD:
ErrorRefStr:='[EBP+offset]';
R_SUBQ:
ErrorRefStr:='[RBP+offset]';
else
internalerror(2019061001);
end;
end
else
message(asmr_w_direct_ebp_for_parameter_regcall);
begin
case getsubreg(opr.ref.base) of
R_SUBW:
ErrorRefStr:='+offset(%bp)';
R_SUBD:
ErrorRefStr:='+offset(%ebp)';
R_SUBQ:
ErrorRefStr:='+offset(%rbp)';
else
internalerror(2019061002);
end;
end;
if current_procinfo.procdef.proccalloption=pocall_register then
message1(asmr_w_no_direct_ebp_for_parameter,ErrorRefStr)
else
message1(asmr_w_direct_ebp_for_parameter_regcall,ErrorRefStr);
end
else if (getsupreg(opr.ref.base)=RS_EBP) and (opr.ref.offset<0) then
message(asmr_w_direct_ebp_neg_offset)