2
0
Эх сурвалжийг харах

* settings refactored

git-svn-id: trunk@5094 -
florian 19 жил өмнө
parent
commit
85d63d9fa9
100 өөрчлөгдсөн 887 нэмэгдсэн , 951 устгасан
  1. 1 1
      compiler/aasmbase.pas
  2. 3 3
      compiler/aasmtai.pas
  3. 9 9
      compiler/aggas.pas
  4. 1 1
      compiler/aopt.pas
  5. 2 2
      compiler/aoptobj.pas
  6. 4 4
      compiler/arm/cgcpu.pas
  7. 2 2
      compiler/arm/cpupara.pas
  8. 3 3
      compiler/arm/cpupi.pas
  9. 1 1
      compiler/arm/narmadd.pas
  10. 1 1
      compiler/arm/narmcnv.pas
  11. 9 9
      compiler/arm/narmcon.pas
  12. 3 3
      compiler/arm/narminl.pas
  13. 15 15
      compiler/assemble.pas
  14. 7 7
      compiler/browcol.pas
  15. 2 2
      compiler/browlog.pas
  16. 7 7
      compiler/cgobj.pas
  17. 8 8
      compiler/comprsrc.pas
  18. 1 1
      compiler/dbgdwarf.pas
  19. 4 4
      compiler/dbgstabs.pas
  20. 24 24
      compiler/defcmp.pas
  21. 5 5
      compiler/defutil.pas
  22. 8 8
      compiler/fppu.pas
  23. 1 1
      compiler/gendef.pas
  24. 64 75
      compiler/globals.pas
  25. 17 17
      compiler/htypechk.pas
  26. 6 6
      compiler/i386/ag386nsm.pas
  27. 2 2
      compiler/i386/aopt386.pas
  28. 3 3
      compiler/i386/cgcpu.pas
  29. 1 1
      compiler/i386/cpupi.pas
  30. 7 7
      compiler/i386/csopt386.pas
  31. 4 4
      compiler/i386/daopt386.pas
  32. 2 2
      compiler/i386/n386add.pas
  33. 2 2
      compiler/i386/n386cal.pas
  34. 2 2
      compiler/i386/n386mat.pas
  35. 4 4
      compiler/i386/n386set.pas
  36. 20 20
      compiler/i386/popt386.pas
  37. 24 24
      compiler/link.pas
  38. 19 19
      compiler/m68k/cgcpu.pas
  39. 1 1
      compiler/m68k/n68kadd.pas
  40. 1 1
      compiler/m68k/n68kcnv.pas
  41. 2 2
      compiler/m68k/n68kmat.pas
  42. 1 1
      compiler/m68k/ra68kmot.pas
  43. 24 24
      compiler/nadd.pas
  44. 2 2
      compiler/nbas.pas
  45. 11 11
      compiler/ncal.pas
  46. 16 16
      compiler/ncgadd.pas
  47. 3 3
      compiler/ncgbas.pas
  48. 3 3
      compiler/ncgcal.pas
  49. 1 1
      compiler/ncgcnv.pas
  50. 9 9
      compiler/ncgcon.pas
  51. 13 13
      compiler/ncgflw.pas
  52. 1 1
      compiler/ncginl.pas
  53. 2 2
      compiler/ncgmat.pas
  54. 17 17
      compiler/ncgmem.pas
  55. 3 3
      compiler/ncgset.pas
  56. 13 13
      compiler/ncgutil.pas
  57. 8 8
      compiler/ncnv.pas
  58. 5 5
      compiler/nflw.pas
  59. 13 13
      compiler/ninl.pas
  60. 3 3
      compiler/nld.pas
  61. 8 8
      compiler/nmat.pas
  62. 5 5
      compiler/nmem.pas
  63. 2 2
      compiler/nobj.pas
  64. 1 1
      compiler/node.pas
  65. 2 2
      compiler/nopt.pas
  66. 2 2
      compiler/nset.pas
  67. 1 1
      compiler/nutils.pas
  68. 6 6
      compiler/ogbase.pas
  69. 5 5
      compiler/ogcoff.pas
  70. 1 1
      compiler/oglx.pas
  71. 140 140
      compiler/options.pas
  72. 2 2
      compiler/optunrol.pas
  73. 12 65
      compiler/parser.pas
  74. 10 10
      compiler/pass_1.pas
  75. 5 5
      compiler/pass_2.pas
  76. 2 2
      compiler/pbase.pas
  77. 7 7
      compiler/pdecl.pas
  78. 15 15
      compiler/pdecobj.pas
  79. 30 30
      compiler/pdecsub.pas
  80. 17 17
      compiler/pdecvar.pas
  81. 21 21
      compiler/pexpr.pas
  82. 6 6
      compiler/pinline.pas
  83. 41 41
      compiler/pmodules.pas
  84. 5 5
      compiler/powerpc/agppcmpw.pas
  85. 7 7
      compiler/powerpc/cgcpu.pas
  86. 3 3
      compiler/powerpc/cpupi.pas
  87. 1 1
      compiler/powerpc/itcpugas.pas
  88. 6 6
      compiler/powerpc/nppcadd.pas
  89. 4 4
      compiler/powerpc/nppcmat.pas
  90. 16 16
      compiler/powerpc64/cgcpu.pas
  91. 2 2
      compiler/powerpc64/cpupi.pas
  92. 1 1
      compiler/powerpc64/itcpugas.pas
  93. 2 2
      compiler/powerpc64/nppcadd.pas
  94. 3 3
      compiler/powerpc64/nppcmat.pas
  95. 1 1
      compiler/ppcgen/ngppcadd.pas
  96. 1 1
      compiler/procinfo.pas
  97. 7 7
      compiler/pstatmnt.pas
  98. 27 27
      compiler/psub.pas
  99. 2 2
      compiler/psystem.pas
  100. 8 8
      compiler/ptconst.pas

