소스 검색

* don't allow duplicate uses
* fix wrong circular dependency

peter 21 년 전
부모
커밋
fa52c0e3a0
2개의 변경된 파일20개의 추가작업 그리고 8개의 파일을 삭제
  1. 7 2
      compiler/fmodule.pas
  2. 13 6
      compiler/pmodules.pas

+ 7 - 2
compiler/fmodule.pas

@@ -559,6 +559,7 @@ implementation
         linkothersharedlibs:=TLinkContainer.Create;
         uses_imports:=false;
         do_compile:=false;
+        do_reload:=false;
         interface_compiled:=false;
         in_interface:=true;
         in_global:=true;
@@ -570,8 +571,8 @@ implementation
           The following fields should not
           be reset:
            mainsource
-           loaded_from
            state
+           loaded_from
            sources_avail
         }
       end;
@@ -691,7 +692,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.42  2003-11-23 17:23:49  peter
+  Revision 1.43  2003-12-08 22:33:43  peter
+    * don't allow duplicate uses
+    * fix wrong circular dependency
+
+  Revision 1.42  2003/11/23 17:23:49  peter
     * fixed memleak with derefdata
 
   Revision 1.41  2003/10/23 14:44:07  peter

+ 13 - 6
compiler/pmodules.pas

@@ -511,9 +511,10 @@ implementation
                   end;
                  pu:=tused_unit(pu.next);
                end;
-              { Need to register the unit? }
               if not assigned(hp2) then
-                hp2:=registerunit(current_module,sorg,fn);
+                hp2:=registerunit(current_module,sorg,fn)
+              else
+                Message1(sym_e_duplicate_id,s);
               { Create unitsym, we need to use the name as specified, we
                 can not use the modulename because that can be different
                 when -Un is used }
@@ -929,17 +930,19 @@ implementation
          write_gdb_info;
 {$endIf Def New_GDB}
 
+         { Our interface is compiled, generate CRC and switch to implementation }
          if not(cs_compilesystem in aktmoduleswitches) and
             (Errorcount=0) then
            tppumodule(current_module).getppucrc;
+         current_module.in_interface:=false;
+         current_module.interface_compiled:=true;
 
-         { we have a new interface loaded, reload all flagged units }
+         { First reload all units depending on our interface, we need to do this
+           in the implementation part to prevent errorneous circular references }
          reload_flagged_units;
 
          { Parse the implementation section }
          consume(_IMPLEMENTATION);
-         current_module.in_interface:=false;
-         current_module.interface_compiled:=true;
 
          Message1(unit_u_loading_implementation_units,current_module.modulename^);
 
@@ -1422,7 +1425,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.133  2003-11-29 20:13:25  florian
+  Revision 1.134  2003-12-08 22:33:43  peter
+    * don't allow duplicate uses
+    * fix wrong circular dependency
+
+  Revision 1.133  2003/11/29 20:13:25  florian
     * fixed several pi_do_call problems
 
   Revision 1.132  2003/10/29 19:48:51  peter