Treat -Cb / -Cb- options in first pass (to be able to use FPC_BIG_ENDIAN inside .fpc.cfg config file)

This commit is contained in:
Pierre Muller 2023-04-06 16:49:35 +02:00
parent 2a4ca98e85
commit 892220d6fe

View File

@ -169,6 +169,27 @@ begin
{$endif}
end;
procedure set_endianess_macros;
begin
{ endian define }
case target_info.endian of
endian_little :
begin
def_system_macro('ENDIAN_LITTLE');
def_system_macro('FPC_LITTLE_ENDIAN');
undef_system_macro('ENDIAN_BIG');
undef_system_macro('FPC_BIG_ENDIAN');
end;
endian_big :
begin
def_system_macro('ENDIAN_BIG');
def_system_macro('FPC_BIG_ENDIAN');
undef_system_macro('ENDIAN_LITTLE');
undef_system_macro('FPC_LITTLE_ENDIAN');
end;
end;
end;
{****************************************************************************
Toption
@ -1488,7 +1509,7 @@ begin
(
((length(opt)>1) and (opt[2] in ['i','d','v','T','u','n','X','l','U'])) or
((length(opt)>3) and (opt[2]='F') and (opt[3]='e')) or
((length(opt)>3) and (opt[2]='C') and (opt[3] in ['a','f','p'])) or
((length(opt)>2) and (opt[2]='C') and (opt[3] in ['a','b','f','p'])) or
((length(opt)>3) and (opt[2]='W') and (opt[3] in ['m','p']))
)
) then
@ -1627,6 +1648,7 @@ begin
target_info.endian:=endian_little
else
target_info.endian:=endian_big;
set_endianess_macros;
end;
'c' :
@ -4559,6 +4581,7 @@ begin
{ make cpu makros available when reading the config files the second time }
def_cpu_macros;
set_endianess_macros;
if tf_cld in target_info.flags then
if not UpdateTargetSwitchStr('CLD', init_settings.targetswitches, true) then
@ -4659,20 +4682,6 @@ begin
if ErrorCount>0 then
StopOptions(1);
{ endian define }
case target_info.endian of
endian_little :
begin
def_system_macro('ENDIAN_LITTLE');
def_system_macro('FPC_LITTLE_ENDIAN');
end;
endian_big :
begin
def_system_macro('ENDIAN_BIG');
def_system_macro('FPC_BIG_ENDIAN');
end;
end;
{ Write logo }
if option.ParaLogo then
option.writelogo;
@ -5219,6 +5228,7 @@ begin
{ now we can define cpu and fpu type }
def_cpu_macros;
set_endianess_macros;
{ Use init_settings cpu type for asm cpu type,
if asmcputype is cpu_none,