From 826f208e4549fe2c94962ab23f8f9d995fae4d92 Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 12 Nov 2017 22:14:18 +0000 Subject: [PATCH] * define CPU and FPU type macros before the second parsing of the parameters so they can be used in config files git-svn-id: trunk@37582 - --- compiler/options.pas | 43 +++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/compiler/options.pas b/compiler/options.pas index 2363e8dc09..fadf758c62 100644 --- a/compiler/options.pas +++ b/compiler/options.pas @@ -3332,8 +3332,33 @@ begin end; end; - procedure read_arguments(cmd:TCmdStr); + + procedure def_cpu_macros; + var + abi : tabi; + fputype : tfputype; + cputype : tcputype; + begin + for cputype:=low(tcputype) to high(tcputype) do + undef_system_macro('CPU'+Cputypestr[cputype]); + def_system_macro('CPU'+Cputypestr[init_settings.cputype]); + + for fputype:=low(tfputype) to high(tfputype) do + undef_system_macro('FPU'+fputypestr[fputype]); + def_system_macro('FPU'+fputypestr[init_settings.fputype]); + + { define abi } + for abi:=low(tabi) to high(tabi) do + undef_system_macro('FPC_ABI_'+abiinfo[abi].name); + def_system_macro('FPC_ABI_'+abiinfo[target_info.abi].name); + + { Define FPC_ABI_EABI in addition to FPC_ABI_EABIHF on EABI VFP hardfloat + systems since most code needs to behave the same on both} + if target_info.abi = abi_eabihf then + def_system_macro('FPC_ABI_EABI'); + end; + var env: ansistring; i : tfeature; @@ -3608,6 +3633,8 @@ begin def_system_macro('CPUINT64'); {$endif defined(cpu64bitalu)} + def_cpu_macros; + if tf_cld in target_info.flags then if not UpdateTargetSwitchStr('CLD', init_settings.targetswitches, true) then InternalError(2013092801); @@ -3702,16 +3729,6 @@ begin end; end; - { define abi } - for abi:=low(tabi) to high(tabi) do - undef_system_macro('FPC_ABI_'+abiinfo[abi].name); - def_system_macro('FPC_ABI_'+abiinfo[target_info.abi].name); - - { Define FPC_ABI_EABI in addition to FPC_ABI_EABIHF on EABI VFP hardfloat - systems since most code needs to behave the same on both} - if target_info.abi = abi_eabihf then - def_system_macro('FPC_ABI_EABI'); - { Write logo } if option.ParaLogo then option.writelogo; @@ -4041,7 +4058,7 @@ begin {$endif m68k} { now we can define cpu and fpu type } - def_system_macro('CPU'+Cputypestr[init_settings.cputype]); + def_cpu_macros; { Use init_settings cpu type for asm cpu type, if asmcputype is cpu_none, @@ -4050,8 +4067,6 @@ begin if init_settings.asmcputype = cpu_none then init_settings.asmcputype:=init_settings.cputype; - def_system_macro('FPU'+fputypestr[init_settings.fputype]); - {$ifdef llvm} def_system_macro('CPULLVM'); {$endif llvm}