diff --git a/compiler/cgobj.pas b/compiler/cgobj.pas index afb57e5bb3..eaa22cebcb 100644 --- a/compiler/cgobj.pas +++ b/compiler/cgobj.pas @@ -1095,7 +1095,7 @@ unit cgobj; begin {$ifdef FPC} {$warning FIX ME!} -{$endif} +{$endif} a_paramaddr_ref(list,dest,paramanager.getintparaloc(3)); if loadref then a_param_ref(list,OS_ADDR,source,paramanager.getintparaloc(2)) @@ -1408,7 +1408,8 @@ unit cgobj; begin if is_class(procinfo._class) then begin - procinfo.flags:=procinfo.flags or pi_needs_implicit_finally; + if (cs_implicit_exceptions in aktmoduleswitches) then + procinfo.flags:=procinfo.flags or pi_needs_implicit_finally; { parameter 2 : self pointer / flag } {!! this is a terrible hack, normally the helper should get three params : } { one with self register, one with flag and one with VMT pointer } @@ -1603,7 +1604,12 @@ finalization end. { $Log$ - Revision 1.61 2002-10-05 12:43:23 carl + Revision 1.62 2002-10-16 19:01:43 peter + + $IMPLICITEXCEPTIONS switch to turn on/off generation of the + implicit exception frames for procedures with initialized variables + and for constructors. The default is on for compatibility + + Revision 1.61 2002/10/05 12:43:23 carl * fixes for Delphi 6 compilation (warning : Some features do not work under Delphi) diff --git a/compiler/fpcdefs.inc b/compiler/fpcdefs.inc index 878fef91c7..b346236186 100644 --- a/compiler/fpcdefs.inc +++ b/compiler/fpcdefs.inc @@ -10,6 +10,12 @@ { This reduces the memory requirements a lot } {$PACKENUM 1} + { We don't use exceptions, so turn off the implicit + exceptions in the constructors } + {$ifndef VER1_0} + {$IMPLICITEXCEPTIONS OFF} + {$endif VER1_0} + {$define FPCPROCVAR} {$ifdef I386} {$define USEEXCEPT} @@ -48,7 +54,12 @@ {$endif alpha} { $Log$ - Revision 1.12 2002-10-05 12:43:24 carl + Revision 1.13 2002-10-16 19:01:43 peter + + $IMPLICITEXCEPTIONS switch to turn on/off generation of the + implicit exception frames for procedures with initialized variables + and for constructors. The default is on for compatibility + + Revision 1.12 2002/10/05 12:43:24 carl * fixes for Delphi 6 compilation (warning : Some features do not work under Delphi) diff --git a/compiler/globals.pas b/compiler/globals.pas index 314f624d94..67b8891771 100644 --- a/compiler/globals.pas +++ b/compiler/globals.pas @@ -1418,7 +1418,7 @@ implementation { Init values } initmodeswitches:=fpcmodeswitches; initlocalswitches:=[cs_check_io,cs_typed_const_writable]; - initmoduleswitches:=[cs_extsyntax,cs_browser]; + initmoduleswitches:=[cs_extsyntax,cs_browser,cs_implicit_exceptions]; initsourcecodepage:='8859-1'; initglobalswitches:=[cs_check_unit_name,cs_link_static{$ifdef INTERNALLINKER},cs_link_internal,cs_link_map{$endif}]; initoutputformat:=target_asm.id; @@ -1477,7 +1477,12 @@ begin end. { $Log$ - Revision 1.66 2002-09-05 19:28:29 peter + Revision 1.67 2002-10-16 19:01:43 peter + + $IMPLICITEXCEPTIONS switch to turn on/off generation of the + implicit exception frames for procedures with initialized variables + and for constructors. The default is on for compatibility + + Revision 1.66 2002/09/05 19:28:29 peter * removed repetitive pass counting * display heapsize also for extdebug diff --git a/compiler/globtype.pas b/compiler/globtype.pas index 3a3daf6f23..ca3c9037d2 100644 --- a/compiler/globtype.pas +++ b/compiler/globtype.pas @@ -53,7 +53,7 @@ interface cs_support_c_operators,cs_static_keyword, { generation } cs_profile,cs_debuginfo,cs_browser,cs_local_browser,cs_compilesystem, - cs_lineinfo,cs_threading, + cs_lineinfo,cs_threading,cs_implicit_exceptions, { linking } cs_create_smart,cs_create_dynamic,cs_create_pic ); @@ -211,7 +211,12 @@ implementation end. { $Log$ - Revision 1.33 2002-10-14 19:43:41 peter + Revision 1.34 2002-10-16 19:01:43 peter + + $IMPLICITEXCEPTIONS switch to turn on/off generation of the + implicit exception frames for procedures with initialized variables + and for constructors. The default is on for compatibility + + Revision 1.33 2002/10/14 19:43:41 peter * threading switch, defines the symbol FPC_THREADING Revision 1.32 2002/10/05 12:43:24 carl diff --git a/compiler/ncgutil.pas b/compiler/ncgutil.pas index 701dd220eb..1f49d42b73 100644 --- a/compiler/ncgutil.pas +++ b/compiler/ncgutil.pas @@ -935,7 +935,8 @@ implementation not(is_class(tvarsym(p).vartype.def)) and tvarsym(p).vartype.def.needs_inittable then begin - if assigned(procinfo) then + if assigned(procinfo) and + (cs_implicit_exceptions in aktmoduleswitches) then procinfo.flags:=procinfo.flags or pi_needs_implicit_finally; if tsym(p).owner.symtabletype in [localsymtable,inlinelocalsymtable] then reference_reset_base(href,procinfo.framepointer,-tvarsym(p).address+tvarsym(p).owner.address_fixup) @@ -997,7 +998,8 @@ implementation case tvarsym(p).varspez of vs_value : begin - procinfo.flags:=procinfo.flags or pi_needs_implicit_finally; + if (cs_implicit_exceptions in aktmoduleswitches) then + procinfo.flags:=procinfo.flags or pi_needs_implicit_finally; if assigned(tvarsym(p).localvarsym) then reference_reset_base(href,procinfo.framepointer, -tvarsym(p).localvarsym.address+tvarsym(p).localvarsym.owner.address_fixup) @@ -1055,7 +1057,8 @@ implementation tt_widestring,tt_freewidestring, tt_interfacecom,tt_freeinterfacecom] then begin - procinfo.flags:=procinfo.flags or pi_needs_implicit_finally; + if (cs_implicit_exceptions in aktmoduleswitches) then + procinfo.flags:=procinfo.flags or pi_needs_implicit_finally; reference_reset_base(href,procinfo.framepointer,hp^.pos); cg.a_load_const_ref(list,OS_ADDR,0,href); end; @@ -1273,7 +1276,8 @@ implementation { initialize return value } if (aktprocdef.rettype.def.needs_inittable) then begin - procinfo.flags:=procinfo.flags or pi_needs_implicit_finally; + if (cs_implicit_exceptions in aktmoduleswitches) then + procinfo.flags:=procinfo.flags or pi_needs_implicit_finally; reference_reset_base(href,procinfo.framepointer,procinfo.return_offset); cg.g_initialize(list,aktprocdef.rettype.def,href,paramanager.ret_in_param(aktprocdef.rettype.def)); end; @@ -1842,7 +1846,12 @@ implementation end. { $Log$ - Revision 1.55 2002-10-14 19:42:33 peter + Revision 1.56 2002-10-16 19:01:43 peter + + $IMPLICITEXCEPTIONS switch to turn on/off generation of the + implicit exception frames for procedures with initialized variables + and for constructors. The default is on for compatibility + + Revision 1.55 2002/10/14 19:42:33 peter * only use init tables for threadvars Revision 1.54 2002/10/06 19:41:30 peter diff --git a/compiler/scandir.pas b/compiler/scandir.pas index 5a72c64ead..7ebdb8a2ad 100644 --- a/compiler/scandir.pas +++ b/compiler/scandir.pas @@ -295,6 +295,11 @@ implementation do_setverbose('H'); end; + procedure dir_implicitexceptions; + begin + do_moduleswitch(cs_implicit_exceptions); + end; + procedure dir_includepath; begin if not current_module.in_global then @@ -901,6 +906,7 @@ implementation AddDirective('HINT',{$ifdef FPCPROCVAR}@{$endif}dir_hint); AddDirective('HINTS',{$ifdef FPCPROCVAR}@{$endif}dir_hints); AddDirective('IOCHECKS',{$ifdef FPCPROCVAR}@{$endif}dir_iochecks); + AddDirective('IMPLICITEXCEPTIONS',{$ifdef FPCPROCVAR}@{$endif}dir_implicitexceptions); AddDirective('INCLUDEPATH',{$ifdef FPCPROCVAR}@{$endif}dir_includepath); AddDirective('INFO',{$ifdef FPCPROCVAR}@{$endif}dir_info); AddDirective('INLINE',{$ifdef FPCPROCVAR}@{$endif}dir_inline); @@ -960,7 +966,12 @@ implementation end. { $Log$ - Revision 1.20 2002-10-14 19:43:41 peter + Revision 1.21 2002-10-16 19:01:43 peter + + $IMPLICITEXCEPTIONS switch to turn on/off generation of the + implicit exception frames for procedures with initialized variables + and for constructors. The default is on for compatibility + + Revision 1.20 2002/10/14 19:43:41 peter * threading switch, defines the symbol FPC_THREADING Revision 1.19 2002/08/13 18:01:52 carl diff --git a/compiler/x86/cgx86.pas b/compiler/x86/cgx86.pas index 531ed7162b..c2925c827a 100644 --- a/compiler/x86/cgx86.pas +++ b/compiler/x86/cgx86.pas @@ -1532,7 +1532,8 @@ unit cgx86; begin if is_class(procinfo._class) then begin - procinfo.flags:=procinfo.flags or pi_needs_implicit_finally; + if (cs_implicit_exceptions in aktmoduleswitches) then + procinfo.flags:=procinfo.flags or pi_needs_implicit_finally; a_call_name(list,'FPC_NEW_CLASS'); list.concat(Taicpu.Op_cond_sym(A_Jcc,C_Z,S_NO,faillabel)); end @@ -1681,7 +1682,12 @@ unit cgx86; end. { $Log$ - Revision 1.18 2002-10-05 12:43:30 carl + Revision 1.19 2002-10-16 19:01:43 peter + + $IMPLICITEXCEPTIONS switch to turn on/off generation of the + implicit exception frames for procedures with initialized variables + and for constructors. The default is on for compatibility + + Revision 1.18 2002/10/05 12:43:30 carl * fixes for Delphi 6 compilation (warning : Some features do not work under Delphi)