Parcourir la source

* synchronised with trunk till r42118

git-svn-id: branches/debug_eh@42119 -
Jonas Maebe il y a 6 ans
Parent
commit
a0e35fd1bc

+ 3 - 2
compiler/aarch64/cpupara.pas

@@ -92,7 +92,7 @@ unit cpupara;
 
     function tcpuparamanager.get_saved_registers_int(calloption: tproccalloption): tcpuregisterarray;
       const
-        saved_regs : array[0..9] of tsuperregister =
+        saved_regs : {$ifndef VER3_0}tcpuregisterarray{$else}array[0..9] of tsuperregister{$endif} =
           (RS_X19,RS_X20,RS_X21,RS_X22,RS_X23,RS_X24,RS_X25,RS_X26,RS_X27,RS_X28);
       begin
         result:=saved_regs;
@@ -101,7 +101,8 @@ unit cpupara;
 
     function tcpuparamanager.get_saved_registers_mm(calloption: tproccalloption): tcpuregisterarray;
       const
-        saved_mm_regs : array[0..7] of tsuperregister = (RS_D8,RS_D9,RS_D10,RS_D11,RS_D12,RS_D13,RS_D14,RS_D15);
+        saved_mm_regs : {$ifndef VER3_0}tcpuregisterarray{$else}array[0..7] of tsuperregister{$endif} =
+          (RS_D8,RS_D9,RS_D10,RS_D11,RS_D12,RS_D13,RS_D14,RS_D15);
       begin
         result:=saved_mm_regs;
       end;

+ 1 - 1
compiler/arm/cpupara.pas

@@ -87,7 +87,7 @@ unit cpupara;
 
     function tcpuparamanager.get_saved_registers_int(calloption : tproccalloption):tcpuregisterarray;
       const
-        saved_regs : array[0..6] of tsuperregister =
+        saved_regs : {$ifndef VER3_0}tcpuregisterarray{$else}array[0..6] of tsuperregister{$endif} =
           (RS_R4,RS_R5,RS_R6,RS_R7,RS_R8,RS_R9,RS_R10);
       begin
         result:=saved_regs;

+ 2 - 2
compiler/defcmp.pas

@@ -1037,8 +1037,8 @@ implementation
                                { dynamic array -> dynamic array }
                                if is_dynamic_array(def_from) then
                                  eq:=te_equal
-                               { fpc modes only: array -> dyn. array }
-                               else if (current_settings.modeswitches*[m_objfpc,m_fpc]<>[]) and
+                               { regular array -> dynamic array }
+                               else if (m_array2dynarray in current_settings.modeswitches) and
                                  not(is_special_array(def_from)) and
                                  is_zero_based_array(def_from) then
                                  begin

Fichier diff supprimé car celui-ci est trop grand
+ 541 - 5
compiler/entfile.pas


+ 4 - 2
compiler/globtype.pas

@@ -487,7 +487,8 @@ interface
          m_isolike_program_para, { program parameters as it required by an ISO compatible compiler }
          m_isolike_mod,         { mod operation as it is required by an iso compatible compiler }
          m_array_operators,     { use Delphi compatible array operators instead of custom ones ("+") }
-         m_multi_helpers        { helpers can appear in multiple scopes simultaneously }
+         m_multi_helpers,       { helpers can appear in multiple scopes simultaneously }
+         m_array2dynarray       { regular arrays can be implicitly converted to dynamic arrays }
        );
        tmodeswitches = set of tmodeswitch;
 
@@ -677,7 +678,8 @@ interface
          'ISOPROGRAMPARAS',
          'ISOMOD',
          'ARRAYOPERATORS',
-         'MULTIHELPERS'
+         'MULTIHELPERS',
+         'ARRAYTODYNARRAY'
          );
 
 

+ 2 - 2
compiler/i386/cpupara.pas

@@ -299,8 +299,8 @@ unit cpupara;
 
     function tcpuparamanager.get_saved_registers_int(calloption : tproccalloption):tcpuregisterarray;
       const
-        saveregs : array[0..3] of tsuperregister = (RS_EBX,RS_ESI,RS_EDI,RS_EBP);
-        saveregs_oldfpccall : array[0..0] of tsuperregister = (RS_EBP);
+        saveregs : {$ifndef VER3_0}tcpuregisterarray{$else}array[0..3] of tsuperregister{$endif} = (RS_EBX,RS_ESI,RS_EDI,RS_EBP);
+        saveregs_oldfpccall : {$ifndef VER3_0}tcpuregisterarray{$else}array[0..0] of tsuperregister{$endif} = (RS_EBP);
       begin
         case calloption of
           pocall_internproc,

+ 2 - 3
compiler/i386/n386flw.pas

@@ -144,16 +144,15 @@ function reset_regvars(var n: tnode; arg: pointer): foreachnoderesult;
         make_not_regable(n,[]);
       calln:
         include(tprocinfo(arg).flags,pi_do_call);
+      else ;
     end;
     result:=fen_true;
   end;
 
 function copy_parasize(var n: tnode; arg: pointer): foreachnoderesult;
   begin
-    case n.nodetype of
-      calln:
+    if n.nodetype=calln then
         tcgprocinfo(arg).allocate_push_parasize(tcallnode(n).pushed_parasize);
