فهرست منبع

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

peter 23 سال پیش
والد
کامیت
83dae76625
7فایلهای تغییر یافته به همراه69 افزوده شده و 16 حذف شده
  1. 9 3
      compiler/cgobj.pas
  2. 12 1
      compiler/fpcdefs.inc
  3. 7 2
      compiler/globals.pas
  4. 7 2
      compiler/globtype.pas
  5. 14 5
      compiler/ncgutil.pas
  6. 12 1
      compiler/scandir.pas
  7. 8 2
      compiler/x86/cgx86.pas

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

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

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

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

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

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

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