diff options
145 files changed, 1317 insertions, 1381 deletions
diff --git a/compiler/aasmbase.pas b/compiler/aasmbase.pas index 0437b89b0c..00860f187f 100644 --- a/compiler/aasmbase.pas +++ b/compiler/aasmbase.pas @@ -134,7 +134,7 @@ implementation function maybe_smartlink_symbol:boolean; begin - result:=(cs_create_smart in aktmoduleswitches) or + result:=(cs_create_smart in current_settings.moduleswitches) or use_smartlink_section; end; diff --git a/compiler/aasmtai.pas b/compiler/aasmtai.pas index 462e313473..f6b37931da 100644 --- a/compiler/aasmtai.pas +++ b/compiler/aasmtai.pas @@ -660,7 +660,7 @@ implementation procedure maybe_new_object_file(list:TAsmList); begin - if (cs_create_smart in aktmoduleswitches) and + if (cs_create_smart in current_settings.moduleswitches) and (not use_smartlink_section) then list.concat(tai_cutobject.create); end; @@ -779,7 +779,7 @@ implementation begin inherited create; if not(inlining_procedure and - (cs_gdb_valgrind in aktglobalswitches)) then + (cs_gdb_valgrind in current_settings.globalswitches)) then fileinfo:=aktfilepos; end; @@ -2079,7 +2079,7 @@ implementation segprefix:=ref^.segment; {$endif} {$ifdef extdebug} - if (cs_create_pic in aktmoduleswitches) and + if (cs_create_pic in current_settings.moduleswitches) and assigned(r.symbol) and (r.refaddr=addr_no) then internalerror(200502052); diff --git a/compiler/aggas.pas b/compiler/aggas.pas index c34b6b9051..1f127f03fc 100644 --- a/compiler/aggas.pas +++ b/compiler/aggas.pas @@ -284,7 +284,7 @@ implementation var secname : string; begin - if (cs_create_pic in aktmoduleswitches) and + if (cs_create_pic in current_settings.moduleswitches) and not(target_info.system in [system_powerpc_darwin,system_i386_darwin]) then secname:=secnames_pic[atype] else @@ -422,8 +422,8 @@ implementation last_align := 2; InlineLevel:=0; { lineinfo is only needed for al_procedures (PFV) } - do_line:=(cs_asm_source in aktglobalswitches) or - ((cs_lineinfo in aktmoduleswitches) + do_line:=(cs_asm_source in current_settings.globalswitches) or + ((cs_lineinfo in current_settings.moduleswitches) and (p=current_asmdata.asmlists[al_procedures])); hp:=tai(p.first); while assigned(hp) do @@ -442,7 +442,7 @@ implementation if assigned(infile) then begin { open only if needed !! } - if (cs_asm_source in aktglobalswitches) then + if (cs_asm_source in current_settings.globalswitches) then infile.open; end; { avoid unnecessary reopens of the same file !! } @@ -451,7 +451,7 @@ implementation lastfileinfo.line:=-1; end; { write source } - if (cs_asm_source in aktglobalswitches) and + if (cs_asm_source in current_settings.globalswitches) and assigned(infile) then begin if (infile<>lastinfile) then @@ -489,7 +489,7 @@ implementation ait_regalloc : begin - if (cs_asm_regalloc in aktglobalswitches) then + if (cs_asm_regalloc in current_settings.globalswitches) then begin AsmWrite(#9+target_asm.comment+'Register '); repeat @@ -508,7 +508,7 @@ implementation ait_tempalloc : begin - if (cs_asm_tempalloc in aktglobalswitches) then + if (cs_asm_tempalloc in current_settings.globalswitches) then begin {$ifdef EXTDEBUG} if assigned(tai_tempalloc(hp).problem) then @@ -861,7 +861,7 @@ implementation ait_symbol : begin if (target_info.system = system_powerpc64_linux) and - (tai_symbol(hp).sym.typ = AT_FUNCTION) and (cs_profile in aktmoduleswitches) then + (tai_symbol(hp).sym.typ = AT_FUNCTION) and (cs_profile in current_settings.moduleswitches) then begin AsmWriteLn('.globl _mcount'); end; @@ -1063,7 +1063,7 @@ implementation AsmWriteLn(target_asm.comment+'End asmlist '+AsmlistTypeStr[hal]); end; - if (cs_create_smart in aktmoduleswitches) and + if (cs_create_smart in current_settings.moduleswitches) and (target_info.system in [system_powerpc_darwin,system_i386_darwin]) then AsmWriteLn(#9'.subsections_via_symbols'); diff --git a/compiler/aopt.pas b/compiler/aopt.pas index 050908f6e8..0dcd8ba74f 100644 --- a/compiler/aopt.pas +++ b/compiler/aopt.pas @@ -220,7 +220,7 @@ Unit aopt; { Only perform them twice in the first pass } if pass = 0 then PeepHoleOptPass1; - If (cs_opt_asmcse in aktoptimizerswitches) Then + If (cs_opt_asmcse in current_settings.optimizerswitches) Then Begin // DFA:=TAOptDFACpu.Create(AsmL,BlockStart,BlockEnd,LabelInfo); { data flow analyzer } diff --git a/compiler/aoptobj.pas b/compiler/aoptobj.pas index 9e0fd1356e..e066e02d76 100644 --- a/compiler/aoptobj.pas +++ b/compiler/aoptobj.pas @@ -505,7 +505,7 @@ Unit AoptObj; With Regs[Counter] Do Begin If (typ = Con_Ref) And - ((Not(cs_opt_size in aktoptimizerswitches) And + ((Not(cs_opt_size in current_settings.optimizerswitches) And (NrOfMods <> 1) ) Or (RefInSequence(Ref,Regs[Counter], RefsEq) And @@ -533,7 +533,7 @@ Unit AoptObj; For Counter := LoGPReg to HiGPReg Do With Regs[Counter] Do If (typ = Con_Ref) And - (Not(cs_opt_size in aktoptimizerswitches) Or + (Not(cs_opt_size in current_settings.optimizerswitches) Or {$ifdef x86} {for movsl} (Ref.Base = R_EDI) Or diff --git a/compiler/arm/cgcpu.pas b/compiler/arm/cgcpu.pas index 360ba24051..3f9ea3ff7b 100644 --- a/compiler/arm/cgcpu.pas +++ b/compiler/arm/cgcpu.pas @@ -1567,7 +1567,7 @@ unit cgcpu; helpsize:=12+maxtmpreg*4;//52 with maxtmpreg=10 dstref:=dest; srcref:=source; - if cs_opt_size in aktoptimizerswitches then + if cs_opt_size in current_settings.optimizerswitches then helpsize:=8; if (len<=helpsize) and aligned then begin @@ -1674,7 +1674,7 @@ unit cgcpu; countreg:=getintregister(list,OS_32); -// if cs_opt_size in aktoptimizerswitches then +// if cs_opt_size in current_settings.optimizerswitches then { roozbeh : it seems loading 1 byte is faster becouse of caching/fetching(?) } {if aligned then genloop(len,4) @@ -1715,7 +1715,7 @@ unit cgcpu; ai:TAiCpu; hflags : tresflags; begin - if not(cs_check_overflow in aktlocalswitches) then + if not(cs_check_overflow in current_settings.localswitches) then exit; current_asmdata.getjumplabel(hl); case ovloc.loc of @@ -1813,7 +1813,7 @@ unit cgcpu; make_global:=false; if (not current_module.is_unit) or - (cs_create_smart in aktmoduleswitches) or + (cs_create_smart in current_settings.moduleswitches) or (procdef.owner.defowner.owner.symtabletype=globalsymtable) then make_global:=true; diff --git a/compiler/arm/cpupara.pas b/compiler/arm/cpupara.pas index 2c07b1792c..dc3d6182d3 100644 --- a/compiler/arm/cpupara.pas +++ b/compiler/arm/cpupara.pas @@ -108,7 +108,7 @@ unit cpupara; orddef: getparaloc:=LOC_REGISTER; floatdef: - if (calloption in [pocall_cdecl,pocall_cppdecl,pocall_softfloat]) or (cs_fp_emulation in aktmoduleswitches) then + if (calloption in [pocall_cdecl,pocall_cppdecl,pocall_softfloat]) or (cs_fp_emulation in current_settings.moduleswitches) then getparaloc:=LOC_REGISTER else getparaloc:=LOC_FPUREGISTER; @@ -448,7 +448,7 @@ unit cpupara; { Return in FPU register? } if p.returndef.deftype=floatdef then begin - if (p.proccalloption in [pocall_softfloat]) or (cs_fp_emulation in aktmoduleswitches) then + if (p.proccalloption in [pocall_softfloat]) or (cs_fp_emulation in current_settings.moduleswitches) then begin case retcgsize of OS_64, diff --git a/compiler/arm/cpupi.pas b/compiler/arm/cpupi.pas index 7df2d8ea58..64ddb29850 100644 --- a/compiler/arm/cpupi.pas +++ b/compiler/arm/cpupi.pas @@ -72,7 +72,7 @@ unit cpupi; r : byte; floatsavesize : aword; begin - maxpushedparasize:=align(maxpushedparasize,max(aktalignment.localalignmin,4)); + maxpushedparasize:=align(maxpushedparasize,max(current_settings.alignment.localalignmin,4)); firstfloatreg:=RS_NO; { save floating point registers? } for r:=RS_F0 to RS_F7 do @@ -86,8 +86,8 @@ unit cpupi; floatsavesize:=(lastfloatreg-firstfloatreg+1)*12 else floatsavesize:=0; - floatsavesize:=align(floatsavesize,max(aktalignment.localalignmin,4)); - result:=Align(tg.direction*tg.lasttemp,max(aktalignment.localalignmin,4))+maxpushedparasize+floatsavesize; + floatsavesize:=align(floatsavesize,max(current_settings.alignment.localalignmin,4)); + result:=Align(tg.direction*tg.lasttemp,max(current_settings.alignment.localalignmin,4))+maxpushedparasize+floatsavesize; floatregstart:=-result+maxpushedparasize; end; diff --git a/compiler/arm/narmadd.pas b/compiler/arm/narmadd.pas index aaa187342a..15003ae81c 100644 --- a/compiler/arm/narmadd.pas +++ b/compiler/arm/narmadd.pas @@ -124,7 +124,7 @@ interface var op : TAsmOp; begin - case aktfputype of + case current_settings.fputype of fpu_fpa, fpu_fpa10, fpu_fpa11: diff --git a/compiler/arm/narmcnv.pas b/compiler/arm/narmcnv.pas index 2369ce20f1..1a111b2128 100644 --- a/compiler/arm/narmcnv.pas +++ b/compiler/arm/narmcnv.pas @@ -76,7 +76,7 @@ implementation var fname: string[19]; begin - if cs_fp_emulation in aktmoduleswitches then + if cs_fp_emulation in current_settings.moduleswitches then begin if target_info.system in system_wince then begin diff --git a/compiler/arm/narmcon.pas b/compiler/arm/narmcon.pas index 3304d9faad..717395a8da 100644 --- a/compiler/arm/narmcon.pas +++ b/compiler/arm/narmcon.pas @@ -66,7 +66,7 @@ interface location_reset(location,LOC_CREFERENCE,def_cgsize(resultdef)); lastlabel:=nil; realait:=floattype2ait[tfloatdef(resultdef).typ]; - hiloswapped:=aktfputype in [fpu_fpa,fpu_fpa10,fpu_fpa11]; + hiloswapped:=current_settings.fputype in [fpu_fpa,fpu_fpa10,fpu_fpa11]; { const already used ? } if not assigned(lab_real) then begin @@ -79,8 +79,8 @@ interface begin current_procinfo.aktlocaldata.concat(Tai_real_32bit.Create(ts32real(value_real))); { range checking? } - if ((cs_check_range in aktlocalswitches) or - (cs_check_overflow in aktlocalswitches)) and + if ((cs_check_range in current_settings.localswitches) or + (cs_check_overflow in current_settings.localswitches)) and (tai_real_32bit(current_asmdata.asmlists[al_typedconsts].last).value=MathInf.Value) then Message(parser_e_range_check_error); end; @@ -93,8 +93,8 @@ interface current_procinfo.aktlocaldata.concat(Tai_real_64bit.Create(ts64real(value_real))); { range checking? } - if ((cs_check_range in aktlocalswitches) or - (cs_check_overflow in aktlocalswitches)) and + if ((cs_check_range in current_settings.localswitches) or + (cs_check_overflow in current_settings.localswitches)) and (tai_real_64bit(current_asmdata.asmlists[al_typedconsts].last).value=MathInf.Value) then Message(parser_e_range_check_error); end; @@ -104,8 +104,8 @@ interface current_procinfo.aktlocaldata.concat(Tai_real_80bit.Create(value_real)); { range checking? } - if ((cs_check_range in aktlocalswitches) or - (cs_check_overflow in aktlocalswitches)) and + if ((cs_check_range in current_settings.localswitches) or + (cs_check_overflow in current_settings.localswitches)) and (tai_real_80bit(current_asmdata.asmlists[al_typedconsts].last).value=MathInf.Value) then Message(parser_e_range_check_error); end; @@ -115,8 +115,8 @@ interface current_procinfo.aktlocaldata.concat(Tai_real_128bit.Create(value_real)); { range checking? } - if ((cs_check_range in aktlocalswitches) or - (cs_check_overflow in aktlocalswitches)) and + if ((cs_check_range in current_settings.localswitches) or + (cs_check_overflow in current_settings.localswitches)) and (tai_real_128bit(current_asmdata.asmlists[al_typedconsts].last).value=MathInf.Value) then Message(parser_e_range_check_error); end; diff --git a/compiler/arm/narminl.pas b/compiler/arm/narminl.pas index f1af4500ce..c6a61db6a5 100644 --- a/compiler/arm/narminl.pas +++ b/compiler/arm/narminl.pas @@ -85,7 +85,7 @@ implementation function tarminlinenode.first_abs_real : tnode; begin - if cs_fp_emulation in aktmoduleswitches then + if cs_fp_emulation in current_settings.moduleswitches then result:=inherited first_abs_real else begin @@ -99,7 +99,7 @@ implementation function tarminlinenode.first_sqr_real : tnode; begin - if cs_fp_emulation in aktmoduleswitches then + if cs_fp_emulation in current_settings.moduleswitches then result:=inherited first_sqr_real else begin @@ -113,7 +113,7 @@ implementation function tarminlinenode.first_sqrt_real : tnode; begin - if cs_fp_emulation in aktmoduleswitches then + if cs_fp_emulation in current_settings.moduleswitches then result:=inherited first_sqrt_real else begin diff --git a/compiler/assemble.pas b/compiler/assemble.pas index 301741275b..3378ff00d2 100644 --- a/compiler/assemble.pas +++ b/compiler/assemble.pas @@ -252,8 +252,8 @@ Implementation Function DoPipe:boolean; begin - DoPipe:=(cs_asm_pipe in aktglobalswitches) and - (([cs_asm_leave,cs_link_on_target] * aktglobalswitches) = []) and + DoPipe:=(cs_asm_pipe in current_settings.globalswitches) and + (([cs_asm_leave,cs_link_on_target] * current_settings.globalswitches) = []) and ((target_asm.id in [as_gas,as_darwin])); end; @@ -336,7 +336,7 @@ Implementation UtilExe : string; begin asfound:=false; - if cs_link_on_target in aktglobalswitches then + if cs_link_on_target in current_settings.globalswitches then begin { If linking on target, don't add any path PM } FindAssembler:=utilsprefix+AddExtension(target_asm.asmbin,target_info.exeext); @@ -352,10 +352,10 @@ Implementation asfound:=FindFile(UtilExe,utilsdirectory,LastASBin); if not AsFound then asfound:=FindExe(UtilExe,LastASBin); - if (not asfound) and not(cs_asm_extern in aktglobalswitches) then + if (not asfound) and not(cs_asm_extern in current_settings.globalswitches) then begin Message1(exec_e_assembler_not_found,LastASBin); - aktglobalswitches:=aktglobalswitches+[cs_asm_extern]; + current_settings.globalswitches:=current_settings.globalswitches+[cs_asm_extern]; end; if asfound then Message1(exec_t_using_assembler,LastASBin); @@ -371,7 +371,7 @@ Implementation {$ENDIF USE_SYSUTILS} begin callassembler:=true; - if not(cs_asm_extern in aktglobalswitches) then + if not(cs_asm_extern in current_settings.globalswitches) then {$IFDEF USE_SYSUTILS} try FlushOutput; @@ -384,7 +384,7 @@ Implementation except on E:EOSError do begin Message1(exec_e_cant_call_assembler,tostr(E.ErrorCode)); - aktglobalswitches:=aktglobalswitches+[cs_asm_extern]; + current_settings.globalswitches:=current_settings.globalswitches+[cs_asm_extern]; callassembler:=false; end end @@ -397,7 +397,7 @@ Implementation if (doserror<>0) then begin Message1(exec_e_cant_call_assembler,tostr(doserror)); - aktglobalswitches:=aktglobalswitches+[cs_asm_extern]; + current_settings.globalswitches:=current_settings.globalswitches+[cs_asm_extern]; callassembler:=false; end else @@ -417,9 +417,9 @@ Implementation var g : file; begin - if cs_asm_leave in aktglobalswitches then + if cs_asm_leave in current_settings.globalswitches then exit; - if cs_asm_extern in aktglobalswitches then + if cs_asm_extern in current_settings.globalswitches then AsmRes.AddDeleteCommand(AsmFileName) else begin @@ -437,7 +437,7 @@ Implementation DoAssemble:=true; if DoPipe then exit; - if not(cs_asm_extern in aktglobalswitches) then + if not(cs_asm_extern in current_settings.globalswitches) then begin if SmartAsm then begin @@ -519,7 +519,7 @@ Implementation begin if OutCnt>=AsmOutSize-2 then AsmFlush; - if (cs_link_on_target in aktglobalswitches) then + if (cs_link_on_target in current_settings.globalswitches) then begin OutBuf[OutCnt]:=target_info.newline[1]; inc(OutCnt); @@ -550,12 +550,12 @@ Implementation begin result:=target_asm.asmcmd; {$ifdef m68k} - if aktcputype = cpu_MC68020 then + if current_settings.cputype = cpu_MC68020 then result:='-m68020 '+result else result:='-m68000 '+result; {$endif} - if (cs_link_on_target in aktglobalswitches) then + if (cs_link_on_target in current_settings.globalswitches) then begin Replace(result,'$ASM',maybequoted(ScriptFixFileName(AsmFileName))); Replace(result,'$OBJ',maybequoted(ScriptFixFileName(ObjFileName))); @@ -1266,7 +1266,7 @@ Implementation place: tcutplace; ObjWriter : TObjectWriter; begin - if not(cs_asm_leave in aktglobalswitches) then + if not(cs_asm_leave in current_settings.globalswitches) then ObjWriter:=TARObjectWriter.create(current_module.staticlibfilename^) else ObjWriter:=TObjectwriter.create; diff --git a/compiler/browcol.pas b/compiler/browcol.pas index c9f77dee06..1c9ef3f32c 100644 --- a/compiler/browcol.pas +++ b/compiler/browcol.pas @@ -1503,7 +1503,7 @@ end; with tprocsym(sym) do if assigned(first_procdef) then begin - if cs_local_browser in aktmoduleswitches then + if cs_local_browser in current_settings.moduleswitches then ProcessSymTable(Symbol,Symbol^.Items,first_procdef.parast); if assigned(first_procdef.parast) then begin @@ -1515,7 +1515,7 @@ end; begin Symbol^.Params:=TypeNames^.Add('...'); end; - if cs_local_browser in aktmoduleswitches then + if cs_local_browser in current_settings.moduleswitches then begin if assigned(first_procdef.localst) and (first_procdef.localst.symtabletype<>staticsymtable) then @@ -1618,10 +1618,10 @@ var pif: tinputfile; begin DisposeBrowserCol; - if (cs_browser in aktmoduleswitches) then + if (cs_browser in current_settings.moduleswitches) then NewBrowserCol; hp:=tmodule(loaded_units.first); - if (cs_browser in aktmoduleswitches) then + if (cs_browser in current_settings.moduleswitches) then while assigned(hp) do begin t:=tsymtable(hp.globalsymtable); @@ -1645,7 +1645,7 @@ begin Modules^.Insert(UnitS); ProcessSymTable(UnitS,UnitS^.Items,T); - if cs_local_browser in aktmoduleswitches then + if cs_local_browser in current_settings.moduleswitches then begin t:=tsymtable(hp.localsymtable); if assigned(t) then @@ -1656,7 +1656,7 @@ begin end; hp:=tmodule(loaded_units.first); - if (cs_browser in aktmoduleswitches) then + if (cs_browser in current_settings.moduleswitches) then while assigned(hp) do begin t:=tsymtable(hp.globalsymtable); @@ -1683,7 +1683,7 @@ begin hp:=tmodule(hp.next); end; - if (cs_browser in aktmoduleswitches) then + if (cs_browser in current_settings.moduleswitches) then BuildObjectInfo; { can allways be done needed to know when recompilation of sources is necessary } diff --git a/compiler/browlog.pas b/compiler/browlog.pas index 105e2658c3..f371639792 100644 --- a/compiler/browlog.pas +++ b/compiler/browlog.pas @@ -429,7 +429,7 @@ implementation var hp : tsym; begin - if cs_browser in aktmoduleswitches then + if cs_browser in current_settings.moduleswitches then begin if assigned(p.name) then Browserlog.AddLog('---Symtable '+p.name^) @@ -485,7 +485,7 @@ implementation p:=tstoredsymtable(hp.globalsymtable); if assigned(p) then writesymtable(p); - if cs_local_browser in aktmoduleswitches then + if cs_local_browser in current_settings.moduleswitches then begin p:=tstoredsymtable(hp.localsymtable); if assigned(p) then diff --git a/compiler/cgobj.pas b/compiler/cgobj.pas index 80f0572ab7..4df953dea4 100644 --- a/compiler/cgobj.pas +++ b/compiler/cgobj.pas @@ -1798,7 +1798,7 @@ implementation { division by 1 returns result } if a = 1 then op:=OP_NONE - else if ispowerof2(int64(a), powerval) and not(cs_check_overflow in aktlocalswitches) then + else if ispowerof2(int64(a), powerval) and not(cs_check_overflow in current_settings.localswitches) then begin a := powerval; op:= OP_SHR; @@ -1816,7 +1816,7 @@ implementation else if a=0 then op:=OP_MOVE - else if ispowerof2(int64(a), powerval) and not(cs_check_overflow in aktlocalswitches) then + else if ispowerof2(int64(a), powerval) and not(cs_check_overflow in current_settings.localswitches) then begin a := powerval; op:= OP_SHL; @@ -2625,7 +2625,7 @@ implementation from_signed, to_signed: boolean; begin { range checking on and range checkable value? } - if not(cs_check_range in aktlocalswitches) or + if not(cs_check_range in current_settings.localswitches) or not(fromdef.deftype in [orddef,enumdef]) then exit; {$ifndef cpu64bit} @@ -2811,8 +2811,8 @@ implementation OKLabel : tasmlabel; cgpara1 : TCGPara; begin - if (cs_check_object in aktlocalswitches) or - (cs_check_range in aktlocalswitches) then + if (cs_check_object in current_settings.localswitches) or + (cs_check_range in current_settings.localswitches) then begin current_asmdata.getjumplabel(oklabel); a_cmp_const_reg_label(list,OS_ADDR,OC_NE,0,reg,oklabel); @@ -2837,7 +2837,7 @@ implementation cgpara2.init; paramanager.getintparaloc(pocall_default,1,cgpara1); paramanager.getintparaloc(pocall_default,2,cgpara2); - if (cs_check_object in aktlocalswitches) then + if (cs_check_object in current_settings.localswitches) then begin reference_reset_symbol(hrefvmt,current_asmdata.RefAsmSymbol(objdef.vmt_mangledname),0); paramanager.allocparaloc(list,cgpara2); @@ -2851,7 +2851,7 @@ implementation deallocallcpuregisters(list); end else - if (cs_check_range in aktlocalswitches) then + if (cs_check_range in current_settings.localswitches) then begin paramanager.allocparaloc(list,cgpara1); a_param_reg(list,OS_ADDR,reg,cgpara1); diff --git a/compiler/comprsrc.pas b/compiler/comprsrc.pas index 9498f5e37c..e50103229b 100644 --- a/compiler/comprsrc.pas +++ b/compiler/comprsrc.pas @@ -92,10 +92,10 @@ begin {$ELSE USE_SYSUTILS} fsplit(resbin,respath,n,e); {$ENDIF USE_SYSUTILS} - if (not resfound) and not(cs_link_nolink in aktglobalswitches) then + if (not resfound) and not(cs_link_nolink in current_settings.globalswitches) then begin Message(exec_e_res_not_found); - aktglobalswitches:=aktglobalswitches+[cs_link_nolink]; + current_settings.globalswitches:=current_settings.globalswitches+[cs_link_nolink]; end; {$IFDEF USE_SYSUTILS} srcfilepath := SplitPath(current_module.mainsource^); @@ -117,7 +117,7 @@ begin (srcfilepath<>'') then s:=s+' --include '+maybequoted(srcfilepath); { Execute the command } - if not (cs_link_nolink in aktglobalswitches) then + if not (cs_link_nolink in current_settings.globalswitches) then begin Message1(exec_i_compilingresource,fname); Message2(exec_d_resbin_params,resbin,s); @@ -127,13 +127,13 @@ begin if ExecuteProcess(resbin,s) <> 0 then begin Message(exec_e_error_while_linking); - aktglobalswitches:=aktglobalswitches+[cs_link_nolink]; + current_settings.globalswitches:=current_settings.globalswitches+[cs_link_nolink]; end; except on E:EOSError do begin Message(exec_e_cant_call_linker); - aktglobalswitches:=aktglobalswitches+[cs_link_nolink]; + current_settings.globalswitches:=current_settings.globalswitches+[cs_link_nolink]; end end; {$ELSE USE_SYSUTILS} @@ -143,18 +143,18 @@ begin if (doserror<>0) then begin Message(exec_e_cant_call_linker); - aktglobalswitches:=aktglobalswitches+[cs_link_nolink]; + current_settings.globalswitches:=current_settings.globalswitches+[cs_link_nolink]; end else if (dosexitcode<>0) then begin Message(exec_e_error_while_linking); - aktglobalswitches:=aktglobalswitches+[cs_link_nolink]; + current_settings.globalswitches:=current_settings.globalswitches+[cs_link_nolink]; end; {$ENDIF USE_SYSUTILS} end; { Update asmres when externmode is set } - if cs_link_nolink in aktglobalswitches then + if cs_link_nolink in current_settings.globalswitches then AsmRes.AddLinkCommand(resbin,s,''); if ObjUsed then current_module.linkotherofiles.add(resobj,link_always); diff --git a/compiler/dbgdwarf.pas b/compiler/dbgdwarf.pas index 4a2a364157..3062de8ebe 100644 --- a/compiler/dbgdwarf.pas +++ b/compiler/dbgdwarf.pas @@ -1531,7 +1531,7 @@ end; templist.concat(Tai_stab.create(stab_stabs,strpnew( '"'+pd.procsym.name+':'+hs+def_stab_number(pd.returndef)+'",'+ tostr(N_tsym)+',0,0,'+tostr(tabstractnormalvarsym(pd.funcretsym).localloc.reference.offset)))); - if (m_result in aktmodeswitches) then + if (m_result in current_settings.modeswitches) then templist.concat(Tai_stab.create(stab_stabs,strpnew( '"RESULT:'+hs+def_stab_number(pd.returndef)+'",'+ tostr(N_tsym)+',0,0,'+tostr(tabstractnormalvarsym(pd.funcretsym).localloc.reference.offset)))); diff --git a/compiler/dbgstabs.pas b/compiler/dbgstabs.pas index f0a8901685..e15bbcfc35 100644 --- a/compiler/dbgstabs.pas +++ b/compiler/dbgstabs.pas @@ -518,7 +518,7 @@ implementation function orddef_stabstr(def:torddef):pchar; begin - if cs_gdb_valgrind in aktglobalswitches then + if cs_gdb_valgrind in current_settings.globalswitches then begin case def.typ of uvoid : @@ -615,7 +615,7 @@ implementation begin if (def.owner.symtabletype = objectsymtable) then obj := def.owner.name^+'__'+def.procsym.name; - if not(cs_gdb_valgrind in aktglobalswitches) and + if not(cs_gdb_valgrind in current_settings.globalswitches) and (def.owner.symtabletype=localsymtable) and assigned(def.owner.defowner) and assigned(tprocdef(def.owner.defowner).procsym) then @@ -967,7 +967,7 @@ implementation templist.concat(Tai_stab.create(stab_stabs,strpnew( '"'+pd.procsym.name+':'+hs+def_stab_number(pd.returndef)+'",'+ tostr(N_tsym)+',0,0,'+tostr(tabstractnormalvarsym(pd.funcretsym).localloc.reference.offset)))); - if (m_result in aktmodeswitches) then + if (m_result in current_settings.modeswitches) then templist.concat(Tai_stab.create(stab_stabs,strpnew( '"RESULT:'+hs+def_stab_number(pd.returndef)+'",'+ tostr(N_tsym)+',0,0,'+tostr(tabstractnormalvarsym(pd.funcretsym).localloc.reference.offset)))); @@ -1243,7 +1243,7 @@ implementation the N_Func for the function itself. Valgrind does not support constants } if (sym.owner.symtabletype=parasymtable) or - (cs_gdb_valgrind in aktglobalswitches) then + (cs_gdb_valgrind in current_settings.globalswitches) then exit; case sym.consttyp of conststring: diff --git a/compiler/defcmp.pas b/compiler/defcmp.pas index 2886d3ca26..a4ce2b45e1 100644 --- a/compiler/defcmp.pas +++ b/compiler/defcmp.pas @@ -288,7 +288,7 @@ implementation end; arraydef : begin - if (m_mac in aktmodeswitches) and + if (m_mac in current_settings.modeswitches) and (fromtreetype=stringconstn) then begin eq:=te_convert_l3; @@ -370,7 +370,7 @@ implementation doconv:=tc_char_2_string; eq:=te_convert_l1; end; - if (m_mac in aktmodeswitches) and + if (m_mac in current_settings.modeswitches) and is_integer(def_from) and (def_from.size = 4) then begin @@ -388,10 +388,10 @@ implementation begin doconv:=tc_string_2_string; { prefered string type depends on the $H switch } - if not(cs_ansistrings in aktlocalswitches) and + if not(cs_ansistrings in current_settings.localswitches) and (tstringdef(def_to).string_typ=st_shortstring) then eq:=te_equal - else if (cs_ansistrings in aktlocalswitches) and + else if (cs_ansistrings in current_settings.localswitches) and (tstringdef(def_to).string_typ=st_ansistring) then eq:=te_equal else if tstringdef(def_to).string_typ=st_widestring then @@ -453,7 +453,7 @@ implementation begin { pchar can be assigned to short/ansistrings, but not in tp7 compatible mode } - if not(m_tp7 in aktmodeswitches) then + if not(m_tp7 in current_settings.modeswitches) then begin if is_pchar(def_from) then begin @@ -461,9 +461,9 @@ implementation { prefer ansistrings because pchars can overflow shortstrings, } { but only if ansistrings are the default (JM) } if (is_shortstring(def_to) and - not(cs_ansistrings in aktlocalswitches)) or + not(cs_ansistrings in current_settings.localswitches)) or (is_ansistring(def_to) and - (cs_ansistrings in aktlocalswitches)) then + (cs_ansistrings in current_settings.localswitches)) then eq:=te_convert_l1 else eq:=te_convert_l2; @@ -488,7 +488,7 @@ implementation begin { ordinal to real } { only for implicit and internal typecasts in tp/delphi } if (([cdo_explicit,cdo_internal] * cdoptions <> [cdo_explicit]) or - ([m_tp7,m_delphi] * aktmodeswitches = [])) and + ([m_tp7,m_delphi] * current_settings.modeswitches = [])) and (is_integer(def_from) or (is_currency(def_from) and (s64currencytype.deftype = floatdef))) then @@ -514,7 +514,7 @@ implementation begin if (fromtreetype=realconstn) or not((cdo_explicit in cdoptions) and - (m_delphi in aktmodeswitches)) then + (m_delphi in current_settings.modeswitches)) then begin doconv:=tc_real_2_real; { do we loose precision? } @@ -582,7 +582,7 @@ implementation begin { ugly, but delphi allows it } if (cdo_explicit in cdoptions) and - (m_delphi in aktmodeswitches) and + (m_delphi in current_settings.modeswitches) and (eq=te_incompatible) then begin doconv:=tc_int_2_int; @@ -634,7 +634,7 @@ implementation if is_dynamic_array(def_from) then eq:=te_equal { fpc modes only: array -> dyn. array } - else if (aktmodeswitches*[m_objfpc,m_fpc]<>[]) and + else if (current_settings.modeswitches*[m_objfpc,m_fpc]<>[]) and not(is_special_array(def_from)) and is_zero_based_array(def_from) then begin @@ -730,8 +730,8 @@ implementation end else { array -> array } - if not(m_tp7 in aktmodeswitches) and - not(m_delphi in aktmodeswitches) and + if not(m_tp7 in current_settings.modeswitches) and + not(m_delphi in current_settings.modeswitches) and (tarraydef(def_from).lowrange=tarraydef(def_to).lowrange) and (tarraydef(def_from).highrange=tarraydef(def_to).highrange) and equal_defs(tarraydef(def_from).elementdef,tarraydef(def_to).elementdef) and @@ -876,7 +876,7 @@ implementation eq:=te_convert_l1; end else - if (m_delphi in aktmodeswitches) and is_integer(def_from) then + if (m_delphi in current_settings.modeswitches) and is_integer(def_from) then begin doconv:=tc_cord_2_pointer; eq:=te_convert_l2; @@ -889,7 +889,7 @@ implementation not is_void(def_from) and ( ( - (m_delphi in aktmodeswitches) and + (m_delphi in current_settings.modeswitches) and (cdo_explicit in cdoptions) ) or (cdo_internal in cdoptions) @@ -925,7 +925,7 @@ implementation end else { dynamic array to pointer, delphi only } - if (m_delphi in aktmodeswitches) and + if (m_delphi in current_settings.modeswitches) and is_dynamic_array(def_from) then begin eq:=te_equal; @@ -998,7 +998,7 @@ implementation { procedure variable can be assigned to an void pointer, this not allowed for methodpointers } if (is_void(tpointerdef(def_to).pointeddef) or - (m_mac_procvar in aktmodeswitches)) and + (m_mac_procvar in current_settings.modeswitches)) and tprocvardef(def_from).is_addressonly then begin doconv:=tc_equal; @@ -1009,7 +1009,7 @@ implementation begin { procedure variable can be assigned to an void pointer, this not allowed for methodpointers } - if (m_mac_procvar in aktmodeswitches) and + if (m_mac_procvar in current_settings.modeswitches) and tprocdef(def_from).is_addressonly then begin doconv:=tc_proc_2_procvar; @@ -1070,8 +1070,8 @@ implementation procdef : begin { proc -> procvar } - if (m_tp_procvar in aktmodeswitches) or - (m_mac_procvar in aktmodeswitches) then + if (m_tp_procvar in current_settings.modeswitches) or + (m_mac_procvar in current_settings.modeswitches) then begin subeq:=proc_to_procvar_equal(tprocdef(def_from),tprocvardef(def_to)); if subeq>te_incompatible then @@ -1097,7 +1097,7 @@ implementation else { for example delphi allows the assignement from pointers } { to procedure variables } - if (m_pointer_2_procedure in aktmodeswitches) and + if (m_pointer_2_procedure in current_settings.modeswitches) and is_void(tpointerdef(def_from).pointeddef) and tprocvardef(def_to).is_addressonly then begin @@ -1122,7 +1122,7 @@ implementation if is_class_or_interface(def_to) then begin { void pointer also for delphi mode } - if (m_delphi in aktmodeswitches) and + if (m_delphi in current_settings.modeswitches) and is_voidpointer(def_from) then begin doconv:=tc_equal; @@ -1172,7 +1172,7 @@ implementation { ugly, but delphi allows it } else if (eq=te_incompatible) and (def_from.deftype=orddef) and - (m_delphi in aktmodeswitches) and + (m_delphi in current_settings.modeswitches) and (cdo_explicit in cdoptions) then begin doconv:=tc_int_2_int; @@ -1523,7 +1523,7 @@ implementation { check return value and options, methodpointer is already checked } po_comp:=[po_staticmethod,po_interrupt, po_iocheck,po_varargs]; - if (m_delphi in aktmodeswitches) then + if (m_delphi in current_settings.modeswitches) then exclude(po_comp,po_varargs); if (def1.proccalloption=def2.proccalloption) and ((po_comp * def1.procoptions)= (po_comp * def2.procoptions)) and diff --git a/compiler/defutil.pas b/compiler/defutil.pas index ab93b0984e..6d784b3d35 100644 --- a/compiler/defutil.pas +++ b/compiler/defutil.pas @@ -711,7 +711,7 @@ implementation l:=0; } if not explicit then begin - if (cs_check_range in aktlocalswitches) then + if (cs_check_range in current_settings.localswitches) then Message(parser_e_range_check_error) else Message(parser_w_range_check_error); @@ -729,8 +729,8 @@ implementation if ((def.deftype=enumdef) and { delphi allows range check errors in enumeration type casts FK } - not(m_delphi in aktmodeswitches)) or - (cs_check_range in aktlocalswitches) then + not(m_delphi in current_settings.modeswitches)) or + (cs_check_range in current_settings.localswitches) then Message(parser_e_range_check_error) else Message(parser_w_range_check_error); @@ -853,7 +853,7 @@ implementation function is_mmx_able_array(p : tdef) : boolean; begin {$ifdef SUPPORT_MMX} - if (cs_mmx_saturation in aktlocalswitches) then + if (cs_mmx_saturation in current_settings.localswitches) then begin is_mmx_able_array:=(p.deftype=arraydef) and not(is_special_array(p)) and @@ -967,7 +967,7 @@ implementation result:=int_cgsize(def.size); end; floatdef: - if cs_fp_emulation in aktmoduleswitches then + if cs_fp_emulation in current_settings.moduleswitches then result:=int_cgsize(def.size) else result:=tfloat2tcgsize[tfloatdef(def).typ]; diff --git a/compiler/fppu.pas b/compiler/fppu.pas index 98bd6243c6..8d9cd1cda1 100644 --- a/compiler/fppu.pas +++ b/compiler/fppu.pas @@ -230,7 +230,7 @@ uses { check if floating point emulation is on?} { fpu emulation isn't unit levelwise if ((ppufile.header.flags and uf_fpu_emulation)<>0) and - (cs_fp_emulation in aktmoduleswitches) then + (cs_fp_emulation in current_settings.moduleswitches) then begin ppufile.free; ppufile:=nil; @@ -302,7 +302,7 @@ uses { Check for .pas } Found:=UnitExists(pasext,hs); end; - if not Found and (m_mac in aktmodeswitches) then + if not Found and (m_mac in current_settings.modeswitches) then begin { Check for .p, if mode is macpas} Found:=UnitExists(pext,hs); @@ -384,7 +384,7 @@ uses Message1(unit_t_unitsearch,AddExtension(sourcefn^,pasext)); fnd:=FindFile(AddExtension(sourcefn^,pasext),'',hs); end; - if not fnd and ((m_mac in aktmodeswitches) or (tf_p_ext_support in target_info.flags)) then + if not fnd and ((m_mac in current_settings.modeswitches) or (tf_p_ext_support in target_info.flags)) then begin Message1(unit_t_unitsearch,AddExtension(sourcefn^,pext)); fnd:=FindFile(AddExtension(sourcefn^,pext),'',hs); @@ -888,7 +888,7 @@ uses ibmodulename : begin newmodulename:=ppufile.getstring; - if (cs_check_unit_name in aktglobalswitches) and + if (cs_check_unit_name in current_settings.globalswitches) and (upper(newmodulename)<>modulename^) then Message2(unit_f_unit_name_error,realmodulename^,newmodulename); stringdispose(modulename); @@ -982,16 +982,16 @@ uses Message1(unit_u_ppu_write,realmodulename^); { create unit flags } - if cs_browser in aktmoduleswitches then + if cs_browser in current_settings.moduleswitches then flags:=flags or uf_has_browser; - if cs_local_browser in aktmoduleswitches then + if cs_local_browser in current_settings.moduleswitches then flags:=flags or uf_local_browser; if do_release then flags:=flags or uf_release; if assigned(localsymtable) then flags:=flags or uf_local_symtable; {$ifdef cpufpemu} - if (cs_fp_emulation in aktmoduleswitches) then + if (cs_fp_emulation in current_settings.moduleswitches) then flags:=flags or uf_fpu_emulation; {$endif cpufpemu} {$ifdef Test_Double_checksum_write} @@ -1032,7 +1032,7 @@ uses { generate implementation deref data, the interface deref data is already generated when calculating the interface crc } - if (cs_compilesystem in aktmoduleswitches) then + if (cs_compilesystem in current_settings.moduleswitches) then begin tstoredsymtable(globalsymtable).buildderef; derefdataintflen:=derefdata.size; diff --git a/compiler/gendef.pas b/compiler/gendef.pas index 12b96b5057..1e7202f11a 100644 --- a/compiler/gendef.pas +++ b/compiler/gendef.pas @@ -69,7 +69,7 @@ end; destructor tdeffile.destroy; begin if WrittenOnDisk and - not(cs_link_nolink in aktglobalswitches) then + not(cs_link_nolink in current_settings.globalswitches) then RemoveFile(FName); importlist.Free; exportlist.Free; diff --git a/compiler/globals.pas b/compiler/globals.pas index f046a9daa2..aa844ebd7b 100644 --- a/compiler/globals.pas +++ b/compiler/globals.pas @@ -113,6 +113,32 @@ interface fileindex : word; { moduleindex : word; } end; + + tcodepagestring = string[20]; + + tsettings = record + globalswitches : tglobalswitches; + moduleswitches : tmoduleswitches; + localswitches : tlocalswitches; + modeswitches : tmodeswitches; + optimizerswitches : toptimizerswitches; + { 0: old behaviour for sets <=256 elements + >0: round to this size } + setalloc, + packenum : shortint; + alignment : talignmentinfo; + cputype, + optimizecputype : tcputype; + fputype : tfputype; + asmmode : tasmmode; + interfacetype : tinterfacetypes; + defproccall : tproccalloption; + sourcecodepage : tcodepagestring; + + packrecords : shortint; + maxfpuregisters : byte; + end; + TSearchPathList = class(TStringList) procedure AddPath(s:string;addfirst:boolean);overload; @@ -121,8 +147,6 @@ interface function FindFile(const f : string;var foundfile:string):boolean; end; - tcodepagestring = string[20]; - var { specified inputfile } inputdir : dirstr; @@ -216,46 +240,11 @@ interface LinkLibraryAliases : TLinkStrMap; LinkLibraryOrder : TLinkStrMap; - - { commandline values } - initglobalswitches : tglobalswitches; - initmoduleswitches : tmoduleswitches; - initlocalswitches : tlocalswitches; - initmodeswitches : tmodeswitches; - initoptimizerswitches : toptimizerswitches; - { 0: old behaviour for sets <=256 elements - >0: round to this size } - initsetalloc, - initpackenum : shortint; - initalignment : talignmentinfo; - initcputype, - initoptimizecputype : tcputype; - initfputype : tfputype; - initasmmode : tasmmode; - initinterfacetype : tinterfacetypes; - initdefproccall : tproccalloption; - initsourcecodepage : tcodepagestring; - - { current state values } - aktglobalswitches : tglobalswitches; - aktmoduleswitches : tmoduleswitches; - aktlocalswitches : tlocalswitches; - aktoptimizerswitches : toptimizerswitches; - nextaktlocalswitches : tlocalswitches; + init_settings, + current_settings : tsettings; + + nextlocalswitches : tlocalswitches; localswitcheschanged : boolean; - aktmodeswitches : tmodeswitches; - aktsetalloc, - aktpackrecords, - aktpackenum : shortint; - aktmaxfpuregisters : longint; - aktalignment : talignmentinfo; - aktcputype, - aktoptimizecputype : tcputype; - aktfputype : tfputype; - aktasmmode : tasmmode; - aktinterfacetype : tinterfacetypes; - aktdefproccall : tproccalloption; - aktsourcecodepage : tcodepagestring; { Memory sizes } heapsize, @@ -2101,14 +2090,14 @@ end; function var_align(siz: shortint): shortint; begin siz := size_2_align(siz); - var_align := used_align(siz,aktalignment.varalignmin,aktalignment.varalignmax); + var_align := used_align(siz,current_settings.alignment.varalignmin,current_settings.alignment.varalignmax); end; function const_align(siz: shortint): shortint; begin siz := size_2_align(siz); - const_align := used_align(siz,aktalignment.constalignmin,aktalignment.constalignmax); + const_align := used_align(siz,current_settings.alignment.constalignmin,current_settings.alignment.constalignmax); end; @@ -2251,55 +2240,55 @@ end; apptype:=app_cui; { Init values } - initmodeswitches:=fpcmodeswitches; - initlocalswitches:=[cs_check_io,cs_typed_const_writable]; - initmoduleswitches:=[cs_extsyntax,cs_implicit_exceptions]; - initglobalswitches:=[cs_check_unit_name,cs_link_static]; - initoptimizerswitches:=[]; - initsourcecodepage:='8859-1'; - initpackenum:=4; - initsetalloc:=0; - fillchar(initalignment,sizeof(talignmentinfo),0); + init_settings.modeswitches:=fpcmodeswitches; + init_settings.localswitches:=[cs_check_io,cs_typed_const_writable]; + init_settings.moduleswitches:=[cs_extsyntax,cs_implicit_exceptions]; + init_settings.globalswitches:=[cs_check_unit_name,cs_link_static]; + init_settings.optimizerswitches:=[]; + init_settings.sourcecodepage:='8859-1'; + init_settings.packenum:=4; + init_settings.setalloc:=0; + fillchar(init_settings.alignment,sizeof(talignmentinfo),0); { might be overridden later } - initasmmode:=asmmode_standard; - initcputype:=cpu_none; - initoptimizecputype:=cpu_none; - initfputype:=fpu_none; - initinterfacetype:=it_interfacecom; - initdefproccall:=pocall_default; + init_settings.asmmode:=asmmode_standard; + init_settings.cputype:=cpu_none; + init_settings.optimizecputype:=cpu_none; + init_settings.fputype:=fpu_none; + init_settings.interfacetype:=it_interfacecom; + init_settings.defproccall:=pocall_default; { Target specific defaults, these can override previous default options } {$ifdef i386} - initcputype:=cpu_Pentium; - initoptimizecputype:=cpu_Pentium3; - initfputype:=fpu_x87; + init_settings.cputype:=cpu_Pentium; + init_settings.optimizecputype:=cpu_Pentium3; + init_settings.fputype:=fpu_x87; {$endif i386} {$ifdef m68k} - initcputype:=cpu_MC68020; - initfputype:=fpu_soft; + init_settings.cputype:=cpu_MC68020; + init_settings.fputype:=fpu_soft; {$endif m68k} {$ifdef powerpc} - initcputype:=cpu_PPC604; - initfputype:=fpu_standard; + init_settings.cputype:=cpu_PPC604; + init_settings.fputype:=fpu_standard; {$endif powerpc} {$ifdef POWERPC64} - initcputype:=cpu_PPC970; - initfputype:=fpu_standard; + init_settings.cputype:=cpu_PPC970; + init_settings.fputype:=fpu_standard; {$endif POWERPC64} {$ifdef sparc} - initcputype:=cpu_SPARC_V8; - initfputype:=fpu_hard; + init_settings.cputype:=cpu_SPARC_V8; + init_settings.fputype:=fpu_hard; {$endif sparc} {$ifdef arm} - initcputype:=cpu_armv3; - initfputype:=fpu_fpa; + init_settings.cputype:=cpu_armv3; + init_settings.fputype:=fpu_fpa; {$endif arm} {$ifdef x86_64} - initcputype:=cpu_athlon64; - initfputype:=fpu_sse64; + init_settings.cputype:=cpu_athlon64; + init_settings.fputype:=fpu_sse64; {$endif x86_64} - if initoptimizecputype=cpu_none then - initoptimizecputype:=initcputype; + if init_settings.optimizecputype=cpu_none then + init_settings.optimizecputype:=init_settings.cputype; LinkLibraryAliases :=TLinkStrMap.Create; LinkLibraryOrder :=TLinkStrMap.Create; diff --git a/compiler/htypechk.pas b/compiler/htypechk.pas index 3c0ab8a397..25f7a1b2c3 100644 --- a/compiler/htypechk.pas +++ b/compiler/htypechk.pas @@ -230,9 +230,9 @@ implementation arraydef : begin { not vector/mmx } - if ((cs_mmx in aktlocalswitches) and + if ((cs_mmx in current_settings.localswitches) and is_mmx_able_array(ld)) or - ((cs_support_vectors in aktglobalswitches) and + ((cs_support_vectors in current_settings.globalswitches) and is_vector(ld)) then begin allowed:=false; @@ -326,7 +326,7 @@ implementation exit; {$ifdef SUPPORT_MMX} - if (cs_mmx in aktlocalswitches) and + if (cs_mmx in current_settings.localswitches) and is_mmx_able_array(ld) then exit; {$endif SUPPORT_MMX} @@ -340,7 +340,7 @@ implementation exit; {$ifdef SUPPORT_MMX} - if (cs_mmx in aktlocalswitches) and + if (cs_mmx in current_settings.localswitches) and is_mmx_able_array(ld) then exit; {$endif SUPPORT_MMX} @@ -742,8 +742,8 @@ implementation begin result:=false; { remove voidpointer typecast for tp procvars } - if ((m_tp_procvar in aktmodeswitches) or - (m_mac_procvar in aktmodeswitches)) and + if ((m_tp_procvar in current_settings.modeswitches) or + (m_mac_procvar in current_settings.modeswitches)) and (p.nodetype=typeconvn) and is_voidpointer(p.resultdef) then p:=tunarynode(p).left; @@ -1030,7 +1030,7 @@ implementation begin { in TP it is allowed to typecast to smaller types. But the variable can't be in a register } - if (m_tp7 in aktmodeswitches) or + if (m_tp7 in current_settings.modeswitches) or (todef.size<fromdef.size) then make_not_regable(hp,vr_addr) else @@ -1080,7 +1080,7 @@ implementation end; gotvec:=true; { accesses to dyn. arrays override read only access in delphi } - if (m_delphi in aktmodeswitches) and is_dynamic_array(tunarynode(hp).left.resultdef) then + if (m_delphi in current_settings.modeswitches) and is_dynamic_array(tunarynode(hp).left.resultdef) then gotdynarray:=true; hp:=tunarynode(hp).left; end; @@ -1144,7 +1144,7 @@ implementation else { Temp strings are stored in memory, for compatibility with delphi only } - if (m_delphi in aktmodeswitches) and + if (m_delphi in current_settings.modeswitches) and ((valid_addr in opts) or (valid_const in opts)) and (hp.resultdef.deftype=stringdef) then @@ -1209,7 +1209,7 @@ implementation else { Temp strings are stored in memory, for compatibility with delphi only } - if (m_delphi in aktmodeswitches) and + if (m_delphi in current_settings.modeswitches) and (valid_addr in opts) and (hp.resultdef.deftype=stringdef) then result:=true @@ -1375,7 +1375,7 @@ implementation begin { allows conversion from word to integer and byte to shortint, but only for TP7 compatibility } - if (m_tp7 in aktmodeswitches) and + if (m_tp7 in current_settings.modeswitches) and (def_from.deftype=orddef) and (def_from.size=def_to.size) then eq:=te_convert_l1; @@ -1413,7 +1413,7 @@ implementation { if they are objects } if (def_from.deftype=objectdef) and ( - not(m_delphi in aktmodeswitches) or + not(m_delphi in current_settings.modeswitches) or ( (tobjectdef(def_from).objecttype=odt_object) and (tobjectdef(def_to).objecttype=odt_object) @@ -1477,13 +1477,13 @@ implementation procvardef : begin { in tp7 mode proc -> procvar is allowed } - if ((m_tp_procvar in aktmodeswitches) or - (m_mac_procvar in aktmodeswitches)) and + if ((m_tp_procvar in current_settings.modeswitches) or + (m_mac_procvar in current_settings.modeswitches)) and (p.left.nodetype=calln) and (proc_to_procvar_equal(tprocdef(tcallnode(p.left).procdefinition),tprocvardef(def_to))>=te_equal) then eq:=te_equal else - if (m_mac_procvar in aktmodeswitches) and + if (m_mac_procvar in current_settings.modeswitches) and is_procvar_load(p.left) then eq:=te_convert_l2; end; @@ -1494,7 +1494,7 @@ implementation function allowenumop(nt:tnodetype):boolean; begin result:=(nt in [equaln,unequaln,ltn,lten,gtn,gten]) or - ((cs_allow_enum_calc in aktlocalswitches) and + ((cs_allow_enum_calc in current_settings.localswitches) and (nt in [addn,subn])); end; @@ -2319,7 +2319,7 @@ implementation begin if (destdef.size < source.resultdef.size) then begin - if (cs_check_range in aktlocalswitches) then + if (cs_check_range in current_settings.localswitches) then MessagePos(location,type_w_smaller_possible_range_check) else MessagePos(location,type_h_smaller_possible_range_check); diff --git a/compiler/i386/ag386nsm.pas b/compiler/i386/ag386nsm.pas index 7e80f8de96..8664aae56b 100644 --- a/compiler/i386/ag386nsm.pas +++ b/compiler/i386/ag386nsm.pas @@ -398,8 +398,8 @@ interface exit; InlineLevel:=0; { lineinfo is only needed for al_procedures (PFV) } - do_line:=(cs_asm_source in aktglobalswitches) or - ((cs_lineinfo in aktmoduleswitches) + do_line:=(cs_asm_source in current_settings.globalswitches) or + ((cs_lineinfo in current_settings.moduleswitches) and (p=current_asmdata.asmlists[al_procedures])); hp:=tai(p.first); while assigned(hp) do @@ -418,7 +418,7 @@ interface if assigned(infile) then begin { open only if needed !! } - if (cs_asm_source in aktglobalswitches) then + if (cs_asm_source in current_settings.globalswitches) then infile.open; end; { avoid unnecessary reopens of the same file !! } @@ -427,7 +427,7 @@ interface lastfileinfo.line:=-1; end; { write source } - if (cs_asm_source in aktglobalswitches) and + if (cs_asm_source in current_settings.globalswitches) and assigned(infile) then begin if (infile<>lastinfile) then @@ -463,14 +463,14 @@ interface ait_regalloc : begin - if (cs_asm_regalloc in aktglobalswitches) then + if (cs_asm_regalloc in current_settings.globalswitches) then AsmWriteLn(#9#9+target_asm.comment+'Register '+nasm_regname(tai_regalloc(hp).reg)+ regallocstr[tai_regalloc(hp).ratype]); end; ait_tempalloc : begin - if (cs_asm_tempalloc in aktglobalswitches) then + if (cs_asm_tempalloc in current_settings.globalswitches) then begin {$ifdef EXTDEBUG} if assigned(tai_tempalloc(hp).problem) then diff --git a/compiler/i386/aopt386.pas b/compiler/i386/aopt386.pas index e08af42948..0e82343ad2 100644 --- a/compiler/i386/aopt386.pas +++ b/compiler/i386/aopt386.pas @@ -46,7 +46,7 @@ Var pass: longint; slowopt, changed, lastLoop: boolean; Begin - slowopt := (cs_opt_level3 in aktoptimizerswitches); + slowopt := (cs_opt_level3 in current_settings.optimizerswitches); pass := 0; changed := false; dfa := TDFAObj.create(asml); @@ -72,7 +72,7 @@ Begin if pass = 0 then PeepHoleOptPass1(AsmL, BlockStart, BlockEnd); { Data flow analyzer } - If (cs_opt_asmcse in aktoptimizerswitches) Then + If (cs_opt_asmcse in current_settings.optimizerswitches) Then begin if dfa.pass_generate_code then { common subexpression elimination } diff --git a/compiler/i386/cgcpu.pas b/compiler/i386/cgcpu.pas index ff070fca31..63ae956bc4 100644 --- a/compiler/i386/cgcpu.pas +++ b/compiler/i386/cgcpu.pas @@ -81,7 +81,7 @@ unit cgcpu; procedure tcg386.init_register_allocators; begin inherited init_register_allocators; - if cs_create_pic in aktmoduleswitches then + if cs_create_pic in current_settings.moduleswitches then rg[R_INTREGISTER]:=trgcpu.create(R_INTREGISTER,R_SUBWHOLE,[RS_EAX,RS_EDX,RS_ECX,RS_ESI,RS_EDI],first_int_imreg,[RS_EBP]) else rg[R_INTREGISTER]:=trgcpu.create(R_INTREGISTER,R_SUBWHOLE,[RS_EAX,RS_EDX,RS_ECX,RS_EBX,RS_ESI,RS_EDI],first_int_imreg,[RS_EBP]); @@ -246,7 +246,7 @@ unit cgcpu; stacksize : longint; begin { Release PIC register } - if cs_create_pic in aktmoduleswitches then + if cs_create_pic in current_settings.moduleswitches then list.concat(tai_regalloc.dealloc(NR_PIC_OFFSET_REG,nil)); { MMX needs to call EMMS } @@ -581,7 +581,7 @@ unit cgcpu; make_global:=false; if (not current_module.is_unit) or - (cs_create_smart in aktmoduleswitches) or + (cs_create_smart in current_settings.moduleswitches) or (af_smartlink_sections in target_asm.flags) or (procdef.owner.defowner.owner.symtabletype=globalsymtable) then make_global:=true; diff --git a/compiler/i386/cpupi.pas b/compiler/i386/cpupi.pas index f0b9568dd5..74eb08bb5e 100644 --- a/compiler/i386/cpupi.pas +++ b/compiler/i386/cpupi.pas @@ -72,7 +72,7 @@ unit cpupi; { align to 4 bytes at least otherwise all those subl $2,%esp are meaningless PM } if (target_info.system <> system_i386_darwin) then - result:=Align(tg.direction*tg.lasttemp,min(aktalignment.localalignmin,4)) + result:=Align(tg.direction*tg.lasttemp,min(current_settings.alignment.localalignmin,4)) else result:=tg.direction*tg.lasttemp+maxpushedparasize; end; diff --git a/compiler/i386/csopt386.pas b/compiler/i386/csopt386.pas index aca5b6a41e..116cb24aab 100644 --- a/compiler/i386/csopt386.pas +++ b/compiler/i386/csopt386.pas @@ -241,7 +241,7 @@ var hp: tai; begin { only regvars are still used at jump instructions } - if (cs_opt_regvar in aktoptimizerswitches) and + if (cs_opt_regvar in current_settings.optimizerswitches) and (p.typ = ait_instruction) and taicpu(p).is_jmp then regsstillvalid := regsstillvalid - ptaiprop(p.optinfo)^.usedregs; @@ -312,7 +312,7 @@ var getPrevSequence := RS_INVALID; passedFlagsModifyingInstr := passedFlagsModifyingInstr or instrWritesFlags(currentPrev); - if (cs_opt_regvar in aktoptimizerswitches) and + if (cs_opt_regvar in current_settings.optimizerswitches) and (currentprev.typ = ait_instruction) and taicpu(currentprev).is_jmp then regsstillvalid := regsstillvalid - ptaiprop(currentprev.optinfo)^.usedregs; @@ -2072,7 +2072,7 @@ begin end; end; Ch_MOp1: - if not(cs_opt_size in aktoptimizerswitches) and + if not(cs_opt_size in current_settings.optimizerswitches) and (taicpu(p).oper[0]^.typ = top_ref) then begin memreg := @@ -2119,7 +2119,7 @@ begin end; end; Ch_MOp2: - if not(cs_opt_size in aktoptimizerswitches) and + if not(cs_opt_size in current_settings.optimizerswitches) and (taicpu(p).oper[1]^.typ = top_ref) and ((taicpu(p).opcode < A_BT) or ((taicpu(p).opcode > A_IN) and @@ -2243,10 +2243,10 @@ end; function CSE(asml: TAsmList; First, Last: tai; pass: longint): boolean; begin - doCSE(asml, First, Last, not(cs_opt_level3 in aktoptimizerswitches) or (pass >= 2), - not(cs_opt_level3 in aktoptimizerswitches) or (pass >= 1)); + doCSE(asml, First, Last, not(cs_opt_level3 in current_settings.optimizerswitches) or (pass >= 2), + not(cs_opt_level3 in current_settings.optimizerswitches) or (pass >= 1)); { register renaming } - if not(cs_opt_level3 in aktoptimizerswitches) or (pass > 0) then + if not(cs_opt_level3 in current_settings.optimizerswitches) or (pass > 0) then doRenaming(asml, first, last); cse := removeInstructs(asml, first, last); end; diff --git a/compiler/i386/daopt386.pas b/compiler/i386/daopt386.pas index 7e4228a7a0..fcff4a20d7 100644 --- a/compiler/i386/daopt386.pas +++ b/compiler/i386/daopt386.pas @@ -1816,7 +1816,7 @@ begin refsEq := @refsOverlapping; invalsmemwrite := assigned(c.memwrite) and - ((not(cs_opt_size in aktoptimizerswitches) and + ((not(cs_opt_size in current_settings.optimizerswitches) and containsPointerRef(c.memwrite)) or refsEq(c.memwrite.oper[1]^.ref^,ref,topsize2tcgsize[c.memwrite.opsize],size)); if not(c.typ in [con_ref,con_noRemoveRef,con_invalid]) then @@ -1837,7 +1837,7 @@ begin with c do writeToMemDestroysContents := (typ in [con_ref,con_noRemoveRef]) and - ((not(cs_opt_size in aktoptimizerswitches) and + ((not(cs_opt_size in current_settings.optimizerswitches) and containsPointerLoad(c) ) or (refInSequence(ref,c,refsEq,size) and @@ -1861,7 +1861,7 @@ begin begin invalsmemwrite := assigned(c.memwrite) and - (not(cs_opt_size in aktoptimizerswitches) or + (not(cs_opt_size in current_settings.optimizerswitches) or containsPointerRef(c.memwrite)); if not(c.typ in [con_ref,con_noRemoveRef,con_invalid]) then begin @@ -1871,7 +1871,7 @@ begin with c do writeToMemDestroysContents := (typ in [con_ref,con_noRemoveRef]) and - (not(cs_opt_size in aktoptimizerswitches) or + (not(cs_opt_size in current_settings.optimizerswitches) or { for movsl } ((ref.base = NR_EDI) and (ref.index = NR_EDI)) or { don't destroy if reg contains a parameter, local or global variable } diff --git a/compiler/i386/n386add.pas b/compiler/i386/n386add.pas index b3086f9221..e9b6d296ef 100644 --- a/compiler/i386/n386add.pas +++ b/compiler/i386/n386add.pas @@ -166,7 +166,7 @@ interface { is in unsigned VAR!! } if mboverflow then begin - if cs_check_overflow in aktlocalswitches then + if cs_check_overflow in current_settings.localswitches then begin current_asmdata.getjumplabel(hl4); if unsigned then @@ -364,7 +364,7 @@ interface {Also allocate EDX, since it is also modified by a mul (JM).} cg.getcpuregister(current_asmdata.CurrAsmList,NR_EDX); emit_reg(A_MUL,S_L,r); - if cs_check_overflow in aktlocalswitches then + if cs_check_overflow in current_settings.localswitches then begin current_asmdata.getjumplabel(hl4); cg.a_jmp_flags(current_asmdata.CurrAsmList,F_AE,hl4); diff --git a/compiler/i386/n386cal.pas b/compiler/i386/n386cal.pas index e9111522f1..6b15144c14 100644 --- a/compiler/i386/n386cal.pas +++ b/compiler/i386/n386cal.pas @@ -91,8 +91,8 @@ implementation { but the registers must be different! } else if (pop_size=8) and - not(cs_opt_size in aktoptimizerswitches) and - (aktoptimizecputype=cpu_Pentium) then + not(cs_opt_size in current_settings.optimizerswitches) and + (current_settings.optimizecputype=cpu_Pentium) then begin hreg:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT); current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_POP,S_L,hreg)); diff --git a/compiler/i386/n386mat.pas b/compiler/i386/n386mat.pas index 3166ced20e..585c8acc1c 100644 --- a/compiler/i386/n386mat.pas +++ b/compiler/i386/n386mat.pas @@ -106,8 +106,8 @@ implementation "Cardinal($ffffffff) div 16" overflows! (JM) } if is_signed(left.resultdef) Then begin - if (aktoptimizecputype <> cpu_386) and - not(cs_opt_size in aktoptimizerswitches) then + if (current_settings.optimizecputype <> cpu_386) and + not(cs_opt_size in current_settings.optimizerswitches) then { use a sequence without jumps, saw this in comp.compilers (JM) } begin diff --git a/compiler/i386/n386set.pas b/compiler/i386/n386set.pas index a7d2f1cc15..6a581823bb 100644 --- a/compiler/i386/n386set.pas +++ b/compiler/i386/n386set.pas @@ -59,13 +59,13 @@ implementation procedure ti386casenode.optimizevalues(var max_linear_list:aint;var max_dist:aword); begin { a jump table crashes the pipeline! } - if aktoptimizecputype=cpu_386 then + if current_settings.optimizecputype=cpu_386 then inc(max_linear_list,3) - else if aktoptimizecputype=cpu_Pentium then + else if current_settings.optimizecputype=cpu_Pentium then inc(max_linear_list,6) - else if aktoptimizecputype in [cpu_Pentium2,cpu_Pentium3] then + else if current_settings.optimizecputype in [cpu_Pentium2,cpu_Pentium3] then inc(max_linear_list,9) - else if aktoptimizecputype=cpu_Pentium4 then + else if current_settings.optimizecputype=cpu_Pentium4 then inc(max_linear_list,14); end; diff --git a/compiler/i386/popt386.pas b/compiler/i386/popt386.pas index 70bb1bc48e..59447c6012 100644 --- a/compiler/i386/popt386.pas +++ b/compiler/i386/popt386.pas @@ -148,9 +148,9 @@ begin else if ((taicpu(p).ops <= 2) or (taicpu(p).oper[2]^.typ = Top_Reg)) and - (aktoptimizecputype < cpu_Pentium2) and + (current_settings.optimizecputype < cpu_Pentium2) and (taicpu(p).oper[0]^.val <= 12) and - not(cs_opt_size in aktoptimizerswitches) and + not(cs_opt_size in current_settings.optimizerswitches) and (not(GetNextInstruction(p, hp1)) or {GetNextInstruction(p, hp1) and} not((tai(hp1).typ = ait_instruction) and @@ -198,7 +198,7 @@ begin imul 6, reg1 to lea (reg1,reg1,2), reg1 add reg1, reg1} - if (aktoptimizecputype <= cpu_386) then + if (current_settings.optimizecputype <= cpu_386) then begin TmpRef.index := taicpu(p).oper[1]^.reg; if (taicpu(p).ops = 3) then @@ -255,7 +255,7 @@ begin imul 10, reg1 to lea (reg1,reg1,4), reg1 add reg1, reg1} - if (aktoptimizecputype <= cpu_386) then + if (current_settings.optimizecputype <= cpu_386) then begin if (taicpu(p).ops = 3) then hp1 := taicpu.op_reg_reg(A_ADD, S_L, @@ -283,7 +283,7 @@ begin imul 12, reg1 to lea (reg1,reg1,2), reg1 lea (,reg1,4), reg1} - if (aktoptimizecputype <= cpu_386) + if (current_settings.optimizecputype <= cpu_386) then begin TmpRef.index := taicpu(p).oper[1]^.reg; @@ -337,7 +337,7 @@ begin (taicpu(hp1).oper[1]^.typ = taicpu(p).oper[1]^.typ) and OpsEqual(taicpu(hp1).oper[1]^, taicpu(p).oper[1]^) then if (taicpu(p).oper[0]^.val > taicpu(hp1).oper[0]^.val) and - not(cs_opt_size in aktoptimizerswitches) then + not(cs_opt_size in current_settings.optimizerswitches) then { shr/sar const1, %reg shl const2, %reg with const1 > const2 } @@ -352,7 +352,7 @@ begin end; end else if (taicpu(p).oper[0]^.val<taicpu(hp1).oper[0]^.val) and - not(cs_opt_size in aktoptimizerswitches) then + not(cs_opt_size in current_settings.optimizerswitches) then { shr/sar const1, %reg shl const2, %reg with const1 < const2 } @@ -1244,7 +1244,7 @@ begin S_BW: begin if (getsupreg(taicpu(p).oper[0]^.reg)=getsupreg(taicpu(p).oper[1]^.reg)) and - not(cs_opt_size in aktoptimizerswitches) then + not(cs_opt_size in current_settings.optimizerswitches) then {Change "movzbw %al, %ax" to "andw $0x0ffh, %ax"} begin taicpu(p).opcode := A_AND; @@ -1269,7 +1269,7 @@ begin S_BL: begin if (getsupreg(taicpu(p).oper[0]^.reg)=getsupreg(taicpu(p).oper[1]^.reg)) and - not(cs_opt_size in aktoptimizerswitches) then + not(cs_opt_size in current_settings.optimizerswitches) then {Change "movzbl %al, %eax" to "andl $0x0ffh, %eax"} begin taicpu(p).opcode := A_AND; @@ -1294,7 +1294,7 @@ begin S_WL: begin if (getsupreg(taicpu(p).oper[0]^.reg)=getsupreg(taicpu(p).oper[1]^.reg)) and - not(cs_opt_size in aktoptimizerswitches) then + not(cs_opt_size in current_settings.optimizerswitches) then {Change "movzwl %ax, %eax" to "andl $0x0ffffh, %eax"} begin taicpu(p).opcode := A_AND; @@ -1510,9 +1510,9 @@ begin end; end; if TmpBool2 or - ((aktoptimizecputype < cpu_Pentium2) and + ((current_settings.optimizecputype < cpu_Pentium2) and (taicpu(p).oper[0]^.val <= 3) and - not(cs_opt_size in aktoptimizerswitches)) then + not(cs_opt_size in current_settings.optimizerswitches)) then begin if not(TmpBool2) and (taicpu(p).oper[0]^.val = 1) then @@ -1529,7 +1529,7 @@ begin end; end else - if (aktoptimizecputype < cpu_Pentium2) and + if (current_settings.optimizecputype < cpu_Pentium2) and (taicpu(p).oper[0]^.typ = top_const) and (taicpu(p).oper[1]^.typ = top_reg) then if (taicpu(p).oper[0]^.val = 1) then @@ -1699,7 +1699,7 @@ begin case taicpu(p).opcode Of {$ifdef USECMOV} A_Jcc: - if (aktcputype>=cpu_Pentium2) then + if (current_settings.cputype>=cpu_Pentium2) then begin { check for jCC xxx @@ -1931,7 +1931,7 @@ begin begin case taicpu(p).opcode Of A_CALL: - if (aktoptimizecputype < cpu_Pentium2) and + if (current_settings.optimizecputype < cpu_Pentium2) and GetNextInstruction(p, hp1) and (hp1.typ = ait_instruction) and (taicpu(hp1).opcode = A_JMP) and @@ -1974,7 +1974,7 @@ See test/tgadint64 in the test suite. { "cmpl $3,%eax; movzbl 8(%ebp),%ebx; je .Lxxx" } { so we can't safely replace the movzx then with xor/mov, } { since that would change the flags (JM) } - if not(cs_opt_regvar in aktoptimizerswitches) then + if not(cs_opt_regvar in current_settings.optimizerswitches) then begin if (taicpu(p).oper[1]^.typ = top_reg) then if (taicpu(p).oper[0]^.typ = top_reg) @@ -1983,8 +1983,8 @@ See test/tgadint64 in the test suite. S_BL: begin if IsGP32Reg(getsupreg(taicpu(p).oper[1]^.reg)) and - not(cs_opt_size in aktoptimizerswitches) and - (aktoptimizecputype = cpu_Pentium) then + not(cs_opt_size in current_settings.optimizerswitches) and + (current_settings.optimizecputype = cpu_Pentium) then {Change "movzbl %reg1, %reg2" to "xorl %reg2, %reg2; movb %reg1, %reg2" for Pentium and PentiumMMX} @@ -2001,9 +2001,9 @@ See test/tgadint64 in the test suite. else if (taicpu(p).oper[0]^.typ = top_ref) and (taicpu(p).oper[0]^.ref^.base <> taicpu(p).oper[1]^.reg) and (taicpu(p).oper[0]^.ref^.index <> taicpu(p).oper[1]^.reg) and - not(cs_opt_size in aktoptimizerswitches) and + not(cs_opt_size in current_settings.optimizerswitches) and IsGP32Reg(getsupreg(taicpu(p).oper[1]^.reg)) and - (aktoptimizecputype = cpu_Pentium) and + (current_settings.optimizecputype = cpu_Pentium) and (taicpu(p).opsize = S_BL) then {changes "movzbl mem, %reg" to "xorl %reg, %reg; movb mem, %reg8" for Pentium and PentiumMMX} diff --git a/compiler/link.pas b/compiler/link.pas index 76b1205003..aeb5ea8892 100644 --- a/compiler/link.pas +++ b/compiler/link.pas @@ -154,7 +154,7 @@ Implementation so there is no object files to look for at the host. Look for the corresponding assembler file instead, because it will be assembled to object file on the target.} - if isunit and (cs_link_on_target in aktglobalswitches) then + if isunit and (cs_link_on_target in current_settings.globalswitches) then s:= ForceExtension(s,target_info.asmext); { when it does not belong to the unit then check if @@ -194,13 +194,13 @@ Implementation found:=current_module.localobjectsearchpath.FindFile(s,foundfile); if (not found) then found:=objectsearchpath.FindFile(s,foundfile); - if not(cs_link_on_target in aktglobalswitches) and (not found) then + if not(cs_link_on_target in current_settings.globalswitches) and (not found) then found:=FindFile(s,exepath,foundfile); - if not(cs_link_nolink in aktglobalswitches) and (not found) then + if not(cs_link_nolink in current_settings.globalswitches) and (not found) then Message1(exec_w_objfile_not_found,s); {Restore file extension} - if isunit and (cs_link_on_target in aktglobalswitches) then + if isunit and (cs_link_on_target in current_settings.globalswitches) then foundfile:= ForceExtension(foundfile,target_info.objext); findobjectfile:=ScriptFixFileName(foundfile); @@ -278,7 +278,7 @@ Implementation found:=current_module.locallibrarysearchpath.FindFile(s,foundfile); if (not found) then found:=librarysearchpath.FindFile(s,foundfile); - if not(cs_link_on_target in aktglobalswitches) and (not found) then + if not(cs_link_on_target in current_settings.globalswitches) and (not found) then found:=FindFile(s,exepath,foundfile); foundfile:=ScriptFixFileName(foundfile); findlibraryfile:=found; @@ -325,7 +325,7 @@ Implementation { create mask which unit files need linking } mask:=link_always; { static linking ? } - if (cs_link_static in aktglobalswitches) then + if (cs_link_static in current_settings.globalswitches) then begin if (flags and uf_static_linked)=0 then begin @@ -342,7 +342,7 @@ Implementation mask:=mask or link_static; end; { smart linking ? } - if (cs_link_smart in aktglobalswitches) then + if (cs_link_smart in current_settings.globalswitches) then begin if (flags and uf_smart_linked)=0 then begin @@ -359,7 +359,7 @@ Implementation mask:=mask or link_smart; end; { shared linking } - if (cs_link_shared in aktglobalswitches) then + if (cs_link_shared in current_settings.globalswitches) then begin if (flags and uf_shared_linked)=0 then begin @@ -439,7 +439,7 @@ Implementation if s='' then exit; found:=FindLibraryFile(s,target_info.staticlibprefix,target_info.staticlibext,ns); - if not(cs_link_nolink in aktglobalswitches) and (not found) then + if not(cs_link_nolink in current_settings.globalswitches) and (not found) then Message1(exec_w_libfile_not_found,s); StaticLibFiles.Concat(ns); end; @@ -468,7 +468,7 @@ Implementation if s='' then exit; found:=FindLibraryFile(s,target_info.staticclibprefix,target_info.staticclibext,ns); - if not(cs_link_nolink in aktglobalswitches) and (not found) then + if not(cs_link_nolink in current_settings.globalswitches) and (not found) then Message1(exec_w_libfile_not_found,s); StaticLibFiles.Concat(ns); end; @@ -548,7 +548,7 @@ Implementation inherited Create; { set generic defaults } FillChar(Info,sizeof(Info),0); - if cs_link_on_target in aktglobalswitches then + if cs_link_on_target in current_settings.globalswitches then begin Info.ResName:=outputexedir+inputfile+'_link.res'; Info.ScriptName:=outputexedir+inputfile+'_script.res'; @@ -588,7 +588,7 @@ Implementation FoundBin : string; UtilExe : string; begin - if cs_link_on_target in aktglobalswitches then + if cs_link_on_target in current_settings.globalswitches then begin { If linking on target, don't add any path PM } FindUtil:=AddExtension(s,target_info.exeext); @@ -601,10 +601,10 @@ Implementation Found:=FindFile(utilexe,utilsdirectory,Foundbin); if (not Found) then Found:=FindExe(utilexe,Foundbin); - if (not Found) and not(cs_link_nolink in aktglobalswitches) then + if (not Found) and not(cs_link_nolink in current_settings.globalswitches) then begin Message1(exec_e_util_not_found,utilexe); - aktglobalswitches:=aktglobalswitches+[cs_link_nolink]; + current_settings.globalswitches:=current_settings.globalswitches+[cs_link_nolink]; end; if (FoundBin<>'') then Message1(exec_t_using_util,FoundBin); @@ -617,7 +617,7 @@ Implementation exitcode: longint; begin DoExec:=true; - if not(cs_link_nolink in aktglobalswitches) then + if not(cs_link_nolink in current_settings.globalswitches) then begin FlushOutput; if useshell then @@ -628,13 +628,13 @@ Implementation if ExecuteProcess(command,para) <> 0 then begin Message(exec_e_error_while_linking); - aktglobalswitches:=aktglobalswitches+[cs_link_nolink]; + current_settings.globalswitches:=current_settings.globalswitches+[cs_link_nolink]; DoExec:=false; end; except on E:EOSError do begin Message(exec_e_cant_call_linker); - aktglobalswitches:=aktglobalswitches+[cs_link_nolink]; + current_settings.globalswitches:=current_settings.globalswitches+[cs_link_nolink]; DoExec:=false; end; end @@ -649,20 +649,20 @@ Implementation if (doserror<>0) then begin Message(exec_e_cant_call_linker); - aktglobalswitches:=aktglobalswitches+[cs_link_nolink]; + current_settings.globalswitches:=current_settings.globalswitches+[cs_link_nolink]; DoExec:=false; end else if (exitcode<>0) then begin Message(exec_e_error_while_linking); - aktglobalswitches:=aktglobalswitches+[cs_link_nolink]; + current_settings.globalswitches:=current_settings.globalswitches+[cs_link_nolink]; DoExec:=false; end; end; {$ENDIF USE_SYSUTILS} { Update asmres when externmode is set } - if cs_link_nolink in aktglobalswitches then + if cs_link_nolink in current_settings.globalswitches then begin if showinfo then begin @@ -750,8 +750,8 @@ Implementation end; { Clean up } - if not(cs_asm_leave in aktglobalswitches) then - if not(cs_link_nolink in aktglobalswitches) then + if not(cs_asm_leave in current_settings.globalswitches) then + if not(cs_link_nolink in current_settings.globalswitches) then begin while not SmartLinkOFiles.Empty do RemoveFile(SmartLinkOFiles.GetFirst); @@ -982,7 +982,7 @@ Implementation exeoutput:=CExeOutput.Create; - if (cs_link_map in aktglobalswitches) then + if (cs_link_map in current_settings.globalswitches) then exemap:=texemap.create(current_module.mapfilename^); PrintLinkerScript; @@ -1063,7 +1063,7 @@ Implementation var lk : TlinkerClass; begin - if (cs_link_extern in aktglobalswitches) and + if (cs_link_extern in current_settings.globalswitches) and assigned(target_info.linkextern) then begin lk:=TlinkerClass(target_info.linkextern); diff --git a/compiler/m68k/cgcpu.pas b/compiler/m68k/cgcpu.pas index b3f24804b0..9c4d4fda72 100644 --- a/compiler/m68k/cgcpu.pas +++ b/compiler/m68k/cgcpu.pas @@ -212,7 +212,7 @@ unit cgcpu; addressing capabilities with a 32-bit displacement. } - if (aktcputype<>cpu_MC68000) then + if (current_settings.cputype<>cpu_MC68000) then exit; if (ref.base<>NR_NO) then begin @@ -333,7 +333,7 @@ unit cgcpu; procedure tcg68k.a_loadfpu_reg_reg(list: TAsmList; size: tcgsize; reg1, reg2: tregister); begin { in emulation mode, only 32-bit single is supported } - if cs_fp_emulation in aktmoduleswitches then + if cs_fp_emulation in current_settings.moduleswitches then list.concat(taicpu.op_reg_reg(A_MOVE,S_L,reg1,reg2)) else list.concat(taicpu.op_reg_reg(A_FMOVE,S_FD,reg1,reg2)); @@ -352,7 +352,7 @@ unit cgcpu; href := ref; fixref(list,href); { in emulation mode, only 32-bit single is supported } - if cs_fp_emulation in aktmoduleswitches then + if cs_fp_emulation in current_settings.moduleswitches then list.concat(taicpu.op_ref_reg(A_MOVE,S_L,href,reg)) else list.concat(taicpu.op_ref_reg(A_FMOVE,opsize,href,reg)); @@ -367,7 +367,7 @@ unit cgcpu; if opsize = S_FX then internalerror(20020729); { in emulation mode, only 32-bit single is supported } - if cs_fp_emulation in aktmoduleswitches then + if cs_fp_emulation in current_settings.moduleswitches then list.concat(taicpu.op_reg_ref(A_MOVE,S_L,reg, ref)) else list.concat(taicpu.op_reg_ref(A_FMOVE,opsize,reg, ref)); @@ -442,7 +442,7 @@ unit cgcpu; end; OP_IMUL : begin - if aktcputype = cpu_MC68000 then + if current_settings.cputype = cpu_MC68000 then begin r:=NR_D0; r2:=NR_D1; @@ -471,7 +471,7 @@ unit cgcpu; end; OP_MUL : begin - if aktcputype = cpu_MC68000 then + if current_settings.cputype = cpu_MC68000 then begin r:=NR_D0; r2:=NR_D1; @@ -558,7 +558,7 @@ unit cgcpu; case op of OP_ADD : begin - if aktcputype = cpu_ColdFire then + if current_settings.cputype = cpu_ColdFire then begin { operation only allowed only a longword } sign_extend(list, size, reg1); @@ -591,7 +591,7 @@ unit cgcpu; else hreg2 := reg2; - if aktcputype = cpu_ColdFire then + if current_settings.cputype = cpu_ColdFire then begin { operation only allowed only a longword } {!*************************************** @@ -628,7 +628,7 @@ unit cgcpu; begin sign_extend(list, size,reg1); sign_extend(list, size,reg2); - if aktcputype = cpu_MC68000 then + if current_settings.cputype = cpu_MC68000 then begin r:=NR_D0; r2:=NR_D1; @@ -671,7 +671,7 @@ unit cgcpu; begin sign_extend(list, size,reg1); sign_extend(list, size,reg2); - if aktcputype = cpu_MC68000 then + if current_settings.cputype = cpu_MC68000 then begin r:=NR_D0; r2:=NR_D1; @@ -730,7 +730,7 @@ unit cgcpu; hreg2 := reg2; { coldfire only supports long version } - if aktcputype = cpu_ColdFire then + if current_settings.cputype = cpu_ColdFire then begin sign_extend(list, size,hreg2); list.concat(taicpu.op_reg(topcg2tasmop[op],S_L,hreg2)); @@ -764,7 +764,7 @@ unit cgcpu; end else begin - if (aktcputype = cpu_ColdFire) then + if (current_settings.cputype = cpu_ColdFire) then begin { only longword comparison is supported, @@ -826,7 +826,7 @@ unit cgcpu; ai.SetCondition(flags_to_cond(f)); list.concat(ai); - if (aktcputype = cpu_ColdFire) then + if (current_settings.cputype = cpu_ColdFire) then begin { neg.b does not exist on the Coldfire so we need to sign extend the value @@ -848,7 +848,7 @@ unit cgcpu; ai.SetCondition(flags_to_cond(f)); list.concat(ai); - if (aktcputype = cpu_ColdFire) then + if (current_settings.cputype = cpu_ColdFire) then begin { neg.b does not exist on the Coldfire so we need to sign extend the value @@ -897,7 +897,7 @@ unit cgcpu; // reference_release(list,source); { from 12 bytes movs is being used } - if {(not loadref) and} ((len<=8) or (not(cs_opt_size in aktoptimizerswitches) and (len<=12))) then + if {(not loadref) and} ((len<=8) or (not(cs_opt_size in current_settings.optimizerswitches) and (len<=12))) then begin srcref := source; dstref := dest; @@ -951,7 +951,7 @@ unit cgcpu; { double word move only on 68020+ machines } { because of possible alignment problems } { use fast loop mode } - if (aktcputype=cpu_MC68020) then + if (current_settings.cputype=cpu_MC68020) then begin helpsize := len - len mod 4; len := len mod 4; @@ -1067,7 +1067,7 @@ unit cgcpu; { return with immediate size possible here signed! RTD is not supported on the coldfire } - if (aktcputype=cpu_MC68020) and (parasize<$7FFF) then + if (current_settings.cputype=cpu_MC68020) and (parasize<$7FFF) then list.concat(taicpu.op_const(A_RTD,S_NO,parasize)) { manually restore the stack } else @@ -1151,7 +1151,7 @@ unit cgcpu; begin if (isaddressregister(reg)) then internalerror(20020729); - if (aktcputype = cpu_MC68000) then + if (current_settings.cputype = cpu_MC68000) then begin list.concat(taicpu.op_reg(A_EXT,S_W,reg)); list.concat(taicpu.op_reg(A_EXT,S_L,reg)); @@ -1241,7 +1241,7 @@ unit cgcpu; make_global:=false; if (not current_module.is_unit) or - (cs_create_smart in aktmoduleswitches) or + (cs_create_smart in current_settings.moduleswitches) or (procdef.owner.defowner.owner.symtabletype=globalsymtable) then make_global:=true; diff --git a/compiler/m68k/n68kadd.pas b/compiler/m68k/n68kadd.pas index 1a8b88f5dc..349ef11fb8 100644 --- a/compiler/m68k/n68kadd.pas +++ b/compiler/m68k/n68kadd.pas @@ -368,7 +368,7 @@ implementation else cgsize:=OS_32; - if (cs_full_boolean_eval in aktlocalswitches) or + if (cs_full_boolean_eval in current_settings.localswitches) or (nodetype in [unequaln,ltn,lten,gtn,gten,equaln,xorn]) then begin if left.nodetype in [ordconstn,realconstn] then diff --git a/compiler/m68k/n68kcnv.pas b/compiler/m68k/n68kcnv.pas index ab3b05fd09..ce2c06a262 100644 --- a/compiler/m68k/n68kcnv.pas +++ b/compiler/m68k/n68kcnv.pas @@ -61,7 +61,7 @@ implementation { In case we are in emulation mode, we must always call the helpers } - if (cs_fp_emulation in aktmoduleswitches) then + if (cs_fp_emulation in current_settings.moduleswitches) then begin result := inherited first_int_to_real; exit; diff --git a/compiler/m68k/n68kmat.pas b/compiler/m68k/n68kmat.pas index cd42d8b133..1576a705d3 100644 --- a/compiler/m68k/n68kmat.pas +++ b/compiler/m68k/n68kmat.pas @@ -145,7 +145,7 @@ implementation paraloc1 : tcgpara; begin { no RTL call, so inline a zero denominator verification } - if aktcputype <> cpu_MC68000 then + if current_settings.cputype <> cpu_MC68000 then begin { verify if denominator is zero } current_asmdata.getjumplabel(continuelabel); @@ -193,7 +193,7 @@ implementation begin // writeln('emit mod reg reg'); { no RTL call, so inline a zero denominator verification } - if aktcputype <> cpu_MC68000 then + if current_settings.cputype <> cpu_MC68000 then begin { verify if denominator is zero } current_asmdata.getjumplabel(continuelabel); diff --git a/compiler/m68k/ra68kmot.pas b/compiler/m68k/ra68kmot.pas index e0e79b2e8b..2b4ddcbfb7 100644 --- a/compiler/m68k/ra68kmot.pas +++ b/compiler/m68k/ra68kmot.pas @@ -1555,7 +1555,7 @@ const { DIVSL/DIVS/MULS/MULU with long for MC68020 only } if (actasmtoken = AS_COLON) then begin - if (aktcputype = cpu_MC68020) or (cs_compilesystem in aktmoduleswitches) then + if (current_settings.cputype = cpu_MC68020) or (cs_compilesystem in current_settings.moduleswitches) then begin Consume(AS_COLON); if (actasmtoken = AS_REGISTER) then diff --git a/compiler/nadd.pas b/compiler/nadd.pas index 7d8ae39ed6..ce56bfb4c9 100644 --- a/compiler/nadd.pas +++ b/compiler/nadd.pas @@ -208,8 +208,8 @@ implementation ((rt = realconstn) and (trealconstnode(right).value_real = 0.0))) then begin - if (cs_check_range in aktlocalswitches) or - (cs_check_overflow in aktlocalswitches) then + if (cs_check_range in current_settings.localswitches) or + (cs_check_overflow in current_settings.localswitches) then begin result:=crealconstnode.create(1,pbestrealtype^); Message(parser_e_division_by_zero); @@ -250,7 +250,7 @@ implementation { of the same type (JM) } if (lt = pointerconstn) and (rt = pointerconstn) then begin - if not(cs_extsyntax in aktmoduleswitches) and + if not(cs_extsyntax in current_settings.moduleswitches) and not(nodetype in [equaln,unequaln]) then CGMessage3(type_e_operator_not_supported_for_types,node2opstr(nodetype),ld.typename,rd.typename) else @@ -729,7 +729,7 @@ implementation { Kylix allows enum+ordconstn in an enum declaration (blocktype is bt_type), we need to do the conversion here before the constant folding } - if (m_delphi in aktmodeswitches) and + if (m_delphi in current_settings.modeswitches) and (blocktype=bt_type) then begin if (left.resultdef.deftype=enumdef) and @@ -790,7 +790,7 @@ implementation else if (ld.deftype=orddef) and (rd.deftype=orddef) then begin { optimize multiplacation by a power of 2 } - if not(cs_check_overflow in aktlocalswitches) and + if not(cs_check_overflow in current_settings.localswitches) and (nodetype = muln) and (((left.nodetype = ordconstn) and ispowerof2(tordconstnode(left).value,i)) or @@ -857,7 +857,7 @@ implementation unequaln, equaln: begin - if not(cs_full_boolean_eval in aktlocalswitches) or + if not(cs_full_boolean_eval in current_settings.localswitches) or (nf_short_bool in flags) then begin { Remove any compares with constants } @@ -1166,7 +1166,7 @@ implementation end; ltn,lten,gtn,gten: begin - if (cs_extsyntax in aktmoduleswitches) then + if (cs_extsyntax in current_settings.moduleswitches) then begin if is_voidpointer(right.resultdef) then inserttypeconv(right,left.resultdef) @@ -1180,7 +1180,7 @@ implementation end; subn: begin - if (cs_extsyntax in aktmoduleswitches) then + if (cs_extsyntax in current_settings.moduleswitches) then begin if is_voidpointer(right.resultdef) then begin @@ -1232,7 +1232,7 @@ implementation strtype:= st_widestring else if is_ansistring(rd) or is_ansistring(ld) or - ((cs_ansistrings in aktlocalswitches) and + ((cs_ansistrings in current_settings.localswitches) and //todo: Move some of this to longstring's then they are implemented? ( is_pchar(rd) or (is_chararray(rd) and (rd.size > 255)) or is_open_chararray(rd) or @@ -1385,7 +1385,7 @@ implementation {$ifdef SUPPORT_MMX} { mmx support, this must be before the zero based array check } - else if (cs_mmx in aktlocalswitches) and + else if (cs_mmx in current_settings.localswitches) and is_mmx_able_array(ld) and is_mmx_able_array(rd) and equal_defs(ld,rd) then @@ -1404,7 +1404,7 @@ implementation {$endif SUPPORT_MMX} { vector support, this must be before the zero based array check } - else if (cs_support_vectors in aktglobalswitches) and + else if (cs_support_vectors in current_settings.globalswitches) and is_vector(ld) and is_vector(rd) and equal_defs(ld,rd) then @@ -1430,8 +1430,8 @@ implementation inserttypeconv(left,sinttype); if nodetype=addn then begin - if not(cs_extsyntax in aktmoduleswitches) or - (not(is_pchar(ld)) and not(m_add_pointer in aktmodeswitches)) then + if not(cs_extsyntax in current_settings.moduleswitches) or + (not(is_pchar(ld)) and not(m_add_pointer in current_settings.modeswitches)) then CGMessage3(type_e_operator_not_supported_for_types,node2opstr(nodetype),ld.typename,rd.typename); if (rd.deftype=pointerdef) and (tpointerdef(rd).pointeddef.size>1) then @@ -1459,8 +1459,8 @@ implementation inserttypeconv(right,sinttype); if nodetype in [addn,subn] then begin - if not(cs_extsyntax in aktmoduleswitches) or - (not(is_pchar(ld)) and not(m_add_pointer in aktmodeswitches)) then + if not(cs_extsyntax in current_settings.moduleswitches) or + (not(is_pchar(ld)) and not(m_add_pointer in current_settings.modeswitches)) then CGMessage3(type_e_operator_not_supported_for_types,node2opstr(nodetype),ld.typename,rd.typename); if (ld.deftype=pointerdef) then begin @@ -2062,7 +2062,7 @@ implementation end; { can we use a shift instead of a mul? } - if not (cs_check_overflow in aktlocalswitches) and + if not (cs_check_overflow in current_settings.localswitches) and (right.nodetype = ordconstn) and ispowerof2(tordconstnode(right).value,power) then begin @@ -2089,7 +2089,7 @@ implementation { otherwise, create the parameters for the helper } right := ccallparanode.create( - cordconstnode.create(ord(cs_check_overflow in aktlocalswitches),booltype,true), + cordconstnode.create(ord(cs_check_overflow in current_settings.localswitches),booltype,true), ccallparanode.create(right,ccallparanode.create(left,nil))); left := nil; { only qword needs the unsigned code, the @@ -2115,7 +2115,7 @@ implementation { In non-emulation mode, real opcodes are emitted for floating point values. } - if not (cs_fp_emulation in aktmoduleswitches) then + if not (cs_fp_emulation in current_settings.moduleswitches) then exit; if not(target_info.system in system_wince) then @@ -2269,7 +2269,7 @@ implementation if nodetype=slashn then begin {$ifdef cpufpemu} - if (aktfputype=fpu_soft) or (cs_fp_emulation in aktmoduleswitches) then + if (current_settings.fputype=fpu_soft) or (cs_fp_emulation in current_settings.moduleswitches) then begin result:=first_addfloat; if assigned(result) then @@ -2302,7 +2302,7 @@ implementation { 2 booleans ? } if is_boolean(ld) and is_boolean(rd) then begin - if (not(cs_full_boolean_eval in aktlocalswitches) or + if (not(cs_full_boolean_eval in current_settings.localswitches) or (nf_short_bool in flags)) and (nodetype in [andn,orn]) then begin @@ -2392,7 +2392,7 @@ implementation else {$ifdef MMXSET} {$ifdef i386} - if cs_mmx in aktlocalswitches then + if cs_mmx in current_settings.localswitches then begin expectloc:=LOC_MMXREGISTER; calcregisters(self,0,0,4); @@ -2478,7 +2478,7 @@ implementation else if (rd.deftype=floatdef) or (ld.deftype=floatdef) then begin {$ifdef cpufpemu} - if (aktfputype=fpu_soft) or (cs_fp_emulation in aktmoduleswitches) then + if (current_settings.fputype=fpu_soft) or (cs_fp_emulation in current_settings.moduleswitches) then begin result:=first_addfloat; if assigned(result) then @@ -2534,7 +2534,7 @@ implementation {$ifdef SUPPORT_MMX} { mmx support, this must be before the zero based array check } - else if (cs_mmx in aktlocalswitches) and is_mmx_able_array(ld) and + else if (cs_mmx in current_settings.localswitches) and is_mmx_able_array(ld) and is_mmx_able_array(rd) then begin expectloc:=LOC_MMXREGISTER; @@ -2563,7 +2563,7 @@ implementation end {$ifdef SUPPORT_MMX} - else if (cs_mmx in aktlocalswitches) and + else if (cs_mmx in current_settings.localswitches) and is_mmx_able_array(ld) and is_mmx_able_array(rd) then begin diff --git a/compiler/nbas.pas b/compiler/nbas.pas index 324b5cde9d..47e800825a 100644 --- a/compiler/nbas.pas +++ b/compiler/nbas.pas @@ -308,7 +308,7 @@ implementation { left is the statement itself calln assignn or a complex one } typecheckpass(left); - if (not (cs_extsyntax in aktmoduleswitches)) and + if (not (cs_extsyntax in current_settings.moduleswitches)) and assigned(left.resultdef) and not((left.nodetype=calln) and { don't complain when funcretrefnode is set, because then the @@ -396,7 +396,7 @@ implementation codegenerror:=false; typecheckpass(hp.left); if not(codegenerror) and - not(cs_extsyntax in aktmoduleswitches) and + not(cs_extsyntax in current_settings.moduleswitches) and (hp.left.nodetype=calln) and not(is_void(hp.left.resultdef)) and not(cnf_return_value_used in tcallnode(hp.left).callnodeflags) and diff --git a/compiler/ncal.pas b/compiler/ncal.pas index b4ab1a1114..37bdcc4f79 100644 --- a/compiler/ncal.pas +++ b/compiler/ncal.pas @@ -580,7 +580,7 @@ type { Remove implicitly inserted typecast to pointer for @procvar in macpas } - if (m_mac_procvar in aktmodeswitches) and + if (m_mac_procvar in current_settings.modeswitches) and (parasym.vardef.deftype=procvardef) and (left.nodetype=typeconvn) and is_voidpointer(left.resultdef) and @@ -673,7 +673,7 @@ type end; { check var strings } - if (cs_strict_var_strings in aktlocalswitches) and + if (cs_strict_var_strings in current_settings.localswitches) and is_shortstring(left.resultdef) and is_shortstring(parasym.vardef) and (parasym.varspez in [vs_out,vs_var]) and @@ -688,8 +688,8 @@ type if (parasym.vardef.deftype=formaldef) then begin { load procvar if a procedure is passed } - if ((m_tp_procvar in aktmodeswitches) or - (m_mac_procvar in aktmodeswitches)) and + if ((m_tp_procvar in current_settings.modeswitches) or + (m_mac_procvar in current_settings.modeswitches)) and (left.nodetype=calln) and (is_void(left.resultdef)) then load_procvar_from_calln(left); @@ -854,7 +854,7 @@ type begin srsym := tsym(systemunit.search(name)); if not assigned(srsym) and - (cs_compilesystem in aktmoduleswitches) then + (cs_compilesystem in current_settings.moduleswitches) then srsym := tsym(systemunit.search(upper(name))); if not assigned(srsym) or (srsym.typ<>procsym) then @@ -1654,7 +1654,7 @@ type begin candidates:=tcallcandidates.create(symtableprocentry,symtableproc,left,(nf_isproperty in flags), { ignore possible private in delphi mode for anon. inherited (FK) } - (m_delphi in aktmodeswitches) and (cnf_anon_inherited in callnodeflags)); + (m_delphi in current_settings.modeswitches) and (cnf_anon_inherited in callnodeflags)); { no procedures found? then there is something wrong with the parameter size or the procedures are @@ -1668,7 +1668,7 @@ type this inherited by inserting a nothingn. Only do this ugly hack in Delphi mode as it looks more like a bug. It's also not documented } - if (m_delphi in aktmodeswitches) and + if (m_delphi in current_settings.modeswitches) and (cnf_anon_inherited in callnodeflags) and (symtableprocentry.owner.symtabletype=objectsymtable) and (po_overload in symtableprocentry.first_procdef.procoptions) and @@ -1680,8 +1680,8 @@ type there are no parameters specified } if not(assigned(left)) and not(cnf_inherited in callnodeflags) and - ((m_tp_procvar in aktmodeswitches) or - (m_mac_procvar in aktmodeswitches)) and + ((m_tp_procvar in current_settings.modeswitches) or + (m_mac_procvar in current_settings.modeswitches)) and (not assigned(methodpointer) or (methodpointer.nodetype <> typen)) then begin @@ -2453,7 +2453,7 @@ type begin tcallparanode(left).det_registers; - if cs_opt_level1 in aktoptimizerswitches then + if cs_opt_level1 in current_settings.optimizerswitches then begin { check for stacked parameters } check_stack_parameters; @@ -2528,7 +2528,7 @@ type begin expectloc:=LOC_FPUREGISTER; {$ifdef cpufpemu} - if (cs_fp_emulation in aktmoduleswitches) then + if (cs_fp_emulation in current_settings.moduleswitches) then registersint:=1 else {$endif cpufpemu} diff --git a/compiler/ncgadd.pas b/compiler/ncgadd.pas index cd4bd809f0..234f42e832 100644 --- a/compiler/ncgadd.pas +++ b/compiler/ncgadd.pas @@ -381,7 +381,7 @@ interface { And,Or will only evaluate from left to right only the needed nodes unless full boolean evaluation is enabled } if (nodetype in [orn,andn]) and - (not(cs_full_boolean_eval in aktlocalswitches) or + (not(cs_full_boolean_eval in current_settings.localswitches) or (nf_short_bool in flags)) then begin location_reset(location,LOC_JUMP,OS_NO); @@ -520,12 +520,12 @@ interface // reg64 - reg64 cg.a_op_reg_reg_reg_checkoverflow(current_asmdata.CurrAsmList,OP_SUB,location.size, right.location.register,left.location.register,location.register, - checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc) + checkoverflow and (cs_check_overflow in current_settings.localswitches),ovloc) else // reg64 - const64 cg.a_op_const_reg_reg_checkoverflow(current_asmdata.CurrAsmList,OP_SUB,location.size, right.location.value,left.location.register,location.register, - checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc); + checkoverflow and (cs_check_overflow in current_settings.localswitches),ovloc); end else begin @@ -533,7 +533,7 @@ interface location_force_reg(current_asmdata.CurrAsmList,left.location,left.location.size,true); cg.a_op_reg_reg_reg_checkoverflow(current_asmdata.CurrAsmList,OP_SUB,location.size, right.location.register,left.location.register,location.register, - checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc); + checkoverflow and (cs_check_overflow in current_settings.localswitches),ovloc); end; end; else @@ -546,11 +546,11 @@ interface if (right.location.loc = LOC_CONSTANT) then cg64.a_op64_const_reg_reg_checkoverflow(current_asmdata.CurrAsmList,op,location.size,right.location.value64, left.location.register64,location.register64, - checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc) + checkoverflow and (cs_check_overflow in current_settings.localswitches),ovloc) else cg64.a_op64_reg_reg_reg_checkoverflow(current_asmdata.CurrAsmList,op,location.size,right.location.register64, left.location.register64,location.register64, - checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc); + checkoverflow and (cs_check_overflow in current_settings.localswitches),ovloc); end; subn: begin @@ -564,13 +564,13 @@ interface cg64.a_op64_reg_reg_reg_checkoverflow(current_asmdata.CurrAsmList,OP_SUB,location.size, right.location.register64,left.location.register64, location.register64, - checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc) + checkoverflow and (cs_check_overflow in current_settings.localswitches),ovloc) else // reg64 - const64 cg64.a_op64_const_reg_reg_checkoverflow(current_asmdata.CurrAsmList,OP_SUB,location.size, right.location.value64,left.location.register64, location.register64, - checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc) + checkoverflow and (cs_check_overflow in current_settings.localswitches),ovloc) end else begin @@ -579,7 +579,7 @@ interface cg64.a_op64_reg_reg_reg_checkoverflow(current_asmdata.CurrAsmList,OP_SUB,location.size, right.location.register64,left.location.register64, location.register64, - checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc); + checkoverflow and (cs_check_overflow in current_settings.localswitches),ovloc); end; end; else @@ -689,11 +689,11 @@ interface if (right.location.loc<>LOC_CONSTANT) then cg.a_op_reg_reg_reg_checkoverflow(current_asmdata.CurrAsmList,cgop,location.size, left.location.register,right.location.register, - location.register,checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc) + location.register,checkoverflow and (cs_check_overflow in current_settings.localswitches),ovloc) else cg.a_op_const_reg_reg_checkoverflow(current_asmdata.CurrAsmList,cgop,location.size, right.location.value,left.location.register, - location.register,checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc); + location.register,checkoverflow and (cs_check_overflow in current_settings.localswitches),ovloc); end else { subtract is a special case since its not commutative } begin @@ -704,11 +704,11 @@ interface if right.location.loc<>LOC_CONSTANT then cg.a_op_reg_reg_reg_checkoverflow(current_asmdata.CurrAsmList,OP_SUB,location.size, right.location.register,left.location.register, - location.register,checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc) + location.register,checkoverflow and (cs_check_overflow in current_settings.localswitches),ovloc) else cg.a_op_const_reg_reg_checkoverflow(current_asmdata.CurrAsmList,OP_SUB,location.size, aword(right.location.value),left.location.register, - location.register,checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc); + location.register,checkoverflow and (cs_check_overflow in current_settings.localswitches),ovloc); end else begin @@ -716,7 +716,7 @@ interface cg.a_load_const_reg(current_asmdata.CurrAsmList,location.size, left.location.value,tmpreg); cg.a_op_reg_reg_reg_checkoverflow(current_asmdata.CurrAsmList,OP_SUB,location.size, - right.location.register,tmpreg,location.register,checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc); + right.location.register,tmpreg,location.register,checkoverflow and (cs_check_overflow in current_settings.localswitches),ovloc); end; end; @@ -763,7 +763,7 @@ interface begin {$ifdef SUPPORT_MMX} {$ifdef i386} - if cs_mmx in aktlocalswitches then + if cs_mmx in current_settings.localswitches then second_opmmxset else {$endif} @@ -779,7 +779,7 @@ interface if is_dynamic_array(left.resultdef) then second_opordinal else - if (cs_support_vectors in aktglobalswitches) and + if (cs_support_vectors in current_settings.globalswitches) and is_vector(left.resultdef) then second_opvector {$ifdef SUPPORT_MMX} diff --git a/compiler/ncgbas.pas b/compiler/ncgbas.pas index a35d3a7a72..635dd9cece 100644 --- a/compiler/ncgbas.pas +++ b/compiler/ncgbas.pas @@ -493,7 +493,7 @@ interface LOC_CREGISTER, LOC_REGISTER: begin - if not(cs_opt_regvar in aktoptimizerswitches) or + if not(cs_opt_regvar in current_settings.optimizerswitches) or (pi_has_goto in current_procinfo.flags) then begin { make sure the register allocator doesn't reuse the } @@ -516,7 +516,7 @@ interface LOC_CFPUREGISTER, LOC_FPUREGISTER: begin - if not(cs_opt_regvar in aktoptimizerswitches) or + if not(cs_opt_regvar in current_settings.optimizerswitches) or (pi_has_goto in current_procinfo.flags) then begin { make sure the register allocator doesn't reuse the } @@ -531,7 +531,7 @@ interface LOC_CMMREGISTER, LOC_MMREGISTER: begin - if not(cs_opt_regvar in aktoptimizerswitches) or + if not(cs_opt_regvar in current_settings.optimizerswitches) or (pi_has_goto in current_procinfo.flags) then begin { make sure the register allocator doesn't reuse the } diff --git a/compiler/ncgcal.pas b/compiler/ncgcal.pas index af169e3c95..4c5d1ca644 100644 --- a/compiler/ncgcal.pas +++ b/compiler/ncgcal.pas @@ -131,7 +131,7 @@ implementation location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resultdef),false); { Handle Floating point types differently } - if (left.resultdef.deftype=floatdef) and not(cs_fp_emulation in aktmoduleswitches) then + if (left.resultdef.deftype=floatdef) and not(cs_fp_emulation in current_settings.moduleswitches) then begin {$ifdef i386} if tempcgpara.location^.loc<>LOC_REFERENCE then @@ -603,7 +603,7 @@ implementation cg.a_load_reg_reg(current_asmdata.CurrAsmList,cgsize,def_cgsize(resultdef),procdefinition.funcretloc[callerside].register,location.register); end; {$ifdef arm} - if (resultdef.deftype=floatdef) and (aktfputype in [fpu_fpa,fpu_fpa10,fpu_fpa11]) then + if (resultdef.deftype=floatdef) and (current_settings.fputype in [fpu_fpa,fpu_fpa10,fpu_fpa11]) then begin location_force_mem(current_asmdata.CurrAsmList,location); end; @@ -1087,7 +1087,7 @@ implementation location_reset(location,LOC_VOID,OS_NO); { perhaps i/o check ? } - if (cs_check_io in aktlocalswitches) and + if (cs_check_io in current_settings.localswitches) and (po_iocheck in procdefinition.procoptions) and not(po_iocheck in current_procinfo.procdef.procoptions) and { no IO check for methods and procedure variables } diff --git a/compiler/ncgcnv.pas b/compiler/ncgcnv.pas index 38939f1142..4b435a192b 100644 --- a/compiler/ncgcnv.pas +++ b/compiler/ncgcnv.pas @@ -552,7 +552,7 @@ interface (tpointerdef(p^.resultdef).definition.deftype=objectdef) and not (tobjectdef(tpointerdef(p^.resultdef).definition).isclass) and ((tobjectdef(tpointerdef(p^.resultdef).definition).options and oo_hasvmt)<>0) and - (cs_check_range in aktlocalswitches) then + (cs_check_range in current_settings.localswitches) then checkobject; {$endif TESTOBJEXT2} end; diff --git a/compiler/ncgcon.pas b/compiler/ncgcon.pas index 42e0677e4e..c4fda65faa 100644 --- a/compiler/ncgcon.pas +++ b/compiler/ncgcon.pas @@ -94,7 +94,7 @@ implementation lastlabel:=nil; realait:=floattype2ait[tfloatdef(resultdef).typ]; {$ifdef ARM} - hiloswapped:=aktfputype in [fpu_fpa,fpu_fpa10,fpu_fpa11]; + hiloswapped:=current_settings.fputype in [fpu_fpa,fpu_fpa10,fpu_fpa11]; {$endif ARM} { const already used ? } if not assigned(lab_real) then @@ -146,8 +146,8 @@ implementation begin current_asmdata.asmlists[al_typedconsts].concat(Tai_real_32bit.Create(ts32real(value_real))); { range checking? } - if ((cs_check_range in aktlocalswitches) or - (cs_check_overflow in aktlocalswitches)) and + if ((cs_check_range in current_settings.localswitches) or + (cs_check_overflow in current_settings.localswitches)) and (tai_real_32bit(current_asmdata.asmlists[al_typedconsts].last).value=MathInf.Value) then Message(parser_e_range_check_error); end; @@ -162,8 +162,8 @@ implementation current_asmdata.asmlists[al_typedconsts].concat(Tai_real_64bit.Create(ts64real(value_real))); { range checking? } - if ((cs_check_range in aktlocalswitches) or - (cs_check_overflow in aktlocalswitches)) and + if ((cs_check_range in current_settings.localswitches) or + (cs_check_overflow in current_settings.localswitches)) and (tai_real_64bit(current_asmdata.asmlists[al_typedconsts].last).value=MathInf.Value) then Message(parser_e_range_check_error); end; @@ -173,8 +173,8 @@ implementation current_asmdata.asmlists[al_typedconsts].concat(Tai_real_80bit.Create(value_real)); { range checking? } - if ((cs_check_range in aktlocalswitches) or - (cs_check_overflow in aktlocalswitches)) and + if ((cs_check_range in current_settings.localswitches) or + (cs_check_overflow in current_settings.localswitches)) and (tai_real_80bit(current_asmdata.asmlists[al_typedconsts].last).value=MathInf.Value) then Message(parser_e_range_check_error); end; @@ -184,8 +184,8 @@ implementation current_asmdata.asmlists[al_typedconsts].concat(Tai_real_128bit.Create(value_real)); { range checking? } - if ((cs_check_range in aktlocalswitches) or - (cs_check_overflow in aktlocalswitches)) and + if ((cs_check_range in current_settings.localswitches) or + (cs_check_overflow in current_settings.localswitches)) and (tai_real_128bit(current_asmdata.asmlists[al_typedconsts].last).value=MathInf.Value) then Message(parser_e_range_check_error); end; diff --git a/compiler/ncgflw.pas b/compiler/ncgflw.pas index 5ebf6db006..c37177a677 100644 --- a/compiler/ncgflw.pas +++ b/compiler/ncgflw.pas @@ -107,7 +107,7 @@ implementation procedure tcgwhilerepeatnode.sync_regvars(checkusedregvars: boolean); begin - if (cs_opt_regvar in aktoptimizerswitches) and + if (cs_opt_regvar in current_settings.optimizerswitches) and not(pi_has_goto in current_procinfo.flags) then begin if checkusedregvars then @@ -159,9 +159,9 @@ implementation if lnf_testatbegin in loopflags then cg.a_jmp_always(current_asmdata.CurrAsmList,lcont); - if not(cs_opt_size in aktoptimizerswitches) then + if not(cs_opt_size in current_settings.optimizerswitches) then { align loop target } - current_asmdata.CurrAsmList.concat(Tai_align.Create(aktalignment.loopalign)); + current_asmdata.CurrAsmList.concat(Tai_align.Create(current_settings.alignment.loopalign)); cg.a_label(current_asmdata.CurrAsmList,lloop); @@ -239,7 +239,7 @@ implementation (* { save regvars loaded in the beginning so that we can restore them } { when processing the else-block } - if cs_opt_regvar in aktoptimizerswitches then + if cs_opt_regvar in current_settings.optimizerswitches then begin org_list := current_asmdata.CurrAsmList; current_asmdata.CurrAsmList := TAsmList.create; @@ -248,7 +248,7 @@ implementation maketojumpbool(current_asmdata.CurrAsmList,left,lr_dont_load_regvars); (* - if cs_opt_regvar in aktoptimizerswitches then + if cs_opt_regvar in current_settings.optimizerswitches then begin org_regvar_loaded_int := rg.regvar_loaded_int; org_regvar_loaded_other := rg.regvar_loaded_other; @@ -264,7 +264,7 @@ implementation { save current asmlist (previous instructions + then-block) and } { loaded regvar state and create new clean ones } { - if cs_opt_regvar in aktoptimizerswitches then + if cs_opt_regvar in current_settings.optimizerswitches then begin then_regvar_loaded_int := rg.regvar_loaded_int; then_regvar_loaded_other := rg.regvar_loaded_other; @@ -282,7 +282,7 @@ implementation current_asmdata.getjumplabel(hl); { do go back to if line !! } (* - if not(cs_opt_regvar in aktoptimizerswitches) then + if not(cs_opt_regvar in current_settings.optimizerswitches) then *) aktfilepos:=current_asmdata.CurrAsmList.getlasttaifilepos^ (* @@ -297,7 +297,7 @@ implementation (* { save current asmlist (previous instructions + else-block) } { and loaded regvar state and create a new clean list } - if cs_opt_regvar in aktoptimizerswitches then + if cs_opt_regvar in current_settings.optimizerswitches then begin { else_regvar_loaded_int := rg.regvar_loaded_int; else_regvar_loaded_other := rg.regvar_loaded_other;} @@ -311,7 +311,7 @@ implementation else begin (* - if cs_opt_regvar in aktoptimizerswitches then + if cs_opt_regvar in current_settings.optimizerswitches then begin { else_regvar_loaded_int := rg.regvar_loaded_int; else_regvar_loaded_other := rg.regvar_loaded_other;} @@ -327,7 +327,7 @@ implementation end; (* - if cs_opt_regvar in aktoptimizerswitches then + if cs_opt_regvar in current_settings.optimizerswitches then begin { add loads of regvars at the end of the then- and else-blocks } { so that at the end of both blocks the same regvars are loaded } @@ -373,7 +373,7 @@ implementation procedure tcgfornode.sync_regvars(checkusedregvars: boolean); begin - if (cs_opt_regvar in aktoptimizerswitches) and + if (cs_opt_regvar in current_settings.optimizerswitches) and not(pi_has_goto in current_procinfo.flags) then begin if checkusedregvars then @@ -517,8 +517,8 @@ implementation cg.a_jmp_always(current_asmdata.CurrAsmList,tcglabelnode(entrylabel).getasmlabel); { align loop target } - if not(cs_opt_size in aktoptimizerswitches) then - current_asmdata.CurrAsmList.concat(Tai_align.Create(aktalignment.loopalign)); + if not(cs_opt_size in current_settings.optimizerswitches) then + current_asmdata.CurrAsmList.concat(Tai_align.Create(current_settings.alignment.loopalign)); cg.a_label(current_asmdata.CurrAsmList,l3); {If the loopvar doesn't mind on exit, we avoid the loopvar inc/dec diff --git a/compiler/ncginl.pas b/compiler/ncginl.pas index aef59bddce..002d794ced 100644 --- a/compiler/ncginl.pas +++ b/compiler/ncginl.pas @@ -168,7 +168,7 @@ implementation paraloc3,paraloc4 : tcgpara; begin { the node should be removed in the firstpass } - if not (cs_do_assertion in aktlocalswitches) then + if not (cs_do_assertion in current_settings.localswitches) then internalerror(7123458); paraloc1.init; paraloc2.init; diff --git a/compiler/ncgmat.pas b/compiler/ncgmat.pas index bcab55694c..b03752d5c3 100644 --- a/compiler/ncgmat.pas +++ b/compiler/ncgmat.pas @@ -232,7 +232,7 @@ implementation else {$endif cpu64bit} {$ifdef SUPPORT_MMX} - if (cs_mmx in aktlocalswitches) and is_mmx_able_array(left.resultdef) then + if (cs_mmx in current_settings.localswitches) and is_mmx_able_array(left.resultdef) then second_mmx else {$endif SUPPORT_MMX} @@ -469,7 +469,7 @@ implementation if is_boolean(resultdef) then second_boolean {$ifdef SUPPORT_MMX} - else if (cs_mmx in aktlocalswitches) and is_mmx_able_array(left.resultdef) then + else if (cs_mmx in current_settings.localswitches) and is_mmx_able_array(left.resultdef) then second_mmx {$endif SUPPORT_MMX} {$ifndef cpu64bit} diff --git a/compiler/ncgmem.pas b/compiler/ncgmem.pas index 84ce6424e6..39c01178ba 100644 --- a/compiler/ncgmem.pas +++ b/compiler/ncgmem.pas @@ -215,9 +215,9 @@ implementation else internalerror(200507031); end; - if (cs_use_heaptrc in aktglobalswitches) and - (cs_checkpointer in aktlocalswitches) and - not(cs_compilesystem in aktmoduleswitches) and + if (cs_use_heaptrc in current_settings.globalswitches) and + (cs_checkpointer in current_settings.localswitches) and + not(cs_compilesystem in current_settings.moduleswitches) and not(tpointerdef(left.resultdef).is_far) and not(nf_no_checkpointer in flags) then begin @@ -274,9 +274,9 @@ implementation end; end; { implicit deferencing } - if (cs_use_heaptrc in aktglobalswitches) and - (cs_checkpointer in aktlocalswitches) and - not(cs_compilesystem in aktmoduleswitches) then + if (cs_use_heaptrc in current_settings.globalswitches) and + (cs_checkpointer in current_settings.localswitches) and + not(cs_compilesystem in current_settings.moduleswitches) then begin paramanager.getintparaloc(pocall_default,1,paraloc1); paramanager.allocparaloc(current_asmdata.CurrAsmList,paraloc1); @@ -293,9 +293,9 @@ implementation tg.GetTempTyped(current_asmdata.CurrAsmList,left.resultdef,tt_normal,location.reference); cg.a_load_loc_ref(current_asmdata.CurrAsmList,OS_ADDR,left.location,location.reference); { implicit deferencing also for interfaces } - if (cs_use_heaptrc in aktglobalswitches) and - (cs_checkpointer in aktlocalswitches) and - not(cs_compilesystem in aktmoduleswitches) then + if (cs_use_heaptrc in current_settings.globalswitches) and + (cs_checkpointer in current_settings.localswitches) and + not(cs_compilesystem in current_settings.moduleswitches) then begin paramanager.getintparaloc(pocall_default,1,paraloc1); paramanager.allocparaloc(current_asmdata.CurrAsmList,paraloc1); @@ -648,7 +648,7 @@ implementation { check for a zero length string, we can use the ansistring routine here } - if (cs_check_range in aktlocalswitches) then + if (cs_check_range in current_settings.localswitches) then begin paramanager.getintparaloc(pocall_default,1,paraloc1); paramanager.allocparaloc(current_asmdata.CurrAsmList,paraloc1); @@ -712,7 +712,7 @@ implementation (tordconstnode(right).value<tarraydef(left.resultdef).lowrange) then begin { this should be caught in the typecheckpass! (JM) } - if (cs_check_range in aktlocalswitches) then + if (cs_check_range in current_settings.localswitches) then CGMessage(parser_e_range_check_error) else CGMessage(parser_w_range_check_error); @@ -723,13 +723,13 @@ implementation { range checking for open and dynamic arrays needs runtime code } secondpass(right); - if (cs_check_range in aktlocalswitches) then + if (cs_check_range in current_settings.localswitches) then rangecheck_array; end; end; stringdef : begin - if (cs_check_range in aktlocalswitches) then + if (cs_check_range in current_settings.localswitches) then begin case tstringdef(left.resultdef).string_typ of { it's the same for ansi- and wide strings } @@ -800,11 +800,11 @@ implementation else { not nodetype=ordconstn } begin - if (cs_opt_level1 in aktoptimizerswitches) and + if (cs_opt_level1 in current_settings.optimizerswitches) and { if we do range checking, we don't } { need that fancy code (it would be } { buggy) } - not(cs_check_range in aktlocalswitches) and + not(cs_check_range in current_settings.localswitches) and (left.resultdef.deftype=arraydef) and not is_packed_array(left.resultdef) then begin @@ -884,14 +884,14 @@ implementation internalerror(2006010801); { only range check now, we can't range check loc_flags/loc_jump } - if cs_check_range in aktlocalswitches then + if cs_check_range in current_settings.localswitches then begin if left.resultdef.deftype=arraydef then rangecheck_array; end; { produce possible range check code: } - if cs_check_range in aktlocalswitches then + if cs_check_range in current_settings.localswitches then begin if left.resultdef.deftype=arraydef then begin diff --git a/compiler/ncgset.pas b/compiler/ncgset.pas index 55ece603bf..c89a0a3018 100644 --- a/compiler/ncgset.pas +++ b/compiler/ncgset.pas @@ -182,7 +182,7 @@ implementation { Lots of comparisions take a lot of time, so do not allow too much comparisions. 8 comparisions are, however, still smalller than emitting the set } - if cs_opt_size in aktoptimizerswitches then + if cs_opt_size in current_settings.optimizerswitches then maxcompares:=8 else maxcompares:=5; @@ -765,7 +765,7 @@ implementation else {$endif cpu64bit} begin - if cs_opt_level1 in aktoptimizerswitches then + if cs_opt_level1 in current_settings.optimizerswitches then begin { procedures are empirically passed on } { consumption can also be calculated } @@ -793,7 +793,7 @@ implementation dist:=max_label-min_label; { optimize for size ? } - if cs_opt_size in aktoptimizerswitches then + if cs_opt_size in current_settings.optimizerswitches then begin if has_jumptable and not((labelcnt<=2) or diff --git a/compiler/ncgutil.pas b/compiler/ncgutil.pas index ba3b5b6e7c..e4d7c2b040 100644 --- a/compiler/ncgutil.pas +++ b/compiler/ncgutil.pas @@ -344,10 +344,10 @@ implementation end; LOC_CREFERENCE,LOC_REFERENCE: begin - if not(cs_opt_regvar in aktoptimizerswitches) or + if not(cs_opt_regvar in current_settings.optimizerswitches) or (getsupreg(t.reference.base) in cg.rgint.usableregs) then exclude(regs,getsupreg(t.reference.base)); - if not(cs_opt_regvar in aktoptimizerswitches) or + if not(cs_opt_regvar in current_settings.optimizerswitches) or (getsupreg(t.reference.index) in cg.rgint.usableregs) then exclude(regs,getsupreg(t.reference.index)); end; @@ -1860,7 +1860,7 @@ implementation therefore if the context must be saved, do it before the actual call to the profile code } - if (cs_profile in aktmoduleswitches) and + if (cs_profile in current_settings.moduleswitches) and not(po_assembler in current_procinfo.procdef.procoptions) then begin { non-win32 can call mcout even in main } @@ -1925,7 +1925,7 @@ implementation hs:=current_procinfo.procdef.aliasnames.getfirst; if hs='' then break; - if (cs_profile in aktmoduleswitches) or + if (cs_profile in current_settings.moduleswitches) or (po_global in current_procinfo.procdef.procoptions) then list.concat(Tai_symbol.createname_global(hs,AT_FUNCTION,0)) else @@ -1983,7 +1983,7 @@ implementation current_asmdata.asmcfi.start_frame(list); { All temps are know, write offsets used for information } - if (cs_asm_source in aktglobalswitches) then + if (cs_asm_source in current_settings.globalswitches) then begin if tg.direction>0 then begin @@ -2091,7 +2091,7 @@ implementation to the cg } {$ifdef i386} { allocate PIC register } - if (cs_create_pic in aktmoduleswitches) and + if (cs_create_pic in current_settings.moduleswitches) and (tf_pic_uses_got in target_info.flags) and (pi_needs_got in current_procinfo.flags) and not(po_kylixlocal in current_procinfo.procdef.procoptions) then @@ -2117,8 +2117,8 @@ implementation begin { add the procedure to the al_procedures } maybe_new_object_file(list); - new_section(list,sec_code,lower(pd.mangledname),aktalignment.procalign); - list.concat(Tai_align.create(aktalignment.procalign)); + new_section(list,sec_code,lower(pd.mangledname),current_settings.alignment.procalign); + list.concat(Tai_align.create(current_settings.alignment.procalign)); if (po_global in pd.procoptions) then list.concat(Tai_symbol.createname_global(pd.mangledname,AT_FUNCTION,0)) else @@ -2131,7 +2131,7 @@ implementation { create pic'ed? } - if cs_create_pic in aktmoduleswitches then + if cs_create_pic in current_settings.moduleswitches then begin { it could be that we're called from a procedure not having the got loaded @@ -2303,7 +2303,7 @@ implementation end; end; end; - if cs_asm_source in aktglobalswitches then + if cs_asm_source in current_settings.globalswitches then begin case initialloc.loc of LOC_REFERENCE : @@ -2367,7 +2367,7 @@ implementation add_regvars(rv^,tabstractnormalvarsym(tloadnode(n).symtableentry).localloc); vecn: { range checks sometimes need the high parameter } - if (cs_check_range in aktlocalswitches) and + if (cs_check_range in current_settings.localswitches) and (is_open_array(tvecnode(n).left.resultdef) or is_array_of_const(tvecnode(n).left.resultdef)) and not(current_procinfo.procdef.proccalloption in [pocall_cdecl,pocall_cppdecl]) then @@ -2819,10 +2819,10 @@ implementation function getprocalign : shortint; begin { gprof uses 16 byte granularity } - if (cs_profile in aktmoduleswitches) then + if (cs_profile in current_settings.moduleswitches) then result:=16 else - result:=aktalignment.procalign; + result:=current_settings.alignment.procalign; end; diff --git a/compiler/ncnv.pas b/compiler/ncnv.pas index 856254ccef..464b0ecc85 100644 --- a/compiler/ncnv.pas +++ b/compiler/ncnv.pas @@ -447,7 +447,7 @@ implementation begin { for constant set elements, delphi allows the usage of elements of enumerations which have value>255 if there is no element with a value > 255 used } - if (m_delphi in aktmodeswitches) and (p2.resultdef.deftype=enumdef) then + if (m_delphi in current_settings.modeswitches) and (p2.resultdef.deftype=enumdef) then begin if tordconstnode(p2).value>constsethi then constsethi:=tordconstnode(p2).value; @@ -602,7 +602,7 @@ implementation newblock: tblocknode; newstatement: tstatementnode; begin - if (m_mac in aktmodeswitches) and + if (m_mac in current_settings.modeswitches) and is_integer(p.resultdef) and (p.resultdef.size = 4) then begin @@ -1138,7 +1138,7 @@ implementation function ttypeconvnode.typecheck_int_to_string : tnode; begin - if (m_mac in aktmodeswitches) and + if (m_mac in current_settings.modeswitches) and is_integer(left.resultdef) and (left.resultdef.size = 4) then begin @@ -1649,8 +1649,8 @@ implementation (tcallnode(left).para_count=0) and (resultdef.deftype=procvardef) and ( - (m_tp_procvar in aktmodeswitches) or - (m_mac_procvar in aktmodeswitches) + (m_tp_procvar in current_settings.modeswitches) or + (m_mac_procvar in current_settings.modeswitches) ) then begin if assigned(tcallnode(left).right) then @@ -1745,7 +1745,7 @@ implementation end; { Add runtime check? } - if (cs_check_object in aktlocalswitches) then + if (cs_check_object in current_settings.localswitches) then begin { we can translate the typeconvnode to 'as' when typecasting to a class or interface } @@ -2062,7 +2062,7 @@ implementation function ttypeconvnode.first_real_to_real : tnode; begin {$ifdef cpufpemu} - if cs_fp_emulation in aktmoduleswitches then + if cs_fp_emulation in current_settings.moduleswitches then begin if target_info.system in system_wince then begin @@ -2499,7 +2499,7 @@ implementation (convtype=tc_int_2_int) and ( (resultdef.size=left.resultdef.size) or - ((m_tp7 in aktmodeswitches) and + ((m_tp7 in current_settings.modeswitches) and (resultdef.size<left.resultdef.size)) ) ) or diff --git a/compiler/nflw.pas b/compiler/nflw.pas index 78011f9217..91b5032139 100644 --- a/compiler/nflw.pas +++ b/compiler/nflw.pas @@ -497,7 +497,7 @@ implementation old_t_times:=cg.t_times; { calc register weight } - if not(cs_opt_size in aktoptimizerswitches) then + if not(cs_opt_size in current_settings.optimizerswitches) then cg.t_times:=cg.t_times*8; firstpass(left); @@ -530,7 +530,7 @@ implementation {$ifdef prefetchnext} { do at the end so all complex typeconversions are already } { converted to calln's } - if (cs_opt_level1 in aktoptimizerswitches) and + if (cs_opt_level1 in current_settings.optimizerswitches) and (lnf_testatbegin in loopflags) then begin { get first component of the while check } @@ -734,7 +734,7 @@ implementation {$endif SUPPORT_MMX} { determines registers weigths } - if not(cs_opt_size in aktoptimizerswitches) then + if not(cs_opt_size in current_settings.optimizerswitches) then cg.t_times:=cg.t_times div 2; if cg.t_times=0 then cg.t_times:=1; @@ -818,7 +818,7 @@ implementation resultdef:=voidtype; { loop unrolling } - if cs_opt_loopunroll in aktoptimizerswitches then + if cs_opt_loopunroll in current_settings.optimizerswitches then begin unrollres:=unroll_loop(self); if assigned(unrollres) then @@ -903,7 +903,7 @@ implementation begin { Calc register weight } old_t_times:=cg.t_times; - if not(cs_opt_size in aktoptimizerswitches) then + if not(cs_opt_size in current_settings.optimizerswitches) then cg.t_times:=cg.t_times*8; firstpass(t2); if codegenerror then diff --git a/compiler/ninl.pas b/compiler/ninl.pas index d9c91b9e90..3cddb53dee 100644 --- a/compiler/ninl.pas +++ b/compiler/ninl.pas @@ -1181,8 +1181,8 @@ implementation function handle_ln_const(r : bestreal) : tnode; begin if r<=0.0 then - if (cs_check_range in aktlocalswitches) or - (cs_check_overflow in aktlocalswitches) then + if (cs_check_range in current_settings.localswitches) or + (cs_check_overflow in current_settings.localswitches) then begin result:=crealconstnode.create(0,pbestrealtype^); CGMessage(type_e_wrong_math_argument) @@ -1202,8 +1202,8 @@ implementation function handle_sqrt_const(r : bestreal) : tnode; begin if r<0.0 then - if (cs_check_range in aktlocalswitches) or - (cs_check_overflow in aktlocalswitches) then + if (cs_check_range in current_settings.localswitches) or + (cs_check_overflow in current_settings.localswitches) then begin result:=crealconstnode.create(0,pbestrealtype^); CGMessage(type_e_wrong_math_argument) @@ -1384,8 +1384,8 @@ implementation begin { give warning for incompatibility with tp and delphi } if (inlinenumber in [in_lo_long,in_hi_long,in_lo_qword,in_hi_qword]) and - ((m_tp7 in aktmodeswitches) or - (m_delphi in aktmodeswitches)) then + ((m_tp7 in current_settings.modeswitches) or + (m_delphi in current_settings.modeswitches)) then CGMessage(type_w_maybe_wrong_hi_lo); { constant folding } if left.nodetype=ordconstn then @@ -1536,7 +1536,7 @@ implementation end; pointerdef : begin - if m_mac in aktmodeswitches then + if m_mac in current_settings.modeswitches then begin hp:=ctypeconvnode.create_internal(left,ptrinttype); left:=nil; @@ -1722,7 +1722,7 @@ implementation begin if (resultdef.deftype=enumdef) and (tenumdef(resultdef).has_jumps) and - not(m_delphi in aktmodeswitches) then + not(m_delphi in current_settings.modeswitches) then CGMessage(type_e_succ_and_pred_enums_with_assign_not_possible); end; @@ -1939,8 +1939,8 @@ implementation begin result:=crealconstnode.create(exp(getconstrealvalue),pbestrealtype^); if (trealconstnode(result).value_real=MathInf.Value) and - ((cs_check_range in aktlocalswitches) or - (cs_check_overflow in aktlocalswitches)) then + ((cs_check_range in current_settings.localswitches) or + (cs_check_overflow in current_settings.localswitches)) then begin result:=crealconstnode.create(0,pbestrealtype^); CGMessage(parser_e_range_check_error); @@ -2158,7 +2158,7 @@ implementation { We've checked the whole statement for correctness, now we can remove it if assertions are off } - if not(cs_do_assertion in aktlocalswitches) then + if not(cs_do_assertion in current_settings.localswitches) then begin { we need a valid node, so insert a nothingn } result:=cnothingnode.create; @@ -2318,7 +2318,7 @@ implementation not(is_char(left.resultdef)) and not(is_boolean(left.resultdef))) or (left.resultdef.deftype = pointerdef)) and - (aktlocalswitches * [cs_check_overflow,cs_check_range] <> []) + (current_settings.localswitches * [cs_check_overflow,cs_check_range] <> []) ) then { convert to simple add (JM) } begin @@ -2347,7 +2347,7 @@ implementation trigger an overflow. For uint32 it works because then the operation is done in 64bit } if (tcallparanode(left).left.resultdef.deftype=pointerdef) then - exclude(aktlocalswitches,cs_check_overflow); + exclude(current_settings.localswitches,cs_check_overflow); { make sure we don't call functions part of the left node twice (and generally } { optimize the code generation) } if node_complexity(tcallparanode(left).left) > 1 then diff --git a/compiler/nld.pas b/compiler/nld.pas index c6d9398448..01794e2927 100644 --- a/compiler/nld.pas +++ b/compiler/nld.pas @@ -351,7 +351,7 @@ implementation {$ifdef SUPPORT_MMX} registersmmx:=0; {$endif SUPPORT_MMX} - if (cs_create_pic in aktmoduleswitches) and + if (cs_create_pic in current_settings.moduleswitches) and not(symtableentry.typ in [paravarsym,localvarsym]) then include(current_procinfo.flags,pi_needs_got); @@ -747,7 +747,7 @@ implementation if codegenerror then exit; - if (cs_opt_level1 in aktoptimizerswitches) and + if (cs_opt_level1 in current_settings.optimizerswitches) and (right.nodetype = calln) and (right.resultdef=left.resultdef) and { left must be a temp, since otherwise as soon as you modify the } @@ -786,7 +786,7 @@ implementation (tstringconstnode(right).len<>0) then begin {$ifdef old_append_str} - if (cs_opt_level1 in aktoptimizerswitches) and + if (cs_opt_level1 in current_settings.optimizerswitches) and (right.nodetype in [calln,blockn]) and (left.nodetype = temprefn) and is_shortstring(right.resultdef) and diff --git a/compiler/nmat.pas b/compiler/nmat.pas index 1758702494..57b748ccaa 100644 --- a/compiler/nmat.pas +++ b/compiler/nmat.pas @@ -367,7 +367,7 @@ implementation begin result := nil; { divide/mod a number by a constant which is a power of 2? } - if (cs_opt_peephole in aktoptimizerswitches) and + if (cs_opt_peephole in current_settings.optimizerswitches) and (right.nodetype = ordconstn) and { ((nodetype = divn) or not is_signed(resultdef)) and} @@ -380,7 +380,7 @@ implementation if is_signed(resultdef) then begin if is_64bitint(left.resultdef) then - if not (cs_opt_size in aktoptimizerswitches) then + if not (cs_opt_size in current_settings.optimizerswitches) then shiftval := 63 else { the shift code is a lot bigger than the call to } @@ -622,12 +622,12 @@ implementation begin end {$ifdef SUPPORT_MMX} - else if (cs_mmx in aktlocalswitches) and + else if (cs_mmx in current_settings.localswitches) and is_mmx_able_array(left.resultdef) then begin { if saturation is on, left.resultdef isn't "mmx able" (FK) - if (cs_mmx_saturation in aktlocalswitches^) and + if (cs_mmx_saturation in current_settings.localswitches^) and (torddef(tarraydef(resultdef).definition).typ in [s32bit,u32bit]) then CGMessage(type_e_mismatch); @@ -671,7 +671,7 @@ implementation if codegenerror then exit; - if (cs_fp_emulation in aktmoduleswitches) and (left.resultdef.deftype=floatdef) then + if (cs_fp_emulation in current_settings.moduleswitches) and (left.resultdef.deftype=floatdef) then begin if not(target_info.system in system_wince) then begin @@ -730,7 +730,7 @@ implementation expectloc:=LOC_FPUREGISTER; end {$ifdef SUPPORT_MMX} - else if (cs_mmx in aktlocalswitches) and + else if (cs_mmx in current_settings.localswitches) and is_mmx_able_array(left.resultdef) then begin if (left.expectloc<>LOC_MMXREGISTER) and @@ -864,7 +864,7 @@ implementation end else {$ifdef SUPPORT_MMX} - if (cs_mmx in aktlocalswitches) and + if (cs_mmx in current_settings.localswitches) and is_mmx_able_array(left.resultdef) then begin end @@ -923,7 +923,7 @@ implementation end else {$ifdef SUPPORT_MMX} - if (cs_mmx in aktlocalswitches) and + if (cs_mmx in current_settings.localswitches) and is_mmx_able_array(left.resultdef) then begin if (left.expectloc<>LOC_MMXREGISTER) and diff --git a/compiler/nmem.pas b/compiler/nmem.pas index 38278a6f31..5815e1d61a 100644 --- a/compiler/nmem.pas +++ b/compiler/nmem.pas @@ -362,8 +362,8 @@ implementation if (left.resultdef.deftype=procdef) or ( (left.resultdef.deftype=procvardef) and - ((m_tp_procvar in aktmodeswitches) or - (m_mac_procvar in aktmodeswitches)) + ((m_tp_procvar in current_settings.modeswitches) or + (m_mac_procvar in current_settings.modeswitches)) ) then begin isprocvar:=(left.resultdef.deftype=procvardef); @@ -377,8 +377,8 @@ implementation { In tp procvar mode the result is always a voidpointer. Insert a typeconversion to voidpointer. For methodpointers we need to load the proc field } - if (m_tp_procvar in aktmodeswitches) or - (m_mac_procvar in aktmodeswitches) then + if (m_tp_procvar in current_settings.modeswitches) or + (m_mac_procvar in current_settings.modeswitches) then begin if tabstractprocdef(left.resultdef).is_addressonly then begin @@ -730,7 +730,7 @@ implementation (except voidpointer) in delphi/tp7 it's only allowed for pchars. } if not is_voidpointer(left.resultdef) and ( - (m_fpc in aktmodeswitches) or + (m_fpc in current_settings.modeswitches) or is_pchar(left.resultdef) or is_pwidechar(left.resultdef) ) then diff --git a/compiler/nobj.pas b/compiler/nobj.pas index a5d97c8980..7f6aef7b1d 100644 --- a/compiler/nobj.pas +++ b/compiler/nobj.pas @@ -531,7 +531,7 @@ implementation MessagePos1(pd.fileinfo,parser_e_nothing_to_be_overridden,pd.fullprocname(false)); { check that all methods have overload directive } - if not(m_fpc in aktmodeswitches) then + if not(m_fpc in current_settings.modeswitches) then begin procdefcoll:=vmtentry^.firstprocdef; while assigned(procdefcoll) do @@ -712,7 +712,7 @@ implementation (tobjectdef(pd.returndef).is_related( tobjectdef(procdefcoll^.data.returndef)))) then begin - if not((m_delphi in aktmodeswitches) and + if not((m_delphi in current_settings.modeswitches) and is_interface(_class)) then Message2(parser_e_overridden_methods_not_same_ret,pd.fullprocname(false), procdefcoll^.data.fullprocname(false)) diff --git a/compiler/node.pas b/compiler/node.pas index 852de05348..32797edc6f 100644 --- a/compiler/node.pas +++ b/compiler/node.pas @@ -653,7 +653,7 @@ implementation location.loc:=LOC_INVALID; { save local info } fileinfo:=aktfilepos; - localswitches:=aktlocalswitches; + localswitches:=current_settings.localswitches; resultdef:=nil; registersint:=0; registersfpu:=0; diff --git a/compiler/nopt.pas b/compiler/nopt.pas index a67f4849ff..4da10270ca 100644 --- a/compiler/nopt.pas +++ b/compiler/nopt.pas @@ -244,7 +244,7 @@ end; function canbeaddsstringcharoptnode(p: taddnode): boolean; begin canbeaddsstringcharoptnode := - (cs_opt_level1 in aktoptimizerswitches) and + (cs_opt_level1 in current_settings.optimizerswitches) and { the shortstring will be gotten through conversion if necessary (JM) is_shortstring(p.left.resultdef) and } @@ -266,7 +266,7 @@ end; function canbeaddsstringcsstringoptnode(p: taddnode): boolean; begin canbeaddsstringcsstringoptnode := - (cs_opt_level1 in aktoptimizerswitches) and + (cs_opt_level1 in current_settings.optimizerswitches) and { the shortstring will be gotten through conversion if necessary (JM) is_shortstring(p.left.resultdef) and } diff --git a/compiler/nset.pas b/compiler/nset.pas index 6d749c33f6..4beb036306 100644 --- a/compiler/nset.pas +++ b/compiler/nset.pas @@ -237,7 +237,7 @@ implementation if not assigned(left.resultdef) then internalerror(20021126); - if (m_fpc in aktmodeswitches) then + if (m_fpc in current_settings.modeswitches) then begin { insert a hint that a range check error might occur on non-byte elements with the in operator. @@ -593,7 +593,7 @@ implementation { estimates the repeat of each instruction } old_t_times:=cg.t_times; - if not(cs_opt_size in aktoptimizerswitches) then + if not(cs_opt_size in current_settings.optimizerswitches) then begin cg.t_times:=cg.t_times div case_count_labels(labels); if cg.t_times<1 then diff --git a/compiler/nutils.pas b/compiler/nutils.pas index 33bd8b28bf..26e6041a11 100644 --- a/compiler/nutils.pas +++ b/compiler/nutils.pas @@ -281,7 +281,7 @@ implementation result:=false; if (p1.resultdef.deftype<>procvardef) or (tponly and - not(m_tp_procvar in aktmodeswitches)) then + not(m_tp_procvar in current_settings.modeswitches)) then exit; { ignore vecn,subscriptn } hp:=p1; diff --git a/compiler/ogbase.pas b/compiler/ogbase.pas index dda1ea83a7..ffab5cba3b 100644 --- a/compiler/ogbase.pas +++ b/compiler/ogbase.pas @@ -1100,8 +1100,8 @@ implementation function TObjOutput.newObjData(const n:string):TObjData; begin result:=CObjData.create(n); - if (cs_use_lineinfo in aktglobalswitches) or - (cs_debuginfo in aktmoduleswitches) then + if (cs_use_lineinfo in current_settings.globalswitches) or + (cs_debuginfo in current_settings.moduleswitches) then result.CreateDebugSections; end; @@ -1738,7 +1738,7 @@ implementation VTENTRY and VTINHERIT symbols } if objsym.bind=AB_LOCAL then begin - if cs_link_opt_vtable in aktglobalswitches then + if cs_link_opt_vtable in current_settings.globalswitches then begin hs:=objsym.name; if (hs[1]='V') then @@ -1906,7 +1906,7 @@ implementation Comment(V_Error,'Entrypoint '+EntryName+' not defined'); { Generate VTable tree } - if cs_link_opt_vtable in aktglobalswitches then + if cs_link_opt_vtable in current_settings.globalswitches then BuildVTableTree(VTInheritList,VTEntryList); VTInheritList.Free; VTEntryList.Free; @@ -2169,7 +2169,7 @@ implementation ( (exesec.ObjSectionlist.count=0) or ( - (cs_link_strip in aktglobalswitches) and + (cs_link_strip in current_settings.globalswitches) and (oso_debug in exesec.SecOptions) ) ) then @@ -2297,7 +2297,7 @@ implementation DoReloc(TObjRelocation(objsec.ObjRelocations[i])); { Process Virtual Entry calls } - if cs_link_opt_vtable in aktglobalswitches then + if cs_link_opt_vtable in current_settings.globalswitches then begin for i:=0 to objsec.VTRefList.count-1 do begin diff --git a/compiler/ogcoff.pas b/compiler/ogcoff.pas index a516a99745..4dd5501002 100644 --- a/compiler/ogcoff.pas +++ b/compiler/ogcoff.pas @@ -1736,7 +1736,7 @@ const pemagic : array[0..3] of byte = ( with TCoffObjSection(p) do begin { Skip debug sections } - if (cs_link_strip in aktglobalswitches) and + if (cs_link_strip in current_settings.globalswitches) and (oso_debug in secoptions) then exit; @@ -1758,7 +1758,7 @@ const pemagic : array[0..3] of byte = ( with TCoffObjSection(p) do begin { Skip debug sections } - if (cs_link_strip in aktglobalswitches) and + if (cs_link_strip in current_settings.globalswitches) and (oso_debug in secoptions) then exit; @@ -2097,7 +2097,7 @@ const pemagic : array[0..3] of byte = ( begin nsyms:=0; sympos:=0; - if not(cs_link_strip in aktglobalswitches) then + if not(cs_link_strip in current_settings.globalswitches) then begin nsyms:=ExeSymbolList.Count; sympos:=CurrDataPos; @@ -2166,7 +2166,7 @@ const pemagic : array[0..3] of byte = ( header.flag:=header.flag or PE_FILE_RELOCS_STRIPPED; if FindExeSection('.stab')=nil then header.flag:=header.flag or PE_FILE_DEBUG_STRIPPED; - if (cs_link_strip in aktglobalswitches) then + if (cs_link_strip in current_settings.globalswitches) then header.flag:=header.flag or PE_FILE_LOCAL_SYMS_STRIPPED; end else @@ -2245,7 +2245,7 @@ const pemagic : array[0..3] of byte = ( { Section data } ExeSections.ForEachCall(@ExeSections_write_data,nil); { Optional ObjSymbols } - if not(cs_link_strip in aktglobalswitches) then + if not(cs_link_strip in current_settings.globalswitches) then begin if SymPos<>FWriter.Size then internalerror(200602252); diff --git a/compiler/oglx.pas b/compiler/oglx.pas index b9fde85a02..b19c187dc6 100644 --- a/compiler/oglx.pas +++ b/compiler/oglx.pas @@ -290,7 +290,7 @@ uses { symbols } nsyms:=0; sympos:=0; - if not(cs_link_strip in aktglobalswitches) then + if not(cs_link_strip in current_settings.globalswitches) then begin sympos:=datapos; objdata:=TObjData(objdatalist.first); diff --git a/compiler/options.pas b/compiler/options.pas index 83cb7cc597..78b7813804 100644 --- a/compiler/options.pas +++ b/compiler/options.pas @@ -104,8 +104,8 @@ begin undef_system_macro('FPC_LINK_SMART'); def_system_macro('FPC_LINK_STATIC'); undef_system_macro('FPC_LINK_DYNAMIC'); - initglobalswitches:=initglobalswitches+[cs_link_static]; - initglobalswitches:=initglobalswitches-[cs_link_shared,cs_link_smart]; + init_settings.globalswitches:=init_settings.globalswitches+[cs_link_static]; + init_settings.globalswitches:=init_settings.globalswitches-[cs_link_shared,cs_link_smart]; end; {**************************************************************************** @@ -409,29 +409,29 @@ begin 'a' : begin - include(initglobalswitches,cs_asm_leave); + include(init_settings.globalswitches,cs_asm_leave); j:=1; while j<=length(more) do begin case more[j] of 'l' : - include(initglobalswitches,cs_asm_source); + include(init_settings.globalswitches,cs_asm_source); 'r' : - include(initglobalswitches,cs_asm_regalloc); + include(init_settings.globalswitches,cs_asm_regalloc); 't' : - include(initglobalswitches,cs_asm_tempalloc); + include(init_settings.globalswitches,cs_asm_tempalloc); 'n' : - include(initglobalswitches,cs_asm_nodes); + include(init_settings.globalswitches,cs_asm_nodes); 'p' : begin - exclude(initglobalswitches,cs_asm_leave); + exclude(init_settings.globalswitches,cs_asm_leave); if UnsetBool(More, 0) then - exclude(initglobalswitches,cs_asm_pipe) + exclude(init_settings.globalswitches,cs_asm_pipe) else - include(initglobalswitches,cs_asm_pipe); + include(init_settings.globalswitches,cs_asm_pipe); end; '-' : - initglobalswitches:=initglobalswitches - + init_settings.globalswitches:=init_settings.globalswitches - [cs_asm_leave, cs_asm_source,cs_asm_regalloc, cs_asm_tempalloc, cs_asm_nodes, cs_asm_pipe]; else @@ -453,25 +453,25 @@ begin {$ifdef supportbrowser} if UnsetBool(More,0) then begin - exclude(initmoduleswitches,cs_browser); - exclude(initmoduleswitches,cs_local_browser); + exclude(init_settings.moduleswitches,cs_browser); + exclude(init_settings.moduleswitches,cs_local_browser); {$ifdef BrowserLog} - exclude(initglobalswitches,cs_browser_log); + exclude(init_settings.globalswitches,cs_browser_log); {$endif} end else begin - include(initmoduleswitches,cs_browser); + include(init_settings.moduleswitches,cs_browser); {$ifdef BrowserLog} - include(initglobalswitches,cs_browser_log); + include(init_settings.globalswitches,cs_browser_log); {$endif} end; if More<>'' then if (More='l') or (More='l+') then - include(initmoduleswitches,cs_local_browser) + include(init_settings.moduleswitches,cs_local_browser) else if More='l-' then - exclude(initmoduleswitches,cs_local_browser) + exclude(init_settings.moduleswitches,cs_local_browser) else {$ifdef BrowserLog} browserlog.elements_to_list.insert(more); @@ -492,7 +492,7 @@ begin case more[j] of 'c' : begin - if not SetAktProcCall(upper(copy(more,j+1,length(more)-j)),initdefproccall) then + if not SetAktProcCall(upper(copy(more,j+1,length(more)-j)),init_settings.defproccall) then IllegalPara(opt); break; end; @@ -500,20 +500,20 @@ begin 'e' : begin If UnsetBool(More, j) then - exclude(initmoduleswitches,cs_fp_emulation) + exclude(init_settings.moduleswitches,cs_fp_emulation) Else - include(initmoduleswitches,cs_fp_emulation); + include(init_settings.moduleswitches,cs_fp_emulation); end; {$endif cpufpemu} 'f' : begin s:=upper(copy(more,j+1,length(more)-j)); - if not(SetFpuType(s,initfputype)) then + if not(SetFpuType(s,init_settings.fputype)) then IllegalPara(opt); break; end; 'g' : - include(initmoduleswitches,cs_create_pic); + include(init_settings.moduleswitches,cs_create_pic); 'h' : begin val(copy(more,j+1,length(more)-j),heapsize,code); @@ -523,41 +523,41 @@ begin end; 'i' : If UnsetBool(More, j) then - exclude(initlocalswitches,cs_check_io) + exclude(init_settings.localswitches,cs_check_io) else - include(initlocalswitches,cs_check_io); + include(init_settings.localswitches,cs_check_io); 'n' : If UnsetBool(More, j) then - exclude(initglobalswitches,cs_link_nolink) + exclude(init_settings.globalswitches,cs_link_nolink) Else - include(initglobalswitches,cs_link_nolink); + include(init_settings.globalswitches,cs_link_nolink); 'o' : If UnsetBool(More, j) then - exclude(initlocalswitches,cs_check_overflow) + exclude(init_settings.localswitches,cs_check_overflow) Else - include(initlocalswitches,cs_check_overflow); + include(init_settings.localswitches,cs_check_overflow); 'p' : begin s:=upper(copy(more,j+1,length(more)-j)); - if not(Setcputype(s,initcputype)) then + if not(Setcputype(s,init_settings.cputype)) then IllegalPara(opt); break; end; 'r' : If UnsetBool(More, j) then - exclude(initlocalswitches,cs_check_range) + exclude(init_settings.localswitches,cs_check_range) Else - include(initlocalswitches,cs_check_range); + include(init_settings.localswitches,cs_check_range); 'R' : If UnsetBool(More, j) then begin - exclude(initlocalswitches,cs_check_range); - exclude(initlocalswitches,cs_check_object); + exclude(init_settings.localswitches,cs_check_range); + exclude(init_settings.localswitches,cs_check_object); end Else begin - include(initlocalswitches,cs_check_range); - include(initlocalswitches,cs_check_object); + include(init_settings.localswitches,cs_check_range); + include(init_settings.localswitches,cs_check_object); end; 's' : begin @@ -568,19 +568,19 @@ begin end; 't' : If UnsetBool(More, j) then - exclude(initlocalswitches,cs_check_stack) + exclude(init_settings.localswitches,cs_check_stack) Else - include(initlocalswitches,cs_check_stack); + include(init_settings.localswitches,cs_check_stack); 'D' : If UnsetBool(More, j) then - exclude(initmoduleswitches,cs_create_dynamic) + exclude(init_settings.moduleswitches,cs_create_dynamic) Else - include(initmoduleswitches,cs_create_dynamic); + include(init_settings.moduleswitches,cs_create_dynamic); 'X' : If UnsetBool(More, j) then - exclude(initmoduleswitches,cs_create_smart) + exclude(init_settings.moduleswitches,cs_create_smart) Else - include(initmoduleswitches,cs_create_smart); + include(init_settings.moduleswitches,cs_create_smart); else IllegalPara(opt); end; @@ -599,7 +599,7 @@ begin end; 'D' : begin - include(initglobalswitches,cs_link_deffile); + include(init_settings.globalswitches,cs_link_deffile); j:=1; while j<=length(more) do begin @@ -643,7 +643,7 @@ begin usewindowapi:=true; '-' : begin - exclude(initglobalswitches,cs_link_deffile); + exclude(init_settings.globalswitches,cs_link_deffile); usewindowapi:=false; end; else @@ -659,9 +659,9 @@ begin 'E' : begin if UnsetBool(More, 0) then - exclude(initglobalswitches,cs_link_nolink) + exclude(init_settings.globalswitches,cs_link_nolink) else - include(initglobalswitches,cs_link_nolink); + include(init_settings.globalswitches,cs_link_nolink); end; 'F' : @@ -675,11 +675,11 @@ begin 'c' : begin if (upper(more)='UTF8') or (upper(more)='UTF-8') then - initsourcecodepage:='utf8' + init_settings.sourcecodepage:='utf8' else if not(cpavailable(more)) then Message1(option_code_page_not_available,more) else - initsourcecodepage:=more; + init_settings.sourcecodepage:=more; end; 'D' : utilsdirectory:=FixPath(More,true); @@ -737,15 +737,15 @@ begin begin if UnsetBool(More, 0) then begin - exclude(initmoduleswitches,cs_debuginfo); - exclude(initglobalswitches,cs_use_heaptrc); - exclude(initglobalswitches,cs_use_lineinfo); - exclude(initlocalswitches,cs_checkpointer); + exclude(init_settings.moduleswitches,cs_debuginfo); + exclude(init_settings.globalswitches,cs_use_heaptrc); + exclude(init_settings.globalswitches,cs_use_lineinfo); + exclude(init_settings.localswitches,cs_checkpointer); localvartrashing := -1; end else begin - include(initmoduleswitches,cs_debuginfo); + include(init_settings.moduleswitches,cs_debuginfo); end; if not RelocSectionSetExplicitly then RelocSection:=false; @@ -756,9 +756,9 @@ begin 'c' : begin if UnsetBool(More, j) then - exclude(initlocalswitches,cs_checkpointer) + exclude(init_settings.localswitches,cs_checkpointer) else - include(initlocalswitches,cs_checkpointer); + include(init_settings.localswitches,cs_checkpointer); end; 'd' : begin @@ -767,16 +767,16 @@ begin 'h' : begin if UnsetBool(More, j) then - exclude(initglobalswitches,cs_use_heaptrc) + exclude(init_settings.globalswitches,cs_use_heaptrc) else - include(initglobalswitches,cs_use_heaptrc); + include(init_settings.globalswitches,cs_use_heaptrc); end; 'l' : begin if UnsetBool(More, j) then - exclude(initglobalswitches,cs_use_lineinfo) + exclude(init_settings.globalswitches,cs_use_lineinfo) else - include(initglobalswitches,cs_use_lineinfo); + include(init_settings.globalswitches,cs_use_lineinfo); end; 's' : begin @@ -792,9 +792,9 @@ begin 'v' : begin if UnsetBool(More, j) then - exclude(initglobalswitches,cs_gdb_valgrind) + exclude(init_settings.globalswitches,cs_gdb_valgrind) else - include(initglobalswitches,cs_gdb_valgrind); + include(init_settings.globalswitches,cs_gdb_valgrind); end; 'w' : begin @@ -894,11 +894,11 @@ begin begin case more[j] of '1' : - initoptimizerswitches:=initoptimizerswitches+level1optimizerswitches; + init_settings.optimizerswitches:=init_settings.optimizerswitches+level1optimizerswitches; '2' : - initoptimizerswitches:=initoptimizerswitches+level2optimizerswitches; + init_settings.optimizerswitches:=init_settings.optimizerswitches+level2optimizerswitches; '3' : - initoptimizerswitches:=initoptimizerswitches+level3optimizerswitches; + init_settings.optimizerswitches:=init_settings.optimizerswitches+level3optimizerswitches; 'a' : begin if not(UpdateAlignmentStr(Copy(Opt,j+3,255),ParaAlignment)) then @@ -906,10 +906,10 @@ begin break; end; 's' : - include(initoptimizerswitches,cs_opt_size); + include(init_settings.optimizerswitches,cs_opt_size); 'p' : begin - if not Setcputype(copy(more,j+1,length(more)),initoptimizecputype) then + if not Setcputype(copy(more,j+1,length(more)),init_settings.optimizecputype) then begin { Give warning for old i386 switches } if (Length(More)-j=1) and @@ -922,13 +922,13 @@ begin end; 'o' : begin - if not UpdateOptimizerStr(copy(more,j+1,length(more)),initoptimizerswitches) then + if not UpdateOptimizerStr(copy(more,j+1,length(more)),init_settings.optimizerswitches) then IllegalPara(opt); break; end; '-' : begin - initoptimizerswitches:=[]; + init_settings.optimizerswitches:=[]; FillChar(ParaAlignment,sizeof(ParaAlignment),0); end; { Obsolete switches } @@ -951,7 +951,7 @@ begin begin if UnsetBool(More, 0) then begin - initmoduleswitches:=initmoduleswitches-[cs_profile]; + init_settings.moduleswitches:=init_settings.moduleswitches-[cs_profile]; undef_system_macro('FPC_PROFILE'); end else @@ -961,12 +961,12 @@ begin case more[1] of 'g' : if UnsetBool(more, 1) then begin - exclude(initmoduleswitches,cs_profile); + exclude(init_settings.moduleswitches,cs_profile); undef_system_macro('FPC_PROFILE'); end else begin - include(initmoduleswitches,cs_profile); + include(init_settings.moduleswitches,cs_profile); def_system_macro('FPC_PROFILE'); end; else @@ -978,7 +978,7 @@ begin 'R' : begin - if not SetAsmReadMode(More,initasmmode) then + if not SetAsmReadMode(More,init_settings.asmmode) then IllegalPara(opt); end; @@ -986,19 +986,19 @@ begin begin if UnsetBool(More, 0) then begin - initglobalswitches:=initglobalswitches-[cs_asm_extern,cs_link_extern,cs_link_nolink]; + init_settings.globalswitches:=init_settings.globalswitches-[cs_asm_extern,cs_link_extern,cs_link_nolink]; if more<>'' then IllegalPara(opt); end else begin - initglobalswitches:=initglobalswitches+[cs_asm_extern,cs_link_extern,cs_link_nolink]; + init_settings.globalswitches:=init_settings.globalswitches+[cs_asm_extern,cs_link_extern,cs_link_nolink]; if more='h' then - initglobalswitches:=initglobalswitches-[cs_link_on_target] + init_settings.globalswitches:=init_settings.globalswitches-[cs_link_on_target] else if more='t' then - initglobalswitches:=initglobalswitches+[cs_link_on_target] + init_settings.globalswitches:=init_settings.globalswitches+[cs_link_on_target] else if more='r' then - initglobalswitches:=initglobalswitches+[cs_asm_leave,cs_no_regalloc] + init_settings.globalswitches:=init_settings.globalswitches+[cs_asm_leave,cs_no_regalloc] else if more<>'' then IllegalPara(opt); end; @@ -1009,9 +1009,9 @@ begin if more[1]='I' then begin if upper(more)='ICOM' then - initinterfacetype:=it_interfacecom + init_settings.interfacetype:=it_interfacecom else if upper(more)='ICORBA' then - initinterfacetype:=it_interfacecorba + init_settings.interfacetype:=it_interfacecorba else IllegalPara(opt); end @@ -1024,9 +1024,9 @@ begin '2' : //an alternative to -Mobjfpc SetCompileMode('OBJFPC',true); 'a' : - include(initlocalswitches,cs_do_assertion); + include(init_settings.localswitches,cs_do_assertion); 'c' : - include(initmoduleswitches,cs_support_c_operators); + include(init_settings.moduleswitches,cs_support_c_operators); 'd' : //an alternative to -Mdelphi SetCompileMode('DELPHI',true); 'e' : @@ -1035,32 +1035,32 @@ begin break; end; 'g' : - include(initmoduleswitches,cs_support_goto); + include(init_settings.moduleswitches,cs_support_goto); 'h' : - include(initlocalswitches,cs_ansistrings); + include(init_settings.localswitches,cs_ansistrings); 'i' : - include(initlocalswitches,cs_do_inline); + include(init_settings.localswitches,cs_do_inline); 'k' : - include(initglobalswitches,cs_load_fpcylix_unit); + include(init_settings.globalswitches,cs_load_fpcylix_unit); 'm' : - include(initmoduleswitches,cs_support_macro); + include(init_settings.moduleswitches,cs_support_macro); 'o' : //an alternative to -Mtp SetCompileMode('TP',true); 'p' : //an alternative to -Mgpc SetCompileMode('GPC',true); 's' : - include(initglobalswitches,cs_constructor_name); + include(init_settings.globalswitches,cs_constructor_name); 't' : - include(initmoduleswitches,cs_static_keyword); + include(init_settings.moduleswitches,cs_static_keyword); 'v' : - include(initglobalswitches,cs_support_vectors); + include(init_settings.globalswitches,cs_support_vectors); 'x' : - include(initglobalswitches,cs_support_exceptions); + include(init_settings.globalswitches,cs_support_exceptions); '-' : begin - initglobalswitches:=initglobalswitches - [cs_constructor_name,cs_support_exceptions]; - initlocalswitches:=InitLocalswitches - [cs_do_assertion, cs_do_inline, cs_ansistrings]; - initmoduleswitches:=initmoduleswitches - [cs_support_c_operators, cs_support_goto, + init_settings.globalswitches:=init_settings.globalswitches - [cs_constructor_name,cs_support_exceptions]; + init_settings.localswitches:=init_settings.localswitches - [cs_do_assertion, cs_do_inline, cs_ansistrings]; + init_settings.moduleswitches:=init_settings.moduleswitches - [cs_support_c_operators, cs_support_goto, cs_support_macro, cs_static_keyword]; end; @@ -1110,7 +1110,7 @@ begin end; {$endif UNITALIASES} 'n' : - exclude(initglobalswitches,cs_check_unit_name); + exclude(init_settings.globalswitches,cs_check_unit_name); 'p' : begin Message2(option_obsolete_switch_use_new,'-Up','-Fu'); @@ -1119,11 +1119,11 @@ begin 'r' : do_release:=true; 's' : - include(initmoduleswitches,cs_compilesystem); + include(init_settings.moduleswitches,cs_compilesystem); '-' : begin - exclude(initmoduleswitches,cs_compilesystem); - exclude(initglobalswitches,cs_check_unit_name); + exclude(init_settings.moduleswitches,cs_compilesystem); + exclude(init_settings.globalswitches,cs_check_unit_name); end; else IllegalPara(opt); @@ -1238,25 +1238,25 @@ begin 'e' : begin If UnsetBool(More, j) then - exclude(initglobalswitches,cs_link_extern) + exclude(init_settings.globalswitches,cs_link_extern) else - include(initglobalswitches,cs_link_extern); + include(init_settings.globalswitches,cs_link_extern); end; 'f' : - include(initglobalswitches,cs_link_pthread); + include(init_settings.globalswitches,cs_link_pthread); 'i' : begin If UnsetBool(More, j) then - include(initglobalswitches,cs_link_extern) + include(init_settings.globalswitches,cs_link_extern) else - exclude(initglobalswitches,cs_link_extern); + exclude(init_settings.globalswitches,cs_link_extern); end; 'm' : begin If UnsetBool(More, j) then - exclude(initglobalswitches,cs_link_map) + exclude(init_settings.globalswitches,cs_link_map) else - include(initglobalswitches,cs_link_map); + include(init_settings.globalswitches,cs_link_map); end; 'p' : ; { Ignore used by fpc.pp } 'r' : @@ -1268,27 +1268,27 @@ begin 's' : begin If UnsetBool(More, j) then - exclude(initglobalswitches,cs_link_strip) + exclude(init_settings.globalswitches,cs_link_strip) else - include(initglobalswitches,cs_link_strip); + include(init_settings.globalswitches,cs_link_strip); end; 't' : - include(initglobalswitches,cs_link_staticflag); + include(init_settings.globalswitches,cs_link_staticflag); 'v' : begin If UnsetBool(More, j) then - exclude(initglobalswitches,cs_link_opt_vtable) + exclude(init_settings.globalswitches,cs_link_opt_vtable) else - include(initglobalswitches,cs_link_opt_vtable); + include(init_settings.globalswitches,cs_link_opt_vtable); end; 'D' : begin def_system_macro('FPC_LINK_DYNAMIC'); undef_system_macro('FPC_LINK_SMART'); undef_system_macro('FPC_LINK_STATIC'); - exclude(initglobalswitches,cs_link_static); - exclude(initglobalswitches,cs_link_smart); - include(initglobalswitches,cs_link_shared); + exclude(init_settings.globalswitches,cs_link_static); + exclude(init_settings.globalswitches,cs_link_smart); + include(init_settings.globalswitches,cs_link_shared); LinkTypeSetExplicitly:=true; end; 'M' : @@ -1319,7 +1319,7 @@ begin if not LinkLibraryOrder.AddWeight(s) Then IllegalPara(opt); end; - 'D' : include(initglobalswitches,cs_link_no_default_lib_order) + 'D' : include(init_settings.globalswitches,cs_link_no_default_lib_order) else IllegalPara(opt); end; {case} @@ -1331,9 +1331,9 @@ begin def_system_macro('FPC_LINK_STATIC'); undef_system_macro('FPC_LINK_SMART'); undef_system_macro('FPC_LINK_DYNAMIC'); - include(initglobalswitches,cs_link_static); - exclude(initglobalswitches,cs_link_smart); - exclude(initglobalswitches,cs_link_shared); + include(init_settings.globalswitches,cs_link_static); + exclude(init_settings.globalswitches,cs_link_smart); + exclude(init_settings.globalswitches,cs_link_shared); LinkTypeSetExplicitly:=true; end; 'X' : @@ -1341,16 +1341,16 @@ begin def_system_macro('FPC_LINK_SMART'); undef_system_macro('FPC_LINK_STATIC'); undef_system_macro('FPC_LINK_DYNAMIC'); - exclude(initglobalswitches,cs_link_static); - include(initglobalswitches,cs_link_smart); - exclude(initglobalswitches,cs_link_shared); + exclude(init_settings.globalswitches,cs_link_static); + include(init_settings.globalswitches,cs_link_smart); + exclude(init_settings.globalswitches,cs_link_shared); LinkTypeSetExplicitly:=true; end; '-' : begin - exclude(initglobalswitches,cs_link_staticflag); - exclude(initglobalswitches,cs_link_strip); - exclude(initglobalswitches,cs_link_map); + exclude(init_settings.globalswitches,cs_link_staticflag); + exclude(init_settings.globalswitches,cs_link_strip); + exclude(init_settings.globalswitches,cs_link_map); set_default_link_type; end; else @@ -2109,7 +2109,7 @@ begin end; { CPU Define } - def_system_macro('CPU'+Cputypestr[initcputype]); + def_system_macro('CPU'+Cputypestr[init_settings.cputype]); { Check file to compile } if param_file='' then @@ -2133,7 +2133,7 @@ begin inputextension:=sourceext else if FileExists(inputdir+inputfile+pasext) then inputextension:=pasext - else if ((m_mac in aktmodeswitches) or + else if ((m_mac in current_settings.modeswitches) or (tf_p_ext_support in target_info.flags)) and FileExists(inputdir+inputfile+pext) then inputextension:=pext; @@ -2210,7 +2210,7 @@ begin Do not add it when linking on the target because then we can maybe already find .o files that are not for the target } if (ExePath<>GetCurrentDir) and - not(cs_link_on_target in initglobalswitches) then + not(cs_link_on_target in init_settings.globalswitches) then UnitSearchPath.AddPath(ExePath,false); { Add unit dir to the object and library path } objectsearchpath.AddList(unitsearchpath,false); @@ -2232,7 +2232,7 @@ begin end; { switch assembler if it's binary and we got -a on the cmdline } - if (cs_asm_leave in initglobalswitches) and + if (cs_asm_leave in init_settings.globalswitches) and (af_outputbinary in target_asm.flags) then begin Message(option_switch_bin_to_src_assembler); @@ -2241,19 +2241,19 @@ begin { Force use of external linker if there is no internal linker or the linking is skipped } - if not(cs_link_extern in initglobalswitches) and + if not(cs_link_extern in init_settings.globalswitches) and (not assigned(target_info.link) or - (cs_link_nolink in initglobalswitches)) then - include(initglobalswitches,cs_link_extern); + (cs_link_nolink in init_settings.globalswitches)) then + include(init_settings.globalswitches,cs_link_extern); { turn off stripping if compiling with debuginfo or profile } - if (cs_debuginfo in initmoduleswitches) or - (cs_profile in initmoduleswitches) then - exclude(initglobalswitches,cs_link_strip); + if (cs_debuginfo in init_settings.moduleswitches) or + (cs_profile in init_settings.moduleswitches) then + exclude(init_settings.globalswitches,cs_link_strip); { force fpu emulation on arm/wince and arm/gba } if target_info.system in [system_arm_wince,system_arm_gba] then - include(initmoduleswitches,cs_fp_emulation); + include(init_settings.moduleswitches,cs_fp_emulation); { Section smartlinking conflicts with import sections on Windows } if GenerateImportSection and @@ -2262,7 +2262,7 @@ begin {$ifdef x86_64} {$warning HACK: turn off smartlinking} - exclude(initmoduleswitches,cs_create_smart); + exclude(init_settings.moduleswitches,cs_create_smart); {$endif} if not LinkTypeSetExplicitly then @@ -2272,15 +2272,15 @@ begin 1. load the defaults for the target 2. override with generic optimizer setting (little size) 3. override with the user specified -Oa } - UpdateAlignment(initalignment,target_info.alignment); - if (cs_opt_size in aktoptimizerswitches) then + UpdateAlignment(init_settings.alignment,target_info.alignment); + if (cs_opt_size in current_settings.optimizerswitches) then begin - initalignment.procalign:=1; - initalignment.jumpalign:=1; - initalignment.loopalign:=1; + init_settings.alignment.procalign:=1; + init_settings.alignment.jumpalign:=1; + init_settings.alignment.loopalign:=1; end; - UpdateAlignment(initalignment,option.paraalignment); + UpdateAlignment(init_settings.alignment,option.paraalignment); set_system_macro('FPC_VERSION',version_nr); set_system_macro('FPC_RELEASE',release_nr); diff --git a/compiler/optunrol.pas b/compiler/optunrol.pas index e549d9ab99..961f2f5c42 100644 --- a/compiler/optunrol.pas +++ b/compiler/optunrol.pas @@ -61,7 +61,7 @@ unit optunrol; begin {$ifdef i386} { multiply by 2 for CPUs with a long pipeline } - if aktcputype in [cpu_Pentium4] then + if current_settings.cputype in [cpu_Pentium4] then number_unrolls:=60 div countnodes(node) else {$endif i386} @@ -80,7 +80,7 @@ unit optunrol; unrollblock : tblocknode; begin result:=nil; - if (cs_opt_size in aktoptimizerswitches) then + if (cs_opt_size in current_settings.optimizerswitches) then exit; if not(node.nodetype in [forn]) then exit; diff --git a/compiler/parser.pas b/compiler/parser.pas index 8611ae6d12..01b7e38eaf 100644 --- a/compiler/parser.pas +++ b/compiler/parser.pas @@ -81,9 +81,9 @@ implementation usedunits:=TLinkedList.Create; { global switches } - aktglobalswitches:=initglobalswitches; + current_settings.globalswitches:=init_settings.globalswitches; - aktsourcecodepage:=initsourcecodepage; + current_settings.sourcecodepage:=init_settings.sourcecodepage; { initialize scanner } InitScanner; @@ -104,7 +104,7 @@ implementation stacksize:=target_info.stacksize; { open assembler response } - if cs_link_on_target in aktglobalswitches then + if cs_link_on_target in current_settings.globalswitches then GenerateAsmRes(outputexedir+inputfile+'_ppas') else GenerateAsmRes(outputexedir+'ppas'); @@ -273,23 +273,10 @@ implementation { cg } oldparse_only : boolean; { akt.. things } - oldaktlocalswitches : tlocalswitches; - oldaktmoduleswitches : tmoduleswitches; oldaktfilepos : tfileposinfo; - oldaktpackrecords, - oldaktpackenum : shortint; - oldaktmaxfpuregisters : longint; - oldaktalignment : talignmentinfo; - oldaktoptimizecputype, - oldaktcputype : tcputype; - oldaktfputype : tfputype; - oldaktasmmode : tasmmode; - oldaktinterfacetype: tinterfacetypes; - oldaktmodeswitches : tmodeswitches; - oldaktoptimizerswitches : toptimizerswitches; old_compiled_module : tmodule; oldcurrent_procinfo : tprocinfo; - oldaktdefproccall : tproccalloption; + old_settings : tsettings; oldsourcecodepage : tcodepagestring; end; @@ -309,7 +296,6 @@ implementation oldsymtablestack:=symtablestack; oldmacrosymtablestack:=macrosymtablestack; oldcurrent_procinfo:=current_procinfo; - oldaktdefproccall:=aktdefproccall; { save scanner state } oldc:=c; oldpattern:=pattern; @@ -318,30 +304,17 @@ implementation oldidtoken:=idtoken; old_block_type:=block_type; oldtokenpos:=akttokenpos; - oldsourcecodepage:=aktsourcecodepage; { save cg } oldparse_only:=parse_only; { save akt... state } { handle the postponed case first } if localswitcheschanged then begin - aktlocalswitches:=nextaktlocalswitches; + current_settings.localswitches:=nextlocalswitches; localswitcheschanged:=false; end; - oldaktlocalswitches:=aktlocalswitches; - oldaktmoduleswitches:=aktmoduleswitches; - oldaktalignment:=aktalignment; - oldaktpackenum:=aktpackenum; - oldaktpackrecords:=aktpackrecords; - oldaktfputype:=aktfputype; - oldaktmaxfpuregisters:=aktmaxfpuregisters; - oldaktcputype:=aktcputype; - oldaktoptimizecputype:=aktoptimizecputype; - oldaktasmmode:=aktasmmode; - oldaktinterfacetype:=aktinterfacetype; oldaktfilepos:=aktfilepos; - oldaktmodeswitches:=aktmodeswitches; - oldaktoptimizerswitches:=aktoptimizerswitches; + old_settings:=current_settings; end; { reset parser, a previous fatal error could have left these variables in an unreliable state, this is important for the IDE } @@ -357,10 +330,10 @@ implementation symtablestack:=tsymtablestack.create; macrosymtablestack:=tsymtablestack.create; systemunit:=nil; - aktdefproccall:=initdefproccall; + current_settings.defproccall:=init_settings.defproccall; aktexceptblock:=0; exceptblockcounter:=0; - aktmaxfpuregisters:=-1; + current_settings.maxfpuregisters:=-1; { reset the unit or create a new program } { a unit compiled at command line must be inside the loaded_unit list } if (compile_level=1) then @@ -382,19 +355,7 @@ implementation Fillchar(aktfilepos,0,sizeof(aktfilepos)); { Load current state from the init values } - aktlocalswitches:=initlocalswitches; - aktmoduleswitches:=initmoduleswitches; - aktmodeswitches:=initmodeswitches; - aktoptimizerswitches:=initoptimizerswitches; - aktsetalloc:=initsetalloc; - aktalignment:=initalignment; - aktfputype:=initfputype; - aktpackenum:=initpackenum; - aktpackrecords:=0; - aktcputype:=initcputype; - aktoptimizecputype:=initoptimizecputype; - aktasmmode:=initasmmode; - aktinterfacetype:=initinterfacetype; + current_settings:=init_settings; { load current asmdata from current_module } current_asmdata:=TAsmData(current_module.asmdata); @@ -503,23 +464,9 @@ implementation { restore symtable state } symtablestack:=oldsymtablestack; macrosymtablestack:=oldmacrosymtablestack; - aktdefproccall:=oldaktdefproccall; current_procinfo:=oldcurrent_procinfo; - aktsourcecodepage:=oldsourcecodepage; - aktlocalswitches:=oldaktlocalswitches; - aktmoduleswitches:=oldaktmoduleswitches; - aktalignment:=oldaktalignment; - aktpackenum:=oldaktpackenum; - aktpackrecords:=oldaktpackrecords; - aktmaxfpuregisters:=oldaktmaxfpuregisters; - aktcputype:=oldaktcputype; - aktoptimizecputype:=oldaktoptimizecputype; - aktfputype:=oldaktfputype; - aktasmmode:=oldaktasmmode; - aktinterfacetype:=oldaktinterfacetype; aktfilepos:=oldaktfilepos; - aktmodeswitches:=oldaktmodeswitches; - aktoptimizerswitches:=oldaktoptimizerswitches; + current_settings:=old_settings; aktexceptblock:=0; exceptblockcounter:=0; end; @@ -540,8 +487,8 @@ implementation begin {$ifdef BrowserLog} { Write Browser Log } - if (cs_browser_log in aktglobalswitches) and - (cs_browser in aktmoduleswitches) then + if (cs_browser_log in current_settings.globalswitches) and + (cs_browser in current_settings.moduleswitches) then begin if browserlog.elements_to_list.empty then begin diff --git a/compiler/pass_1.pas b/compiler/pass_1.pas index 37022e8da4..d6b929454c 100644 --- a/compiler/pass_1.pas +++ b/compiler/pass_1.pas @@ -68,10 +68,10 @@ implementation begin oldcodegenerror:=codegenerror; oldpos:=aktfilepos; - oldlocalswitches:=aktlocalswitches; + oldlocalswitches:=current_settings.localswitches; codegenerror:=false; aktfilepos:=p.fileinfo; - aktlocalswitches:=p.localswitches; + current_settings.localswitches:=p.localswitches; hp:=p.pass_typecheck; { should the node be replaced? } if assigned(hp) then @@ -82,7 +82,7 @@ implementation { switch to new node } p:=hp; end; - aktlocalswitches:=oldlocalswitches; + current_settings.localswitches:=oldlocalswitches; aktfilepos:=oldpos; if codegenerror then begin @@ -123,18 +123,18 @@ implementation begin oldcodegenerror:=codegenerror; oldpos:=aktfilepos; - oldlocalswitches:=aktlocalswitches; + oldlocalswitches:=current_settings.localswitches; codegenerror:=false; aktfilepos:=p.fileinfo; - aktlocalswitches:=p.localswitches; + current_settings.localswitches:=p.localswitches; { checks make always a call } - if ([cs_check_range,cs_check_overflow,cs_check_stack] * aktlocalswitches <> []) then + if ([cs_check_range,cs_check_overflow,cs_check_stack] * current_settings.localswitches <> []) then include(current_procinfo.flags,pi_do_call); { determine the resultdef if not done } if (p.resultdef=nil) then begin aktfilepos:=p.fileinfo; - aktlocalswitches:=p.localswitches; + current_settings.localswitches:=p.localswitches; hp:=p.pass_typecheck; { should the node be replaced? } if assigned(hp) then @@ -152,7 +152,7 @@ implementation if p.resultdef=nil then p.resultdef:=generrordef; end; - aktlocalswitches:=oldlocalswitches; + current_settings.localswitches:=oldlocalswitches; aktfilepos:=oldpos; codegenerror:=codegenerror or oldcodegenerror; end; @@ -160,7 +160,7 @@ implementation begin { first pass } aktfilepos:=p.fileinfo; - aktlocalswitches:=p.localswitches; + current_settings.localswitches:=p.localswitches; hp:=p.pass_1; { should the node be replaced? } if assigned(hp) then @@ -183,7 +183,7 @@ implementation end; include(p.flags,nf_pass1_done); codegenerror:=codegenerror or oldcodegenerror; - aktlocalswitches:=oldlocalswitches; + current_settings.localswitches:=oldlocalswitches; aktfilepos:=oldpos; end else diff --git a/compiler/pass_2.pas b/compiler/pass_2.pas index 74627a737c..72bcb2ea4f 100644 --- a/compiler/pass_2.pas +++ b/compiler/pass_2.pas @@ -158,23 +158,23 @@ implementation if not(nf_error in p.flags) then begin oldcodegenerror:=codegenerror; - oldlocalswitches:=aktlocalswitches; + oldlocalswitches:=current_settings.localswitches; oldpos:=aktfilepos; if not inlining_procedure then aktfilepos:=p.fileinfo; - aktlocalswitches:=p.localswitches; + current_settings.localswitches:=p.localswitches; codegenerror:=false; {$ifdef EXTDEBUG} if (p.expectloc=LOC_INVALID) then Comment(V_Warning,'ExpectLoc is not set before secondpass: '+nodetype2str[p.nodetype]); if (p.location.loc<>LOC_INVALID) then Comment(V_Warning,'Location.Loc is already set before secondpass: '+nodetype2str[p.nodetype]); - if (cs_asm_nodes in aktglobalswitches) then + if (cs_asm_nodes in current_settings.globalswitches) then logsecond(p.nodetype,true); {$endif EXTDEBUG} p.pass_generate_code; {$ifdef EXTDEBUG} - if (cs_asm_nodes in aktglobalswitches) then + if (cs_asm_nodes in current_settings.globalswitches) then logsecond(p.nodetype,false); if (not codegenerror) then begin @@ -185,7 +185,7 @@ implementation if codegenerror then include(p.flags,nf_error); codegenerror:=codegenerror or oldcodegenerror; - aktlocalswitches:=oldlocalswitches; + current_settings.localswitches:=oldlocalswitches; aktfilepos:=oldpos; end else diff --git a/compiler/pbase.pas b/compiler/pbase.pas index cb1c6f592e..c744cdb225 100644 --- a/compiler/pbase.pas +++ b/compiler/pbase.pas @@ -106,7 +106,7 @@ implementation Message1(sym_e_id_not_found,s); { show a fatal that you need -S2 or -Sd, but only if we just parsed the a token that has m_class } - if not(m_class in aktmodeswitches) and + if not(m_class in current_settings.modeswitches) and (Upper(s)=pattern) and (tokeninfo^[idtoken].keyword=m_class) then Message(parser_f_need_objfpc_or_delphi_mode); @@ -266,7 +266,7 @@ implementation function try_consume_hintdirective(var symopt:tsymoptions):boolean; begin try_consume_hintdirective:=false; - if not(m_hintdirective in aktmodeswitches) then + if not(m_hintdirective in current_settings.modeswitches) then exit; repeat case idtoken of diff --git a/compiler/pdecl.pas b/compiler/pdecl.pas index 9f69a00a71..d7daa790ac 100644 --- a/compiler/pdecl.pas +++ b/compiler/pdecl.pas @@ -203,7 +203,7 @@ implementation { create symbol } storetokenpos:=akttokenpos; akttokenpos:=filepos; - sym:=ttypedconstsym.create(orgname,hdef,(cs_typed_const_writable in aktlocalswitches)); + sym:=ttypedconstsym.create(orgname,hdef,(cs_typed_const_writable in current_settings.localswitches)); akttokenpos:=storetokenpos; symtablestack.top.insert(sym); { procvar can have proc directives, but not type references } @@ -234,11 +234,11 @@ implementation begin { get init value } consume(_EQUAL); - if (cs_typed_const_writable in aktlocalswitches) then + if (cs_typed_const_writable in current_settings.localswitches) then tclist:=current_asmdata.asmlists[al_rotypedconsts] else tclist:=current_asmdata.asmlists[al_typedconsts]; - readtypedconst(tclist,hdef,ttypedconstsym(sym),(cs_typed_const_writable in aktlocalswitches)); + readtypedconst(tclist,hdef,ttypedconstsym(sym),(cs_typed_const_writable in current_settings.localswitches)); consume(_SEMICOLON); end; end; @@ -255,7 +255,7 @@ implementation procedure label_dec; begin consume(_LABEL); - if not(cs_support_goto in aktmoduleswitches) then + if not(cs_support_goto in current_settings.moduleswitches) then Message(sym_e_goto_and_label_not_supported); repeat if not(token in [_ID,_INTCONST]) then @@ -349,7 +349,7 @@ implementation trecorddef(pd).symtable.foreach_static(@resolve_type_forward,nil); objectdef : begin - if not(m_fpc in aktmodeswitches) and + if not(m_fpc in current_settings.modeswitches) and (oo_is_forward in tobjectdef(pd).objectoptions) then begin { only give an error as the implementation may follow in an @@ -434,7 +434,7 @@ implementation { MacPas object model is more like Delphi's than like TP's, but } { uses the object keyword instead of class } - if (m_mac in aktmodeswitches) and + if (m_mac in current_settings.modeswitches) and (token = _OBJECT) then token := _CLASS; @@ -499,7 +499,7 @@ implementation end; newtype.typedef:=hdef; { KAZ: handle TGUID declaration in system unit } - if (cs_compilesystem in aktmoduleswitches) and not assigned(rec_tguid) and + if (cs_compilesystem in current_settings.moduleswitches) and not assigned(rec_tguid) and (typename='TGUID') and { name: TGUID and size=16 bytes that is 128 bits } assigned(hdef) and (hdef.deftype=recorddef) and (hdef.size=16) then rec_tguid:=trecorddef(hdef); diff --git a/compiler/pdecobj.pas b/compiler/pdecobj.pas index 54bc3eef50..b0e4fba874 100644 --- a/compiler/pdecobj.pas +++ b/compiler/pdecobj.pas @@ -74,7 +74,7 @@ implementation consume(_SEMICOLON); exit; end; - if (cs_constructor_name in aktglobalswitches) and + if (cs_constructor_name in current_settings.globalswitches) and (pd.procsym.name<>'INIT') then Message(parser_e_constructorname_must_be_init); consume(_SEMICOLON); @@ -99,7 +99,7 @@ implementation begin { check for a class } if not((is_class_or_interface_or_dispinterface(aktobjectdef)) or - (not(m_tp7 in aktmodeswitches) and (is_object(aktobjectdef)))) then + (not(m_tp7 in current_settings.modeswitches) and (is_object(aktobjectdef)))) then Message(parser_e_syntax_error); consume(_PROPERTY); p:=read_property_dec(aktobjectdef); @@ -132,11 +132,11 @@ implementation consume(_SEMICOLON); exit; end; - if (cs_constructor_name in aktglobalswitches) and + if (cs_constructor_name in current_settings.globalswitches) and (pd.procsym.name<>'DONE') then Message(parser_e_destructorname_must_be_done); if not(pd.maxparacount=0) and - (m_fpc in aktmodeswitches) then + (m_fpc in current_settings.modeswitches) then Message(parser_e_no_paras_for_destructor); consume(_SEMICOLON); include(aktobjectdef.objectoptions,oo_has_destructor); @@ -153,7 +153,7 @@ implementation begin aktobjectdef.objecttype:=classtype; { set published flag in $M+ mode or it is inherited } - if (cs_generate_rtti in aktlocalswitches) or + if (cs_generate_rtti in current_settings.localswitches) or (assigned(aktobjectdef.childof) and (oo_can_have_published in aktobjectdef.childof.objectoptions)) then include(aktobjectdef.objectoptions,oo_can_have_published); @@ -209,7 +209,7 @@ implementation begin { need extra check here since interface is a keyword in all pascal modes } - if not(m_class in aktmodeswitches) then + if not(m_class in current_settings.modeswitches) then Message(parser_f_need_objfpc_or_delphi_mode); classtype:=odt_dispinterface; consume(_DISPINTERFACE); @@ -231,9 +231,9 @@ implementation begin { need extra check here since interface is a keyword in all pascal modes } - if not(m_class in aktmodeswitches) then + if not(m_class in current_settings.modeswitches) then Message(parser_f_need_objfpc_or_delphi_mode); - if aktinterfacetype=it_interfacecom then + if current_settings.interfacetype=it_interfacecom then classtype:=odt_interfacecom else {it_interfacecorba} classtype:=odt_interfacecorba; @@ -245,11 +245,11 @@ implementation if n='' then Message(parser_f_no_anonym_objects); aktobjectdef:=tobjectdef.create(classtype,n,nil); - if (cs_compilesystem in aktmoduleswitches) and + if (cs_compilesystem in current_settings.moduleswitches) and (classtype=odt_interfacecom) and (upper(n)='IUNKNOWN') then interface_iunknown:=aktobjectdef; include(aktobjectdef.objectoptions,oo_is_forward); - if (cs_generate_rtti in aktlocalswitches) and + if (cs_generate_rtti in current_settings.localswitches) and (classtype=odt_interfacecom) then include(aktobjectdef.objectoptions,oo_can_have_published); object_dec:=aktobjectdef; @@ -269,7 +269,7 @@ implementation the blocktype is bt_type so the check for typecanbeforward is also necessary (PFV) } (((block_type=bt_type) and typecanbeforward) or - not(m_delphi in aktmodeswitches)) then + not(m_delphi in current_settings.modeswitches)) then begin { a hack, but it's easy to handle } { class reference type } @@ -299,11 +299,11 @@ implementation if n='' then Message(parser_f_no_anonym_objects); aktobjectdef:=tobjectdef.create(odt_class,n,nil); - if (cs_compilesystem in aktmoduleswitches) and (upper(n)='TOBJECT') then + if (cs_compilesystem in current_settings.moduleswitches) and (upper(n)='TOBJECT') then class_tobject:=aktobjectdef; aktobjectdef.objecttype:=odt_class; include(aktobjectdef.objectoptions,oo_is_forward); - if (cs_generate_rtti in aktlocalswitches) then + if (cs_generate_rtti in current_settings.localswitches) then include(aktobjectdef.objectoptions,oo_can_have_published); { all classes must have a vmt !! at offset zero } if not(oo_has_vmt in aktobjectdef.objectoptions) then @@ -514,7 +514,7 @@ implementation storetypecanbeforward:=typecanbeforward; { for tp7 don't allow forward types } - if (m_tp7 in aktmodeswitches) then + if (m_tp7 in current_settings.modeswitches) then typecanbeforward:=false; if not(readobjecttype) then @@ -683,7 +683,7 @@ implementation { all Macintosh Object Pascal methods are virtual. } { this can't be a class method, because macpas mode } { has no m_class } - if (m_mac in aktmodeswitches) then + if (m_mac in current_settings.modeswitches) then include(pd.procoptions,po_virtualmethod); handle_calling_convention(pd); diff --git a/compiler/pdecsub.pas b/compiler/pdecsub.pas index e14232e122..1eff07c756 100644 --- a/compiler/pdecsub.pas +++ b/compiler/pdecsub.pas @@ -233,7 +233,7 @@ implementation tlocalsymtable(pd.localst).insert(aliasvs); { insert result also if support is on } - if (m_result in aktmodeswitches) then + if (m_result in current_settings.modeswitches) then begin sl:=tpropaccesslist.create; sl.addsym(sl_load,pd.funcretsym); @@ -400,7 +400,7 @@ implementation { Delphi/Kylix supports nonsense like } { procedure p(); } if try_to_consume(_RKLAMMER) and - not(m_tp7 in aktmodeswitches) then + not(m_tp7 in current_settings.modeswitches) then exit; { parsing a proc or procvar ? } currparast:=tparasymtable(pd.parast); @@ -420,25 +420,25 @@ implementation if try_to_consume(_CONST) then varspez:=vs_const else - if (m_out in aktmodeswitches) and + if (m_out in current_settings.modeswitches) and try_to_consume(_OUT) then varspez:=vs_out else - if (m_mac in aktmodeswitches) and + if (m_mac in current_settings.modeswitches) and try_to_consume(_POINTPOINTPOINT) then begin include(pd.procoptions,po_varargs); break; end else - if (m_mac in aktmodeswitches) and + if (m_mac in current_settings.modeswitches) and try_to_consume(_PROCEDURE) then begin parseprocvar:=pv_proc; varspez:=vs_const; end else - if (m_mac in aktmodeswitches) and + if (m_mac in current_settings.modeswitches) and try_to_consume(_FUNCTION) then begin parseprocvar:=pv_func; @@ -498,7 +498,7 @@ implementation { define range and type of range } hdef:=tarraydef.create(0,-1,s32inttype); { array of const ? } - if (token=_CONST) and (m_objpas in aktmodeswitches) then + if (token=_CONST) and (m_objpas in current_settings.modeswitches) then begin consume(_CONST); srsym:=search_system_type('TVARREC'); @@ -514,13 +514,13 @@ implementation end else begin - if (m_mac in aktmodeswitches) then + if (m_mac in current_settings.modeswitches) then try_to_consume(_UNIV); {currently does nothing} single_type(hdef,false); { open string ? } if (varspez in [vs_out,vs_var]) and - (cs_openstring in aktmoduleswitches) and + (cs_openstring in current_settings.moduleswitches) and is_shortstring(hdef) then hdef:=openshortstringtype; @@ -543,7 +543,7 @@ implementation locationstr:=''; { default parameter } - if (m_default_para in aktmodeswitches) then + if (m_default_para in current_settings.modeswitches) then begin if try_to_consume(_EQUAL) then begin @@ -719,7 +719,7 @@ implementation if aprocsym.typ<>procsym then begin { we use a different error message for tp7 so it looks more compatible } - if (m_fpc in aktmodeswitches) then + if (m_fpc in current_settings.modeswitches) then Message1(parser_e_overloaded_no_procedure,aprocsym.realname) else Message(parser_e_methode_id_expected); @@ -778,7 +778,7 @@ implementation else begin { we use a different error message for tp7 so it looks more compatible } - if (m_fpc in aktmodeswitches) then + if (m_fpc in current_settings.modeswitches) then Message1(parser_e_overloaded_no_procedure,srsym.realname) else DuplicateSym(nil,srsym); @@ -965,7 +965,7 @@ implementation parse_only and not(is_interface(pd._class)) ) or - (m_repeat_forward in aktmodeswitches) then + (m_repeat_forward in current_settings.modeswitches) then begin consume(_COLON); consume_all_until(_SEMICOLON); @@ -1048,7 +1048,7 @@ implementation Message(parser_e_no_local_operator); if token<>_ID then begin - if not(m_result in aktmodeswitches) then + if not(m_result in current_settings.modeswitches) then consume(_ID); end else @@ -1258,7 +1258,7 @@ end; procedure pd_static(pd:tabstractprocdef); begin - if (cs_static_keyword in aktmoduleswitches) then + if (cs_static_keyword in current_settings.moduleswitches) then begin if pd.deftype=procdef then include(tprocdef(pd).procsym.symoptions,sp_static); @@ -1960,7 +1960,7 @@ const found:=false; { Hint directive? Then exit immediatly } - if (m_hintdirective in aktmodeswitches) then + if (m_hintdirective in current_settings.modeswitches) then begin case idtoken of _LIBRARY, @@ -1974,7 +1974,7 @@ const { C directive is MAC only, because it breaks too much existing code on other platforms (PFV) } if (idtoken=_C) and - not(m_mac in aktmodeswitches) then + not(m_mac in current_settings.modeswitches) then exit; { retrieve data for directive if found } @@ -1997,7 +1997,7 @@ const end; { static needs a special treatment } - if (idtoken=_STATIC) and not (cs_static_keyword in aktmoduleswitches) then + if (idtoken=_STATIC) and not (cs_static_keyword in current_settings.moduleswitches) then exit; { check if method and directive not for object, like public. @@ -2153,7 +2153,7 @@ const else begin {In MacPas a single "external" has the same effect as "external name 'xxx'" } - if (m_mac in aktmodeswitches) then + if (m_mac in current_settings.modeswitches) then result:=tprocdef(pd).procsym.realname; end; end; @@ -2217,7 +2217,7 @@ const begin { set the default calling convention if none provided } if not(po_hascallingconvention in pd.procoptions) then - pd.proccalloption:=aktdefproccall + pd.proccalloption:=current_settings.defproccall else begin if pd.proccalloption=pocall_none then @@ -2241,11 +2241,11 @@ const { Inlining is enabled and supported? } if (po_inline in pd.procoptions) and - not(cs_do_inline in aktlocalswitches) then + not(cs_do_inline in current_settings.localswitches) then begin { Give an error if inline is not supported by the compiler mode, otherwise only give a warning that this procedure will not be inlined } - if not(m_default_inline in aktmodeswitches) then + if not(m_default_inline in current_settings.modeswitches) then Message(parser_e_proc_inline_not_supported) else Message(parser_w_inlining_disabled); @@ -2309,7 +2309,7 @@ const var res : boolean; begin - if (m_mac in aktmodeswitches) and (cs_externally_visible in aktlocalswitches) then + if (m_mac in current_settings.modeswitches) and (cs_externally_visible in current_settings.localswitches) then begin tprocdef(pd).aliasnames.insert(tprocdef(pd).procsym.realname); include(pd.procoptions,po_public); @@ -2425,7 +2425,7 @@ const But for an overload declared function this is not allowed } if { check if empty implementation arguments match is allowed } ( - not(m_repeat_forward in aktmodeswitches) and + not(m_repeat_forward in current_settings.modeswitches) and not(pd.forwarddef) and (pd.maxparacount=0) and not(po_overload in hd.procoptions) @@ -2455,12 +2455,12 @@ const also the parameters must match also with the type } if (hd.proctypeoption<>pd.proctypeoption) or ( - (m_repeat_forward in aktmodeswitches) and + (m_repeat_forward in current_settings.modeswitches) and (not((pd.maxparacount=0) or (compare_paras(pd.paras,hd.paras,cp_all,[cpo_comparedefaultvalue])>=te_equal))) ) or ( - ((m_repeat_forward in aktmodeswitches) or + ((m_repeat_forward in current_settings.modeswitches) or not(is_void(pd.returndef))) and (not equal_defs(hd.returndef,pd.returndef))) then begin @@ -2491,7 +2491,7 @@ const convention in the interface or implementation if there was no convention specified in the other part } - if (m_delphi in aktmodeswitches) then + if (m_delphi in current_settings.modeswitches) then begin if not(po_hascallingconvention in pd.procoptions) then pd.proccalloption:=hd.proccalloption @@ -2517,7 +2517,7 @@ const { Check procedure options, Delphi requires that class is repeated in the implementation for class methods } - if (m_fpc in aktmodeswitches) then + if (m_fpc in current_settings.modeswitches) then po_comp:=[po_classmethod,po_varargs,po_methodpointer,po_interrupt] else po_comp:=[po_classmethod,po_methodpointer]; @@ -2535,7 +2535,7 @@ const MessagePos(pd.fileinfo,parser_e_proc_already_external); { Check parameters } - if (m_repeat_forward in aktmodeswitches) or + if (m_repeat_forward in current_settings.modeswitches) or (pd.minparacount>0) then begin { If mangled names are equal then they have the same amount of arguments } @@ -2640,7 +2640,7 @@ const end; { check for allowing overload directive } - if not(m_fpc in aktmodeswitches) then + if not(m_fpc in current_settings.modeswitches) then begin { overload directive turns on overloading } if ((po_overload in pd.procoptions) or diff --git a/compiler/pdecvar.pas b/compiler/pdecvar.pas index 573712a378..3b77e1cf57 100644 --- a/compiler/pdecvar.pas +++ b/compiler/pdecvar.pas @@ -260,7 +260,7 @@ implementation if try_to_consume(_LECKKLAMMER) then begin if (sp_published in current_object_option) and - not (m_delphi in aktmodeswitches) then + not (m_delphi in current_settings.modeswitches) then Message(parser_e_cant_publish_that_property); { create a list of the parameters } symtablestack.push(readprocdef.parast); @@ -271,7 +271,7 @@ implementation varspez:=vs_var else if try_to_consume(_CONST) then varspez:=vs_const - else if (m_out in aktmodeswitches) and try_to_consume(_OUT) then + else if (m_out in current_settings.modeswitches) and try_to_consume(_OUT) then varspez:=vs_out else varspez:=vs_value; @@ -763,7 +763,7 @@ implementation until not try_to_consume(_COMMA); consume(_COLON); - if (m_gpc in aktmodeswitches) and + if (m_gpc in current_settings.modeswitches) and (token=_ID) and (orgpattern='__asmname__') then begin @@ -833,8 +833,8 @@ implementation system_i386_wdosx,system_i386_win32, system_arm_wince,system_i386_wince, system_arm_gba]) or - (m_objfpc in aktmodeswitches) or - (m_delphi in aktmodeswitches)) then + (m_objfpc in current_settings.modeswitches) or + (m_delphi in current_settings.modeswitches)) then begin abssym:=tabsolutevarsym.create(vs.realname,hdef); abssym.fileinfo:=vs.fileinfo; @@ -899,7 +899,7 @@ implementation { Handling of Delphi typed const = initialized vars } if (token=_EQUAL) and - not(m_tp7 in aktmodeswitches) and + not(m_tp7 in current_settings.modeswitches) and (symtablestack.top.symtabletype<>parasymtable) then begin { Add calling convention for procvar } @@ -930,7 +930,7 @@ implementation handle_calling_convention(tprocvardef(hdef)); { Handling of Delphi typed const = initialized vars } if (token=_EQUAL) and - not(m_tp7 in aktmodeswitches) and + not(m_tp7 in current_settings.modeswitches) and (symtablestack.top.symtabletype<>parasymtable) then begin read_default_value(sc,hdef,vd_threadvar in options); @@ -945,12 +945,12 @@ implementation begin if ( (token=_ID) and - (m_cvar_support in aktmodeswitches) and + (m_cvar_support in current_settings.modeswitches) and (idtoken in [_EXPORT,_EXTERNAL,_PUBLIC,_CVAR]) ) or ( - (m_mac in aktmodeswitches) and - ((cs_external_var in aktlocalswitches) or (cs_externally_visible in aktlocalswitches)) + (m_mac in current_settings.modeswitches) and + ((cs_external_var in current_settings.localswitches) or (cs_externally_visible in current_settings.localswitches)) ) then begin { only allowed for one var } @@ -981,15 +981,15 @@ implementation semicolonatend:= true; end; { macpas specific handling due to some switches} - if (m_mac in aktmodeswitches) then + if (m_mac in current_settings.modeswitches) then begin - if (cs_external_var in aktlocalswitches) then + if (cs_external_var in current_settings.localswitches) then begin {The effect of this is the same as if cvar; external; has been given as directives.} is_cdecl:=true; C_name:=target_info.Cprefix+sorg; extern_var:=true; end - else if (cs_externally_visible in aktlocalswitches) then + else if (cs_externally_visible in current_settings.localswitches) then begin {The effect of this is the same as if cvar has been given as directives.} is_cdecl:=true; C_name:=target_info.Cprefix+sorg; @@ -1231,7 +1231,7 @@ implementation { Check for STATIC directive } if (vd_object in options) and - (cs_static_keyword in aktmoduleswitches) and + (cs_static_keyword in current_settings.moduleswitches) and (try_to_consume(_STATIC)) then begin include(current_object_option,sp_static); @@ -1317,7 +1317,7 @@ implementation Message(type_e_ordinal_expr_expected); consume(_OF); - UnionSymtable:=trecordsymtable.create(aktpackrecords); + UnionSymtable:=trecordsymtable.create(current_settings.packrecords); UnionDef:=trecorddef.create(unionsymtable); uniondef.isunion:=true; startvarrecsize:=UnionSymtable.datasize; @@ -1374,9 +1374,9 @@ implementation {$endif powerpc} { Align the offset where the union symtable is added } if (recst.usefieldalignment=-1) then - usedalign:=used_align(unionsymtable.recordalignment,aktalignment.recordalignmin,aktalignment.maxCrecordalign) + usedalign:=used_align(unionsymtable.recordalignment,current_settings.alignment.recordalignmin,current_settings.alignment.maxCrecordalign) else - usedalign:=used_align(unionsymtable.recordalignment,aktalignment.recordalignmin,aktalignment.recordalignmax); + usedalign:=used_align(unionsymtable.recordalignment,current_settings.alignment.recordalignmin,current_settings.alignment.recordalignmax); offset:=align(recst.datasize,usedalign); recst.datasize:=offset+unionsymtable.datasize; diff --git a/compiler/pexpr.pas b/compiler/pexpr.pas index 20d635a1f5..8b983e22ee 100644 --- a/compiler/pexpr.pas +++ b/compiler/pexpr.pas @@ -133,7 +133,7 @@ implementation end else begin - if cs_ansistrings in aktlocalswitches then + if cs_ansistrings in current_settings.localswitches then def:=cansistringtype else def:=cshortstringtype; @@ -363,7 +363,7 @@ implementation begin if try_to_consume(_LKLAMMER) then begin - if not (m_mac in aktmodeswitches) then + if not (m_mac in current_settings.modeswitches) then begin if not(try_to_consume(_RKLAMMER)) then begin @@ -404,7 +404,7 @@ implementation in_break : begin - if not (m_mac in aktmodeswitches) then + if not (m_mac in current_settings.modeswitches) then statement_syssym:=cbreaknode.create else begin @@ -415,7 +415,7 @@ implementation in_continue : begin - if not (m_mac in aktmodeswitches) then + if not (m_mac in current_settings.modeswitches) then statement_syssym:=ccontinuenode.create else begin @@ -426,7 +426,7 @@ implementation in_leave : begin - if m_mac in aktmodeswitches then + if m_mac in current_settings.modeswitches then statement_syssym:=cbreaknode.create else begin @@ -437,7 +437,7 @@ implementation in_cycle : begin - if m_mac in aktmodeswitches then + if m_mac in current_settings.modeswitches then statement_syssym:=ccontinuenode.create else begin @@ -614,7 +614,7 @@ implementation in_args:=true; p1:=comp_expr(true); p1:=caddrnode.create(p1); - if cs_typed_addresses in aktlocalswitches then + if cs_typed_addresses in current_settings.localswitches then include(p1.flags,nf_typedaddr); consume(_RKLAMMER); statement_syssym:=p1; @@ -938,8 +938,8 @@ implementation getaddr:=true; end else - if (m_tp_procvar in aktmodeswitches) or - (m_mac_procvar in aktmodeswitches) then + if (m_tp_procvar in current_settings.modeswitches) or + (m_mac_procvar in current_settings.modeswitches) then begin aprocdef:=Tprocsym(sym).search_procdef_byprocvardef(getprocvardef); if assigned(aprocdef) then @@ -1038,8 +1038,8 @@ implementation begin if not assigned(pv) then internalerror(200301121); - if (m_tp_procvar in aktmodeswitches) or - (m_mac_procvar in aktmodeswitches) then + if (m_tp_procvar in current_settings.modeswitches) or + (m_mac_procvar in current_settings.modeswitches) then begin hp:=p2; hpp:=@p2; @@ -1317,8 +1317,8 @@ implementation (token=_LKLAMMER) or ( ( - (m_tp7 in aktmodeswitches) or - (m_delphi in aktmodeswitches) + (m_tp7 in current_settings.modeswitches) or + (m_delphi in current_settings.modeswitches) ) and (afterassignment or in_args) and not(vo_is_result in tabstractvarsym(srsym).varoptions) @@ -1413,7 +1413,7 @@ implementation begin { We need to know if this unit uses Variants } if (hdef=cvarianttype) and - not(cs_compilesystem in aktmoduleswitches) then + not(cs_compilesystem in current_settings.moduleswitches) then current_module.flags:=current_module.flags or uf_uses_variants; if (block_type<>bt_specialize) and try_to_consume(_LKLAMMER) then @@ -1529,7 +1529,7 @@ implementation conststring : begin len:=tconstsym(srsym).value.len; - if not(cs_ansistrings in aktlocalswitches) and (len>255) then + if not(cs_ansistrings in current_settings.localswitches) and (len>255) then len:=255; getmem(pc,len+1); move(pchar(tconstsym(srsym).value.valueptr)^,pc^,len); @@ -1807,8 +1807,8 @@ implementation { support tp/mac procvar^ if the procvar returns a pointer type } - if ((m_tp_procvar in aktmodeswitches) or - (m_mac_procvar in aktmodeswitches)) and + if ((m_tp_procvar in current_settings.modeswitches) or + (m_mac_procvar in current_settings.modeswitches)) and (p1.resultdef.deftype=procvardef) and (tprocvardef(p1.resultdef).returndef.deftype=pointerdef) then begin @@ -1859,7 +1859,7 @@ implementation begin { support delphi autoderef } if (tpointerdef(p1.resultdef).pointeddef.deftype=arraydef) and - (m_autoderef in aktmodeswitches) then + (m_autoderef in current_settings.modeswitches) then p1:=cderefnode.create(p1); p2:=comp_expr(true); { Support Pbytevar[0..9] which returns array [0..9].} @@ -1890,7 +1890,7 @@ implementation { the macpas unit } if (p1.resultdef.deftype = orddef) then begin - if (m_mac in aktmodeswitches) and + if (m_mac in current_settings.modeswitches) and is_integer(p1.resultdef) and (p1.resultdef.size = 4) then int_to_4cc(p1) @@ -1963,7 +1963,7 @@ implementation begin consume(_POINT); if (p1.resultdef.deftype=pointerdef) and - (m_autoderef in aktmodeswitches) then + (m_autoderef in current_settings.modeswitches) then begin p1:=cderefnode.create(p1); do_typecheckpass(p1); @@ -2445,7 +2445,7 @@ implementation end; got_addrn:=false; p1:=caddrnode.create(p1); - if cs_typed_addresses in aktlocalswitches then + if cs_typed_addresses in current_settings.localswitches then include(p1.flags,nf_typedaddr); { Store the procvar that we are expecting, the addrn will use the information to find the correct diff --git a/compiler/pinline.pas b/compiler/pinline.pas index d6842c3322..40e64a35fc 100644 --- a/compiler/pinline.pas +++ b/compiler/pinline.pas @@ -82,7 +82,7 @@ implementation set_varstate(p,vs_written,[]) else set_varstate(p,vs_readwritten,[vsf_must_be_valid]); - if (m_mac in aktmodeswitches) and + if (m_mac in current_settings.modeswitches) and is_class(p.resultdef) then begin classh:=tobjectdef(p.resultdef); @@ -138,7 +138,7 @@ implementation new_dispose_statement := p2; end { constructor,destructor specified } - else if not(m_mac in aktmodeswitches) and + else if not(m_mac in current_settings.modeswitches) and try_to_consume(_COMMA) then begin { extended syntax of new and dispose } @@ -212,7 +212,7 @@ implementation do_member_read(classh,false,sym,p2,again,[callflag]) else begin - if not(m_fpc in aktmodeswitches) then + if not(m_fpc in current_settings.modeswitches) then do_member_read(classh,false,sym,p2,again,[callflag]) else begin @@ -275,8 +275,8 @@ implementation if (tpointerdef(p.resultdef).pointeddef.deftype=orddef) and (torddef(tpointerdef(p.resultdef).pointeddef).typ=uvoid) then begin - if (m_tp7 in aktmodeswitches) or - (m_delphi in aktmodeswitches) then + if (m_tp7 in current_settings.modeswitches) or + (m_delphi in current_settings.modeswitches) then Message(parser_w_no_new_dispose_on_void_pointers) else Message(parser_e_no_new_dispose_on_void_pointers); @@ -705,7 +705,7 @@ implementation if is_ansistring(paradef) or (is_chararray(paradef) and (paradef.size>255)) or - ((cs_ansistrings in aktlocalswitches) and + ((cs_ansistrings in current_settings.localswitches) and is_pchar(paradef)) then copynode:=ccallnode.createintern('fpc_ansistr_copy',paras) else diff --git a/compiler/pmodules.pas b/compiler/pmodules.pas index c33294ba81..b744f4c5d5 100644 --- a/compiler/pmodules.pas +++ b/compiler/pmodules.pas @@ -89,15 +89,15 @@ implementation { Start and end module debuginfo, at least required for stabs to insert n_sourcefile lines } - if (cs_debuginfo in aktmoduleswitches) or - (cs_use_lineinfo in aktglobalswitches) then + if (cs_debuginfo in current_settings.moduleswitches) or + (cs_use_lineinfo in current_settings.globalswitches) then debuginfo.insertmoduleinfo; { create the .s file and assemble it } GenerateAsm(false); { Also create a smartlinked version ? } - if (cs_create_smart in aktmoduleswitches) and + if (cs_create_smart in current_settings.moduleswitches) and (not use_smartlink_section) then begin GenerateAsm(true); @@ -116,7 +116,7 @@ implementation current_module.linkunitofiles.add(current_module.objfilename^,link_static); current_module.flags:=current_module.flags or uf_static_linked; - if (cs_create_smart in aktmoduleswitches) and + if (cs_create_smart in current_settings.moduleswitches) and not use_smartlink_section then begin current_module.linkunitstaticlibs.add(current_module.staticlibfilename^,link_smart); @@ -128,7 +128,7 @@ implementation procedure create_dwarf; begin { Dwarf conflicts with smartlinking in separate .a files } - if (cs_create_smart in aktmoduleswitches) and + if (cs_create_smart in current_settings.moduleswitches) and not use_smartlink_section then exit; { Call frame information } @@ -416,7 +416,7 @@ implementation hp.adddependency(current_module); { add to symtable stack } symtablestack.push(hp.globalsymtable); - if (m_mac in aktmodeswitches) and + if (m_mac in current_settings.modeswitches) and assigned(hp.globalmacrosymtable) then macrosymtablestack.push(hp.globalmacrosymtable); { insert unitsym } @@ -461,7 +461,7 @@ implementation macrosymtablestack.push(initialmacrosymtable); { are we compiling the system unit? } - if (cs_compilesystem in aktmoduleswitches) then + if (cs_compilesystem in current_settings.moduleswitches) then begin systemunit:=tglobalsymtable(current_module.localsymtable); { create system defines } @@ -485,33 +485,33 @@ implementation if not(current_module.is_unit) then begin { Heaptrc unit, load heaptrace before any other units especially objpas } - if (cs_use_heaptrc in aktglobalswitches) then + if (cs_use_heaptrc in current_settings.globalswitches) then AddUnit('HeapTrc'); { Lineinfo unit } - if (cs_use_lineinfo in aktglobalswitches) then + if (cs_use_lineinfo in current_settings.globalswitches) then AddUnit('LineInfo'); { Lineinfo unit } - if (cs_gdb_valgrind in aktglobalswitches) then + if (cs_gdb_valgrind in current_settings.globalswitches) then AddUnit('CMem'); {$ifdef cpufpemu} { Floating point emulation unit? softfpu must be in the system unit anyways (FK) - if (cs_fp_emulation in aktmoduleswitches) and not(target_info.system in system_wince) then + if (cs_fp_emulation in current_settings.moduleswitches) and not(target_info.system in system_wince) then AddUnit('SoftFpu'); } {$endif cpufpemu} end; { Objpas unit? } - if m_objpas in aktmodeswitches then + if m_objpas in current_settings.modeswitches then AddUnit('ObjPas'); { Macpas unit? } - if m_mac in aktmodeswitches then + if m_mac in current_settings.modeswitches then AddUnit('MacPas'); { Profile unit? Needed for go32v2 only } - if (cs_profile in aktmoduleswitches) and + if (cs_profile in current_settings.moduleswitches) and (target_info.system in [system_i386_go32v2,system_i386_watcom]) then AddUnit('Profile'); - if (cs_load_fpcylix_unit in aktglobalswitches) then + if (cs_load_fpcylix_unit in current_settings.globalswitches) then begin AddUnit('FPCylix'); AddUnit('DynLibs'); @@ -548,7 +548,7 @@ implementation consume(_ID); { support "<unit> in '<file>'" construct, but not for tp7 } fn:=''; - if not(m_tp7 in aktmodeswitches) and + if not(m_tp7 in current_settings.modeswitches) and try_to_consume(_OP_IN) then fn:=FixFileName(get_stringconst); { Give a warning if objpas is loaded } @@ -614,7 +614,7 @@ implementation pu.unitsym.module:=pu.u; { add to symtable stack } symtablestack.push(pu.u.globalsymtable); - if (m_mac in aktmodeswitches) and + if (m_mac in current_settings.modeswitches) and assigned(pu.u.globalmacrosymtable) then macrosymtablestack.push(pu.u.globalmacrosymtable); end; @@ -697,10 +697,10 @@ implementation procedure setupglobalswitches; begin { can't have local browser when no global browser } - if (cs_local_browser in aktmoduleswitches) and - not(cs_browser in aktmoduleswitches) then - exclude(aktmoduleswitches,cs_local_browser); - if (cs_create_pic in aktmoduleswitches) then + if (cs_local_browser in current_settings.moduleswitches) and + not(cs_browser in current_settings.moduleswitches) then + exclude(current_settings.moduleswitches,cs_local_browser); + if (cs_create_pic in current_settings.moduleswitches) then begin def_system_macro('FPC_PIC'); def_system_macro('PIC'); @@ -829,7 +829,7 @@ implementation globalvarsym : tglobalvarsym; {$endif i386} begin - if m_mac in aktmodeswitches then + if m_mac in current_settings.modeswitches then current_module.mode_switch_allowed:= false; consume(_UNIT); @@ -852,7 +852,7 @@ implementation new(s2); s2^:=upper(SplitName(main_file.name^)); unitname8:=copy(current_module.modulename^,1,8); - if (cs_check_unit_name in aktglobalswitches) and + if (cs_check_unit_name in current_settings.globalswitches) and ( not( (current_module.modulename^=s2^) or @@ -869,7 +869,7 @@ implementation ) then Message1(unit_e_illegal_unit_name,current_module.realmodulename^); if (current_module.modulename^='SYSTEM') then - include(aktmoduleswitches,cs_compilesystem); + include(current_settings.moduleswitches,cs_compilesystem); dispose(s2); dispose(s1); end; @@ -893,11 +893,11 @@ implementation { maybe turn off m_objpas if we are compiling objpas } if (current_module.modulename^='OBJPAS') then - exclude(aktmodeswitches,m_objpas); + exclude(current_settings.modeswitches,m_objpas); { maybe turn off m_mac if we are compiling macpas } if (current_module.modulename^='MACPAS') then - exclude(aktmodeswitches,m_mac); + exclude(current_settings.modeswitches,m_mac); parse_only:=true; @@ -916,7 +916,7 @@ implementation make_ref:=true; { insert qualifier for the system unit (allows system.writeln) } - if not(cs_compilesystem in aktmoduleswitches) and + if not(cs_compilesystem in current_settings.moduleswitches) and (token=_USES) then begin loadunits; @@ -944,7 +944,7 @@ implementation { Export macros defined in the interface for macpas. The macros are put in the globalmacrosymtable that will only be used by other units. The current unit continues to use the localmacrosymtable } - if (m_mac in aktmodeswitches) then + if (m_mac in current_settings.modeswitches) then begin current_module.globalmacrosymtable:=tmacrosymtable.create(true); current_module.localmacrosymtable.foreach_static(@copy_macro,nil); @@ -959,7 +959,7 @@ implementation end; { Our interface is compiled, generate CRC and switch to implementation } - if not(cs_compilesystem in aktmoduleswitches) and + if not(cs_compilesystem in current_settings.moduleswitches) and (Errorcount=0) then tppumodule(current_module).getppucrc; current_module.in_interface:=false; @@ -970,7 +970,7 @@ implementation reload_flagged_units; { Parse the implementation section } - if (m_mac in aktmodeswitches) and try_to_consume(_END) then + if (m_mac in current_settings.modeswitches) and try_to_consume(_END) then has_impl:= false else has_impl:= true; @@ -981,7 +981,7 @@ implementation current_module.localsymtable:=tstaticsymtable.create(current_module.modulename^,current_module.moduleid); {$ifdef i386} - if cs_create_pic in aktmoduleswitches then + if cs_create_pic in current_settings.moduleswitches then begin { insert symbol for got access in assembler code} globalvarsym:=tglobalvarsym.create('_GLOBAL_OFFSET_TABLE_',vs_value,voidpointertype,[vo_is_external,vo_is_C_var]); @@ -1097,7 +1097,7 @@ implementation maybeloadvariantsunit; { generate debuginfo } - if (cs_debuginfo in aktmoduleswitches) then + if (cs_debuginfo in current_settings.moduleswitches) then debuginfo.inserttypeinfo; { generate wrappers for interfaces } @@ -1144,11 +1144,11 @@ implementation if (Errorcount=0) then tppumodule(current_module).writeppu; - if not(cs_compilesystem in aktmoduleswitches) then + if not(cs_compilesystem in current_settings.moduleswitches) then if store_interface_crc<>current_module.interface_crc then Message1(unit_u_interface_crc_changed,current_module.ppufilename^); {$ifdef EXTDEBUG} - if not(cs_compilesystem in aktmoduleswitches) then + if not(cs_compilesystem in current_settings.moduleswitches) then if (store_crc<>current_module.crc) and simplify_ppu then Message1(unit_u_implementation_crc_changed,current_module.ppufilename^); {$endif EXTDEBUG} @@ -1197,13 +1197,13 @@ implementation (target_info.system in [system_i386_win32,system_i386_wdosx]) and (target_info.assem<>as_i386_pecoff) then begin - include(aktglobalswitches,cs_link_strip); + include(current_settings.globalswitches,cs_link_strip); { Warning stabs info does not work with reloc section !! } - if cs_debuginfo in aktmoduleswitches then + if cs_debuginfo in current_settings.moduleswitches then begin Message1(parser_w_parser_reloc_no_debug,current_module.mainsource^); Message(parser_w_parser_win32_debug_needs_WN); - exclude(aktmoduleswitches,cs_debuginfo); + exclude(current_settings.moduleswitches,cs_debuginfo); end; end; @@ -1225,7 +1225,7 @@ implementation exportlib.preparelib(orgpattern); if tf_library_needs_pic in target_info.flags then - include(aktmoduleswitches,cs_create_pic); + include(current_settings.moduleswitches,cs_create_pic); consume(_ID); consume(_SEMICOLON); @@ -1402,7 +1402,7 @@ implementation {$endif arm} { generate debuginfo } - if (cs_debuginfo in aktmoduleswitches) then + if (cs_debuginfo in current_settings.moduleswitches) then debuginfo.inserttypeinfo; InsertThreadvars; @@ -1421,7 +1421,7 @@ implementation exportlib.generatelib; { Reference all DEBUGINFO sections from the main .text section } - if (cs_debuginfo in aktmoduleswitches) then + if (cs_debuginfo in current_settings.moduleswitches) then debuginfo.referencesections(current_asmdata.asmlists[al_procedures]); { Resource strings } @@ -1462,7 +1462,7 @@ implementation if (compile_level=1) then begin { write .def file } - if (cs_link_deffile in aktglobalswitches) then + if (cs_link_deffile in current_settings.globalswitches) then deffile.writefile; { insert all .o files from all loaded units and unload the units, we don't need them anymore. diff --git a/compiler/powerpc/agppcmpw.pas b/compiler/powerpc/agppcmpw.pas index bcfe6fa31d..e86c646fe0 100644 --- a/compiler/powerpc/agppcmpw.pas +++ b/compiler/powerpc/agppcmpw.pas @@ -698,8 +698,8 @@ interface exit; InlineLevel:=0; { lineinfo is only needed for al_procedures (PFV) } - do_line:=((cs_asm_source in aktglobalswitches) or - (cs_lineinfo in aktmoduleswitches)) + do_line:=((cs_asm_source in current_settings.globalswitches) or + (cs_lineinfo in current_settings.moduleswitches)) and (p=current_asmdata.asmlists[al_procedures]); DoNotSplitLine:=false; hp:=tai(p.first); @@ -719,7 +719,7 @@ interface if assigned(infile) then begin { open only if needed !! } - if (cs_asm_source in aktglobalswitches) then + if (cs_asm_source in current_settings.globalswitches) then infile.open; end; { avoid unnecessary reopens of the same file !! } @@ -728,7 +728,7 @@ interface lastfileinfo.line:=-1; end; { write source } - if (cs_asm_source in aktglobalswitches) and + if (cs_asm_source in current_settings.globalswitches) and assigned(infile) then begin if (infile<>lastinfile) then @@ -1216,7 +1216,7 @@ interface { masm does not seem to recognize specific extensions and uses .obj allways PM } if (target_asm.id = as_i386_masm) then begin - if not(cs_asm_extern in aktglobalswitches) then + if not(cs_asm_extern in current_settings.globalswitches) then begin if Not FileExists(objfile) and FileExists(ForceExtension(objfile,'.obj')) then diff --git a/compiler/powerpc/cgcpu.pas b/compiler/powerpc/cgcpu.pas index 517d42a164..0cd12e1e9a 100644 --- a/compiler/powerpc/cgcpu.pas +++ b/compiler/powerpc/cgcpu.pas @@ -1132,7 +1132,7 @@ const begin { save link register? } if (pi_do_call in current_procinfo.flags) or - ([cs_lineinfo,cs_debuginfo] * aktmoduleswitches <> []) then + ([cs_lineinfo,cs_debuginfo] * current_settings.moduleswitches <> []) then begin a_reg_alloc(list,NR_R0); { save return address... } @@ -1178,7 +1178,7 @@ const if usesfpr then begin { save floating-point registers - if (cs_create_pic in aktmoduleswitches) and not(usesgpr) then + if (cs_create_pic in current_settings.moduleswitches) and not(usesgpr) then begin a_call_name(current_asmdata.RefAsmSymbol('_savefpr_'+tostr(ord(firstregfpu)-ord(R_F14)+14)+'_g')); gotgot:=true; @@ -1204,7 +1204,7 @@ const if usesgpr then begin { - if cs_create_pic in aktmoduleswitches then + if cs_create_pic in current_settings.moduleswitches then begin a_call_name(current_asmdata.RefAsmSymbol('_savegpr_'+tostr(ord(firstreggpr)-ord(R_14)+14)+'_g')); gotgot:=true; @@ -1213,7 +1213,7 @@ const a_call_name(current_asmdata.RefAsmSymbol('_savegpr_'+tostr(ord(firstreggpr)-ord(R_14)+14))) } if (firstregint <= RS_R22) or - ((cs_opt_size in aktoptimizerswitches) and + ((cs_opt_size in current_settings.optimizerswitches) and { with RS_R30 it's also already smaller, but too big a speed trade-off to make } (firstregint <= RS_R29)) then begin @@ -1346,7 +1346,7 @@ const if (usesgpr) then begin if (firstregint <= RS_R22) or - ((cs_opt_size in aktoptimizerswitches) and + ((cs_opt_size in current_settings.optimizerswitches) and { with RS_R30 it's also already smaller, but too big a speed trade-off to make } (firstregint <= RS_R29)) then begin @@ -1987,7 +1987,7 @@ const var hl : tasmlabel; begin - if not(cs_check_overflow in aktlocalswitches) then + if not(cs_check_overflow in current_settings.localswitches) then exit; current_asmdata.getjumplabel(hl); if not ((def.deftype=pointerdef) or @@ -2049,7 +2049,7 @@ const make_global:=false; if (not current_module.is_unit) or - (cs_create_smart in aktmoduleswitches) or + (cs_create_smart in current_settings.moduleswitches) or (procdef.owner.defowner.owner.symtabletype=globalsymtable) then make_global:=true; diff --git a/compiler/powerpc/cpupi.pas b/compiler/powerpc/cpupi.pas index 83139685e6..ec45e62ca4 100644 --- a/compiler/powerpc/cpupi.pas +++ b/compiler/powerpc/cpupi.pas @@ -106,13 +106,13 @@ unit cpupi; begin if not(po_assembler in procdef.procoptions) then begin - if cs_asm_source in aktglobalswitches then + if cs_asm_source in current_settings.globalswitches then aktproccode.insert(Tai_comment.Create(strpnew('Parameter copies start at: r1+'+tostr(procdef.parast.address_fixup)))); - if cs_asm_source in aktglobalswitches then + if cs_asm_source in current_settings.globalswitches then aktproccode.insert(Tai_comment.Create(strpnew('Locals start at: r1+'+tostr(procdef.localst.address_fixup)))); firsttemp_offset:=align(procdef.localst.address_fixup+procdef.localst.datasize,16); - if cs_asm_source in aktglobalswitches then + if cs_asm_source in current_settings.globalswitches then aktproccode.insert(Tai_comment.Create(strpnew('Temp. space start: r1+'+tostr(firsttemp_offset)))); //!!!! tg.setfirsttemp(firsttemp_offset); diff --git a/compiler/powerpc/itcpugas.pas b/compiler/powerpc/itcpugas.pas index e99d876e7c..282c5ce1aa 100644 --- a/compiler/powerpc/itcpugas.pas +++ b/compiler/powerpc/itcpugas.pas @@ -138,7 +138,7 @@ implementation However, we do not do this for smart linked files since that would cause a lot of (mostly useless) overhead. In theory, we could also not do it if "-a" is not used. The Mac OS X assembler (which is based on GNU as) "natively" supports full register names.} - if (cs_create_smart in aktmoduleswitches) and + if (cs_create_smart in current_settings.moduleswitches) and (target_info.system <> system_powerpc_darwin) then result:=gas_regname_short_table[p] else diff --git a/compiler/powerpc/nppcadd.pas b/compiler/powerpc/nppcadd.pas index 42a2865df5..d4c5490826 100644 --- a/compiler/powerpc/nppcadd.pas +++ b/compiler/powerpc/nppcadd.pas @@ -308,11 +308,11 @@ interface if not cmpop then location_reset(location,LOC_REGISTER,def_cgsize(resultdef)); - load_left_right(cmpop,((cs_check_overflow in aktlocalswitches) and + load_left_right(cmpop,((cs_check_overflow in current_settings.localswitches) and (nodetype in [addn,subn])) or (nodetype = muln)); if (nodetype <> muln) and - (not(cs_check_overflow in aktlocalswitches) or + (not(cs_check_overflow in current_settings.localswitches) or not(nodetype in [addn,subn])) then begin case nodetype of @@ -564,7 +564,7 @@ interface case nodetype of addn : begin - if (cs_mmx_saturation in aktlocalswitches) then + if (cs_mmx_saturation in current_settings.localswitches) then begin case mmxbase of mmxs8bit: @@ -600,7 +600,7 @@ interface end; subn : begin - if (cs_mmx_saturation in aktlocalswitches) then + if (cs_mmx_saturation in current_settings.localswitches) then begin case mmxbase of mmxs8bit: @@ -819,13 +819,13 @@ interface else location_reset(location,LOC_FLAGS,OS_NO); - load_left_right(cmpop, (cs_check_overflow in aktlocalswitches) and + load_left_right(cmpop, (cs_check_overflow in current_settings.localswitches) and (nodetype in [addn,subn,muln])); if not(cmpop) then location.register := cg.getintregister(current_asmdata.CurrAsmList,OS_INT); - if not(cs_check_overflow in aktlocalswitches) or + if not(cs_check_overflow in current_settings.localswitches) or (cmpop) or (nodetype in [orn,andn,xorn]) then begin diff --git a/compiler/powerpc/nppcmat.pas b/compiler/powerpc/nppcmat.pas index 45ca7b759b..a515405dec 100644 --- a/compiler/powerpc/nppcmat.pas +++ b/compiler/powerpc/nppcmat.pas @@ -207,7 +207,7 @@ end; cg.a_load_reg_reg(current_asmdata.CurrAsmList, OS_INT, OS_INT, numerator, resultreg); end else if (tordconstnode(right).value = -1) then begin // note: only in the signed case possible..., may overflow - current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(negops[cs_check_overflow in aktlocalswitches], resultreg, numerator)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(negops[cs_check_overflow in current_settings.localswitches], resultreg, numerator)); end else if (ispowerof2(tordconstnode(right).value, power)) then begin if (is_signed(right.resultdef)) then begin { From "The PowerPC Compiler Writer's Guide", pg. 52ff } @@ -338,7 +338,7 @@ end; { needs overflow checking, (-maxlongint-1) div (-1) overflows! } op := divops[is_signed(right.resultdef), - cs_check_overflow in aktlocalswitches]; + cs_check_overflow in current_settings.localswitches]; current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(op,resultreg,numerator, divider)); @@ -567,7 +567,7 @@ end; end; current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_const(A_SUBFIC, location.register64.reglo,left.location.register64.reglo,0)); - if not(cs_check_overflow in aktlocalswitches) then + if not(cs_check_overflow in current_settings.localswitches) then current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_SUBFZE, location.register64.reghi,left.location.register64.reghi)) else @@ -614,7 +614,7 @@ end; { choose appropriate operand } if left.resultdef.deftype <> floatdef then begin - if not(cs_check_overflow in aktlocalswitches) then + if not(cs_check_overflow in current_settings.localswitches) then op := A_NEG else op := A_NEGO_; diff --git a/compiler/powerpc64/cgcpu.pas b/compiler/powerpc64/cgcpu.pas index 04379ec4c2..a59bec9627 100644 --- a/compiler/powerpc64/cgcpu.pas +++ b/compiler/powerpc64/cgcpu.pas @@ -616,7 +616,7 @@ var tmpref: treference; tempreg : TRegister; begin - if (not (cs_opt_size in aktoptimizerswitches)) then begin + if (not (cs_opt_size in current_settings.optimizerswitches)) then begin tempreg := cg.getintregister(current_asmdata.CurrAsmList, OS_INT); { load actual function entry (reg contains the reference to the function descriptor) into tempreg } @@ -756,7 +756,7 @@ begin internalerror(2002090902); { if PIC or basic optimizations are enabled, and the number of instructions which would be required to load the value is greater than 2, store (and later load) the value from there } - if (((cs_opt_peephole in aktoptimizerswitches) or (cs_create_pic in aktmoduleswitches)) and + if (((cs_opt_peephole in current_settings.optimizerswitches) or (cs_create_pic in current_settings.moduleswitches)) and (getInstructionLength(a) > 2)) then loadConstantPIC(list, size, a, reg) else @@ -1049,7 +1049,7 @@ var cg.a_load_reg_reg(current_asmdata.CurrAsmList, OS_INT, OS_INT, src, dst); end else if (a = -1) and (signed) then begin { note: only in the signed case possible..., may overflow } - current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(negops[cs_check_overflow in aktlocalswitches], dst, src)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(negops[cs_check_overflow in current_settings.localswitches], dst, src)); end else if (ispowerof2(a, power, isNegPower)) then begin if (signed) then begin { From "The PowerPC Compiler Writer's Guide", pg. 52ff } @@ -1127,7 +1127,7 @@ begin useReg := false; case (op) of OP_DIV, OP_IDIV: - if (cs_opt_level1 in aktoptimizerswitches) then + if (cs_opt_level1 in current_settings.optimizerswitches) then do_constant_div(list, size, a, src, dst, op = OP_IDIV) else usereg := true; @@ -1504,7 +1504,7 @@ var { there are two ways to do this: manually, by generating a few "std" instructions, or via the restore helper functions. The latter are selected by the -Og switch, i.e. "optimize for size" } - if (cs_opt_size in aktoptimizerswitches) then begin + if (cs_opt_size in current_settings.optimizerswitches) then begin mayNeedLRStore := false; if ((fprcount > 0) and (gprcount > 0)) then begin a_op_const_reg_reg(list, OP_SUB, OS_INT, 8 * fprcount, NR_R1, NR_R12); @@ -1538,7 +1538,7 @@ var end; { we may need to store R0 (=LR) ourselves } - if ((cs_profile in initmoduleswitches) or (mayNeedLRStore)) and (needslinkreg) then begin + if ((cs_profile in init_settings.moduleswitches) or (mayNeedLRStore)) and (needslinkreg) then begin reference_reset_base(href, NR_STACK_POINTER_REG, LA_LR_ELF); list.concat(taicpu.op_reg_ref(A_STD, NR_R0, href)); end; @@ -1557,9 +1557,9 @@ begin { determine whether we need to save the link register } needslinkreg := ((not (po_assembler in current_procinfo.procdef.procoptions)) and - ((pi_do_call in current_procinfo.flags) or (cs_profile in initmoduleswitches))) or - ((cs_opt_size in aktoptimizerswitches) and ((fprcount > 0) or (gprcount > 0))) or - ([cs_lineinfo, cs_debuginfo] * aktmoduleswitches <> []); + ((pi_do_call in current_procinfo.flags) or (cs_profile in init_settings.moduleswitches))) or + ((cs_opt_size in current_settings.optimizerswitches) and ((fprcount > 0) or (gprcount > 0))) or + ([cs_lineinfo, cs_debuginfo] * current_settings.moduleswitches <> []); a_reg_alloc(list, NR_STACK_POINTER_REG); a_reg_alloc(list, NR_R0); @@ -1639,7 +1639,7 @@ var { there are two ways to do this: manually, by generating a few "ld" instructions, or via the restore helper functions. The latter are selected by the -Og switch, i.e. "optimize for size" } - if (cs_opt_size in aktoptimizerswitches) then begin + if (cs_opt_size in current_settings.optimizerswitches) then begin needsExitCode := false; if ((fprcount > 0) and (gprcount > 0)) then begin a_op_const_reg_reg(list, OP_SUB, OS_INT, 8 * fprcount, NR_R1, NR_R12); @@ -1696,9 +1696,9 @@ begin { determine whether we need to restore the link register } needslinkreg := ((not (po_assembler in current_procinfo.procdef.procoptions)) and - ((pi_do_call in current_procinfo.flags) or (cs_profile in initmoduleswitches))) or - ((cs_opt_size in aktoptimizerswitches) and ((fprcount > 0) or (gprcount > 0))) or - ([cs_lineinfo, cs_debuginfo] * aktmoduleswitches <> []); + ((pi_do_call in current_procinfo.flags) or (cs_profile in init_settings.moduleswitches))) or + ((cs_opt_size in current_settings.optimizerswitches) and ((fprcount > 0) or (gprcount > 0))) or + ([cs_lineinfo, cs_debuginfo] * current_settings.moduleswitches <> []); { calculate stack frame } localsize := tppcprocinfo(current_procinfo).calc_stackframe_size( @@ -1973,7 +1973,7 @@ var hl: tasmlabel; flags : TResFlags; begin - if not (cs_check_overflow in aktlocalswitches) then + if not (cs_check_overflow in current_settings.localswitches) then exit; current_asmdata.getjumplabel(hl); if not ((def.deftype = pointerdef) or @@ -2051,7 +2051,7 @@ begin make_global := false; if (not current_module.is_unit) or - (cs_create_smart in aktmoduleswitches) or + (cs_create_smart in current_settings.moduleswitches) or (procdef.owner.defowner.owner.symtabletype = globalsymtable) then make_global := true; @@ -2148,7 +2148,7 @@ begin { if we have to create PIC, add the symbol to the TOC/GOT } {$WARNING Hack for avoiding too long manglednames enabled!!} - if (cs_create_pic in aktmoduleswitches) and (assigned(ref.symbol) and + if (cs_create_pic in current_settings.moduleswitches) and (assigned(ref.symbol) and (length(ref.symbol.name) < MAX_GOT_SYMBOL_NAME_LENGTH_HACK)) then begin tmpreg := load_got_symbol(list, ref.symbol.name); if (ref.base = NR_NO) then diff --git a/compiler/powerpc64/cpupi.pas b/compiler/powerpc64/cpupi.pas index 6e0de60908..f77ae947ae 100644 --- a/compiler/powerpc64/cpupi.pas +++ b/compiler/powerpc64/cpupi.pas @@ -73,7 +73,7 @@ begin { the ABI specification says that it is required to always allocate space for 8 * 8 bytes for registers R3-R10 and stack header if there's a stack frame, but GCC doesn't do that, so we don't that too. Uncomment the next three lines if this is required } - if (cs_profile in initmoduleswitches) and (ofs < 112) then begin + if (cs_profile in init_settings.moduleswitches) and (ofs < 112) then begin ofs := 112; end; tg.setfirsttemp(ofs); @@ -100,7 +100,7 @@ begin numfpr * tcgsize2size[OS_FLOAT], ELF_STACK_ALIGN); if (pi_do_call in flags) or (tg.lasttemp <> tg.firsttemp) or - (result > RED_ZONE_SIZE) {or (cs_profile in initmoduleswitches)} then begin + (result > RED_ZONE_SIZE) {or (cs_profile in init_settings.moduleswitches)} then begin result := align(result + tg.lasttemp, ELF_STACK_ALIGN); end; end else diff --git a/compiler/powerpc64/itcpugas.pas b/compiler/powerpc64/itcpugas.pas index 343e0eba82..3f6796d8bb 100644 --- a/compiler/powerpc64/itcpugas.pas +++ b/compiler/powerpc64/itcpugas.pas @@ -146,7 +146,7 @@ var begin p := findreg_by_number(r); if p <> 0 then - if (cs_create_smart in aktmoduleswitches) and + if (cs_create_smart in current_settings.moduleswitches) and (target_info.system <> system_powerpc_darwin) then result := gas_regname_short_table[p] else diff --git a/compiler/powerpc64/nppcadd.pas b/compiler/powerpc64/nppcadd.pas index 2d6a3b2db0..a7c2e1ab2a 100644 --- a/compiler/powerpc64/nppcadd.pas +++ b/compiler/powerpc64/nppcadd.pas @@ -214,13 +214,13 @@ begin else location_reset(location, LOC_FLAGS, OS_NO); - load_left_right(cmpop, (cs_check_overflow in aktlocalswitches) and + load_left_right(cmpop, (cs_check_overflow in current_settings.localswitches) and (nodetype in [addn, subn, muln])); if not (cmpop) then location.register := cg.getintregister(current_asmdata.CurrAsmList, OS_INT); - if not (cs_check_overflow in aktlocalswitches) or (cmpop) or + if not (cs_check_overflow in current_settings.localswitches) or (cmpop) or (nodetype in [orn, andn, xorn]) then begin case nodetype of addn, muln, xorn, orn, andn: diff --git a/compiler/powerpc64/nppcmat.pas b/compiler/powerpc64/nppcmat.pas index 0153b28aa2..e17e790e51 100644 --- a/compiler/powerpc64/nppcmat.pas +++ b/compiler/powerpc64/nppcmat.pas @@ -151,7 +151,7 @@ begin resultreg := cg.getintregister(current_asmdata.CurrAsmList,size); end; done := false; - if (cs_opt_level1 in aktoptimizerswitches) and (right.nodetype = ordconstn) then begin + if (cs_opt_level1 in current_settings.optimizerswitches) and (right.nodetype = ordconstn) then begin if (nodetype = divn) then cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, divCgOps[is_signed(right.resultdef)], size, tordconstnode(right).value, numerator, resultreg) @@ -174,7 +174,7 @@ begin { select the correct opcode according to the sign of the result, whether we need overflow checking } - op := divops[is_signed(right.resultdef), cs_check_overflow in aktlocalswitches]; + op := divops[is_signed(right.resultdef), cs_check_overflow in current_settings.localswitches]; current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(op, resultreg, numerator, divider)); @@ -303,7 +303,7 @@ begin end; { choose appropriate operand } if left.resultdef.deftype <> floatdef then begin - if not (cs_check_overflow in aktlocalswitches) then + if not (cs_check_overflow in current_settings.localswitches) then op := A_NEG else op := A_NEGO_; diff --git a/compiler/ppcgen/ngppcadd.pas b/compiler/ppcgen/ngppcadd.pas index 52b67fcb10..d5bf058a82 100644 --- a/compiler/ppcgen/ngppcadd.pas +++ b/compiler/ppcgen/ngppcadd.pas @@ -188,7 +188,7 @@ implementation else cgsize:=OS_32; - if ((cs_full_boolean_eval in aktlocalswitches) and + if ((cs_full_boolean_eval in current_settings.localswitches) and not(nf_short_bool in flags)) or (nodetype in [unequaln,ltn,lten,gtn,gten,equaln,xorn]) then begin diff --git a/compiler/procinfo.pas b/compiler/procinfo.pas index 791fd869da..3243e1cc08 100644 --- a/compiler/procinfo.pas +++ b/compiler/procinfo.pas @@ -176,7 +176,7 @@ implementation function tprocinfo.calc_stackframe_size:longint; begin - result:=Align(tg.direction*tg.lasttemp,aktalignment.localalignmin); + result:=Align(tg.direction*tg.lasttemp,current_settings.alignment.localalignmin); end; diff --git a/compiler/pstatmnt.pas b/compiler/pstatmnt.pas index 7f17a08019..eebce87634 100644 --- a/compiler/pstatmnt.pas +++ b/compiler/pstatmnt.pas @@ -327,7 +327,7 @@ implementation ( { record/object fields are allowed in tp7 mode only } ( - (m_tp7 in aktmodeswitches) and + (m_tp7 in current_settings.modeswitches) and (hp.nodetype=subscriptn) and ((tsubscriptnode(hp).left.resultdef.deftype=recorddef) or is_object(tsubscriptnode(hp).left.resultdef)) @@ -371,7 +371,7 @@ implementation ) then begin { Assigning for-loop variable is only allowed in tp7 and macpas } - if ([m_tp7,m_mac] * aktmodeswitches = []) then + if ([m_tp7,m_mac] * current_settings.modeswitches = []) then begin if not assigned(loopvarsym) then loopvarsym:=tabstractvarsym(tloadnode(hp).symtableentry); @@ -384,7 +384,7 @@ implementation typedconstsym : begin { Bad programming, only allowed in tp7 mode } - if not(m_tp7 in aktmodeswitches) then + if not(m_tp7 in current_settings.modeswitches) then MessagePos(hp.fileinfo,type_e_illegal_count_var); end; else @@ -856,9 +856,9 @@ implementation asmreader : tbaseasmreader; begin Inside_asm_statement:=true; - if assigned(asmmodeinfos[aktasmmode]) then + if assigned(asmmodeinfos[current_settings.asmmode]) then begin - asmreader:=asmmodeinfos[aktasmmode]^.casmreader.create; + asmreader:=asmmodeinfos[current_settings.asmmode]^.casmreader.create; asmstat:=casmnode.create(asmreader.assemble as TAsmList); asmreader.free; end @@ -927,7 +927,7 @@ implementation case token of _GOTO : begin - if not(cs_support_goto in aktmoduleswitches)then + if not(cs_support_goto in current_settings.moduleswitches)then Message(sym_e_goto_and_label_not_supported); consume(_GOTO); if (token<>_INTCONST) and (token<>_ID) then @@ -1140,7 +1140,7 @@ implementation current_procinfo.procdef.localst.rename(current_procinfo.procdef.resultname,'$hiddenresult'); { delphi uses register calling for assembler methods } - if (m_delphi in aktmodeswitches) and + if (m_delphi in current_settings.modeswitches) and (po_assembler in current_procinfo.procdef.procoptions) and not(po_hascallingconvention in current_procinfo.procdef.procoptions) then current_procinfo.procdef.proccalloption:=pocall_register; diff --git a/compiler/psub.pas b/compiler/psub.pas index 6d81e49753..b8df8bbaf4 100644 --- a/compiler/psub.pas +++ b/compiler/psub.pas @@ -167,7 +167,7 @@ implementation { do we have an assembler block without the po_assembler? we should allow this for Delphi compatibility (PFV) } - if (token=_ASM) and (m_delphi in aktmodeswitches) then + if (token=_ASM) and (m_delphi in current_settings.modeswitches) then include(current_procinfo.procdef.procoptions,po_assembler); { Handle assembler block different } @@ -554,7 +554,7 @@ implementation depending on the implicit finally we need to add an try...finally...end wrapper } newblock:=internalstatements(newstatement); - if (cs_implicit_exceptions in aktmoduleswitches) and + if (cs_implicit_exceptions in current_settings.moduleswitches) and (pi_needs_implicit_finally in flags) and { but it's useless in init/final code of units } not(procdef.proctypeoption in [potype_unitfinalize,potype_unitinit]) then @@ -614,9 +614,9 @@ implementation (tabstractnormalvarsym(p).localloc.loc in [LOC_REGISTER,LOC_CREGISTER,LOC_MMREGISTER, LOC_CMMREGISTER,LOC_FPUREGISTER,LOC_CFPUREGISTER]) then begin - if not(cs_no_regalloc in aktglobalswitches) then + if not(cs_no_regalloc in current_settings.globalswitches) then cg.translate_register(tabstractnormalvarsym(p).localloc.register); - if cs_asm_source in aktglobalswitches then + if cs_asm_source in current_settings.globalswitches then TAsmList(list).concat(Tai_comment.Create(strpnew('Var '+tabstractnormalvarsym(p).realname+' located in register '+ std_regname(tabstractnormalvarsym(p).localloc.register)))) end; @@ -667,7 +667,7 @@ implementation procedure tcgprocinfo.generate_code; var oldprocinfo : tprocinfo; - oldaktmaxfpuregisters : longint; + oldmaxfpuregisters : longint; oldfilepos : tfileposinfo; templist : TAsmList; headertai : tai; @@ -692,7 +692,7 @@ implementation oldprocinfo:=current_procinfo; oldfilepos:=aktfilepos; - oldaktmaxfpuregisters:=aktmaxfpuregisters; + oldmaxfpuregisters:=current_settings.maxfpuregisters; current_procinfo:=self; aktfilepos:=entrypos; @@ -703,7 +703,7 @@ implementation add_to_symtablestack; { when size optimization only count occurrence } - if cs_opt_size in aktoptimizerswitches then + if cs_opt_size in current_settings.optimizerswitches then cg.t_times:=1 else { reference for repetition is 100 } @@ -731,7 +731,7 @@ implementation { do this before adding the entry code else the tail recursion recognition won't work, if this causes troubles, it must be if'ed } - if (cs_opt_tailrecursion in aktoptimizerswitches) and + if (cs_opt_tailrecursion in current_settings.optimizerswitches) and (pi_is_recursive in flags) then do_opttail(code,procdef); @@ -756,7 +756,7 @@ implementation * open arrays - no inline assembler } - if (cs_opt_stackframe in aktoptimizerswitches) and + if (cs_opt_stackframe in current_settings.optimizerswitches) and not(po_assembler in procdef.procoptions) and ((flags*[pi_has_assembler_block,pi_uses_exceptions,pi_is_assembler, pi_needs_implicit_finally,pi_has_implicit_finally,pi_has_stackparameter])=[]) then @@ -827,7 +827,7 @@ implementation { first generate entry and initialize code with the correct position and switches } aktfilepos:=entrypos; - aktlocalswitches:=entryswitches; + current_settings.localswitches:=entryswitches; cg.set_regalloc_extend_backwards(true); @@ -839,7 +839,7 @@ implementation { now generate finalize and exit code with the correct position and switches } aktfilepos:=exitpos; - aktlocalswitches:=exitswitches; + current_settings.localswitches:=exitswitches; cg.set_regalloc_extend_backwards(false); @@ -950,16 +950,16 @@ implementation { check if the implicit finally has been generated. The flag should already be set in pass1 } - if (cs_implicit_exceptions in aktmoduleswitches) and + if (cs_implicit_exceptions in current_settings.moduleswitches) and not(procdef.proctypeoption in [potype_unitfinalize,potype_unitinit]) and (pi_needs_implicit_finally in flags) and not(pi_has_implicit_finally in flags) then internalerror(200405231); {$ifndef NoOpt} - if not(cs_no_regalloc in aktglobalswitches) then + if not(cs_no_regalloc in current_settings.globalswitches) then begin - if (cs_opt_level1 in aktoptimizerswitches) and + if (cs_opt_level1 in current_settings.optimizerswitches) and { do not optimize pure assembler procedures } not(pi_is_assembler in flags) then optimize(aktproccode); @@ -987,8 +987,8 @@ implementation fixup_jmps(aktproccode); {$endif POWERPC64} { insert line debuginfo } - if (cs_debuginfo in aktmoduleswitches) or - (cs_use_lineinfo in aktglobalswitches) then + if (cs_debuginfo in current_settings.moduleswitches) or + (cs_use_lineinfo in current_settings.globalswitches) then debuginfo.insertlineinfo(aktproccode); { add the procedure to the al_procedures } @@ -1014,7 +1014,7 @@ implementation { restore } templist.free; - aktmaxfpuregisters:=oldaktmaxfpuregisters; + current_settings.maxfpuregisters:=oldmaxfpuregisters; aktfilepos:=oldfilepos; current_procinfo:=oldprocinfo; end; @@ -1154,7 +1154,7 @@ implementation { save entry info } entrypos:=aktfilepos; - entryswitches:=aktlocalswitches; + entryswitches:=current_settings.localswitches; if (df_generic in procdef.defoptions) then begin @@ -1182,7 +1182,7 @@ implementation end; { save exit info } - exitswitches:=aktlocalswitches; + exitswitches:=current_settings.localswitches; exitpos:=last_endtoken_filepos; { the procedure is now defined } @@ -1313,7 +1313,7 @@ implementation (target_info.system in [system_i386_os2,system_i386_emx]) then begin pd.aliasnames.insert(pd.procsym.realname); - if cs_link_deffile in aktglobalswitches then + if cs_link_deffile in current_settings.globalswitches then deffile.AddExport(pd.mangledname); end; @@ -1443,7 +1443,7 @@ implementation taking addresses of static procedures goes wrong if they aren't global when pic is used (FK) } - (cs_create_pic in aktmoduleswitches) then + (cs_create_pic in current_settings.moduleswitches) then include(pd.procoptions,po_global); pd.forwarddef:=false; end; @@ -1534,7 +1534,7 @@ implementation if not(po_external in pd.procoptions) then begin if (po_global in pd.procoptions) or - (cs_profile in aktmoduleswitches) then + (cs_profile in current_settings.moduleswitches) then current_asmdata.DefineAsmSymbol(pd.mangledname,AB_GLOBAL,AT_FUNCTION) else current_asmdata.DefineAsmSymbol(pd.mangledname,AB_LOCAL,AT_FUNCTION); @@ -1604,14 +1604,14 @@ implementation begin { m_class is needed, because the resourcestring loading is in the ObjPas unit } - if (m_class in aktmodeswitches) then + if (m_class in current_settings.modeswitches) then resourcestring_dec else break; end; _PROPERTY: begin - if (m_fpc in aktmodeswitches) then + if (m_fpc in current_settings.modeswitches) then property_dec else break; @@ -1625,7 +1625,7 @@ implementation { check for incomplete class definitions, this is only required for fpc modes } - if (m_fpc in aktmodeswitches) then + if (m_fpc in current_settings.modeswitches) then current_procinfo.procdef.localst.foreach_static(@check_forward_class,nil); end; @@ -1653,7 +1653,7 @@ implementation resourcestring_dec; _PROPERTY: begin - if (m_fpc in aktmodeswitches) then + if (m_fpc in current_settings.modeswitches) then property_dec else break; @@ -1666,7 +1666,7 @@ implementation until false; { check for incomplete class definitions, this is only required for fpc modes } - if (m_fpc in aktmodeswitches) then + if (m_fpc in current_settings.modeswitches) then symtablestack.top.foreach_static(@check_forward_class,nil); end; diff --git a/compiler/psystem.pas b/compiler/psystem.pas index 5559e0d674..31a4d35fc8 100644 --- a/compiler/psystem.pas +++ b/compiler/psystem.pas @@ -212,7 +212,7 @@ implementation { Normal types } (* we use the same types as without emulator, the only difference is that direct calls to the emulator are generated - if (cs_fp_emulation in aktmoduleswitches) then + if (cs_fp_emulation in current_settings.moduleswitches) then begin addtype('Single',s32floattype); { extended size is the best real type for the target } @@ -301,7 +301,7 @@ implementation addtype('$s80real',s80floattype); addtype('$s64currency',s64currencytype); { Add a type for virtual method tables } - hrecst:=trecordsymtable.create(aktpackrecords); + hrecst:=trecordsymtable.create(current_settings.packrecords); vmttype:=trecorddef.create(hrecst); pvmttype:=tpointerdef.create(vmttype); hrecst.insertfield(tfieldvarsym.create('$parent',vs_value,pvmttype,[])); diff --git a/compiler/ptconst.pas b/compiler/ptconst.pas index 19e57a1eb5..2b4d0bed48 100644 --- a/compiler/ptconst.pas +++ b/compiler/ptconst.pas @@ -91,7 +91,7 @@ implementation if ((tordconstnode(p).value>def.high) or (tordconstnode(p).value<def.low)) then begin - if (cs_check_range in aktlocalswitches) then + if (cs_check_range in current_settings.localswitches) then Message(parser_e_range_check_error) else Message(parser_w_range_check_error); @@ -226,7 +226,7 @@ implementation datalist.concat(Tai_real_32bit.Create(ts32real(value))); s64real : {$ifdef ARM} - if aktfputype in [fpu_fpa,fpu_fpa10,fpu_fpa11] then + if current_settings.fputype in [fpu_fpa,fpu_fpa10,fpu_fpa11] then datalist.concat(Tai_real_64bit.Create_hiloswapped(ts64real(value))) else {$endif ARM} @@ -318,7 +318,7 @@ implementation begin len:=tstringconstnode(p).len; { For tp7 the maximum lentgh can be 255 } - if (m_tp7 in aktmodeswitches) and + if (m_tp7 in current_settings.modeswitches) and (len>255) then len:=255; getmem(ca,len+2); @@ -672,7 +672,7 @@ implementation begin len:=tstringconstnode(p).len; { For tp7 the maximum lentgh can be 255 } - if (m_tp7 in aktmodeswitches) and + if (m_tp7 in current_settings.modeswitches) and (len>255) then len:=255; ca:=tstringconstnode(p).value_str; @@ -852,7 +852,7 @@ implementation error := true; end { Delphi allows you to skip fields } - else if (m_delphi in aktmodeswitches) then + else if (m_delphi in current_settings.modeswitches) then begin Message1(parser_w_skipped_fields_before,sorg); srsym := recsym; @@ -925,7 +925,7 @@ implementation end { for objects we allow it only if it doesn't contain a vmt } else if (oo_has_vmt in tobjectdef(def).objectoptions) and - (m_fpc in aktmodeswitches) then + (m_fpc in current_settings.modeswitches) then Message(parser_e_type_const_not_possible) { packed object } else if is_packed_record_or_object(def) then @@ -968,7 +968,7 @@ implementation { check in VMT needs to be added for TP mode } with Tobjectdef(def) do - if not(m_fpc in aktmodeswitches) and + if not(m_fpc in current_settings.modeswitches) and (oo_has_vmt in objectoptions) and (vmt_offset<fieldoffset) then begin @@ -994,7 +994,7 @@ implementation break; end; end; - if not(m_fpc in aktmodeswitches) and + if not(m_fpc in current_settings.modeswitches) and (oo_has_vmt in tobjectdef(def).objectoptions) and (tobjectdef(def).vmt_offset>=aktpos) then begin diff --git a/compiler/ptype.pas b/compiler/ptype.pas index 6dcd4848e9..429fa1fc8d 100644 --- a/compiler/ptype.pas +++ b/compiler/ptype.pas @@ -285,7 +285,7 @@ implementation old_object_option : tsymoptions; begin { create recdef } - recst:=trecordsymtable.create(aktpackrecords); + recst:=trecordsymtable.create(current_settings.packrecords); record_dec:=trecorddef.create(recst); { insert in symtablestack } symtablestack.push(recst); @@ -295,7 +295,7 @@ implementation current_object_option:=[sp_public]; storetypecanbeforward:=typecanbeforward; { for tp7 don't allow forward types } - if m_tp7 in aktmodeswitches then + if m_tp7 in current_settings.modeswitches then typecanbeforward:=false; read_record_fields([vd_record]); consume(_END); @@ -319,7 +319,7 @@ implementation aktenumdef : tenumdef; s : stringid; l,v : TConstExprInt; - oldaktpackrecords : longint; + oldpackrecords : longint; defpos,storepos : tfileposinfo; procedure expr_type; @@ -457,7 +457,7 @@ implementation begin lowval:=tenumdef(def).min; highval:=tenumdef(def).max; - if (m_fpc in aktmodeswitches) and + if (m_fpc in current_settings.modeswitches) and (tenumdef(def).has_jumps) then Message(type_e_array_index_enums_with_assign_not_possible); indexdef:=def; @@ -620,19 +620,19 @@ implementation defpos:=akttokenpos; consume(_ID); { only allow assigning of specific numbers under fpc mode } - if not(m_tp7 in aktmodeswitches) and + if not(m_tp7 in current_settings.modeswitches) and ( { in fpc mode also allow := to be compatible with previous 1.0.x versions } - ((m_fpc in aktmodeswitches) and + ((m_fpc in current_settings.modeswitches) and try_to_consume(_ASSIGNMENT)) or try_to_consume(_EQUAL) ) then begin - oldlocalswitches:=aktlocalswitches; - include(aktlocalswitches,cs_allow_enum_calc); + oldlocalswitches:=current_settings.localswitches; + include(current_settings.localswitches,cs_allow_enum_calc); p:=comp_expr(true); - aktlocalswitches:=oldlocalswitches; + current_settings.localswitches:=oldlocalswitches; if (p.nodetype=ordconstn) then begin { we expect an integer or an enum of the @@ -689,7 +689,7 @@ implementation _BITPACKED: begin bitpacking := - (cs_bitpacking in aktlocalswitches) or + (cs_bitpacking in current_settings.localswitches) or (token = _BITPACKED); consume(token); if token=_ARRAY then @@ -698,17 +698,17 @@ implementation set_dec else begin - oldaktpackrecords:=aktpackrecords; + oldpackrecords:=current_settings.packrecords; if (not bitpacking) or (token in [_CLASS,_OBJECT]) then - aktpackrecords:=1 + current_settings.packrecords:=1 else - aktpackrecords:=bit_alignment; + current_settings.packrecords:=bit_alignment; if token in [_CLASS,_OBJECT] then def:=object_dec(name,genericdef,genericlist,nil) else def:=record_dec; - aktpackrecords:=oldaktpackrecords; + current_settings.packrecords:=oldpackrecords; end; end; _DISPINTERFACE, diff --git a/compiler/rautils.pas b/compiler/rautils.pas index 9d2381a476..b6b905c8f5 100644 --- a/compiler/rautils.pas +++ b/compiler/rautils.pas @@ -679,7 +679,7 @@ begin with current_procinfo.procdef do if (not is_void(returndef)) then begin - if (m_tp7 in aktmodeswitches) and + if (m_tp7 in current_settings.modeswitches) and (not paramanager.ret_in_param(returndef,proccalloption)) then begin message(asmr_e_cannot_use_RESULT_here); @@ -1518,7 +1518,7 @@ end; s32real : p.concat(Tai_real_32bit.Create(value)); s64real : {$ifdef ARM} - if aktfputype in [fpu_fpa,fpu_fpa10,fpu_fpa11] then + if current_settings.fputype in [fpu_fpa,fpu_fpa10,fpu_fpa11] then p.concat(Tai_real_64bit.Create_hiloswapped(value)) else {$endif ARM} diff --git a/compiler/regvars.pas b/compiler/regvars.pas index aee5aab11b..b79d7f2ebe 100644 --- a/compiler/regvars.pas +++ b/compiler/regvars.pas @@ -145,7 +145,7 @@ implementation { max. optimizations } { only if no asm is used } { and no try statement } - if (cs_opt_regvar in aktoptimizerswitches) and + if (cs_opt_regvar in current_settings.optimizerswitches) and { we have to store regvars back to memory in this case (the nested } { procedures can access the variables of the parent) } (tcgprocinfo(current_procinfo).nestedprocs.count = 0) and @@ -229,7 +229,7 @@ implementation { in non leaf procedures we must be very careful } { with assigning registers } {$ifdef i386} - if aktmaxfpuregisters=-1 then + if current_settings.maxfpuregisters=-1 then begin if (pi_do_call in current_procinfo.flags) then begin @@ -246,7 +246,7 @@ implementation end else begin - for i:=aktmaxfpuregisters+1 to maxfpuvarregs do + for i:=current_settings.maxfpuregisters+1 to maxfpuvarregs do regvarinfo^.fpuregvars[i]:=nil; end; {$endif i386} @@ -455,7 +455,7 @@ implementation i: longint; regvarinfo: pregvarinfo; begin - if (cs_opt_regvar in aktoptimizerswitches) and + if (cs_opt_regvar in current_settings.optimizerswitches) and not(pi_has_assembler_block in current_procinfo.flags) and not(pi_uses_exceptions in current_procinfo.flags) then begin @@ -479,7 +479,7 @@ implementation end; {$ifdef i386} if assigned(p) then - if cs_asm_source in aktglobalswitches then + if cs_asm_source in current_settings.globalswitches then asml.insert(tai_comment.Create(strpnew(tostr(p.registersfpu)+ ' registers on FPU stack used by temp. expressions'))); {$endif i386} @@ -488,7 +488,7 @@ implementation begin if assigned(regvarinfo^.fpuregvars[i]) then begin - if cs_asm_source in aktglobalswitches then + if cs_asm_source in current_settings.globalswitches then asml.insert(tai_comment.Create(strpnew(regvarinfo^.fpuregvars[i].name+ ' with weight '+tostr(regvarinfo^.fpuregvars[i].refs)+' assigned to register '+ std_regname(regvarinfo^.fpuregvars[i].localloc.register)))); @@ -497,7 +497,7 @@ implementation tostr(regvarinfo^.fpuregvars[i].refs),regvarinfo^.fpuregvars[i].name); end; end; - if cs_asm_source in aktglobalswitches then + if cs_asm_source in current_settings.globalswitches then asml.insert(tai_comment.Create(strpnew('Register variable assignment:'))); } end; @@ -554,7 +554,7 @@ implementation { can happen when inlining assembler procedures (JM) } if not assigned(current_procinfo.procdef.regvarinfo) then exit; - if (cs_opt_regvar in aktoptimizerswitches) and + if (cs_opt_regvar in current_settings.optimizerswitches) and not(pi_has_assembler_block in current_procinfo.flags) and not(pi_uses_exceptions in current_procinfo.flags) then with pregvarinfo(current_procinfo.procdef.regvarinfo)^ do @@ -610,7 +610,7 @@ implementation begin cg.rg[R_INTREGISTER].translate_register(tvarsym(regvars[i]).localloc.register); r:=tvarsym(regvars[i]).localloc.register; - if cs_asm_source in aktglobalswitches then + if cs_asm_source in current_settings.globalswitches then list.insert(tai_comment.Create(strpnew(tvarsym(regvars[i]).name+ ' with weight '+tostr(tvarsym(regvars[i]).refs)+' assigned to register '+ std_regname(r)))); @@ -622,7 +622,7 @@ implementation begin cg.rg[R_FPUREGISTER].translate_register(tvarsym(regvars[i]).localloc.register); r:=tvarsym(fpuregvars[i]).localloc.register; - if cs_asm_source in aktglobalswitches then + if cs_asm_source in current_settings.globalswitches then list.insert(tai_comment.Create(strpnew(tvarsym(fpuregvars[i]).name+ ' with weight '+tostr(tvarsym(fpuregvars[i]).refs)+' assigned to register '+ std_regname(r)))); diff --git a/compiler/rgobj.pas b/compiler/rgobj.pas index 2d0aa47d10..8d7a37d87c 100644 --- a/compiler/rgobj.pas +++ b/compiler/rgobj.pas @@ -536,7 +536,7 @@ unit rgobj; ibitmap:=tinterferencebitmap.create; generate_interference_graph(list,headertai); { Don't do the real allocation when -sr is passed } - if (cs_no_regalloc in aktglobalswitches) then + if (cs_no_regalloc in current_settings.globalswitches) then exit; {Do register allocation.} spillingcounter:=0; diff --git a/compiler/scandir.pas b/compiler/scandir.pas index 686a8a25eb..bb6004d0c4 100644 --- a/compiler/scandir.pas +++ b/compiler/scandir.pas @@ -79,9 +79,9 @@ implementation if (sw<>cs_modulenone) and (state in ['-','+']) then begin if state='-' then - exclude(aktmoduleswitches,sw) + exclude(current_settings.moduleswitches,sw) else - include(aktmoduleswitches,sw); + include(current_settings.moduleswitches,sw); end; end; @@ -94,11 +94,11 @@ implementation if (sw<>cs_localnone) and (state in ['-','+']) then begin if not localswitcheschanged then - nextaktlocalswitches:=aktlocalswitches; + nextlocalswitches:=current_settings.localswitches; if state='-' then - exclude(nextaktlocalswitches,sw) + exclude(nextlocalswitches,sw) else - include(nextaktlocalswitches,sw); + include(nextlocalswitches,sw); localswitcheschanged:=true; end; end; @@ -111,18 +111,18 @@ implementation if (sw<>cs_localnone) and (state in ['-','+','*']) then begin if not localswitcheschanged then - nextaktlocalswitches:=aktlocalswitches; + nextlocalswitches:=current_settings.localswitches; if state='-' then - exclude(nextaktlocalswitches,sw) + exclude(nextlocalswitches,sw) else if state='+' then - include(nextaktlocalswitches,sw) + include(nextlocalswitches,sw) else begin - if sw in initlocalswitches then - include(nextaktlocalswitches,sw) + if sw in init_settings.localswitches then + include(nextlocalswitches,sw) else - exclude(nextaktlocalswitches,sw); + exclude(nextlocalswitches,sw); end; localswitcheschanged:=true; end; @@ -149,18 +149,18 @@ implementation { Support also the ON and OFF as switch } hs:=current_scanner.readid; if (hs='ON') then - aktpackrecords:=4 + current_settings.packrecords:=4 else if (hs='OFF') then - aktpackrecords:=1 - else if m_mac in aktmodeswitches then + current_settings.packrecords:=1 + else if m_mac in current_settings.modeswitches then begin { Support switches used in Apples Universal Interfaces} if (hs='MAC68K') then - aktpackrecords:=2 + current_settings.packrecords:=2 else if (hs='POWER') then - aktpackrecords:=4 + current_settings.packrecords:=4 else if (hs='RESET') then - aktpackrecords:=0 + current_settings.packrecords:=0 else Message1(scan_e_illegal_pack_records,hs); end @@ -170,12 +170,12 @@ implementation else begin case current_scanner.readval of - 1 : aktpackrecords:=1; - 2 : aktpackrecords:=2; - 4 : aktpackrecords:=4; - 8 : aktpackrecords:=8; - 16 : aktpackrecords:=16; - 32 : aktpackrecords:=32; + 1 : current_settings.packrecords:=1; + 2 : current_settings.packrecords:=2; + 4 : current_settings.packrecords:=4; + 8 : current_settings.packrecords:=8; + 16 : current_settings.packrecords:=16; + 32 : current_settings.packrecords:=32; else Message1(scan_e_illegal_pack_records,hs); end; @@ -184,22 +184,22 @@ implementation procedure dir_a1; begin - aktpackrecords:=1; + current_settings.packrecords:=1; end; procedure dir_a2; begin - aktpackrecords:=2; + current_settings.packrecords:=2; end; procedure dir_a4; begin - aktpackrecords:=4; + current_settings.packrecords:=4; end; procedure dir_a8; begin - aktpackrecords:=8; + current_settings.packrecords:=8; end; procedure dir_asmmode; @@ -211,9 +211,9 @@ implementation If Inside_asm_statement then Message1(scan_w_no_asm_reader_switch_inside_asm,s); if s='DEFAULT' then - aktasmmode:=initasmmode + current_settings.asmmode:=init_settings.asmmode else - if not SetAsmReadMode(s,aktasmmode) then + if not SetAsmReadMode(s,current_settings.asmmode) then Message1(scan_e_illegal_asmmode_specifier,s); end; @@ -246,7 +246,7 @@ implementation if not (target_info.system in system_all_windows + [system_i386_os2, system_i386_emx, system_powerpc_macos]) then begin - if m_delphi in aktmodeswitches then + if m_delphi in current_settings.modeswitches then Message(scan_n_app_type_not_support) else Message(scan_w_app_type_not_support); @@ -283,7 +283,7 @@ implementation begin current_scanner.skipspace; hs:=current_scanner.readid; - if not SetAktProcCall(hs,aktdefproccall) then + if not SetAktProcCall(hs,current_settings.defproccall) then begin if (hs <> '') then Message1(parser_w_unknown_proc_directive_ignored,hs) @@ -377,10 +377,10 @@ implementation procedure dir_fputype; begin current_scanner.skipspace; - { current_scanner.undef_macro('FPU'+fputypestr[aktfputype]); } - if not(SetFPUType(upper(current_scanner.readcomment),aktfputype)) then + { current_scanner.undef_macro('FPU'+fputypestr[current_settings.fputype]); } + if not(SetFPUType(upper(current_scanner.readcomment),current_settings.fputype)) then comment(V_Error,'Illegal FPU type'); - { current_scanner.def_macro('FPU'+fputypestr[aktfputype]); } + { current_scanner.def_macro('FPU'+fputypestr[current_settings.fputype]); } end; procedure dir_goto; @@ -441,11 +441,11 @@ implementation current_scanner.skipspace; hs:=current_scanner.readid; if (hs='CORBA') then - aktinterfacetype:=it_interfacecorba + current_settings.interfacetype:=it_interfacecorba else if (hs='COM') then - aktinterfacetype:=it_interfacecom + current_settings.interfacetype:=it_interfacecom else if (hs='DEFAULT') then - aktinterfacetype:=initinterfacetype + current_settings.interfacetype:=init_settings.interfacetype else Message(scan_e_invalid_interface_type); end; @@ -582,7 +582,7 @@ implementation begin hs:=current_scanner.readid; if (hs='NORMAL') or (hs='DEFAULT') then - aktmaxfpuregisters:=-1 + current_settings.maxfpuregisters:=-1 else Message(scan_e_invalid_maxfpureg_value); end @@ -591,7 +591,7 @@ implementation l:=current_scanner.readval; case l of 0..8: - aktmaxfpuregisters:=l; + current_settings.maxfpuregisters:=l; else Message(scan_e_invalid_maxfpureg_value); end; @@ -691,7 +691,7 @@ implementation current_scanner.skipspace; current_scanner.readstring; if not current_module.mode_switch_allowed and - not ((m_mac in aktmodeswitches) and (pattern='MACPAS')) then + not ((m_mac in current_settings.modeswitches) and (pattern='MACPAS')) then Message1(scan_e_mode_switch_not_allowed,pattern) else if not SetCompileMode(pattern,false) then Message1(scan_w_illegal_switch,pattern) @@ -738,14 +738,14 @@ implementation { Support also the ON and OFF as switch } hs:=current_scanner.readid; if (hs='ON') then - aktoptimizerswitches:=level2optimizerswitches + current_settings.optimizerswitches:=level2optimizerswitches else if (hs='OFF') then - aktoptimizerswitches:=[] + current_settings.optimizerswitches:=[] else if (hs='DEFAULT') then - aktoptimizerswitches:=initoptimizerswitches + current_settings.optimizerswitches:=init_settings.optimizerswitches else begin - if not UpdateOptimizerStr(hs,aktoptimizerswitches) then + if not UpdateOptimizerStr(hs,current_settings.optimizerswitches) then Message1(scan_e_illegal_optimization_specifier,hs); end; end; @@ -764,16 +764,16 @@ implementation begin hs:=current_scanner.readid; if (hs='NORMAL') or (hs='DEFAULT') then - aktpackenum:=4 + current_settings.packenum:=4 else Message1(scan_e_illegal_pack_enum, hs); end else begin case current_scanner.readval of - 1 : aktpackenum:=1; - 2 : aktpackenum:=2; - 4 : aktpackenum:=4; + 1 : current_settings.packenum:=1; + 2 : current_settings.packenum:=2; + 4 : current_settings.packenum:=4; else Message1(scan_e_illegal_pack_enum, pattern); end; @@ -790,22 +790,22 @@ implementation hs:=current_scanner.readid; { C has the special recordalignmax of C_alignment } if (hs='C') then - aktpackrecords:=C_alignment + current_settings.packrecords:=C_alignment else if (hs='NORMAL') or (hs='DEFAULT') then - aktpackrecords:=0 + current_settings.packrecords:=0 else Message1(scan_e_illegal_pack_records,hs); end else begin case current_scanner.readval of - 1 : aktpackrecords:=1; - 2 : aktpackrecords:=2; - 4 : aktpackrecords:=4; - 8 : aktpackrecords:=8; - 16 : aktpackrecords:=16; - 32 : aktpackrecords:=32; + 1 : current_settings.packrecords:=1; + 2 : current_settings.packrecords:=2; + 4 : current_settings.packrecords:=4; + 8 : current_settings.packrecords:=8; + 16 : current_settings.packrecords:=16; + 32 : current_settings.packrecords:=32; else Message1(scan_e_illegal_pack_records,pattern); end; @@ -822,17 +822,17 @@ implementation begin hs:=current_scanner.readid; if (hs='FIXED') or ((hs='DEFAULT') OR (hs='NORMAL')) then - aktsetalloc:=0 {Fixed mode, sets are 4 or 32 bytes} + current_settings.setalloc:=0 {Fixed mode, sets are 4 or 32 bytes} else Message(scan_e_only_packset); end else begin case current_scanner.readval of - 1 : aktsetalloc:=1; - 2 : aktsetalloc:=2; - 4 : aktsetalloc:=4; - 8 : aktsetalloc:=8; + 1 : current_settings.setalloc:=1; + 2 : current_settings.setalloc:=2; + 4 : current_settings.setalloc:=4; + 8 : current_settings.setalloc:=8; else Message(scan_e_only_packset); end; @@ -852,10 +852,10 @@ implementation Message(scan_e_too_many_pop); if not localswitcheschanged then - nextaktlocalswitches:=aktlocalswitches; + nextlocalswitches:=current_settings.localswitches; Dec(localswitchesstackpos); - nextaktlocalswitches:= localswitchesstack[localswitchesstackpos]; + nextlocalswitches:= localswitchesstack[localswitchesstackpos]; localswitcheschanged:=true; end; @@ -864,7 +864,7 @@ implementation begin do_moduleswitch(cs_profile); { defined/undefine FPC_PROFILE } - if cs_profile in aktmoduleswitches then + if cs_profile in current_settings.moduleswitches then def_system_macro('FPC_PROFILE') else undef_system_macro('FPC_PROFILE'); @@ -878,11 +878,11 @@ implementation if localswitcheschanged then begin - aktlocalswitches:=nextaktlocalswitches; + current_settings.localswitches:=nextlocalswitches; localswitcheschanged:=false; end; - localswitchesstack[localswitchesstackpos]:= aktlocalswitches; + localswitchesstack[localswitchesstackpos]:= current_settings.localswitches; Inc(localswitchesstackpos); end; @@ -1140,17 +1140,17 @@ implementation procedure dir_z1; begin - aktpackenum:=1; + current_settings.packenum:=1; end; procedure dir_z2; begin - aktpackenum:=2; + current_settings.packenum:=2; end; procedure dir_z4; begin - aktpackenum:=4; + current_settings.packenum:=4; end; procedure dir_externalsym; @@ -1175,7 +1175,7 @@ implementation begin current_scanner.skipspace; s:=current_scanner.readcomment; - UpdateAlignmentStr(s,aktalignment); + UpdateAlignmentStr(s,current_settings.alignment); end; procedure dir_codepage; @@ -1189,11 +1189,11 @@ implementation current_scanner.skipspace; s:=current_scanner.readcomment; if (upper(s)='UTF8') or (upper(s)='UTF-8') then - aktsourcecodepage:='utf8' + current_settings.sourcecodepage:='utf8' else if not(cpavailable(s)) then Message1(option_code_page_not_available,s) else - aktsourcecodepage:=s; + current_settings.sourcecodepage:=s; end; end; diff --git a/compiler/scanner.pas b/compiler/scanner.pas index 4dbbc457d2..5f3d09aa5f 100644 --- a/compiler/scanner.pas +++ b/compiler/scanner.pas @@ -242,148 +242,148 @@ implementation low:=mid; end; is_keyword:=(pattern=tokeninfo^[ttoken(high)].str) and - (tokeninfo^[ttoken(high)].keyword in aktmodeswitches); + (tokeninfo^[ttoken(high)].keyword in current_settings.modeswitches); end; Function SetCompileMode(const s:string; changeInit: boolean):boolean; var b : boolean; - oldaktmodeswitches : tmodeswitches; + oldmodeswitches : tmodeswitches; begin - oldaktmodeswitches:=aktmodeswitches; + oldmodeswitches:=current_settings.modeswitches; b:=true; if s='DEFAULT' then - aktmodeswitches:=initmodeswitches + current_settings.modeswitches:=fpcmodeswitches else if s='DELPHI' then - aktmodeswitches:=delphimodeswitches + current_settings.modeswitches:=delphimodeswitches else if s='TP' then - aktmodeswitches:=tpmodeswitches + current_settings.modeswitches:=tpmodeswitches else if s='FPC' then begin - aktmodeswitches:=fpcmodeswitches; + current_settings.modeswitches:=fpcmodeswitches; { TODO: enable this for 2.3/2.9 } - // include(aktlocalswitches, cs_typed_addresses); + // include(current_settings.localswitches, cs_typed_addresses); end else if s='OBJFPC' then begin - aktmodeswitches:=objfpcmodeswitches; + current_settings.modeswitches:=objfpcmodeswitches; { TODO: enable this for 2.3/2.9 } - // include(aktlocalswitches, cs_typed_addresses); + // include(current_settings.localswitches, cs_typed_addresses); end else if s='GPC' then - aktmodeswitches:=gpcmodeswitches + current_settings.modeswitches:=gpcmodeswitches else if s='MACPAS' then - aktmodeswitches:=macmodeswitches + current_settings.modeswitches:=macmodeswitches else b:=false; if b and changeInit then - initmodeswitches := aktmodeswitches; + init_settings.modeswitches := current_settings.modeswitches; if b then begin { resolve all postponed switch changes } if localswitcheschanged then begin - aktlocalswitches:=nextaktlocalswitches; + current_settings.localswitches:=nextlocalswitches; localswitcheschanged:=false; end; { turn ansistrings on by default ? } - if (m_default_ansistring in aktmodeswitches) then + if (m_default_ansistring in current_settings.modeswitches) then begin - include(aktlocalswitches,cs_ansistrings); + include(current_settings.localswitches,cs_ansistrings); if changeinit then - include(initlocalswitches,cs_ansistrings); + include(init_settings.localswitches,cs_ansistrings); end else begin - exclude(aktlocalswitches,cs_ansistrings); + exclude(current_settings.localswitches,cs_ansistrings); if changeinit then - exclude(initlocalswitches,cs_ansistrings); + exclude(init_settings.localswitches,cs_ansistrings); end; { turn inline on by default ? } - if (m_default_inline in aktmodeswitches) then + if (m_default_inline in current_settings.modeswitches) then begin - include(aktlocalswitches,cs_do_inline); + include(current_settings.localswitches,cs_do_inline); if changeinit then - include(initlocalswitches,cs_do_inline); + include(init_settings.localswitches,cs_do_inline); end else begin - exclude(aktlocalswitches,cs_ansistrings); + exclude(current_settings.localswitches,cs_ansistrings); if changeinit then - exclude(initlocalswitches,cs_ansistrings); + exclude(init_settings.localswitches,cs_ansistrings); end; { turn on bitpacking for mode macpas } - if (m_mac in aktmodeswitches) then + if (m_mac in current_settings.modeswitches) then begin - include(aktlocalswitches,cs_bitpacking); + include(current_settings.localswitches,cs_bitpacking); if changeinit then - include(initlocalswitches,cs_bitpacking); + include(init_settings.localswitches,cs_bitpacking); end; { support goto/label by default in delphi/tp7/mac modes } - if ([m_delphi,m_tp7,m_mac] * aktmodeswitches <> []) then + if ([m_delphi,m_tp7,m_mac] * current_settings.modeswitches <> []) then begin - include(aktmoduleswitches,cs_support_goto); + include(current_settings.moduleswitches,cs_support_goto); if changeinit then - include(initmoduleswitches,cs_support_goto); + include(init_settings.moduleswitches,cs_support_goto); end; { Default enum packing for delphi/tp7 } - if (m_tp7 in aktmodeswitches) or - (m_delphi in aktmodeswitches) then - aktpackenum:=1 - else if (m_mac in aktmodeswitches) then + if (m_tp7 in current_settings.modeswitches) or + (m_delphi in current_settings.modeswitches) then + current_settings.packenum:=1 + else if (m_mac in current_settings.modeswitches) then { compatible with Metrowerks Pascal } - aktpackenum:=2 + current_settings.packenum:=2 else - aktpackenum:=4; + current_settings.packenum:=4; if changeinit then - initpackenum:=aktpackenum; + init_settings.packenum:=current_settings.packenum; {$ifdef i386} { Default to intel assembler for delphi/tp7 on i386 } - if (m_delphi in aktmodeswitches) or - (m_tp7 in aktmodeswitches) then - aktasmmode:=asmmode_i386_intel; + if (m_delphi in current_settings.modeswitches) or + (m_tp7 in current_settings.modeswitches) then + current_settings.asmmode:=asmmode_i386_intel; if changeinit then - initasmmode:=aktasmmode; + init_settings.asmmode:=current_settings.asmmode; {$endif i386} { Exception support explicitly turned on (mainly for macpas, to } { compensate for lack of interprocedural goto support) } - if (cs_support_exceptions in aktglobalswitches) then - include(aktmodeswitches,m_except); + if (cs_support_exceptions in current_settings.globalswitches) then + include(current_settings.modeswitches,m_except); { Undefine old symbol } - if (m_delphi in oldaktmodeswitches) then + if (m_delphi in oldmodeswitches) then undef_system_macro('FPC_DELPHI') - else if (m_tp7 in oldaktmodeswitches) then + else if (m_tp7 in oldmodeswitches) then undef_system_macro('FPC_TP') - else if (m_objfpc in oldaktmodeswitches) then + else if (m_objfpc in oldmodeswitches) then undef_system_macro('FPC_OBJFPC') - else if (m_gpc in oldaktmodeswitches) then + else if (m_gpc in oldmodeswitches) then undef_system_macro('FPC_GPC') - else if (m_mac in oldaktmodeswitches) then + else if (m_mac in oldmodeswitches) then undef_system_macro('FPC_MACPAS'); { define new symbol in delphi,objfpc,tp,gpc,macpas mode } - if (m_delphi in aktmodeswitches) then + if (m_delphi in current_settings.modeswitches) then def_system_macro('FPC_DELPHI') - else if (m_tp7 in aktmodeswitches) then + else if (m_tp7 in current_settings.modeswitches) then def_system_macro('FPC_TP') - else if (m_objfpc in aktmodeswitches) then + else if (m_objfpc in current_settings.modeswitches) then def_system_macro('FPC_OBJFPC') - else if (m_gpc in aktmodeswitches) then + else if (m_gpc in current_settings.modeswitches) then def_system_macro('FPC_GPC') - else if (m_mac in aktmodeswitches) then + else if (m_mac in current_settings.modeswitches) then def_system_macro('FPC_MACPAS'); end; @@ -672,17 +672,17 @@ In case not, the value returned can be arbitrary. else macroType := [ctetInteger]; end - else if assigned(mac) and (m_mac in aktmodeswitches) and (result='FALSE') then + else if assigned(mac) and (m_mac in current_settings.modeswitches) and (result='FALSE') then begin result:= '0'; macroType:= [ctetBoolean]; end - else if assigned(mac) and (m_mac in aktmodeswitches) and (result='TRUE') then + else if assigned(mac) and (m_mac in current_settings.modeswitches) and (result='TRUE') then begin result:= '1'; macroType:= [ctetBoolean]; end - else if (m_mac in aktmodeswitches) and + else if (m_mac in current_settings.modeswitches) and (not assigned(mac) or not mac.defined) and (macrocount = 1) then begin @@ -720,7 +720,7 @@ In case not, the value returned can be arbitrary. current_scanner.skipspace; hasKlammer:= true; end - else if (m_mac in aktmodeswitches) then + else if (m_mac in current_settings.modeswitches) then hasKlammer:= false else Message(scan_e_error_in_preproc_expr); @@ -750,7 +750,7 @@ In case not, the value returned can be arbitrary. Message(scan_e_error_in_preproc_expr); end else - if (m_mac in aktmodeswitches) and (current_scanner.preproc_pattern='UNDEFINED') then + if (m_mac in current_settings.modeswitches) and (current_scanner.preproc_pattern='UNDEFINED') then begin factorType:= [ctetBoolean]; preproc_consume(_ID); @@ -774,7 +774,7 @@ In case not, the value returned can be arbitrary. Message(scan_e_error_in_preproc_expr); end else - if (m_mac in aktmodeswitches) and (current_scanner.preproc_pattern='OPTION') then + if (m_mac in current_settings.modeswitches) and (current_scanner.preproc_pattern='OPTION') then begin factorType:= [ctetBoolean]; preproc_consume(_ID); @@ -903,14 +903,14 @@ In case not, the value returned can be arbitrary. read_factor:='0'; {Just to have something} end else - if (m_mac in aktmodeswitches) and (current_scanner.preproc_pattern='TRUE') then + if (m_mac in current_settings.modeswitches) and (current_scanner.preproc_pattern='TRUE') then begin factorType:= [ctetBoolean]; preproc_consume(_ID); read_factor:='1'; end else - if (m_mac in aktmodeswitches) and (current_scanner.preproc_pattern='FALSE') then + if (m_mac in current_settings.modeswitches) and (current_scanner.preproc_pattern='FALSE') then begin factorType:= [ctetBoolean]; preproc_consume(_ID); @@ -922,7 +922,7 @@ In case not, the value returned can be arbitrary. { Default is to return the original symbol } read_factor:=hs; - if eval and (m_delphi in aktmodeswitches) and (ctetString in factorType) then + if eval and (m_delphi in current_settings.modeswitches) and (ctetString in factorType) then if searchsym(current_scanner.preproc_pattern,srsym,srsymtable) then begin case srsym.typ of @@ -1256,7 +1256,7 @@ In case not, the value returned can be arbitrary. end; end; mac.is_used:=true; - if (cs_support_macro in aktmoduleswitches) then + if (cs_support_macro in current_settings.moduleswitches) then begin current_scanner.skipspace; @@ -1980,11 +1980,11 @@ In case not, the value returned can be arbitrary. begin inc(inputpointer,3); message(scan_c_switching_to_utf8); - aktsourcecodepage:='utf8'; + current_settings.sourcecodepage:='utf8'; end; line_no:=1; - if cs_asm_source in aktglobalswitches then + if cs_asm_source in current_settings.globalswitches then inputfile.setline(line_no,bufstart); end; end @@ -2059,7 +2059,7 @@ In case not, the value returned can be arbitrary. var oldaktfilepos : tfileposinfo; begin - if (m_nested_comment in aktmodeswitches) then + if (m_nested_comment in current_settings.modeswitches) then inc(comment_level) else comment_level:=1; @@ -2075,7 +2075,7 @@ In case not, the value returned can be arbitrary. procedure tscannerfile.dec_comment_level; begin - if (m_nested_comment in aktmodeswitches) then + if (m_nested_comment in current_settings.modeswitches) then dec(comment_level) else comment_level:=0; @@ -2109,7 +2109,7 @@ In case not, the value returned can be arbitrary. lastlinepos:=bufstart+(inputpointer-inputbuffer); inc(line_no); { update linebuffer } - if cs_asm_source in aktglobalswitches then + if cs_asm_source in current_settings.globalswitches then inputfile.setline(line_no,lastlinepos); { update for status and call the show status routine, but don't touch aktfilepos ! } @@ -2270,7 +2270,7 @@ In case not, the value returned can be arbitrary. Message(scan_c_skipping_until); repeat current_scanner.skipuntildirective; - if not (m_mac in aktmodeswitches) then + if not (m_mac in current_settings.modeswitches) then p:=tdirectiveitem(turbo_scannerdirectives.search(current_scanner.readid)) else p:=tdirectiveitem(mac_scannerdirectives.search(current_scanner.readid)); @@ -2328,7 +2328,7 @@ In case not, the value returned can be arbitrary. hs:=current_scanner.readid; if (hs='') then begin - if (c='$') and (m_fpc in aktmodeswitches) then + if (c='$') and (m_fpc in current_settings.modeswitches) then begin current_scanner.readchar; { skip $ } hs:=current_scanner.readid; @@ -2345,7 +2345,7 @@ In case not, the value returned can be arbitrary. { directives may follow switches after a , } if hs<>'' then begin - if not (m_mac in aktmodeswitches) then + if not (m_mac in current_settings.modeswitches) then t:=tdirectiveitem(turbo_scannerdirectives.search(hs)) else t:=tdirectiveitem(mac_scannerdirectives.search(hs)); @@ -2981,7 +2981,7 @@ In case not, the value returned can be arbitrary. begin if localswitcheschanged then begin - aktlocalswitches:=nextaktlocalswitches; + current_settings.localswitches:=nextlocalswitches; localswitcheschanged:=false; end; @@ -3061,7 +3061,7 @@ In case not, the value returned can be arbitrary. with tokeninfo^[ttoken(high)] do if pattern=str then begin - if keyword in aktmodeswitches then + if keyword in current_settings.modeswitches then if op=NOTOKEN then token:=ttoken(high) else @@ -3073,7 +3073,7 @@ In case not, the value returned can be arbitrary. if token=_ID then begin { this takes some time ... } - if (cs_support_macro in aktmoduleswitches) then + if (cs_support_macro in current_settings.moduleswitches) then begin mac:=tmacro(search_macro(pattern)); if assigned(mac) and (not mac.is_compiler_var) and (assigned(mac.buftext)) then @@ -3114,7 +3114,7 @@ In case not, the value returned can be arbitrary. '%' : begin - if not(m_fpc in aktmodeswitches) then + if not(m_fpc in current_settings.modeswitches) then Illegal_Char(c) else begin @@ -3126,13 +3126,13 @@ In case not, the value returned can be arbitrary. '&' : begin - if m_fpc in aktmodeswitches then + if m_fpc in current_settings.modeswitches then begin readnumber; token:=_INTCONST; goto exit_label; end - else if m_mac in aktmodeswitches then + else if m_mac in current_settings.modeswitches then begin readchar; token:=_AMPERSAND; @@ -3254,7 +3254,7 @@ In case not, the value returned can be arbitrary. '+' : begin readchar; - if (c='=') and (cs_support_c_operators in aktmoduleswitches) then + if (c='=') and (cs_support_c_operators in current_settings.moduleswitches) then begin readchar; token:=_PLUSASN; @@ -3267,7 +3267,7 @@ In case not, the value returned can be arbitrary. '-' : begin readchar; - if (c='=') and (cs_support_c_operators in aktmoduleswitches) then + if (c='=') and (cs_support_c_operators in current_settings.moduleswitches) then begin readchar; token:=_MINUSASN; @@ -3293,7 +3293,7 @@ In case not, the value returned can be arbitrary. '*' : begin readchar; - if (c='=') and (cs_support_c_operators in aktmoduleswitches) then + if (c='=') and (cs_support_c_operators in current_settings.moduleswitches) then begin readchar; token:=_STARASN; @@ -3315,7 +3315,7 @@ In case not, the value returned can be arbitrary. case c of '=' : begin - if (cs_support_c_operators in aktmoduleswitches) then + if (cs_support_c_operators in current_settings.moduleswitches) then begin readchar; token:=_SLASHASN; @@ -3334,7 +3334,7 @@ In case not, the value returned can be arbitrary. end; '|' : - if m_mac in aktmodeswitches then + if m_mac in current_settings.modeswitches then begin readchar; token:=_PIPE; @@ -3501,7 +3501,7 @@ In case not, the value returned can be arbitrary. end; end; { interpret as utf-8 string? } - if (ord(c)>=$80) and (aktsourcecodepage='utf8') then + if (ord(c)>=$80) and (current_settings.sourcecodepage='utf8') then begin { convert existing string to an utf-8 string } if not iswidestring then @@ -3545,7 +3545,7 @@ In case not, the value returned can be arbitrary. end else if iswidestring then begin - if aktsourcecodepage='utf8' then + if current_settings.sourcecodepage='utf8' then concatwidestringchar(patternw,ord(c)) else concatwidestringchar(patternw,asciichar2unicode(c)) diff --git a/compiler/script.pas b/compiler/script.pas index 26277f2c41..9062ce6601 100644 --- a/compiler/script.pas +++ b/compiler/script.pas @@ -114,7 +114,7 @@ uses Function ScriptFixFileName(const s:string):string; begin - if cs_link_on_target in aktglobalswitches then + if cs_link_on_target in current_settings.globalswitches then ScriptFixFileName:=TargetFixFileName(s) else ScriptFixFileName:=FixFileName(s); @@ -135,7 +135,7 @@ end; constructor TScript.CreateExec(const s:string); begin fn:=FixFileName(s); - if cs_link_on_target in aktglobalswitches then + if cs_link_on_target in current_settings.globalswitches then fn:=AddExtension(fn,target_info.scriptext) else fn:=AddExtension(fn,source_info.scriptext); @@ -176,7 +176,7 @@ var begin Assign(t,fn); - if cs_link_on_target in aktglobalswitches then + if cs_link_on_target in current_settings.globalswitches then le:= target_info.newline else le:= source_info.newline; @@ -465,7 +465,7 @@ Procedure GenerateAsmRes(const st : string); var scripttyp : tscripttype; begin - if cs_link_on_target in aktglobalswitches then + if cs_link_on_target in current_settings.globalswitches then scripttyp := target_info.script else scripttyp := source_info.script; @@ -498,7 +498,7 @@ begin begin if not(s[1] in ['a'..'z','A'..'Z','/','\','.','"']) then begin - if cs_link_on_target in aktglobalswitches then + if cs_link_on_target in current_settings.globalswitches then inherited Add('.'+target_info.DirSep+s) else inherited Add('.'+source_info.DirSep+s); diff --git a/compiler/sparc/cgcpu.pas b/compiler/sparc/cgcpu.pas index f05970b759..31f1db5a50 100644 --- a/compiler/sparc/cgcpu.pas +++ b/compiler/sparc/cgcpu.pas @@ -152,7 +152,7 @@ implementation ref.base:=ref.index; ref.index:=NR_NO; end; - if (cs_create_pic in aktmoduleswitches) and + if (cs_create_pic in current_settings.moduleswitches) and assigned(ref.symbol) then begin tmpreg:=GetIntRegister(list,OS_INT); @@ -264,7 +264,7 @@ implementation begin inherited init_register_allocators; - if (cs_create_pic in aktmoduleswitches) and + if (cs_create_pic in current_settings.moduleswitches) and (pi_needs_got in current_procinfo.flags) then begin current_procinfo.got:=NR_L7; @@ -589,7 +589,7 @@ implementation if (href.base=NR_NO) and (href.index<>NR_NO) then internalerror(200306171); - if (cs_create_pic in aktmoduleswitches) and + if (cs_create_pic in current_settings.moduleswitches) and assigned(href.symbol) then begin tmpreg:=GetIntRegister(list,OS_ADDR); @@ -956,7 +956,7 @@ implementation ai:TAiCpu; hflags : tresflags; begin - if not(cs_check_overflow in aktlocalswitches) then + if not(cs_check_overflow in current_settings.localswitches) then exit; current_asmdata.getjumplabel(hl); case ovloc.loc of @@ -1011,7 +1011,7 @@ implementation end else list.concat(Taicpu.Op_reg_const_reg(A_SAVE,NR_STACK_POINTER_REG,-LocalSize,NR_STACK_POINTER_REG)); - if (cs_create_pic in aktmoduleswitches) and + if (cs_create_pic in current_settings.moduleswitches) and (pi_needs_got in current_procinfo.flags) then begin current_procinfo.got:=NR_L7; diff --git a/compiler/sparc/cpupi.pas b/compiler/sparc/cpupi.pas index 8015150226..489e7cb62c 100644 --- a/compiler/sparc/cpupi.pas +++ b/compiler/sparc/cpupi.pas @@ -67,7 +67,7 @@ implementation Alignment must be the max available, as doubles require 8 byte alignment } - result:=Align(tg.direction*tg.lasttemp+maxpushedparasize+target_info.first_parm_offset,aktalignment.localalignmax); + result:=Align(tg.direction*tg.lasttemp+maxpushedparasize+target_info.first_parm_offset,current_settings.alignment.localalignmax); end; diff --git a/compiler/sparc/ncpumat.pas b/compiler/sparc/ncpumat.pas index 528977a5d8..eb5aad088e 100644 --- a/compiler/sparc/ncpumat.pas +++ b/compiler/sparc/ncpumat.pas @@ -139,7 +139,7 @@ implementation current_asmdata.CurrAsmList.concat(taicpu.op_none(A_NOP)); op := divops[is_signed(right.resultdef), - cs_check_overflow in aktlocalswitches]; + cs_check_overflow in current_settings.localswitches]; current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(op,numerator,divider,resultreg)); if (nodetype = modn) then diff --git a/compiler/switches.pas b/compiler/switches.pas index 63435c40e3..e638eac5f3 100644 --- a/compiler/switches.pas +++ b/compiler/switches.pas @@ -121,7 +121,7 @@ begin end; { Select switch table } - if m_mac in aktmodeswitches then + if m_mac in current_settings.modeswitches then switchTablePtr:= @macSwitchTable else switchTablePtr:= @turboSwitchTable; @@ -132,15 +132,15 @@ begin case typesw of alignsw: if state='+' then - aktpackrecords:=4 + current_settings.packrecords:=4 else - aktpackrecords:=1; + current_settings.packrecords:=1; optimizersw : begin if state='+' then - aktoptimizerswitches:=level2optimizerswitches + current_settings.optimizerswitches:=level2optimizerswitches else - aktoptimizerswitches:=[]; + current_settings.optimizerswitches:=[]; end; ignoredsw : Message1(scan_n_ignored_switch,'$'+switch); @@ -151,11 +151,11 @@ begin localsw : begin if not localswitcheschanged then - nextaktlocalswitches:=aktlocalswitches; + nextlocalswitches:=current_settings.localswitches; if state='+' then - include(nextaktlocalswitches,tlocalswitch(setsw)) + include(nextlocalswitches,tlocalswitch(setsw)) else - exclude(nextaktlocalswitches,tlocalswitch(setsw)); + exclude(nextlocalswitches,tlocalswitch(setsw)); localswitcheschanged:=true; end; modulesw : @@ -163,14 +163,14 @@ begin if current_module.in_global then begin if state='+' then - include(aktmoduleswitches,tmoduleswitch(setsw)) + include(current_settings.moduleswitches,tmoduleswitch(setsw)) else begin { Turning off debuginfo when lineinfo is requested is not possible } - if not((cs_use_lineinfo in aktglobalswitches) and + if not((cs_use_lineinfo in current_settings.globalswitches) and (tmoduleswitch(setsw)=cs_debuginfo)) then - exclude(aktmoduleswitches,tmoduleswitch(setsw)); + exclude(current_settings.moduleswitches,tmoduleswitch(setsw)); end; end else @@ -181,9 +181,9 @@ begin if current_module.in_global and (current_module=main_module) then begin if state='+' then - include(aktglobalswitches,tglobalswitch(setsw)) + include(current_settings.globalswitches,tglobalswitch(setsw)) else - exclude(aktglobalswitches,tglobalswitch(setsw)); + exclude(current_settings.globalswitches,tglobalswitch(setsw)); end else Message(scan_w_switch_is_global); @@ -210,7 +210,7 @@ begin end; { Select switch table } - if m_mac in aktmodeswitches then + if m_mac in current_settings.modeswitches then switchTablePtr:= @macSwitchTable else switchTablePtr:= @turboSwitchTable; @@ -219,9 +219,9 @@ begin with switchTablePtr^[switch] do begin case typesw of - localsw : found:=(tlocalswitch(setsw) in aktlocalswitches); - modulesw : found:=(tmoduleswitch(setsw) in aktmoduleswitches); - globalsw : found:=(tglobalswitch(setsw) in aktglobalswitches); + localsw : found:=(tlocalswitch(setsw) in current_settings.localswitches); + modulesw : found:=(tmoduleswitch(setsw) in current_settings.moduleswitches); + globalsw : found:=(tglobalswitch(setsw) in current_settings.globalswitches); else found:=false; end; diff --git a/compiler/symdef.pas b/compiler/symdef.pas index 20f7ad23db..b7c16940bc 100644 --- a/compiler/symdef.pas +++ b/compiler/symdef.pas @@ -1203,7 +1203,7 @@ implementation {$ifdef x86} result:=use_sse(self); {$else x86} - result:=(deftype=floatdef) and not(cs_fp_emulation in aktmoduleswitches); + result:=(deftype=floatdef) and not(cs_fp_emulation in current_settings.moduleswitches); {$endif x86} end; @@ -1471,13 +1471,13 @@ implementation procedure tenumdef.calcsavesize; begin - if (aktpackenum=8) or (min<low(longint)) or (int64(max)>high(cardinal)) then + if (current_settings.packenum=8) or (min<low(longint)) or (int64(max)>high(cardinal)) then savesize:=8 else - if (aktpackenum=4) or (min<low(smallint)) or (max>high(word)) then + if (current_settings.packenum=4) or (min<low(smallint)) or (max>high(word)) then savesize:=4 else - if (aktpackenum=2) or (min<low(shortint)) or (max>high(byte)) then + if (current_settings.packenum=2) or (min<low(shortint)) or (max>high(byte)) then savesize:=2 else savesize:=1; @@ -2309,22 +2309,22 @@ implementation if high<32 then begin settype:=smallset; - if aktsetalloc=0 then { $PACKSET Fixed?} + if current_settings.setalloc=0 then { $PACKSET Fixed?} savesize:=Sizeof(longint) else {No, use $PACKSET VALUE for rounding} - savesize:=aktsetalloc*((high+aktsetalloc*8-1) DIV (aktsetalloc*8)); + savesize:=current_settings.setalloc*((high+current_settings.setalloc*8-1) DIV (current_settings.setalloc*8)); end else if high<256 then begin settype:=normset; - if aktsetalloc=0 then { $PACKSET Fixed?} + if current_settings.setalloc=0 then { $PACKSET Fixed?} savesize:=32 else {No, use $PACKSET VALUE for rounding} - savesize:=aktsetalloc*((high+aktsetalloc*8-1) DIV (aktsetalloc*8)); + savesize:=current_settings.setalloc*((high+current_settings.setalloc*8-1) DIV (current_settings.setalloc*8)); end else - savesize:=aktsetalloc*((high+aktsetalloc*8-1) DIV (aktsetalloc*8)); + savesize:=current_settings.setalloc*((high+current_settings.setalloc*8-1) DIV (current_settings.setalloc*8)); end; @@ -3261,7 +3261,7 @@ implementation defref:=nil; lastwritten:=nil; refcount:=0; - if (cs_browser in aktmoduleswitches) and make_ref then + if (cs_browser in current_settings.moduleswitches) and make_ref then begin defref:=tref.create(defref,@akttokenpos); inc(refcount); @@ -3341,7 +3341,7 @@ implementation if (po_has_inlininginfo in procoptions) then inlininginfo^.code:=ppuloadnodetree(ppufile); { default values for no persistent data } - if (cs_link_deffile in aktglobalswitches) and + if (cs_link_deffile in current_settings.globalswitches) and (tf_need_export in target_info.flags) and (po_exports in procoptions) then deffile.AddExport(mangledname); @@ -4027,7 +4027,7 @@ implementation { Exception: interface definitions in mode macpas, since in that } { case no reference to the old name can exist yet (JM) } if assigned(_mangledname) then - if ((m_mac in aktmodeswitches) and + if ((m_mac in current_settings.modeswitches) and (interfacedef)) then stringdispose(_mangledname) else @@ -4367,7 +4367,7 @@ implementation objecttype:=ot; objectoptions:=[]; childof:=nil; - symtable:=tobjectsymtable.create(n,aktpackrecords); + symtable:=tobjectsymtable.create(n,current_settings.packrecords); { create space for vmt !! } vmt_offset:=0; symtable.defowner:=self; @@ -5661,8 +5661,8 @@ implementation {$ifdef x86} function use_sse(def : tdef) : boolean; begin - use_sse:=(is_single(def) and (aktfputype in sse_singlescalar)) or - (is_double(def) and (aktfputype in sse_doublescalar)); + use_sse:=(is_single(def) and (current_settings.fputype in sse_singlescalar)) or + (is_double(def) and (current_settings.fputype in sse_doublescalar)); end; {$endif x86} diff --git a/compiler/symsym.pas b/compiler/symsym.pas index fbc91c2d9c..06b3723008 100644 --- a/compiler/symsym.pas +++ b/compiler/symsym.pas @@ -650,7 +650,7 @@ implementation begin if (p^.def.owner=owner) and (p^.def.forwarddef) then begin - if (m_mac in aktmodeswitches) and (p^.def.interfacedef) then + if (m_mac in current_settings.modeswitches) and (p^.def.interfacedef) then import_implict_external(p^.def) else begin @@ -1249,7 +1249,7 @@ implementation registers is not valid anymore) - it has a local copy - the value needs to be in memory (i.e. reference counted) } - result:=(cs_opt_regvar in aktoptimizerswitches) and + result:=(cs_opt_regvar in current_settings.optimizerswitches) and not(pi_has_assembler_block in current_procinfo.flags) and not(pi_uses_exceptions in current_procinfo.flags) and not(vo_has_local_copy in varoptions) and @@ -1327,7 +1327,7 @@ implementation (owner.symtabletype in [localsymtable,parasymtable]) or ( (owner.symtabletype=staticsymtable) and - not(cs_create_pic in aktmoduleswitches) + not(cs_create_pic in current_settings.moduleswitches) ) then begin if tstoreddef(vardef).is_intregable then diff --git a/compiler/symtable.pas b/compiler/symtable.pas index 1a124f76f4..8fabea0969 100644 --- a/compiler/symtable.pas +++ b/compiler/symtable.pas @@ -950,7 +950,7 @@ implementation Message1(sym_w_wrong_C_pack,vardef.typename); if varalign=0 then varalign:=l; - if (fieldalignment<aktalignment.maxCrecordalign) then + if (fieldalignment<current_settings.alignment.maxCrecordalign) then begin if (varalign>16) and (fieldalignment<32) then fieldalignment:=32 @@ -966,12 +966,12 @@ implementation else if (varalign>1) and (fieldalignment<2) then fieldalignment:=2; end; - fieldalignment:=min(fieldalignment,aktalignment.maxCrecordalign); + fieldalignment:=min(fieldalignment,current_settings.alignment.maxCrecordalign); end; if varalign=0 then varalign:=size_2_align(l); if (usefieldalignment<> bit_alignment) then - varalignfield:=used_align(varalign,aktalignment.recordalignmin,fieldalignment); + varalignfield:=used_align(varalign,current_settings.alignment.recordalignmin,fieldalignment); sym.fieldoffset:=align(_datasize,varalignfield); if (int64(l)+sym.fieldoffset)>high(aint) then @@ -983,14 +983,14 @@ implementation _datasize:=sym.fieldoffset+l; { Calc alignment needed for this record } if (usefieldalignment=C_alignment) then - varalignrecord:=used_align(varalign,aktalignment.recordalignmin,aktalignment.maxCrecordalign) + varalignrecord:=used_align(varalign,current_settings.alignment.recordalignmin,current_settings.alignment.maxCrecordalign) else if (usefieldalignment=0) then - varalignrecord:=used_align(varalign,aktalignment.recordalignmin,aktalignment.recordalignmax) + varalignrecord:=used_align(varalign,current_settings.alignment.recordalignmin,current_settings.alignment.recordalignmax) else begin { packrecords is set explicitly, ignore recordalignmax limit } - varalignrecord:=used_align(varalign,aktalignment.recordalignmin,usefieldalignment); + varalignrecord:=used_align(varalign,current_settings.alignment.recordalignmin,usefieldalignment); end; recordalignment:=max(recordalignment,varalignrecord); end; @@ -1113,7 +1113,7 @@ implementation varalign:=tfieldvarsym(ps).vardef.alignment; if varalign=0 then varalign:=size_2_align(tfieldvarsym(ps).getsize); - varalignrecord:=used_align(varalign,aktalignment.recordalignmin,fieldalignment); + varalignrecord:=used_align(varalign,current_settings.alignment.recordalignmin,fieldalignment); recordalignment:=max(recordalignment,varalignrecord); end; @@ -1159,7 +1159,7 @@ implementation if not assigned(defowner) then internalerror(200602061); - if (m_duplicate_names in aktmodeswitches) and + if (m_duplicate_names in current_settings.modeswitches) and (sym.typ in [paravarsym,localvarsym]) then exit; @@ -1167,7 +1167,7 @@ implementation also in inherited classes } if (sym.typ in [fieldvarsym,paravarsym,localvarsym]) and ( - not(m_delphi in aktmodeswitches) or + not(m_delphi in current_settings.modeswitches) or is_object(tdef(defowner)) ) then begin @@ -1235,10 +1235,10 @@ implementation begin { a local and the function can have the same name in TP and Delphi, but RESULT not } - if (m_duplicate_names in aktmodeswitches) and + if (m_duplicate_names in current_settings.modeswitches) and (hsym.typ in [absolutevarsym,localvarsym]) and (vo_is_funcret in tabstractvarsym(hsym).varoptions) and - not((m_result in aktmodeswitches) and + not((m_result in current_settings.modeswitches) and (vo_is_result in tabstractvarsym(hsym).varoptions)) then HideSym(hsym) else @@ -1255,10 +1255,10 @@ implementation begin { a local and the function can have the same name in TP and Delphi, but RESULT not } - if (m_duplicate_names in aktmodeswitches) and + if (m_duplicate_names in current_settings.modeswitches) and (sym.typ in [absolutevarsym,localvarsym]) and (vo_is_funcret in tabstractvarsym(sym).varoptions) and - not((m_result in aktmodeswitches) and + not((m_result in current_settings.modeswitches) and (vo_is_result in tabstractvarsym(sym).varoptions)) then HideSym(sym) else @@ -1268,7 +1268,7 @@ implementation { check objectsymtable, skip this for funcret sym because that will always be positive because it has the same name as the procsym } - if not(m_duplicate_names in aktmodeswitches) and + if not(m_duplicate_names in current_settings.modeswitches) and not is_funcret_sym(sym) and (defowner.deftype=procdef) and assigned(tprocdef(defowner)._class) and @@ -1294,7 +1294,7 @@ implementation result:=inherited checkduplicate(sym); if result then exit; - if not(m_duplicate_names in aktmodeswitches) and + if not(m_duplicate_names in current_settings.modeswitches) and (defowner.deftype=procdef) and assigned(tprocdef(defowner)._class) and (tprocdef(defowner).owner.defowner=tprocdef(defowner)._class) then @@ -1374,7 +1374,7 @@ implementation { Delphi you can have a symbol with the same name as the unit, the unit can then not be accessed anymore using <unit>.<id>, so we can hide the symbol } - if (m_duplicate_names in aktmodeswitches) and + if (m_duplicate_names in current_settings.modeswitches) and (hsym.typ=symconst.unitsym) then HideSym(hsym) else @@ -1440,7 +1440,7 @@ implementation { Delphi you can have a symbol with the same name as the unit, the unit can then not be accessed anymore using <unit>.<id>, so we can hide the symbol } - if (m_duplicate_names in aktmodeswitches) and + if (m_duplicate_names in current_settings.modeswitches) and (hsym.typ=symconst.unitsym) then HideSym(hsym) else @@ -1638,7 +1638,7 @@ implementation end; inc(sym.refs); - if (cs_browser in aktmoduleswitches) then + if (cs_browser in current_settings.moduleswitches) then begin newref:=tref.create(sym.lastref,@akttokenpos); { for symbols that are in tables without browser info or syssyms } diff --git a/compiler/symtype.pas b/compiler/symtype.pas index 0ff78b89dd..86b25891f3 100644 --- a/compiler/symtype.pas +++ b/compiler/symtype.pas @@ -312,7 +312,7 @@ implementation lastwritten:=nil; refcount:=0; fileinfo:=akttokenpos; - if (cs_browser in aktmoduleswitches) and make_ref then + if (cs_browser in current_settings.moduleswitches) and make_ref then begin defref:=tref.create(defref,@akttokenpos); inc(refcount); diff --git a/compiler/systems/t_amiga.pas b/compiler/systems/t_amiga.pas index 29a10d02a2..2014439c7e 100644 --- a/compiler/systems/t_amiga.pas +++ b/compiler/systems/t_amiga.pas @@ -107,7 +107,7 @@ begin while assigned(HPath) do begin s:=HPath.Str; - if (cs_link_on_target in aktglobalswitches) then + if (cs_link_on_target in current_settings.globalswitches) then s:=ScriptFixFileName(s); LinkRes.Add('-L'+s); HPath:=TStringListItem(HPath.Next); @@ -146,7 +146,7 @@ begin end; end; - if (cs_link_on_target in aktglobalswitches) then + if (cs_link_on_target in current_settings.globalswitches) then begin LinkRes.Add(')'); @@ -200,7 +200,7 @@ var StripStr: string[40]; begin StripStr:=''; - if (cs_link_strip in aktglobalswitches) then StripStr:='-s'; + if (cs_link_strip in current_settings.globalswitches) then StripStr:='-s'; { Call linker } SplitBinCmd(Info.ExeCmd[1],BinStr,CmdStr); @@ -215,7 +215,7 @@ function TLinkerAmiga.MakeExecutable:boolean; var success : boolean; begin - if not(cs_link_nolink in aktglobalswitches) then + if not(cs_link_nolink in current_settings.globalswitches) then Message1(exec_i_linking,current_module.exefilename^); { Write used files and libraries } @@ -227,7 +227,7 @@ begin end; { Remove ReponseFile } - if (success) and not(cs_link_nolink in aktglobalswitches) then + if (success) and not(cs_link_nolink in current_settings.globalswitches) then RemoveFile(outputexedir+Info.ResName); MakeExecutable:=success; { otherwise a recursive call to link method } diff --git a/compiler/systems/t_beos.pas b/compiler/systems/t_beos.pas index 793f03452c..0bd51b58ae 100644 --- a/compiler/systems/t_beos.pas +++ b/compiler/systems/t_beos.pas @@ -221,7 +221,7 @@ begin prtobj:='prt0'; cprtobj:='cprt0'; - if (cs_profile in aktmoduleswitches) or + if (cs_profile in current_settings.moduleswitches) or (not SharedLibFiles.Empty) then begin AddSharedLibrary('root'); @@ -362,18 +362,18 @@ var StaticStr, StripStr : string[40]; begin - if not(cs_link_nolink in aktglobalswitches) then + if not(cs_link_nolink in current_settings.globalswitches) then Message1(exec_i_linking,current_module.exefilename^); { Create some replacements } StaticStr:=''; StripStr:=''; DynLinkStr:=''; - if (cs_link_staticflag in aktglobalswitches) then + if (cs_link_staticflag in current_settings.globalswitches) then StaticStr:='-static'; - if (cs_link_strip in aktglobalswitches) then + if (cs_link_strip in current_settings.globalswitches) then StripStr:='-s'; - If (cs_profile in aktmoduleswitches) or + If (cs_profile in current_settings.moduleswitches) or ((Info.DynamicLinker<>'') and (not SharedLibFiles.Empty)) then begin DynLinkStr:='-dynamic-linker='+Info.DynamicLinker; @@ -397,7 +397,7 @@ begin success:=DoExec(FindUtil(utilsprefix+BinStr),CmdStr,true,true); { Remove ReponseFile } - if (success) and not(cs_link_nolink in aktglobalswitches) then + if (success) and not(cs_link_nolink in current_settings.globalswitches) then RemoveFile(outputexedir+Info.ResName); MakeExecutable:=success; { otherwise a recursive call to link method } @@ -415,18 +415,18 @@ var begin MakeSharedLibrary:=false; - if not(cs_link_nolink in aktglobalswitches) then + if not(cs_link_nolink in current_settings.globalswitches) then Message1(exec_i_linking,current_module.sharedlibfilename^); { Create some replacements } StaticStr:=''; StripStr:=''; DynLinkStr:=''; - if (cs_link_staticflag in aktglobalswitches) then + if (cs_link_staticflag in current_settings.globalswitches) then StaticStr:='-static'; - if (cs_link_strip in aktglobalswitches) then + if (cs_link_strip in current_settings.globalswitches) then StripStr:='-s'; - If (cs_profile in aktmoduleswitches) or + If (cs_profile in current_settings.moduleswitches) or ((Info.DynamicLinker<>'') and (not SharedLibFiles.Empty)) then begin DynLinkStr:='-dynamic-linker='+Info.DynamicLinker; @@ -449,7 +449,7 @@ var success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,true); { Strip the library ? } - if success and (cs_link_strip in aktglobalswitches) then + if success and (cs_link_strip in current_settings.globalswitches) then begin SplitBinCmd(Info.DllCmd[2],binstr,cmdstr); Replace(cmdstr,'$EXE',maybequoted(current_module.sharedlibfilename^)); @@ -457,7 +457,7 @@ var end; { Remove ReponseFile } - if (success) and not(cs_link_nolink in aktglobalswitches) then + if (success) and not(cs_link_nolink in current_settings.globalswitches) then RemoveFile(outputexedir+Info.ResName); MakeSharedLibrary:=success; { otherwise a recursive call to link method } diff --git a/compiler/systems/t_bsd.pas b/compiler/systems/t_bsd.pas index daac044d03..9273080750 100644 --- a/compiler/systems/t_bsd.pas +++ b/compiler/systems/t_bsd.pas @@ -175,14 +175,14 @@ begin { place jump in al_procedures } current_asmdata.asmlists[al_procedures].concat(tai_align.create(target_info.alignment.procalign)); current_asmdata.asmlists[al_procedures].concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0)); - if (cs_create_pic in aktmoduleswitches) and + if (cs_create_pic in current_settings.moduleswitches) and { other targets need to be checked how it works } (target_info.system in [system_i386_freebsd]) then begin {$ifdef x86} sym:=current_asmdata.RefAsmSymbol(tprocsym(hp2.sym).first_procdef.mangledname); reference_reset_symbol(r,sym,0); - if cs_create_pic in aktmoduleswitches then + if cs_create_pic in current_settings.moduleswitches then r.refaddr:=addr_pic else r.refaddr:=addr_full; @@ -259,7 +259,7 @@ Begin if not(target_info.system in [system_powerpc_darwin,system_i386_darwin]) then begin if (target_info.system =system_i386_freebsd) and - not (cs_link_no_default_lib_order in aktglobalswitches) Then + not (cs_link_no_default_lib_order in current_settings.globalswitches) Then Begin LinkLibraryOrder.add('gcc','',15); LinkLibraryOrder.add('c','',50); // c and c_p mutual. excl? @@ -267,7 +267,7 @@ Begin LinkLibraryOrder.add('pthread','',75); // pthread and c_r should be mutually exclusive LinkLibraryOrder.add('c_r','',76); LinkLibraryOrder.add('kvm','',80); // must be before ncurses - if (cs_link_pthread in aktglobalswitches) Then // convert libpthread to libc_r. + if (cs_link_pthread in current_settings.globalswitches) Then // convert libpthread to libc_r. LinkLibraryAliases.add('pthread','c_r'); end; end @@ -312,8 +312,8 @@ begin ( ReorderEntries or - (cs_link_pthread in aktglobalswitches)); - if cs_profile in aktmoduleswitches then + (cs_link_pthread in current_settings.globalswitches)); + if cs_profile in current_settings.moduleswitches then begin prtobj:=gprtobj; AddSharedLibrary('c'); @@ -333,7 +333,7 @@ begin linklibc := true; reorder:=reorderentries; if not(isdll) then - if not(cs_profile in aktmoduleswitches) then + if not(cs_profile in current_settings.moduleswitches) then begin if librarysearchpath.FindFile('crt1.o',s) then prtobj:=s @@ -452,7 +452,7 @@ begin LinkRes.Add('-lc'); end; { when we have -static for the linker the we also need libgcc } - if (cs_link_staticflag in aktglobalswitches) then + if (cs_link_staticflag in current_settings.globalswitches) then LinkRes.Add('-lgcc'); if linkdynamic and (Info.DynamicLinker<>'') then LinkRes.AddFileName(Info.DynamicLinker); @@ -497,7 +497,7 @@ var StaticStr, StripStr : string[40]; begin - if not(cs_link_nolink in aktglobalswitches) then + if not(cs_link_nolink in current_settings.globalswitches) then Message1(exec_i_linking,current_module.exefilename^); { Create some replacements } @@ -505,19 +505,19 @@ begin StripStr:=''; DynLinkStr:=''; GCSectionsStr:=''; - if (cs_link_staticflag in aktglobalswitches) then + if (cs_link_staticflag in current_settings.globalswitches) then begin if (target_info.system=system_m68k_netbsd) and - ((cs_link_on_target in aktglobalswitches) or + ((cs_link_on_target in current_settings.globalswitches) or (target_info.system=source_info.system)) then StaticStr:='-Bstatic' else StaticStr:='-static'; end; - if (cs_link_strip in aktglobalswitches) then + if (cs_link_strip in current_settings.globalswitches) then StripStr:='-s'; - if (cs_link_smart in aktglobalswitches) and + if (cs_link_smart in current_settings.globalswitches) and (tf_smartlink_sections in target_info.flags) then if not(target_info.system in [system_powerpc_darwin,system_i386_darwin]) then GCSectionsStr:='--gc-sections' @@ -525,7 +525,7 @@ begin // warning: this option only exists for 32 bit under Mac OS X, maybe the default for 64 bit? GCSectionsStr:='-dead_strip'; - If (cs_profile in aktmoduleswitches) or + If (cs_profile in current_settings.moduleswitches) or ((Info.DynamicLinker<>'') and (not SharedLibFiles.Empty)) then DynLinkStr:='-dynamic-linker='+Info.DynamicLinker; @@ -551,7 +551,7 @@ begin success:=DoExec(FindUtil(utilsprefix+BinStr),CmdStr,true,LdSupportsNoResponseFile); { Remove ReponseFile } - if (success) and not(cs_link_nolink in aktglobalswitches) then + if (success) and not(cs_link_nolink in current_settings.globalswitches) then RemoveFile(outputexedir+Info.ResName); MakeExecutable:=success; { otherwise a recursive call to link method } @@ -568,7 +568,7 @@ var success : boolean; begin MakeSharedLibrary:=false; - if not(cs_link_nolink in aktglobalswitches) then + if not(cs_link_nolink in current_settings.globalswitches) then Message1(exec_i_linking,current_module.sharedlibfilename^); { Write used files and libraries } @@ -598,7 +598,7 @@ begin success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,LdSupportsNoResponseFile); { Strip the library ? } - if success and (cs_link_strip in aktglobalswitches) then + if success and (cs_link_strip in current_settings.globalswitches) then begin SplitBinCmd(Info.DllCmd[2],binstr,cmdstr); Replace(cmdstr,'$EXE',maybequoted(current_module.sharedlibfilename^)); @@ -606,7 +606,7 @@ begin end; { Remove ReponseFile } - if (success) and not(cs_link_nolink in aktglobalswitches) then + if (success) and not(cs_link_nolink in current_settings.globalswitches) then RemoveFile(outputexedir+Info.ResName); MakeSharedLibrary:=success; { otherwise a recursive call to link method } diff --git a/compiler/systems/t_emx.pas b/compiler/systems/t_emx.pas index 1b3142cbc9..4cdab376d6 100644 --- a/compiler/systems/t_emx.pas +++ b/compiler/systems/t_emx.pas @@ -443,13 +443,13 @@ var ES: ExtStr; OutName: PathStr; begin - if not(cs_link_nolink in aktglobalswitches) then + if not(cs_link_nolink in current_settings.globalswitches) then Message1(exec_i_linking,current_module.exefilename^); { Create some replacements } FSplit (current_module.exefilename^, DS, NS, ES); OutName := DS + NS + '.out'; - if (cs_link_strip in aktglobalswitches) then + if (cs_link_strip in current_settings.globalswitches) then StripStr := '-s' else StripStr := ''; @@ -497,7 +497,7 @@ begin end; { Remove ReponseFile } - if (success) and not(cs_link_nolink in aktglobalswitches) then + if (success) and not(cs_link_nolink in current_settings.globalswitches) then RemoveFile(outputexedir+Info.ResName); MakeExecutable:=success; { otherwise a recursive call to link method } diff --git a/compiler/systems/t_gba.pas b/compiler/systems/t_gba.pas index 90f010acda..2e682f326d 100644 --- a/compiler/systems/t_gba.pas +++ b/compiler/systems/t_gba.pas @@ -85,7 +85,7 @@ begin while assigned(HPath) do begin s:=HPath.Str; - if (cs_link_on_target in aktglobalswitches) then + if (cs_link_on_target in current_settings.globalswitches) then s:=ScriptFixFileName(s); LinkRes.Add('-L'+s); HPath:=TStringListItem(HPath.Next); @@ -109,7 +109,7 @@ begin if s<>'' then begin { vlink doesn't use SEARCH_DIR for object files } - if not(cs_link_on_target in aktglobalswitches) then + if not(cs_link_on_target in current_settings.globalswitches) then s:=FindObjectFile(s,'',false); LinkRes.AddFileName((maybequoted(s))); end; @@ -119,7 +119,7 @@ begin if not StaticLibFiles.Empty then begin { vlink doesn't need, and doesn't support GROUP } - if (cs_link_on_target in aktglobalswitches) then + if (cs_link_on_target in current_settings.globalswitches) then begin LinkRes.Add(')'); LinkRes.Add('GROUP('); @@ -131,7 +131,7 @@ begin end; end; - if (cs_link_on_target in aktglobalswitches) then + if (cs_link_on_target in current_settings.globalswitches) then begin LinkRes.Add(')'); @@ -509,8 +509,8 @@ begin DynLinkStr:=''; GCSectionsStr:='--gc-sections'; - //if not(cs_link_extern in aktglobalswitches) then - if not(cs_link_nolink in aktglobalswitches) then + //if not(cs_link_extern in current_settings.globalswitches) then + if not(cs_link_nolink in current_settings.globalswitches) then Message1(exec_i_linking,current_module.exefilename^); { Write used files and libraries } @@ -519,7 +519,7 @@ begin { Call linker } SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr); Replace(cmdstr,'$OPT',Info.ExtraOptions); - if not(cs_link_on_target in aktglobalswitches) then + if not(cs_link_on_target in current_settings.globalswitches) then begin Replace(cmdstr,'$EXE',(maybequoted(ScriptFixFileName(ForceExtension(current_module.exefilename^,'.elf'))))); Replace(cmdstr,'$RES',(maybequoted(ScriptFixFileName(outputexedir+Info.ResName)))); @@ -540,7 +540,7 @@ begin success:=DoExec(FindUtil(utilsprefix+BinStr),cmdstr,true,false); { Remove ReponseFile } - if (success) and not(cs_link_nolink in aktglobalswitches) then + if (success) and not(cs_link_nolink in current_settings.globalswitches) then RemoveFile(outputexedir+Info.ResName); { Post process } diff --git a/compiler/systems/t_go32v2.pas b/compiler/systems/t_go32v2.pas index 5f6ce876c4..153da0e4f9 100644 --- a/compiler/systems/t_go32v2.pas +++ b/compiler/systems/t_go32v2.pas @@ -237,12 +237,12 @@ var success : boolean; StripStr : string[40]; begin - if not(cs_link_nolink in aktglobalswitches) then + if not(cs_link_nolink in current_settings.globalswitches) then Message1(exec_i_linking,current_module.exefilename^); { Create some replacements } StripStr:=''; - if (cs_link_strip in aktglobalswitches) then + if (cs_link_strip in current_settings.globalswitches) then StripStr:='-s'; { Write used files and libraries and our own ld script } @@ -260,7 +260,7 @@ begin success:=DoExec(FindUtil(utilsprefix+BinStr),cmdstr,true,false); { Remove ReponseFile } - if (success) and not(cs_link_nolink in aktglobalswitches) then + if (success) and not(cs_link_nolink in current_settings.globalswitches) then begin RemoveFile(outputexedir+Info.ResName); RemoveFile(outputexedir+Info.ScriptName); @@ -311,7 +311,7 @@ var zerobuf : pointer; begin { when -s is used quit, because there is no .exe } - if cs_link_nolink in aktglobalswitches then + if cs_link_nolink in current_settings.globalswitches then exit; { open file } assign(f,n); diff --git a/compiler/systems/t_linux.pas b/compiler/systems/t_linux.pas index 62ba503434..f3f7732e4d 100644 --- a/compiler/systems/t_linux.pas +++ b/compiler/systems/t_linux.pas @@ -160,14 +160,14 @@ begin { place jump in al_procedures } current_asmdata.asmlists[al_procedures].concat(tai_align.create(target_info.alignment.procalign)); current_asmdata.asmlists[al_procedures].concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0)); - if (cs_create_pic in aktmoduleswitches) and + if (cs_create_pic in current_settings.moduleswitches) and { other targets need to be checked how it works } (target_info.system in [system_x86_64_linux,system_i386_linux]) then begin {$ifdef x86} sym:=current_asmdata.RefAsmSymbol(tprocsym(hp2.sym).first_procdef.mangledname); reference_reset_symbol(r,sym,0); - if cs_create_pic in aktmoduleswitches then + if cs_create_pic in current_settings.moduleswitches then r.refaddr:=addr_pic else r.refaddr:=addr_full; @@ -300,7 +300,7 @@ procedure TLinkerLinux.LoadPredefinedLibraryOrder; // put your linkorder/linkalias overrides here. // Note: assumes only called when reordering/aliasing is used. Begin - if not (cs_link_no_default_lib_order in aktglobalswitches) Then + if not (cs_link_no_default_lib_order in current_settings.globalswitches) Then Begin LinkLibraryOrder.add('gcc','',15); LinkLibraryOrder.add('c','',100); @@ -353,7 +353,7 @@ begin gprtobj:='gprt0'; end; end; - if cs_profile in aktmoduleswitches then + if cs_profile in current_settings.moduleswitches then begin prtobj:=gprtobj; if not(libctype in [glibc2,glibc21]) then @@ -449,7 +449,7 @@ begin if linklibc and not reorder then Add('-lc'); { when we have -static for the linker the we also need libgcc } - if (cs_link_staticflag in aktglobalswitches) then + if (cs_link_staticflag in current_settings.globalswitches) then Add('-lgcc'); Add(')'); end; @@ -592,7 +592,7 @@ var StaticStr, StripStr : string[40]; begin - if not(cs_link_nolink in aktglobalswitches) then + if not(cs_link_nolink in current_settings.globalswitches) then Message1(exec_i_linking,current_module.exefilename^); { Create some replacements } @@ -600,15 +600,15 @@ begin StripStr:=''; GCSectionsStr:=''; DynLinkStr:=''; - if (cs_link_staticflag in aktglobalswitches) then + if (cs_link_staticflag in current_settings.globalswitches) then StaticStr:='-static'; - if (cs_link_strip in aktglobalswitches) then + if (cs_link_strip in current_settings.globalswitches) then StripStr:='-s'; - if (cs_link_map in aktglobalswitches) then + if (cs_link_map in current_settings.globalswitches) then StripStr:='-Map '+maybequoted(ForceExtension(current_module.exefilename^,'.map')); if use_smartlink_section then GCSectionsStr:='--gc-sections'; - If (cs_profile in aktmoduleswitches) or + If (cs_profile in current_settings.moduleswitches) or ((Info.DynamicLinker<>'') and (not SharedLibFiles.Empty)) then begin DynLinkStr:='-dynamic-linker='+Info.DynamicLinker; @@ -638,7 +638,7 @@ begin success:=DoExec(FindUtil(utilsprefix+BinStr),CmdStr,true,false); { Remove ReponseFile } - if (success) and not(cs_link_nolink in aktglobalswitches) then + if (success) and not(cs_link_nolink in current_settings.globalswitches) then RemoveFile(outputexedir+Info.ResName); if (success) then @@ -659,7 +659,7 @@ var success : boolean; begin MakeSharedLibrary:=false; - if not(cs_link_nolink in aktglobalswitches) then + if not(cs_link_nolink in current_settings.globalswitches) then Message1(exec_i_linking,current_module.sharedlibfilename^); { Write used files and libraries } @@ -681,7 +681,7 @@ begin success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,false); { Strip the library ? } - if success and (cs_link_strip in aktglobalswitches) then + if success and (cs_link_strip in current_settings.globalswitches) then begin { only remove non global symbols and debugging info for a library } Info.DllCmd[2]:='strip --discard-all --strip-debug $EXE'; @@ -691,7 +691,7 @@ begin end; { Remove ReponseFile } - if (success) and not(cs_link_nolink in aktglobalswitches) then + if (success) and not(cs_link_nolink in current_settings.globalswitches) then RemoveFile(outputexedir+Info.ResName); MakeSharedLibrary:=success; { otherwise a recursive call to link method } diff --git a/compiler/systems/t_macos.pas b/compiler/systems/t_macos.pas index 964d77b976..2738f72dcb 100644 --- a/compiler/systems/t_macos.pas +++ b/compiler/systems/t_macos.pas @@ -194,7 +194,7 @@ var begin //TODO Only external link in MPW is possible, otherwise yell. - if not(cs_link_nolink in aktglobalswitches) then + if not(cs_link_nolink in current_settings.globalswitches) then Message1(exec_i_linking,current_module.exefilename^); { Create some replacements } @@ -202,11 +202,11 @@ begin StaticStr:=''; DynLinkStr:=''; (* - if (cs_link_staticflag in aktglobalswitches) then + if (cs_link_staticflag in current_settings.globalswitches) then StaticStr:='-static'; - if (cs_link_strip in aktglobalswitches) then + if (cs_link_strip in current_settings.globalswitches) then StripStr:='-s'; - If (cs_profile in aktmoduleswitches) or + If (cs_profile in current_settings.moduleswitches) or ((Info.DynamicLinker<>'') and (not SharedLibFiles.Empty)) then DynLinkStr:='-dynamic-linker='+Info.DynamicLinker; *) @@ -223,7 +223,7 @@ begin WriteResponseFile(false); success:= true; - if cs_link_on_target in aktglobalswitches then + if cs_link_on_target in current_settings.globalswitches then success:=DoExec('SetFile', ' -c ''MPS '' -t ''TEXT'' ' + ScriptFixFileName(outputexedir+Info.ResName),true,false); @@ -232,7 +232,7 @@ begin success:=DoExec('Execute',CmdStr,true,false); { Remove ReponseFile } - if (success) and not(cs_link_nolink in aktglobalswitches) then + if (success) and not(cs_link_nolink in current_settings.globalswitches) then RemoveFile(outputexedir+Info.ResName); MakeExecutable:=success; { otherwise a recursive call to link method } diff --git a/compiler/systems/t_morph.pas b/compiler/systems/t_morph.pas index 893edaa594..9b1a5ed83e 100644 --- a/compiler/systems/t_morph.pas +++ b/compiler/systems/t_morph.pas @@ -72,7 +72,7 @@ procedure TLinkerMorphOS.SetDefaultInfo; begin with Info do begin - if (cs_link_on_target in aktglobalswitches) then + if (cs_link_on_target in current_settings.globalswitches) then begin ExeCmd[1]:='ld $OPT -o $EXE $RES'; ExeCmd[2]:='strip --strip-unneeded --remove-section .comment $EXE'; @@ -103,7 +103,7 @@ begin while assigned(HPath) do begin s:=HPath.Str; - if (cs_link_on_target in aktglobalswitches) then + if (cs_link_on_target in current_settings.globalswitches) then s:=ScriptFixFileName(s); LinkRes.Add('-L'+s); HPath:=TStringListItem(HPath.Next); @@ -127,7 +127,7 @@ begin if s<>'' then begin { vlink doesn't use SEARCH_DIR for object files } - if not(cs_link_on_target in aktglobalswitches) then + if not(cs_link_on_target in current_settings.globalswitches) then s:=FindObjectFile(s,'',false); LinkRes.AddFileName(PathConv(maybequoted(s))); end; @@ -137,7 +137,7 @@ begin if not StaticLibFiles.Empty then begin { vlink doesn't need, and doesn't support GROUP } - if (cs_link_on_target in aktglobalswitches) then + if (cs_link_on_target in current_settings.globalswitches) then begin LinkRes.Add(')'); LinkRes.Add('GROUP('); @@ -149,7 +149,7 @@ begin end; end; - if (cs_link_on_target in aktglobalswitches) then + if (cs_link_on_target in current_settings.globalswitches) then begin LinkRes.Add(')'); @@ -207,13 +207,13 @@ var StripStr: string[40]; begin - if not(cs_link_nolink in aktglobalswitches) then + if not(cs_link_nolink in current_settings.globalswitches) then Message1(exec_i_linking,current_module.exefilename^); - if not (cs_link_on_target in aktglobalswitches) then + if not (cs_link_on_target in current_settings.globalswitches) then begin StripStr:=''; - if (cs_link_strip in aktglobalswitches) then + if (cs_link_strip in current_settings.globalswitches) then StripStr:='-s -P __abox__'; end; @@ -223,7 +223,7 @@ begin { Call linker } SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr); Replace(cmdstr,'$OPT',Info.ExtraOptions); - if not(cs_link_on_target in aktglobalswitches) then + if not(cs_link_on_target in current_settings.globalswitches) then begin Replace(cmdstr,'$EXE',PathConv(maybequoted(ScriptFixFileName(current_module.exefilename^)))); Replace(cmdstr,'$RES',PathConv(maybequoted(ScriptFixFileName(outputexedir+Info.ResName)))); @@ -240,9 +240,9 @@ begin { For MorphOS a separate strip command is needed, to avoid stripping } { __abox__ symbol, which is required to be present in current MorphOS } { executables. } - if (cs_link_on_target in aktglobalswitches) then + if (cs_link_on_target in current_settings.globalswitches) then begin - if success and (cs_link_strip in aktglobalswitches) then + if success and (cs_link_strip in current_settings.globalswitches) then begin SplitBinCmd(Info.ExeCmd[2],binstr,cmdstr); Replace(cmdstr,'$EXE',maybequoted(current_module.exefilename^)); @@ -251,7 +251,7 @@ begin end; { Remove ReponseFile } - if (success) and not(cs_link_nolink in aktglobalswitches) then + if (success) and not(cs_link_nolink in current_settings.globalswitches) then RemoveFile(outputexedir+Info.ResName); MakeExecutable:=success; { otherwise a recursive call to link method } diff --git a/compiler/systems/t_nwl.pas b/compiler/systems/t_nwl.pas index bdd036507a..1c926b0b1a 100644 --- a/compiler/systems/t_nwl.pas +++ b/compiler/systems/t_nwl.pas @@ -374,7 +374,7 @@ begin NLMConvLinkFile.Add ('CHECK _LibCCheckUnload'); NLMConvLinkFile.Add ('REENTRANT'); { needed by older libc versions } - if not (cs_link_strip in aktglobalswitches) then + if not (cs_link_strip in current_settings.globalswitches) then begin NLMConvLinkFile.Add ('DEBUG'); Comment(V_Debug,'DEBUG'); @@ -532,13 +532,13 @@ var xdcpresent,usexdc : boolean; f : file; begin - if not(cs_link_nolink in aktglobalswitches) then + if not(cs_link_nolink in current_settings.globalswitches) then Message1(exec_i_linking,current_module.exefilename^); { Create some replacements } StripStr:=''; - if (cs_link_strip in aktglobalswitches) then + if (cs_link_strip in current_settings.globalswitches) then StripStr:='-s'; { Write used files and libraries and create Headerfile for @@ -579,7 +579,7 @@ begin success:=DoExec(FindUtil(BinStr),CmdStr,true,false); { Remove ReponseFile } - if (success) and not(cs_link_nolink in aktglobalswitches) then + if (success) and not(cs_link_nolink in current_settings.globalswitches) then RemoveFile(outputexedir+Info.ResName); { Call nlmconv } @@ -591,7 +591,7 @@ begin Replace(cmdstr,'$RES',maybequoted(outputexedir+'n'+Info.ResName)); Comment (v_debug,'Executing '+BinStr+' '+cmdstr); success:=DoExec(FindUtil(BinStr),CmdStr,true,false); - if (success) and not(cs_link_nolink in aktglobalswitches) then + if (success) and not(cs_link_nolink in current_settings.globalswitches) then begin RemoveFile(outputexedir+'n'+Info.ResName); RemoveFile(outputexedir+tmpLinkFileName); diff --git a/compiler/systems/t_nwm.pas b/compiler/systems/t_nwm.pas index 6cb0a08cb7..deb650ff31 100644 --- a/compiler/systems/t_nwm.pas +++ b/compiler/systems/t_nwm.pas @@ -356,7 +356,7 @@ begin NLMConvLinkFile.Add ('EXIT _Stop'); { nwpre.as } NLMConvLinkFile.Add ('CHECK FPC_NW_CHECKFUNCTION'); { system.pp } - if not (cs_link_strip in aktglobalswitches) then + if not (cs_link_strip in current_settings.globalswitches) then begin NLMConvLinkFile.Add ('DEBUG'); Comment(V_Debug,'DEBUG'); @@ -499,13 +499,13 @@ var success : boolean; StripStr : string[2]; begin - if not(cs_link_nolink in aktglobalswitches) then + if not(cs_link_nolink in current_settings.globalswitches) then Message1(exec_i_linking,current_module.exefilename^); { Create some replacements } StripStr:=''; - if (cs_link_strip in aktglobalswitches) then + if (cs_link_strip in current_settings.globalswitches) then StripStr:='-s'; { Write used files and libraries and create Headerfile for @@ -523,7 +523,7 @@ begin success:=DoExec(FindUtil(BinStr),CmdStr,true,false); { Remove ReponseFile } - if (success) and not(cs_link_nolink in aktglobalswitches) then + if (success) and not(cs_link_nolink in current_settings.globalswitches) then RemoveFile(outputexedir+Info.ResName); { Call nlmconv } @@ -535,7 +535,7 @@ begin Replace(cmdstr,'$RES',maybequoted(outputexedir+'n'+Info.ResName)); Comment (v_debug,'Executing '+BinStr+' '+cmdstr); success:=DoExec(FindUtil(BinStr),CmdStr,true,false); - if (success) and not(cs_link_nolink in aktglobalswitches) then + if (success) and not(cs_link_nolink in current_settings.globalswitches) then begin RemoveFile(outputexedir+'n'+Info.ResName); RemoveFile(outputexedir+tmpLinkFileName); diff --git a/compiler/systems/t_os2.pas b/compiler/systems/t_os2.pas index 8c2b12ae6a..4b723099c1 100644 --- a/compiler/systems/t_os2.pas +++ b/compiler/systems/t_os2.pas @@ -442,13 +442,13 @@ var ES: ExtStr; OutName: PathStr; begin - if not(cs_link_nolink in aktglobalswitches) then + if not(cs_link_nolink in current_settings.globalswitches) then Message1(exec_i_linking,current_module.exefilename^); { Create some replacements } FSplit (current_module.exefilename^, DS, NS, ES); OutName := DS + NS + '.out'; - if (cs_link_strip in aktglobalswitches) then + if (cs_link_strip in current_settings.globalswitches) then StripStr := '-s' else StripStr := ''; @@ -496,7 +496,7 @@ begin end; { Remove ReponseFile } - if (success) and not(cs_link_nolink in aktglobalswitches) then + if (success) and not(cs_link_nolink in current_settings.globalswitches) then RemoveFile(outputexedir+Info.ResName); MakeExecutable:=success; { otherwise a recursive call to link method } diff --git a/compiler/systems/t_palmos.pas b/compiler/systems/t_palmos.pas index 919ef8f284..93206ec9f2 100644 --- a/compiler/systems/t_palmos.pas +++ b/compiler/systems/t_palmos.pas @@ -162,12 +162,12 @@ var StripStr : string[40]; i : longint; begin - if not(cs_link_nolink in aktglobalswitches) then + if not(cs_link_nolink in current_settings.globalswitches) then Message1(exec_i_linking,current_module.exefilename^); { Create some replacements } StripStr:=''; - if (cs_link_strip in aktglobalswitches) then + if (cs_link_strip in current_settings.globalswitches) then StripStr:='-s'; { Write used files and libraries } @@ -194,7 +194,7 @@ begin end; { Remove ReponseFile } - if (success) and not(cs_link_nolink in aktglobalswitches) then + if (success) and not(cs_link_nolink in current_settings.globalswitches) then RemoveFile(outputexedir+Info.ResName); MakeExecutable:=success; { otherwise a recursive call to link method } diff --git a/compiler/systems/t_sunos.pas b/compiler/systems/t_sunos.pas index 661fa04072..852c23dbbd 100644 --- a/compiler/systems/t_sunos.pas +++ b/compiler/systems/t_sunos.pas @@ -181,9 +181,9 @@ begin if NOT Dontlinkstdlibpath Then LibrarySearchPath.AddPath('/lib;/usr/lib;/usr/X11R6/lib;/opt/sfw/lib',true); {$ifdef LinkTest} - if (cs_link_staticflag in aktglobalswitches) then WriteLN('ForceLinkStaticFlag'); - if (cs_link_static in aktglobalswitches) then WriteLN('LinkStatic-Flag'); - if (cs_link_shared in aktglobalswitches) then WriteLN('LinkSynamicFlag'); + if (cs_link_staticflag in current_settings.globalswitches) then WriteLN('ForceLinkStaticFlag'); + if (cs_link_static in current_settings.globalswitches) then WriteLN('LinkStatic-Flag'); + if (cs_link_shared in current_settings.globalswitches) then WriteLN('LinkSynamicFlag'); {$EndIf} end; @@ -245,7 +245,7 @@ begin prtobj:='prt0'; cprtobj:='cprt0'; gprtobj:='gprt0'; - if cs_profile in aktmoduleswitches then + if cs_profile in current_settings.moduleswitches then begin prtobj:=gprtobj; if not glibc2 then @@ -339,7 +339,7 @@ begin if linklibc then LinkRes.Add('-lc'); { when we have -static for the linker the we also need libgcc } - if (cs_link_staticflag in aktglobalswitches) then begin + if (cs_link_staticflag in current_settings.globalswitches) then begin LinkRes.Add('-lgcc'); end; if linkdynamic and (Info.DynamicLinker<>'') then { gld has a default, DynamicLinker is not set in solaris } @@ -375,18 +375,18 @@ var StaticStr, StripStr : string[40]; begin - if not(cs_link_nolink in aktglobalswitches) then + if not(cs_link_nolink in current_settings.globalswitches) then Message1(exec_i_linking,current_module.exefilename^); { Create some replacements } StaticStr:=''; StripStr:=''; DynLinkStr:=''; - if (cs_link_staticflag in aktglobalswitches) then + if (cs_link_staticflag in current_settings.globalswitches) then StaticStr:='-Bstatic'; - if (cs_link_strip in aktglobalswitches) then + if (cs_link_strip in current_settings.globalswitches) then StripStr:='-s'; - If (cs_profile in aktmoduleswitches) or + If (cs_profile in current_settings.moduleswitches) or ((Info.DynamicLinker<>'') and (not SharedLibFiles.Empty)) then DynLinkStr:='-dynamic-linker='+Info.DynamicLinker; { solaris sets DynamicLinker, but gld will (hopefully) defaults to -Bdynamic and add the default-linker } @@ -405,7 +405,7 @@ begin { Remove ReponseFile } {$IFNDEF LinkTest} - if (success) and not(cs_link_nolink in aktglobalswitches) then + if (success) and not(cs_link_nolink in current_settings.globalswitches) then RemoveFile(outputexedir+Info.ResName); {$ENDIF} MakeExecutable:=success; { otherwise a recursive call to link method } @@ -419,7 +419,7 @@ var success : boolean; begin MakeSharedLibrary:=false; - if not(cs_link_nolink in aktglobalswitches) then + if not(cs_link_nolink in current_settings.globalswitches) then Message1(exec_i_linking,current_module.sharedlibfilename^); { Write used files and libraries } @@ -433,7 +433,7 @@ begin success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,false); { Strip the library ? } - if success and (cs_link_strip in aktglobalswitches) then + if success and (cs_link_strip in current_settings.globalswitches) then begin SplitBinCmd(Info.DllCmd[2],binstr,cmdstr); Replace(cmdstr,'$EXE',maybequoted(current_module.sharedlibfilename^)); @@ -442,7 +442,7 @@ begin { Remove ReponseFile } {$IFNDEF LinkTest} - if (success) and not(cs_link_nolink in aktglobalswitches) then + if (success) and not(cs_link_nolink in current_settings.globalswitches) then RemoveFile(outputexedir+Info.ResName); {$ENDIF} MakeSharedLibrary:=success; { otherwise a recursive call to link method } diff --git a/compiler/systems/t_watcom.pas b/compiler/systems/t_watcom.pas index eb72d73898..36936b43ac 100644 --- a/compiler/systems/t_watcom.pas +++ b/compiler/systems/t_watcom.pas @@ -137,12 +137,12 @@ var success : boolean; StripStr : string[40]; begin - if not(cs_link_nolink in aktglobalswitches) then + if not(cs_link_nolink in current_settings.globalswitches) then Message1(exec_i_linking,current_module.exefilename^); { Create some replacements } StripStr:='debug dwarf all'; - if (cs_link_strip in aktglobalswitches) then + if (cs_link_strip in current_settings.globalswitches) then StripStr:=''; { Write used files and libraries } @@ -157,7 +157,7 @@ begin success:=DoExec(FindUtil(utilsprefix+BinStr),cmdstr,true,false); { Remove ReponseFile } - if (success) and not(cs_link_nolink in aktglobalswitches) then + if (success) and not(cs_link_nolink in current_settings.globalswitches) then RemoveFile(outputexedir+Info.ResName); MakeExecutable:=success; { otherwise a recursive call to link method } diff --git a/compiler/systems/t_win.pas b/compiler/systems/t_win.pas index 80a30e34ef..d876a110f2 100644 --- a/compiler/systems/t_win.pas +++ b/compiler/systems/t_win.pas @@ -473,7 +473,7 @@ implementation {$endif ARM} { add jump field to al_imports } new_section(current_asmdata.asmlists[al_imports],sec_idata5,'',0); - if (cs_debuginfo in aktmoduleswitches) then + if (cs_debuginfo in current_settings.moduleswitches) then begin if ImportSymbol.Name<>'' then begin @@ -1036,7 +1036,7 @@ implementation WriteResponseFile:=False; linklibcygwin:=(SharedLibFiles.Find('cygwin')<>nil); - if (cs_profile in aktmoduleswitches) then + if (cs_profile in current_settings.moduleswitches) then begin SharedLibFiles.Concat('gmon'); SharedLibFiles.Concat('c'); @@ -1249,7 +1249,7 @@ implementation EntryStr, ImageBaseStr : string[40]; begin - if not(cs_link_nolink in aktglobalswitches) then + if not(cs_link_nolink in current_settings.globalswitches) then Message1(exec_i_linking,current_module.exefilename^); { Create some replacements } @@ -1278,9 +1278,9 @@ implementation EntryStr:='--entry=_mainCRTStartup'; if assigned(DLLImageBase) then ImageBaseStr:='--image-base=0x'+DLLImageBase^; - if (cs_link_strip in aktglobalswitches) then + if (cs_link_strip in current_settings.globalswitches) then StripStr:='-s'; - if (cs_link_map in aktglobalswitches) then + if (cs_link_map in current_settings.globalswitches) then MapStr:='-Map '+maybequoted(ForceExtension(current_module.exefilename^,'.map')); { Write used files and libraries } @@ -1326,7 +1326,7 @@ implementation success:=PostProcessExecutable(current_module.exefilename^,false); { Remove ReponseFile } - if (success) and not(cs_link_nolink in aktglobalswitches) then + if (success) and not(cs_link_nolink in current_settings.globalswitches) then begin RemoveFile(outputexedir+Info.ResName); RemoveFile('base.$$$'); @@ -1355,7 +1355,7 @@ implementation ImageBaseStr : string[40]; begin MakeSharedLibrary:=false; - if not(cs_link_nolink in aktglobalswitches) then + if not(cs_link_nolink in current_settings.globalswitches) then Message1(exec_i_linking,current_module.sharedlibfilename^); { Create some replacements } @@ -1380,9 +1380,9 @@ implementation EntryStr:='--entry _DLLMainCRTStartup'; if assigned(DLLImageBase) then ImageBaseStr:='--image-base=0x'+DLLImageBase^; - if (cs_link_strip in aktglobalswitches) then + if (cs_link_strip in current_settings.globalswitches) then StripStr:='-s'; - if (cs_link_map in aktglobalswitches) then + if (cs_link_map in current_settings.globalswitches) then MapStr:='-Map '+maybequoted(ForceExtension(current_module.exefilename^,'.map')); { Write used files and libraries } @@ -1428,7 +1428,7 @@ implementation success:=PostProcessExecutable(current_module.sharedlibfilename^,true); { Remove ReponseFile } - if (success) and not(cs_link_nolink in aktglobalswitches) then + if (success) and not(cs_link_nolink in current_settings.globalswitches) then begin RemoveFile(outputexedir+Info.ResName); RemoveFile('base.$$$'); @@ -1483,7 +1483,7 @@ implementation begin postprocessexecutable:=false; { when -s is used or it's a dll then quit } - if (cs_link_nolink in aktglobalswitches) then + if (cs_link_nolink in current_settings.globalswitches) then begin case apptype of app_native : diff --git a/compiler/tgobj.pas b/compiler/tgobj.pas index e5f007e702..488ba43a24 100644 --- a/compiler/tgobj.pas +++ b/compiler/tgobj.pas @@ -290,17 +290,17 @@ implementation ((not bestatend and (direction=-1)) or (bestatend and - isbetteralignedthan(abs(bestslot^.pos+hp^.size-size),abs(hp^.pos+hp^.size-size),aktalignment.localalignmax))); + isbetteralignedthan(abs(bestslot^.pos+hp^.size-size),abs(hp^.pos+hp^.size-size),current_settings.alignment.localalignmax))); fitatbegin:=fitatbegin and (not bestatend or (direction=1)) and - isbetteralignedthan(abs(hp^.pos+size),abs(bestslot^.pos+size),aktalignment.localalignmax); + isbetteralignedthan(abs(hp^.pos+size),abs(bestslot^.pos+size),current_settings.alignment.localalignmax); end; if fitatend and fitatbegin then - if isbetteralignedthan(abs(hp^.pos+hp^.size-size),abs(hp^.pos+size),aktalignment.localalignmax) then + if isbetteralignedthan(abs(hp^.pos+hp^.size-size),abs(hp^.pos+size),current_settings.alignment.localalignmax) then fitatbegin:=false - else if isbetteralignedthan(abs(hp^.pos+size),abs(hp^.pos+hp^.size-size),aktalignment.localalignmax) then + else if isbetteralignedthan(abs(hp^.pos+size),abs(hp^.pos+hp^.size-size),current_settings.alignment.localalignmax) then fitatend:=false else if (direction=1) then fitatend:=false @@ -498,7 +498,7 @@ implementation varalign : shortint; begin varalign:=size_2_align(size); - varalign:=used_align(varalign,aktalignment.localalignmin,aktalignment.localalignmax); + varalign:=used_align(varalign,current_settings.alignment.localalignmin,current_settings.alignment.localalignmax); { can't use reference_reset_base, because that will let tgobj depend on cgobj (PFV) } fillchar(ref,sizeof(ref),0); @@ -512,7 +512,7 @@ implementation varalign : shortint; begin varalign:=def.alignment; - varalign:=used_align(varalign,aktalignment.localalignmin,aktalignment.localalignmax); + varalign:=used_align(varalign,current_settings.alignment.localalignmin,current_settings.alignment.localalignmax); { can't use reference_reset_base, because that will let tgobj depend on cgobj (PFV) } fillchar(ref,sizeof(ref),0); @@ -624,7 +624,7 @@ implementation procedure ttgobj.getlocal(list: TAsmList; size : longint; alignment : shortint; def:tdef;var ref : treference); begin - alignment:=used_align(alignment,aktalignment.localalignmin,aktalignment.localalignmax); + alignment:=used_align(alignment,current_settings.alignment.localalignmin,current_settings.alignment.localalignmax); { can't use reference_reset_base, because that will let tgobj depend on cgobj (PFV) } fillchar(ref,sizeof(ref),0); diff --git a/compiler/widestr.pas b/compiler/widestr.pas index 1931cd3e02..50c367269f 100644 --- a/compiler/widestr.pas +++ b/compiler/widestr.pas @@ -154,9 +154,9 @@ unit widestr; var m : punicodemap; begin - if (aktsourcecodepage <> 'utf8') then + if (current_settings.sourcecodepage <> 'utf8') then begin - m:=getmap(aktsourcecodepage); + m:=getmap(current_settings.sourcecodepage); asciichar2unicode:=getunicode(c,m); end else @@ -177,12 +177,12 @@ unit widestr; i : SizeInt; m : punicodemap; begin - m:=getmap(aktsourcecodepage); + m:=getmap(current_settings.sourcecodepage); setlengthwidestring(r,l); source:=p; r^.len:=l; dest:=tcompilerwidecharptr(r^.data); - if (aktsourcecodepage <> 'utf8') then + if (current_settings.sourcecodepage <> 'utf8') then begin for i:=1 to l do begin @@ -209,7 +209,7 @@ unit widestr; i : longint; begin - m:=getmap(aktsourcecodepage); + m:=getmap(current_settings.sourcecodepage); { should be a very good estimation :) } setlengthwidestring(r,length(s)); // !!!! MBCS diff --git a/compiler/x86/agx86int.pas b/compiler/x86/agx86int.pas index f1cfdfaf45..e7f606f944 100644 --- a/compiler/x86/agx86int.pas +++ b/compiler/x86/agx86int.pas @@ -391,8 +391,8 @@ implementation if not assigned(p) then exit; { lineinfo is only needed for al_procedures (PFV) } - do_line:=((cs_asm_source in aktglobalswitches) or - (cs_lineinfo in aktmoduleswitches)) + do_line:=((cs_asm_source in current_settings.globalswitches) or + (cs_lineinfo in current_settings.moduleswitches)) and (p=current_asmdata.asmlists[al_procedures]); InlineLevel:=0; DoNotSplitLine:=false; @@ -410,7 +410,7 @@ implementation if assigned(infile) then begin { open only if needed !! } - if (cs_asm_source in aktglobalswitches) then + if (cs_asm_source in current_settings.globalswitches) then infile.open; end; { avoid unnecessary reopens of the same file !! } @@ -419,7 +419,7 @@ implementation lastfileinfo.line:=-1; end; { write source } - if (cs_asm_source in aktglobalswitches) and + if (cs_asm_source in current_settings.globalswitches) and assigned(infile) then begin if (infile<>lastinfile) then @@ -455,14 +455,14 @@ implementation ait_regalloc : begin - if (cs_asm_regalloc in aktglobalswitches) then + if (cs_asm_regalloc in current_settings.globalswitches) then AsmWriteLn(target_asm.comment+'Register '+masm_regname(tai_regalloc(hp).reg)+ regallocstr[tai_regalloc(hp).ratype]); end; ait_tempalloc : begin - if (cs_asm_tempalloc in aktglobalswitches) then + if (cs_asm_tempalloc in current_settings.globalswitches) then begin {$ifdef EXTDEBUG} if assigned(tai_tempalloc(hp).problem) then @@ -851,7 +851,7 @@ implementation { masm does not seem to recognize specific extensions and uses .obj allways PM } if (target_asm.id in [as_i386_masm,as_i386_wasm]) then begin - if not(cs_asm_extern in aktglobalswitches) then + if not(cs_asm_extern in current_settings.globalswitches) then begin if Not FileExists(objfilename) and FileExists(ForceExtension(objfilename,'.obj')) then diff --git a/compiler/x86/cgx86.pas b/compiler/x86/cgx86.pas index 7e66704efc..198e9e9561 100644 --- a/compiler/x86/cgx86.pas +++ b/compiler/x86/cgx86.pas @@ -376,7 +376,7 @@ unit cgx86; end; end; end; - if (cs_create_pic in aktmoduleswitches) and + if (cs_create_pic in current_settings.moduleswitches) and assigned(ref.symbol) then begin reference_reset_symbol(href,ref.symbol,0); @@ -401,7 +401,7 @@ unit cgx86; end; end; {$else x86_64} - if (cs_create_pic in aktmoduleswitches) and + if (cs_create_pic in current_settings.moduleswitches) and assigned(ref.symbol) then begin reference_reset_symbol(href,ref.symbol,0); @@ -517,7 +517,7 @@ unit cgx86; list.concat(Taicpu.Op_ref(op,s,tmpref)); { storing non extended floats can cause a floating point overflow } if (t<>OS_F80) and - (cs_fpu_fwait in aktlocalswitches) then + (cs_fpu_fwait in current_settings.localswitches) then list.concat(Taicpu.Op_none(A_FWAIT,S_NO)); dec_fpu_stack; end; @@ -580,7 +580,7 @@ unit cgx86; begin sym:=current_asmdata.RefAsmSymbol(s); reference_reset_symbol(r,sym,0); - if cs_create_pic in aktmoduleswitches then + if cs_create_pic in current_settings.moduleswitches then begin {$ifdef i386} include(current_procinfo.flags,pi_needs_got); @@ -768,7 +768,7 @@ unit cgx86; begin if assigned(ref.symbol) then begin - if (cs_create_pic in aktmoduleswitches) then + if (cs_create_pic in current_settings.moduleswitches) then begin {$ifdef x86_64} reference_reset_symbol(tmpref,ref.symbol,0); @@ -1115,7 +1115,7 @@ unit cgx86; end; OP_MUL,OP_IMUL: begin - if not(cs_check_overflow in aktlocalswitches) and + if not(cs_check_overflow in current_settings.localswitches) and ispowerof2(int64(a),power) then begin list.concat(taicpu.op_const_reg(A_SHL,TCgSize2OpSize[size],power,reg)); @@ -1129,7 +1129,7 @@ unit cgx86; internalerror(200109225); end; OP_ADD, OP_AND, OP_OR, OP_SUB, OP_XOR: - if not(cs_check_overflow in aktlocalswitches) and + if not(cs_check_overflow in current_settings.localswitches) and (a = 1) and (op in [OP_ADD,OP_SUB]) then if op = OP_ADD then @@ -1228,7 +1228,7 @@ unit cgx86; End; OP_MUL,OP_IMUL: begin - if not(cs_check_overflow in aktlocalswitches) and + if not(cs_check_overflow in current_settings.localswitches) and ispowerof2(int64(a),power) then begin list.concat(taicpu.op_const_ref(A_SHL,TCgSize2OpSize[size], @@ -1244,7 +1244,7 @@ unit cgx86; internalerror(200109232); end; OP_ADD, OP_AND, OP_OR, OP_SUB, OP_XOR: - if not(cs_check_overflow in aktlocalswitches) and + if not(cs_check_overflow in current_settings.localswitches) and (a = 1) and (op in [OP_ADD,OP_SUB]) then if op = OP_ADD then @@ -1552,15 +1552,15 @@ unit cgx86; begin cm:=copy_move; helpsize:=12; - if cs_opt_size in aktoptimizerswitches then + if cs_opt_size in current_settings.optimizerswitches then helpsize:=8; - if (cs_mmx in aktlocalswitches) and + if (cs_mmx in current_settings.localswitches) and not(pi_uses_fpu in current_procinfo.flags) and ((len=8) or (len=16) or (len=24) or (len=32)) then cm:=copy_mmx; if (len>helpsize) then cm:=copy_string; - if (cs_opt_size in aktoptimizerswitches) and + if (cs_opt_size in current_settings.optimizerswitches) and not((len<=16) and (cm=copy_mmx)) then cm:=copy_string; case cm of @@ -1647,7 +1647,7 @@ unit cgx86; {$ifdef i386} list.concat(Taicpu.op_none(A_CLD,S_NO)); {$endif i386} - if cs_opt_size in aktoptimizerswitches then + if cs_opt_size in current_settings.optimizerswitches then begin a_load_const_reg(list,OS_INT,len,REGCX); list.concat(Taicpu.op_none(A_REP,S_NO)); @@ -1916,7 +1916,7 @@ unit cgx86; ai : taicpu; cond : TAsmCond; begin - if not(cs_check_overflow in aktlocalswitches) then + if not(cs_check_overflow in current_settings.localswitches) then exit; current_asmdata.getjumplabel(hl); if not ((def.deftype=pointerdef) or diff --git a/compiler/x86/nx86add.pas b/compiler/x86/nx86add.pas index 0c36ed8d89..3560a0fe1a 100644 --- a/compiler/x86/nx86add.pas +++ b/compiler/x86/nx86add.pas @@ -132,7 +132,7 @@ unit nx86add; if (op=A_ADD) and (right.location.loc=LOC_CONSTANT) and (right.location.value=1) and - not(cs_check_overflow in aktlocalswitches) then + not(cs_check_overflow in current_settings.localswitches) then begin emit_reg(A_INC,TCGSize2Opsize[opsize],left.location.register); end @@ -140,7 +140,7 @@ unit nx86add; if (op=A_SUB) and (right.location.loc=LOC_CONSTANT) and (right.location.value=1) and - not(cs_check_overflow in aktlocalswitches) then + not(cs_check_overflow in current_settings.localswitches) then begin emit_reg(A_DEC,TCGSize2Opsize[opsize],left.location.register); end @@ -148,7 +148,7 @@ unit nx86add; if (op=A_IMUL) and (right.location.loc=LOC_CONSTANT) and (ispowerof2(int64(right.location.value),power)) and - not(cs_check_overflow in aktlocalswitches) then + not(cs_check_overflow in current_settings.localswitches) then begin emit_const_reg(A_SHL,TCGSize2Opsize[opsize],power,left.location.register); end @@ -175,7 +175,7 @@ unit nx86add; { is in unsigned VAR!! } if mboverflow then begin - if cs_check_overflow in aktlocalswitches then + if cs_check_overflow in current_settings.localswitches then begin current_asmdata.getjumplabel(hl4); if unsigned then @@ -450,7 +450,7 @@ unit nx86add; case nodetype of addn : begin - if (cs_mmx_saturation in aktlocalswitches) then + if (cs_mmx_saturation in current_settings.localswitches) then begin case mmxbase of mmxs8bit: @@ -486,7 +486,7 @@ unit nx86add; end; subn : begin - if (cs_mmx_saturation in aktlocalswitches) then + if (cs_mmx_saturation in current_settings.localswitches) then begin case mmxbase of mmxs8bit: @@ -915,7 +915,7 @@ unit nx86add; left_and_right_must_be_fpureg; {$ifndef x86_64} - if aktcputype<cpu_Pentium2 then + if current_settings.cputype<cpu_Pentium2 then begin emit_none(A_FCOMPP,S_NO); tcgx86(cg).dec_fpu_stack; diff --git a/compiler/x86/nx86inl.pas b/compiler/x86/nx86inl.pas index 3b8847f618..43cd0740bf 100644 --- a/compiler/x86/nx86inl.pas +++ b/compiler/x86/nx86inl.pas @@ -312,7 +312,7 @@ implementation r : tregister; begin {$ifdef i386} - if aktcputype>=cpu_Pentium3 then + if current_settings.cputype>=cpu_Pentium3 then {$endif i386} begin secondpass(left); diff --git a/compiler/x86/nx86mat.pas b/compiler/x86/nx86mat.pas index c426b3d3f6..ba588dfea8 100644 --- a/compiler/x86/nx86mat.pas +++ b/compiler/x86/nx86mat.pas @@ -86,7 +86,7 @@ interface end {$ifdef SUPPORT_MMX} else - if (cs_mmx in aktlocalswitches) and + if (cs_mmx in current_settings.localswitches) and is_mmx_able_array(left.resultdef) then begin registersint:=left.registersint; @@ -131,7 +131,7 @@ interface else internalerror(200203225); end; - if cs_mmx_saturation in aktlocalswitches then + if cs_mmx_saturation in current_settings.localswitches then case mmx_type(resultdef) of mmxs8bit: op:=A_PSUBSB; diff --git a/compiler/x86/nx86set.pas b/compiler/x86/nx86set.pas index 106e105b67..ed5e8dac5e 100644 --- a/compiler/x86/nx86set.pas +++ b/compiler/x86/nx86set.pas @@ -114,7 +114,7 @@ implementation { Lots of comparisions take a lot of time, so do not allow too much comparisions. 8 comparisions are, however, still smalller than emitting the set } - if cs_opt_size in aktoptimizerswitches then + if cs_opt_size in current_settings.optimizerswitches then maxcompares:=8 else maxcompares:=5; @@ -406,7 +406,7 @@ implementation else begin {$ifdef CORRECT_SET_IN_FPC} - if m_tp in aktmodeswitches then + if m_tp in current_settings.modeswitches then begin {***WARNING only correct if reference is 32 bits (PM) *****} diff --git a/compiler/x86/rax86.pas b/compiler/x86/rax86.pas index 5f4653d9f2..2d51db62b9 100644 --- a/compiler/x86/rax86.pas +++ b/compiler/x86/rax86.pas @@ -169,7 +169,7 @@ end; Procedure FWaitWarning; begin - if (target_info.system=system_i386_GO32V2) and (cs_fp_emulation in aktmoduleswitches) then + if (target_info.system=system_i386_GO32V2) and (cs_fp_emulation in current_settings.moduleswitches) then Message(asmr_w_fwait_emu_prob); end; @@ -274,7 +274,7 @@ begin tx86operand(operands[i]).opsize:=opsize else begin - if (m_delphi in aktmodeswitches) then + if (m_delphi in current_settings.modeswitches) then Message(asmr_w_unable_to_determine_reference_size_using_dword) else Message(asmr_e_unable_to_determine_reference_size); @@ -340,7 +340,7 @@ begin if tx86operand(operands[1]).opsize=S_NO then begin tx86operand(operands[1]).opsize:=S_B; - if (m_delphi in aktmodeswitches) then + if (m_delphi in current_settings.modeswitches) then Message(asmr_w_unable_to_determine_reference_size_using_byte) else Message(asmr_e_unable_to_determine_reference_size); @@ -429,8 +429,8 @@ begin if sizeerr then begin { if range checks are on then generate an error } - if (cs_compilesystem in aktmoduleswitches) or - not (cs_check_range in aktlocalswitches) then + if (cs_compilesystem in current_settings.moduleswitches) or + not (cs_check_range in current_settings.localswitches) then Message(asmr_w_size_suffix_and_dest_dont_match) else Message(asmr_e_size_suffix_and_dest_dont_match); diff --git a/compiler/x86/rax86int.pas b/compiler/x86/rax86int.pas index c6974bb197..0c7cde37a4 100644 --- a/compiler/x86/rax86int.pas +++ b/compiler/x86/rax86int.pas @@ -1638,7 +1638,7 @@ Unit Rax86int; end else { support result for delphi modes } - if (m_objpas in aktmodeswitches) and (actasmpattern='RESULT') then + if (m_objpas in current_settings.modeswitches) and (actasmpattern='RESULT') then begin oper.SetUpResult; Consume(AS_ID); diff --git a/compiler/x86/rgx86.pas b/compiler/x86/rgx86.pas index acd87ac1a3..7a3b14d309 100644 --- a/compiler/x86/rgx86.pas +++ b/compiler/x86/rgx86.pas @@ -346,7 +346,7 @@ implementation var r: Tregister; begin - if not(cs_opt_regvar in aktoptimizerswitches) then + if not(cs_opt_regvar in current_settings.optimizerswitches) then exit; if firstsavefpureg <> NR_NO then for r.enum := firstsavefpureg to lastsavefpureg do diff --git a/compiler/x86_64/cgcpu.pas b/compiler/x86_64/cgcpu.pas index 6d63c4cd60..a674bdcfa5 100644 --- a/compiler/x86_64/cgcpu.pas +++ b/compiler/x86_64/cgcpu.pas @@ -95,7 +95,7 @@ unit cgcpu; stacksize : longint; begin { Release PIC register } - if cs_create_pic in aktmoduleswitches then + if cs_create_pic in current_settings.moduleswitches then list.concat(tai_regalloc.dealloc(NR_PIC_OFFSET_REG,nil)); { remove stackframe } @@ -172,7 +172,7 @@ unit cgcpu; begin sym:=current_asmdata.RefAsmSymbol(procdef.mangledname); reference_reset_symbol(r,sym,0); - if cs_create_pic in aktmoduleswitches then + if cs_create_pic in current_settings.moduleswitches then r.refaddr:=addr_pic else r.refaddr:=addr_full; diff --git a/compiler/x86_64/cpupi.pas b/compiler/x86_64/cpupi.pas index 50d6b628f0..45bc10f2a7 100644 --- a/compiler/x86_64/cpupi.pas +++ b/compiler/x86_64/cpupi.pas @@ -71,7 +71,7 @@ implementation function tx86_64procinfo.calc_stackframe_size:longint; begin - maxpushedparasize:=align(maxpushedparasize,max(aktalignment.localalignmin,16)); + maxpushedparasize:=align(maxpushedparasize,max(current_settings.alignment.localalignmin,16)); { RSP should be aligned on 16 bytes } result:=Align(tg.direction*tg.lasttemp+maxpushedparasize,16); if target_info.system=system_x86_64_win64 then diff --git a/compiler/x86_64/nx64add.pas b/compiler/x86_64/nx64add.pas index e7469cd296..561d271b13 100644 --- a/compiler/x86_64/nx64add.pas +++ b/compiler/x86_64/nx64add.pas @@ -66,7 +66,7 @@ interface { Also allocate RDX, since it is also modified by a mul (JM). } cg.getcpuregister(current_asmdata.CurrAsmList,NR_RDX); emit_reg(A_MUL,S_Q,r); - if cs_check_overflow in aktlocalswitches then + if cs_check_overflow in current_settings.localswitches then begin current_asmdata.getjumplabel(hl4); cg.a_jmp_flags(current_asmdata.CurrAsmList,F_AE,hl4); |