-    end;
     result:=fen_true;
   end;
 

+ 2 - 2
compiler/i8086/cpupara.pas

@@ -237,8 +237,8 @@ unit cpupara;
 
     function tcpuparamanager.get_saved_registers_int(calloption : tproccalloption):tcpuregisterarray;
       const
-        saveregs_cdecl: array [0..2] of tsuperregister = (RS_BP,RS_SI,RS_DI);
-        saveregs_pascal: array [0..0] of tsuperregister = (RS_BP);
+        saveregs_cdecl: {$ifndef VER3_0}tcpuregisterarray{$else}array [0..2] of tsuperregister{$endif} = (RS_BP,RS_SI,RS_DI);
+        saveregs_pascal: {$ifndef VER3_0}tcpuregisterarray{$else}array [0..0] of tsuperregister{$endif} = (RS_BP);
       begin
         case calloption of
           pocall_register,

+ 1 - 1
compiler/jvm/cpupara.pas

@@ -74,7 +74,7 @@ implementation
     function tcpuparamanager.get_saved_registers_int(calloption: tproccalloption): tcpuregisterarray;
       const
         { dummy, not used for JVM }
-        saved_regs: array [0..0] of tsuperregister = (RS_NO);
+        saved_regs: {$ifndef VER3_0}tcpuregisterarray{$else}array [0..0] of tsuperregister{$endif} = (RS_NO);
       begin
         result:=saved_regs;
       end;

+ 3 - 3
compiler/m68k/cpupara.pas

@@ -104,21 +104,21 @@ unit cpupara;
 
     function tcpuparamanager.get_saved_registers_int(calloption:tproccalloption):tcpuregisterarray;
       const
-        saved_regs: array[0..5] of tsuperregister = (RS_D2,RS_D3,RS_D4,RS_D5,RS_D6,RS_D7);
+        saved_regs: {$ifndef VER3_0}tcpuregisterarray{$else}array[0..5] of tsuperregister{$endif} = (RS_D2,RS_D3,RS_D4,RS_D5,RS_D6,RS_D7);
       begin
         result:=saved_regs;
       end;
 
     function tcpuparamanager.get_saved_registers_address(calloption:tproccalloption):tcpuregisterarray;
       const
-        saved_addr_regs: array[0..4] of tsuperregister = (RS_A2,RS_A3,RS_A4,RS_A5,RS_A6);
+        saved_addr_regs: {$ifndef VER3_0}tcpuregisterarray{$else}array[0..4] of tsuperregister{$endif} = (RS_A2,RS_A3,RS_A4,RS_A5,RS_A6);
       begin
         result:=saved_addr_regs;
       end;
 
     function tcpuparamanager.get_saved_registers_fpu(calloption:tproccalloption):tcpuregisterarray;
       const
-        saved_fpu_regs: array[0..5] of tsuperregister = (RS_FP2,RS_FP3,RS_FP4,RS_FP5,RS_FP6,RS_FP7);
+        saved_fpu_regs: {$ifndef VER3_0}tcpuregisterarray{$else}array[0..5] of tsuperregister{$endif} = (RS_FP2,RS_FP3,RS_FP4,RS_FP5,RS_FP6,RS_FP7);
       begin
         result:=saved_fpu_regs;
       end;

+ 1 - 1
compiler/mips/cpupara.pas

@@ -109,7 +109,7 @@ implementation
 
     function tcpuparamanager.get_saved_registers_int(calloption : tproccalloption):TCpuRegisterArray;
       const
-        saved_regs : array[0..0] of tsuperregister =
+        saved_regs : {$ifndef VER3_0}tcpuregisterarray{$else}array[0..0] of tsuperregister{$endif} =
           (RS_NO);
       begin
         result:=saved_regs;

+ 4 - 4
compiler/paramgr.pas

@@ -315,7 +315,7 @@ implementation
 
     function tparamanager.get_saved_registers_int(calloption : tproccalloption):tcpuregisterarray;
       const
-        inv: array [0..0] of tsuperregister = (RS_INVALID);
+        inv: {$ifndef VER3_0}tcpuregisterarray{$else}array [0..0] of tsuperregister{$endif} = (RS_INVALID);
       begin
         result:=inv;
       end;
@@ -323,7 +323,7 @@ implementation
 
     function tparamanager.get_saved_registers_address(calloption : tproccalloption):tcpuregisterarray;
       const
-        inv: array [0..0] of tsuperregister = (RS_INVALID);
+        inv: {$ifndef VER3_0}tcpuregisterarray{$else}array [0..0] of tsuperregister{$endif} = (RS_INVALID);
       begin
         result:=inv;
       end;
@@ -331,7 +331,7 @@ implementation
 
     function tparamanager.get_saved_registers_fpu(calloption : tproccalloption):tcpuregisterarray;
       const
-        inv: array [0..0] of tsuperregister = (RS_INVALID);
+        inv: {$ifndef VER3_0}tcpuregisterarray{$else}array [0..0] of tsuperregister{$endif} = (RS_INVALID);
       begin
         result:=inv;
       end;
@@ -339,7 +339,7 @@ implementation
 
     function tparamanager.get_saved_registers_mm(calloption : tproccalloption):tcpuregisterarray;
       const
