Browse Source

+ -CR option to enable check for object virtual method

pierre 25 years ago
parent
commit
536829e4bc
3 changed files with 29 additions and 15 deletions
  1. 11 11
      compiler/cg386cal.pas
  2. 6 3
      compiler/globtype.pas
  3. 12 1
      compiler/options.pas

+ 11 - 11
compiler/cg386cal.pas

@@ -876,21 +876,18 @@ implementation
                    if pprocdef(p^.procdefinition)^.extnumber=-1 then
                      internalerror(44584);
                    r^.offset:=pprocdef(p^.procdefinition)^._class^.vmtmethodoffset(pprocdef(p^.procdefinition)^.extnumber);
-{$ifndef TESTOBJEXT}
-                   if (cs_check_range in aktlocalswitches) then
-                     begin
-                        emit_reg(A_PUSH,S_L,r^.base);
-                        emitcall('FPC_CHECK_OBJECT');
-                     end;
-{$else TESTOBJEXT}
-                   if (cs_check_range in aktlocalswitches) then
+                   if (cs_check_object_ext in aktlocalswitches) then
                      begin
                         emit_sym(A_PUSH,S_L,
                           newasmsymbol(pprocdef(p^.procdefinition)^._class^.vmt_mangledname));
                         emit_reg(A_PUSH,S_L,r^.base);
                         emitcall('FPC_CHECK_OBJECT_EXT');
+                     end
+                   else if (cs_check_range in aktlocalswitches) then
+                     begin
+                        emit_reg(A_PUSH,S_L,r^.base);
+                        emitcall('FPC_CHECK_OBJECT');
                      end;
-{$endif TESTOBJEXT}
                    emit_ref(A_CALL,S_NO,r);
 {$ifndef noAllocEdi}
                    ungetregister32(R_EDI);
@@ -1429,7 +1426,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.133  2000-05-15 19:30:27  peter
+  Revision 1.134  2000-05-16 20:19:05  pierre
+    + -CR option to enable check for object virtual method
+
+  Revision 1.133  2000/05/15 19:30:27  peter
     * fixed calling of inherited methods from destructors
 
   Revision 1.132  2000/05/09 14:15:03  pierre
@@ -1540,4 +1540,4 @@ end.
       needs some corections regarding register saving
     * gettempansistring is again a procedure
 
-}
+}

+ 6 - 3
compiler/globtype.pas

@@ -60,7 +60,8 @@ interface
        { Switches which can be changed locally }
        tlocalswitch = (cs_localnone,
          { codegen }
-         cs_check_overflow,cs_check_range,cs_check_io,cs_check_stack,
+         cs_check_overflow,cs_check_range,cs_check_object_ext,
+         cs_check_io,cs_check_stack,
          cs_omitstackframe,cs_do_assertion,cs_generate_rtti,
          { mmx }
          cs_mmx,cs_mmx_saturation,
@@ -198,7 +199,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.29  2000-02-28 17:23:57  daniel
+  Revision 1.30  2000-05-16 20:19:05  pierre
+    + -CR option to enable check for object virtual method
+
+  Revision 1.29  2000/02/28 17:23:57  daniel
   * Current work of symtable integration committed. The symtable can be
     activated by defining 'newst', but doesn't compile yet. Changes in type
     checking and oop are completed. What is left is to write a new
@@ -262,4 +266,3 @@ end.
     * PPU version increased to solve .12 <-> .13 probs
 
 }
-

+ 12 - 1
compiler/options.pas

@@ -457,6 +457,14 @@ begin
                                 End
                               Else
                                 initlocalswitches:=initlocalswitches+[cs_check_range];
+                            'R' :
+                              If UnsetBool(More, j) then
+                                Begin
+                                  initlocalswitches:=initlocalswitches-[cs_check_object_ext];
+                                  inc(j);
+                                End
+                              Else
+                                initlocalswitches:=initlocalswitches+[cs_check_object_ext];
                             's' :
                                begin
                                  val(copy(more,j+1,length(more)-j),stacksize,code);
@@ -1445,7 +1453,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.67  2000-05-10 13:40:19  peter
+  Revision 1.68  2000-05-16 20:19:06  pierre
+    + -CR option to enable check for object virtual method
+
+  Revision 1.67  2000/05/10 13:40:19  peter
     * -Se<x> option extended to increase errorcount for
       warning,notes or hints