+ 1 - 1
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;
 

+ 3 - 3
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);

+ 9 - 9
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');
 

+ 1 - 1
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 }

+ 2 - 2
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

+ 4 - 4
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;
 

+ 2 - 2
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,

+ 3 - 3
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;
 

+ 1 - 1
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:

+ 1 - 1
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

+ 9 - 9
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;

+ 3 - 3
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

+ 15 - 15
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;

+ 7 - 7
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 }

+ 2 - 2
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

+ 7 - 7
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);

+ 8 - 8
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);

+ 1 - 1
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))));

+ 4 - 4
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:

+ 24 - 24
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

+ 5 - 5
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];

+ 8 - 8
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;

+ 1 - 1
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;

+ 64 - 75
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;

+ 17 - 17
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);

+ 6 - 6
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

+ 2 - 2
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 }

+ 3 - 3
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;

+ 1 - 1
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;

+ 7 - 7
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;

+ 4 - 4
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 }

+ 2 - 2
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);

+ 2 - 2
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));

+ 2 - 2
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

+ 4 - 4
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;
 

+ 20 - 20
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}

+ 24 - 24
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);

+ 19 - 19
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;
 

+ 1 - 1
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

+ 1 - 1
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;

+ 2 - 2
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);

+ 1 - 1
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

+ 24 - 24
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

+ 2 - 2
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

+ 11 - 11
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}

+ 16 - 16
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}

+ 3 - 3
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 }

+ 3 - 3
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 }

+ 1 - 1
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;

+ 9 - 9
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;

+ 13 - 13
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

+ 1 - 1
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;

+ 2 - 2
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}

+ 17 - 17
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

+ 3 - 3
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

+ 13 - 13
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;
 
 

+ 8 - 8
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

+ 5 - 5
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

+ 13 - 13
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

+ 3 - 3
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

+ 8 - 8
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

+ 5 - 5
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

+ 2 - 2
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))

+ 1 - 1
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;

+ 2 - 2
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 }

+ 2 - 2
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

+ 1 - 1
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;

+ 6 - 6
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

+ 5 - 5
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);

+ 1 - 1
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);

+ 140 - 140
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);

+ 2 - 2
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;

+ 12 - 65
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

+ 10 - 10
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

+ 5 - 5
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

+ 2 - 2
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

+ 7 - 7
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);

+ 15 - 15
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);

+ 30 - 30
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

+ 17 - 17
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;

+ 21 - 21
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

+ 6 - 6
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

+ 41 - 41
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.

+ 5 - 5
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

+ 7 - 7
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;
 

+ 3 - 3
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);

+ 1 - 1
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

+ 6 - 6
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

+ 4 - 4
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_;

+ 16 - 16
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

+ 2 - 2
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

+ 1 - 1
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

+ 2 - 2
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:

+ 3 - 3
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_;

+ 1 - 1
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

+ 1 - 1
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;
 
 

+ 7 - 7
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;

+ 27 - 27
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;
 

+ 2 - 2
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,[]));

+ 8 - 8
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

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно