IDE: pass to FPC only documented assembler mode parameter values and only for relevant CPU families (i8086, i386, x86_64), issue #38786

This commit is contained in:
Maxim Ganetsky 2023-11-24 02:18:36 +03:00
parent dc8475462f
commit 7eb6be5a2c
4 changed files with 16 additions and 8 deletions

View File

@ -1120,6 +1120,8 @@ function GetFPCSubtarget(Subtarget: string): string; // normalize
function IsPas2jsTargetOS(TargetOS: string): boolean;
function IsPas2jsTargetCPU(TargetCPU: string): boolean;
function IsCPUX86(TargetCPU: string): boolean;
function IsCTExecutable(AFilename: string; out ErrorMsg: string): boolean; // not thread-safe
function GuessPascalCompilerFromExeName(Filename: string): TPascalCompiler; // thread-safe
@ -4027,6 +4029,12 @@ begin
Result:=PosI('ecmascript',TargetCPU)>0;
end;
function IsCPUX86(TargetCPU: string): boolean;
begin
TargetCPU:=GetFPCTargetCPU(TargetCPU);
Result:=(TargetCPU='i8086') or (TargetCPU='i386') or (TargetCPU='x86_64');
end;
function IsCTExecutable(AFilename: string; out ErrorMsg: string): boolean;
begin
Result:=false;

View File

@ -2721,12 +2721,12 @@ begin
{ --------------- Parsing Tab ------------------- }
{ Assembler reading style -Ratt = AT&T -Rintel = Intel -Rdirect = direct }
case AssemblerStyle of
1: Result.Add('-Rintel');
2: Result.Add('-Ratt');
3: Result.Add('-Rdirect');
end;
{ Assembler reading style -Ratt = AT&T -Rintel = Intel -Rdefault (or no option) = default }
if IsCPUX86(CurTargetCPU) then
case AssemblerStyle of
1: Result.Add('-Rintel');
2: Result.Add('-Ratt');
end;
// Syntax Options
GetSyntaxOptions(Kind,Result);

View File

@ -255,7 +255,7 @@ begin
// Update selection list for assembler style
ParsingFrame := TCompilerParsingOptionsFrame(FDialog.FindEditor(TCompilerParsingOptionsFrame));
Assert(Assigned(ParsingFrame));
ParsingFrame.grpAsmStyle.Visible := (aTargetCPU='i386') or (aTargetCPU='x86_64');
ParsingFrame.grpAsmStyle.Visible := IsCPUX86(aTargetCPU);
end;
procedure TCompilerConfigTargetFrame.Setup(ADialog: TAbstractOptionsEditorDialog);

View File

@ -142,7 +142,7 @@ begin
begin
cmbSyntaxMode.Text := SyntaxModeToCaption(SyntaxMode);
if (AssemblerStyle in [1,2,3]) then
if (AssemblerStyle in [1,2]) then
grpAsmStyle.ItemIndex := AssemblerStyle
else
grpAsmStyle.ItemIndex := 0;