-        inv: array [0..0] of tsuperregister = (RS_INVALID);
+        inv: {$ifndef VER3_0}tcpuregisterarray{$else}array [0..0] of tsuperregister{$endif} = (RS_INVALID);
       begin
         result:=inv;
       end;

+ 1 - 1
compiler/powerpc/cpupara.pas

@@ -81,7 +81,7 @@ unit cpupara;
 
     function tcpuparamanager.get_saved_registers_int(calloption : tproccalloption):tcpuregisterarray;
       const
-        saved_regs : array[0..18] of tsuperregister = (
+        saved_regs : {$ifndef VER3_0}tcpuregisterarray{$else}array[0..18] of tsuperregister{$endif} = (
           RS_R13,RS_R14,RS_R15,RS_R16,RS_R17,RS_R18,RS_R19,
           RS_R20,RS_R21,RS_R22,RS_R23,RS_R24,RS_R25,RS_R26,RS_R27,RS_R28,RS_R29,
           RS_R30,RS_R31

+ 1 - 1
compiler/powerpc64/cpupara.pas

@@ -83,7 +83,7 @@ end;
 function tcpuparamanager.get_saved_registers_int(calloption: tproccalloption):
   tcpuregisterarray;
 const
-  saved_regs: array[0..17] of tsuperregister = (
+  saved_regs: {$ifndef VER3_0}tcpuregisterarray{$else}array[0..17] of tsuperregister{$endif} = (
     RS_R14, RS_R15, RS_R16, RS_R17, RS_R18, RS_R19,
     RS_R20, RS_R21, RS_R22, RS_R23, RS_R24, RS_R25,
     RS_R26, RS_R27, RS_R28, RS_R29, RS_R30, RS_R31

+ 27 - 0
compiler/ppu.pas

@@ -103,6 +103,9 @@ type
     function getheadersize:longint;override;
     function getheaderaddr:pentryheader;override;
     procedure resetfile;override;
+{$ifdef DEBUG_PPU}
+    procedure ppu_log(st :string);override;
+{$endif}
   public
     header           : tppuheader;
     { crc for the entire unit }
@@ -236,6 +239,30 @@ begin
   result:=not crc_only;
 end;
 
+{$ifdef DEBUG_PPU}
+procedure tppufile.ppu_log(st :string);
+begin
+  inherited ppu_log(st);
+  if flog_open then
+    begin
+      if do_crc and (ppu_log_idx < bufstart+bufidx) then
+        begin
+          writeln(flog,'New crc : ',hexstr(dword(crc),8));
+          writeln(flog,'New interface crc : ',hexstr(dword(interface_crc),8));
+          writeln(flog,'New indirect crc : ',hexstr(dword(indirect_crc),8));
+          ppu_log_idx:=bufstart+bufidx;
+         end;
+    end;
+{$ifdef IN_PPUDUMP}
+  if update_crc then
+    begin
+      writeln('New crc : ',hexstr(dword(crc),8));
+      writeln('New interface crc : ',hexstr(dword(interface_crc),8));
+      writeln('New indirect crc : ',hexstr(dword(indirect_crc),8));
+    end;
+{$endif}
+end;
+{$endif}
 
 {*****************************************************************************
                                 TPPUFile Reading

+ 353 - 10
compiler/utils/ppuutils/ppudump.pp

@@ -209,7 +209,8 @@ type
     ST_LINE,
     ST_COLUMN,
     ST_FILEINDEX,
-    ST_LOADMESSAGES);
+    ST_LOADMESSAGES,
+    ST_INVALID);
 
   TPpuModuleDef = class(TPpuUnitDef)
     ModuleFlags: tmoduleflags;
@@ -340,6 +341,11 @@ Begin
   SetHasErrors;
 End;
 
+procedure StrAppend(var st : string; const st2 : string);
+begin
+  st:=st+st2;
+end;
+
 procedure tppudumpfile.RaiseAssertion(Code: Longint);
 begin
   WriteError('Internal Error ' + ToStr(Code));
@@ -1580,13 +1586,15 @@ const
      (mask:gcf_class;       str:'Class'),
      (mask:gcf_record;      str:'Record')
   );
+  
 var
   defstates  : tdefstates;
   i, nb{, msgvalue}, mesgnb : longint;
   first  : boolean;
   copy_size, min_size, tokenbufsize : longint;
   tokenbuf : pbyte;
-  tbi : longint;
+  tbi, last_col, new_col : longint;
+  last_line,new_line : dword;
 //  idtoken,
   token : ttoken;
 //  state : tmsgstate;
@@ -1594,8 +1602,290 @@ var
   len : sizeint;
   wstring : widestring;
   astring : ansistring;
+  linestr,genstr : string;
   genconstr : tgenericconstraintflags;
 
+  procedure dump_new_settings;
+(*     tsettings = record
+         alignment       : talignmentinfo;
+         globalswitches  : tglobalswitches;
+         targetswitches  : ttargetswitches;
+         moduleswitches  : tmoduleswitches;
+         localswitches   : tlocalswitches;
+         modeswitches    : tmodeswitches;
+         optimizerswitches : toptimizerswitches;
+         { generate information necessary to perform these wpo's during a subsequent compilation }
+         genwpoptimizerswitches: twpoptimizerswitches;
+         { perform these wpo's using information generated during a previous compilation }
+         dowpoptimizerswitches: twpoptimizerswitches;
+         debugswitches   : tdebugswitches;
+         { 0: old behaviour for sets <=256 elements
+           >0: round to this size }
+         setalloc,
+         packenum        : shortint;
+
+         packrecords     : shortint;
+         maxfpuregisters : shortint;
+
+         cputype,
+         optimizecputype,
+         asmcputype      : tcputype;
+         fputype         : tfputype;
+         asmmode         : tasmmode;
+         interfacetype   : tinterfacetypes;
+         defproccall     : tproccalloption;
+         sourcecodepage  : tstringencoding;
+
+         minfpconstprec  : tfloattype;
+
+         disabledircache : boolean;
+
+         tlsmodel : ttlsmodel;
+
+{$if defined(i8086)}
+         x86memorymodel  : tx86memorymodel;
+{$endif defined(i8086)}
+
+{$if defined(ARM)}
+         instructionset : tinstructionset;
+{$endif defined(ARM)}
+
+{$if defined(LLVM) and not defined(GENERIC_CPU)}
+         llvmversion: tllvmversion;
+{$endif defined(LLVM) and not defined(GENERIC_CPU)}
+
+        { CPU targets with microcontroller support can add a controller specific unit }
+         controllertype   : tcontrollertype;
+
+         { WARNING: this pointer cannot be written as such in record token }
+         pmessage : pmessagestaterecord;
+       end; *)
+
+const
+    targetswitchname : array[ttargetswitch] of string[30] =
+       { global target-specific switches }
+       ('Target None', {ts_none}
+         { generate code that results in smaller TOCs than normal (AIX) }
+        'Small TOC', {ts_small_toc}
+         { for the JVM target: generate integer array initializations via string
+           constants in order to reduce the generated code size (Java routines
+           are limited to 64kb of bytecode) }
+        'JVM compact int array init', {ts_compact_int_array_init}
+         { for the JVM target: intialize enum fields in constructors with the
+           enum class instance corresponding to ordinal value 0 (not done by
+           default because this initialization can only be performed after the
+           inherited constructors have run, and if they call a virtual method
+           of the current class, then this virtual method may already have
+           initialized that field with another value and the constructor
+           initialization will result in data loss }
+        'JVM enum field init', {ts_jvm_enum_field_init}
+         { when automatically generating getters/setters for properties, use
+           these strings as prefixes for the generated getters/setter names }
+        'Auto getter prefix', {ts_auto_getter_prefix}
+        'Auto setter prefix', {ts_auto_setter_predix}
+        'Thumb interworking', {ts_thumb_interworking,}
+         { lowercase the first character of routine names, used to generate
+           names that are compliant with Java coding standards from code
+           written according to Delphi coding standards }
+        'LowerCase proc start', {ts_lowercase_proc_start,}
+         { initialise local variables on the JVM target so you won't get
+           accidental uses of uninitialised values }
+        'Init locals', {ts_init_locals}
+         { emit a CLD instruction before using the x86 string instructions }
+        'Emit CLD instruction', {ts_cld}
+         { increment BP before pushing it in the function prologue and decrement
+           it after popping it in the function epilogue, iff the function is
+           going to terminate with a far ret. Thus, the BP value pushed on the
+           stack becomes odd if the function is far and even if the function is
+           near. This allows walking the BP chain on the stack and e.g.
+           obtaining a stack trace even if the program uses a mixture of near
+           and far calls. This is also required for Win16 real mode, because it
+           allows Windows to move code segments around (in order to defragment
+           memory) and then walk through the stacks of all running programs and
+           update the segment values of the segment that has moved. }
+        'Use odd BP for far procs' {ts_x86_far_procs_push_odd_bp}
+       );
+    moduleswitchname : array[tmoduleswitch] of string[30] =
+       ('Module None', {cs_modulenone,}
+         { parser }
+        'Floating Point Emulation',{ cs_fp_emulation}
+        'Extended syntax', {cs_extsyntax}
+        'Open string', {cs_openstring}
+         { support }
+        'Goto allowed', {cs_support_goto}
+        'Macro support', {cs_support_macro}
+        'C operator support', {cs_support_c_operators}
+         { generation }
+        'Profile', {cs_profile}
+        'Debug information', {cs_debuginfo}
+        'Compilation of System unit', {cs_compilesystem}
+        'Line information', {cs_lineinfo}
+        'Implicit exceptions', {cs_implicit_exceptions}
+        'Explicit CodePage', {cs_explicit_codepage}
+        'System CodePage', {cs_system_codepage}
+         { linking }
+        'Create smart units', {cs_create_smart}
+        'Create dynamic', {cs_create_dynamic}
+        'Create PIC code', {cs_create_pic}
+         { browser switches are back }
+        'Browser', {cs_browser}
+        'Local Browser', {cs_local_browser}
+         { target specific }
+        'Executable Stack', {cs_executable_stack}
+         { i8086 specific }
+        'Hude code', {cs_huge_code}
+        'Win16 smart callbacks', {cs_win16_smartcallbacks}
+         { Record usage of checkpointer experimental feature }
+        'CheckPointer used' {cs_checkpointer_called}
+       );
+    globalswitchname : array[tglobalswitch] of string[50] =
+       ('Global None',{cs_globalnone}
+         { parameter switches }
+        'Check unit name', {cs_check_unit_name}
+        'Constructor name', {cs_constructor_name}
+        'Support exceptions',{cs_support_exceptions}
+        'Support Objective-C pas',{ cs_support_c_objectivepas}
+        'Transparent file names', {cs_transparent_file_names}
+         { units }
+        'Load Objpas Unit', {cs_load_objpas_unit}
+        'Load GPC unit', {cs_load_gpc_unit}
+        'Load FPCKylix unit', {cs_load_fpcylix_unit}
+        'Support Vectors', {cs_support_vectors}
+         { debuginfo }
+        'Use HeapTRc unit', {cs_use_heaptrc}
+        'Use line information', {cs_use_lineinfo}
+        'Use GDB Valgrind', {cs_gdb_valgrind}
+        'No regalloc', {cs_no_regalloc}
+        'Stabs preserve cases', {cs_stabs_preservecase}
+         { assembling }
+        'Leave assembler file', {cs_asm_leave}
+        'Use external assembler', {cs_asm_extern}
+        'Use pipes to call assembler', {cs_asm_pipe}
+        'Add source infos into assembler files', {cs_asm_source}
+        'Add register allocation into assembler files', {cs_asm_regalloc}
+        'Add temporary  allocation into assmebler files', {cs_asm_tempalloc}
+        'Add node information into assembler files', {cs_asm_nodes}
+        'Adapt assembler call to GNU version <= 2.25', {cs_asm_pre_binutils_2_25}
+         { linking }
+        'Skip linking stage', {cs_link_nolink}
+        'Link static', {cs_link_static}
+        'Link smart', {cs_link_smart}
+        'Link shared', {cs_link_shared}
+        'Link deffile', {cs_link_deffile}
+        'Strip after linking', {cs_link_strip}
+        'Use linker static flag',{cs_link_staticflag}
+        'Link on target OS',{cs_link_on_target}
+        'Use external linker', {cs_link_extern}
+        'Link opt vtable', {cs_link_opt_vtable}
+        'Link opt used sections', {cs_link_opt_used_sections}
+        'Link debug to separate file',{cs_link_separate_dbg_file}
+        'Create linker map', {cs_link_map}
+        'Link to pthread', {cs_link_pthread}
+        'Link no default lib order', {cs_link_no_default_lib_order}
+        'Link using native linker', {cs_link_native}
+        'Link for GNU linker version <=2.19', {cs_link_pre_binutils_2_19}
+        'Link using vlink' {cs_link_vlink}
+       );
+    localswitchname : array[tlocalswitch] of string[50] =
+       { Switches which can be changed locally }
+       ('Local None', {cs_localnone}
+         { codegen }
+        'Check overflow', {cs_check_overflow}
+        'Check range', {cs_check_range}
+        'Check object error', {cs_check_object}
+        'Check I/O error', {cs_check_io}
+        'Check stack', {cs_check_stack}
+        'Check pointer', {cs_checkpointer}
+        'Check ordinal size', {cs_check_ordinal_size}
+        'Generate stackframes', {cs_generate_stackframes}
+        'Do assertions', {cs_do_assertion}
+        'Generate RTTI', {cs_generate_rtti}
+        'Full boolean evaluaion', {cs_full_boolean_eval}
+        'Typed constant are writable', {cs_typed_const_writable}
+        'Allow calcuation on enum types', {cs_allow_enum_calc}
+        'Do inline', {cs_do_inline}
+        'Add FWAIT instruction for FPU 8087', {cs_fpu_fwait}
+        'IEEE errors', {cs_ieee_errors}
+        'Check low address loading', {cs_check_low_addr_load}
+        'Imported data', {cs_imported_data}
+        'Excess precision', {cs_excessprecision}
+        'Check fpu exceptions', {cs_check_fpu_exceptions}
+        'Check all case coverage', {cs_check_all_case_coverage}
+         { mmx }
+        'Allow MMX instructions', {cs_mmx}
+        'Use MMX saturation', {cs_mmx_saturation}
+         { parser }
+        'Use typed addresses', {cs_typed_addresses}
+        'Use strict var strings', {cs_strict_var_strings}
+        'Use reference counted strings', {cs_refcountedstrings}
+        'Use bit-packing', {cs_bitpacking}
+        'Use var property setter', {cs_varpropsetter}
+        'Use scoped enums',{cs_scopedenums}
+        'Use pointer math', {cs_pointermath}
+         { macpas specific}
+        'MACPAS exteranl variable', {cs_external_var}
+        'MACPAS externally visible', {cs_externally_visible}
+         { jvm specific }
+        'JVM check var copyout', {cs_check_var_copyout}
+        'Zero based strings', {cs_zerobasedstrings}
+         { i8086 specific }
+        'i8086 force FAR calls', {cs_force_far_calls}
+        'i8086 huge pointer arithmetic', {cs_hugeptr_arithmetic_normalization}
+        'i8086 huge pointer comparison' {cs_hugeptr_comparison_normalization}
+       );
+    var
+         globalswitch  : tglobalswitch;
+         targetswitch  : ttargetswitch;
+         moduleswitch  : tmoduleswitch;
+         localswitch   : tlocalswitch;
+         modeswitch    : tmodeswitch;
+         optimizerswitch : toptimizerswitch;
+    begin
+       {alignment : talignmentinfo;}
+       {talignmentinfo = packed record}
+       writeln('Procedure alignment: '+tostr(new_settings.alignment.procalign));
+       writeln('Loop alignment: '+tostr(new_settings.alignment.loopalign));
+       { alignment for labels after unconditional jumps, this must be a power of two }
+       writeln('Jump alignment: '+tostr(new_settings.alignment.jumpalign));
+       { max. alignment for labels after unconditional jumps:
+         the compiler tries to align jumpalign, however, to do so it inserts at maximum jumpalignskipmax bytes or uses
+         the next smaller power of two of jumpalign }
+       writeln('Jump skip max alignment: '+tostr(new_settings.alignment.jumpalignskipmax));
+       { alignment for labels where two flows of the program flow coalesce, this must be a power of two }
+       writeln('Coalescence alignment: '+tostr(new_settings.alignment.coalescealign));
+       { max. alignment for labels where two flows of the program flow coalesce
+         the compiler tries to align to coalescealign, however, to do so it inserts at maximum coalescealignskipmax bytes or uses
+         the next smaller power of two of coalescealign }
+       writeln('Coalescence skip max alignment: '+tostr(new_settings.alignment.coalescealignskipmax));
+       writeln('Const min alignment: '+tostr(new_settings.alignment.constalignmin));
+       writeln('Const max alignment: '+tostr(new_settings.alignment.constalignmax));
+       writeln('Var min alignment: '+tostr(new_settings.alignment.varalignmin));
+       writeln('Var max alignment: '+tostr(new_settings.alignment.varalignmax));
+       writeln('Local min alignment: '+tostr(new_settings.alignment.localalignmin));
+       writeln('Local max alignment: '+tostr(new_settings.alignment.localalignmax));
+       writeln('Min record alignment: '+tostr(new_settings.alignment.recordalignmin));
+       writeln('Max record alignment: '+tostr(new_settings.alignment.recordalignmax));
+       writeln('Max C record alignment: '+tostr(new_settings.alignment.maxCrecordalign));
+       for globalswitch:=low(tglobalswitch) to high(tglobalswitch) do
+         if globalswitch in new_settings.globalswitches then
+           writeln('global switch: '+globalswitchname[globalswitch]);
+       for targetswitch:=low(ttargetswitch) to high(ttargetswitch) do
+         if targetswitch in new_settings.targetswitches then
+           writeln('target switch: '+targetswitchname[targetswitch]);
+       for moduleswitch:=low(tmoduleswitch) to high(tmoduleswitch) do
+         if moduleswitch in new_settings.moduleswitches then
+           writeln('module switch: '+moduleswitchname[moduleswitch]);
+       for localswitch:=low(tlocalswitch) to high(tlocalswitch) do
+         if localswitch in new_settings.localswitches then
+           writeln('local switch: '+localswitchname[localswitch]);
+       (* for modeswitch:=low(tmodeswitch) to high(tmodeswitch) do
+         if modeswitch in new_settings.modeswitches then
+           writeln('mode switch: '+modeswitchname[modeswitch]);
+       for optimizerswitch:=low(toptimizerswitch) to high(toptimizerswitch) do
+         if optimizerswitch in new_settings.optimizerswitches then
+           writeln('optimizer switch: '+optimizerswitchname[optimizerswitch]);*)
+    end;
+
   function readtoken: ttoken;
     var
       b,b2 : byte;
@@ -1786,6 +2076,10 @@ begin
     end;
   if df_generic in defoptions then
     begin
+      last_line:=0;
+      last_col:=0;
+      linestr:='';
+      genstr:='';
       tokenbufsize:=ppufile.getlongint;
       writeln([space,' Tokenbuffer size : ',tokenbufsize]);
       tokenbuf:=allocmem(tokenbufsize);
@@ -1798,7 +2092,12 @@ begin
           if token<>_GENERICSPECIALTOKEN then
             begin
               if token <= high(ttoken) then
-                write(arraytokeninfo[token].str)
+                begin
+                  write(arraytokeninfo[token].str);
+                  if not (token in [_CWCHAR, _CWSTRING, _CSTRING, _CCHAR,
+                                    _INTCONST,_REALNUMBER, _ID]) then
+                    StrAppend(linestr,lowercase(arraytokeninfo[token].str));
+                end
               else
                 begin
                   HasMoreInfos;
@@ -1814,7 +2113,10 @@ begin
                 len:=gettokenbufsizeint;
                 setlength(wstring,len);
                 move(tokenbuf[tbi],wstring[1],len*2);
-                write([' ',wstring]);
+                write([' ''',wstring,'''']);
+                StrAppend(linestr,' ''');
+                StrAppend(linestr,wstring);
+                StrAppend(linestr,'''');
                 inc(tbi,len*2);
               end;
             _CSTRING:
@@ -1823,19 +2125,31 @@ begin
                 setlength(astring,len);
                 if len>0 then
                   move(tokenbuf[tbi],astring[1],len);
-                write([' ',astring]);
+                write([' ''',astring,'''']);
+                StrAppend(linestr,' ''');
+                StrAppend(linestr,astring);
+                StrAppend(linestr,'''');
                 inc(tbi,len);
               end;
-            _CCHAR,
+            _CCHAR:
+              begin
+                write([' ''',unaligned(pshortstring(@tokenbuf[tbi])^),'''']);
+                StrAppend(linestr,' ''');
+                StrAppend(linestr,unaligned(pshortstring(@tokenbuf[tbi])^));
+                StrAppend(linestr,'''');
+                inc(tbi,tokenbuf[tbi]+1);
+              end;
             _INTCONST,
             _REALNUMBER :
               begin
                 write([' ',unaligned(pshortstring(@tokenbuf[tbi])^)]);
+                StrAppend(linestr,unaligned(pshortstring(@tokenbuf[tbi])^));
                 inc(tbi,tokenbuf[tbi]+1);
               end;
             _ID :
               begin
                 write([' ',unaligned(pshortstring(@tokenbuf[tbi])^)]);
+                StrAppend(linestr,unaligned(pshortstring(@tokenbuf[tbi])^));
                 inc(tbi,tokenbuf[tbi]+1);
               end;
             _GENERICSPECIALTOKEN:
@@ -1844,15 +2158,20 @@ begin
                   byte or $80 used }
                 if (tokenbuf[tbi] and $80)<>0 then
                   begin
-                    write(['Col: ',tokenbuf[tbi] and $7f]);
+                    new_col:=tokenbuf[tbi] and $7f;
+                    write(['Col: ',new_col]);
+                    if length(linestr)<new_col-1 then
+                      StrAppend(linestr,StringOfChar(' ',new_col - 1 - length(linestr)));
                     inc(tbi);
+                    last_col:=new_col;
                   end
                 else
                   case tspecialgenerictoken(tokenbuf[tbi]) of
                     ST_LOADSETTINGS:
                       begin
                         inc(tbi);
-                        write('Settings');
+                        write('Settings: ');
+                        fillchar(new_settings,sizeof(new_settings),#0);
                         { This does not load pmessage pointer }
                         new_settings.pmessage:=nil;
                         { TSettings size depends in target...
@@ -1865,6 +2184,8 @@ begin
                           min_size:= sizeof(tsettings)-sizeof(pointer);
                         move(tokenbuf[tbi],new_settings, min_size);
                         inc(tbi,copy_size);
+                        dump_new_settings;
+                        writeln;
                       end;
                     ST_LOADMESSAGES:
                       begin
@@ -1882,26 +2203,48 @@ begin
                     ST_LINE:
                       begin
                         inc(tbi);
-                        write(['Line: ',gettokenbufdword]);
+                        new_line:=gettokenbufdword;
+                        if (new_line<>last_line) then
+                          begin
+                            StrAppend(genstr,linestr+LineEnding);
+                            linestr:='';
+                          end;
+                        write(['Line: ',new_line]);
+                        last_line:=new_line;
                       end;
                     ST_COLUMN:
                       begin
                         inc(tbi);
-                        write(['Col: ',gettokenbufword]);
+                        new_col:=gettokenbufword;
+                        write(['Col: ',new_col]);
+                        if length(linestr)<new_col - 1 then
+                          StrAppend(linestr,StringOfChar(' ',new_col - 1 - length(linestr)));
+                        last_col:=new_col;
                       end;
                     ST_FILEINDEX:
                       begin
                         inc(tbi);
+                        StrAppend(genstr,linestr+LineEnding);
+                        linestr:='';
                         write(['File: ',gettokenbufword]);
                       end;
+                    else
+                      begin
+                        HasMoreInfos;
+                        write('Error in Token List');
+                        break;
+                      end;
                   end;
               end;
+            else ; { empty else to avoid warning }
           end;
 
           if tbi<tokenbufsize then
             write(',');
         end;
       writeln;
+      StrAppend(genstr,linestr);
+      writeln(genstr);
       freemem(tokenbuf);
     end;
   if df_specialization in defoptions then

+ 3 - 3
compiler/x86_64/cpupara.pas

@@ -1372,8 +1372,8 @@ unit cpupara;
 
     function tcpuparamanager.get_saved_registers_int(calloption : tproccalloption):tcpuregisterarray;
       const
-        win64_saved_std_regs : array[0..7] of tsuperregister = (RS_RBX,RS_RDI,RS_RSI,RS_R12,RS_R13,RS_R14,RS_R15,RS_RBP);
-        others_saved_std_regs : array[0..4] of tsuperregister = (RS_RBX,RS_R12,RS_R13,RS_R14,RS_R15);
+        win64_saved_std_regs : {$ifndef VER3_0}tcpuregisterarray{$else}array[0..7] of tsuperregister{$endif} = (RS_RBX,RS_RDI,RS_RSI,RS_R12,RS_R13,RS_R14,RS_R15,RS_RBP);
+        others_saved_std_regs : {$ifndef VER3_0}tcpuregisterarray{$else}array[0..4] of tsuperregister{$endif} = (RS_RBX,RS_R12,RS_R13,RS_R14,RS_R15);
       begin
         if tcgx86_64(cg).use_ms_abi then
           result:=win64_saved_std_regs
@@ -1384,7 +1384,7 @@ unit cpupara;
 
     function tcpuparamanager.get_saved_registers_mm(calloption: tproccalloption):tcpuregisterarray;
       const
-        win64_saved_xmm_regs : array[0..9] of tsuperregister = (RS_XMM6,RS_XMM7,
+        win64_saved_xmm_regs : {$ifndef VER3_0}tcpuregisterarray{$else}array[0..9] of tsuperregister{$endif} = (RS_XMM6,RS_XMM7,
           RS_XMM8,RS_XMM9,RS_XMM10,RS_XMM11,RS_XMM12,RS_XMM13,RS_XMM14,RS_XMM15);
       begin
         if tcgx86_64(cg).use_ms_abi then

+ 14 - 1
packages/openssl/src/openssl.pas

@@ -1024,6 +1024,7 @@ var
   SSLUtilFile: string = '';
 
 // libssl.dll
+  function OpenSSLGetVersion(t: cint):String;
   function SslGetError(s: PSSL; ret_code: cInt):cInt;
   function SslLibraryInit:cInt;
   procedure SslLoadErrorStrings;
@@ -1510,6 +1511,7 @@ end;
 
 type
 // libssl.dll
+  TOpenSSLversion = function (arg : cint) : pchar; cdecl;
   TSslGetError = function(s: PSSL; ret_code: cInt):cInt; cdecl;
   TSslLibraryInit = function:cInt; cdecl;
   TSslLoadErrorStrings = procedure; cdecl;
@@ -1740,6 +1742,7 @@ type
 
 var
 // libssl.dll
+  _OpenSSLVersion : TOpenSSLversion = Nil;
   _SslGetError: TSslGetError = nil;
   _SslLibraryInit: TSslLibraryInit = nil;
   _SslLoadErrorStrings: TSslLoadErrorStrings = nil;
@@ -2411,6 +2414,14 @@ begin
     Result := 0;
 end;
 
+function OpenSSLGetVersion(t: cint):String;
+begin
+  if InitSSLInterface and Assigned(_OpenSSLVersion) then
+    Result := _OpenSSLVersion(t)
+  else
+    Result := '';
+end;
+
 //function SslGetVersion(ssl: PSSL):PChar;
 function SslGetVersion(ssl: PSSL):String;
 begin
@@ -4672,6 +4683,7 @@ end;
 Procedure LoadSSLEntryPoints;
 
 begin
+  _OpenSSLVersion := GetProcAddr(SSLLibHandle, 'OpenSSL_version');
   _SslGetError := GetProcAddr(SSLLibHandle, 'SSL_get_error');
   _SslLibraryInit := GetProcAddr(SSLLibHandle, 'SSL_library_init');
   _SslLoadErrorStrings := GetProcAddr(SSLLibHandle, 'SSL_load_error_strings');
@@ -5013,7 +5025,8 @@ end;
 Procedure ClearSSLEntryPoints;
 
 begin
- _SslGetError := nil;
+  _OpenSSLVersion := Nil;
+  _SslGetError := nil;
   _SslLibraryInit := nil;
   _SslLoadErrorStrings := nil;
   _SslCtxSetCipherList := nil;

+ 3 - 1
rtl/android/sysandroid.inc

@@ -79,6 +79,8 @@ end;
 
 procedure LibMainAndroid; external name 'FPC_LIB_MAIN_ANDROID';
 
+procedure fpc_lib_exit_intern; external name 'FPC_LIB_EXIT';
+
 procedure atexit(p: pointer); cdecl; external;
 
 var
@@ -101,7 +103,7 @@ begin
   FpClose(_SaveStdOut);
   FpClose(_SaveStdErr);
   // Finalize the library
-  lib_exit;
+  fpc_lib_exit_intern;
   // Close stdout and stderr if stdio has been closed
   if ioclosed then
     begin

+ 1 - 1
rtl/java/jsystem.inc

@@ -1041,7 +1041,7 @@ end;
 procedure internal_do_exit; external name 'fpc_do_exit';
 
 
-Procedure lib_exit;[Public,Alias:'FPC_LIB_EXIT'];
+Procedure fpc_lib_exit;[Public,Alias:'FPC_LIB_EXIT'];
 begin
   InternalExit;
 end;

+ 3 - 1
rtl/wince/system.pp

@@ -789,6 +789,8 @@ var
   _SS : Cardinal;
 {$endif cpu386}
 
+procedure fpc_lib_exit_intern; external name 'FPC_LIB_EXIT';
+
 function Dll_entry : longbool;[public, alias : '_FPC_DLL_Entry'];
 begin
    IsLibrary:=true;
@@ -813,7 +815,7 @@ begin
        end;
      DLL_PROCESS_DETACH :
        begin
-         Lib_Exit;
+         Fpc_Lib_Exit_intern;
          if assigned(Dll_Process_Detach_Hook) then
            Dll_Process_Detach_Hook(DllParam);
        end;

+ 1 - 0
tests/webtbs/tw2983.pp

@@ -1,4 +1,5 @@
 {$mode objfpc}
+{$modeswitch arraytodynarray}
 type
   ta1 = array[0..10] of longint;
 var

Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff