2
0
Эх сурвалжийг харах

* don't write .o and link if errors occure during assembling

peter 26 жил өмнө
parent
commit
f34e2067eb

+ 8 - 7
compiler/ag386bin.pas

@@ -699,7 +699,7 @@ unit ag386bin;
 
     procedure ti386binasmlist.writetree(p:paasmoutput);
       var
-        hp : pai;
+        hp,hp1 : pai;
       begin
         if not assigned(p) then
          exit;
@@ -713,7 +713,8 @@ unit ag386bin;
 {$ifdef GDB}
            StartFileLineInfo;
 {$endif GDB}
-           TreePass1(hp);
+           hp1:=TreePass1(hp);
+
          { set section sizes }
            objectoutput^.setsectionsizes(objectalloc^.secsize);
          { Pass 2 }
@@ -721,8 +722,10 @@ unit ag386bin;
 {$ifdef GDB}
            StartFileLineInfo;
 {$endif GDB}
-           hp:=TreePass2(hp);
+           hp1:=TreePass2(hp);
+
          { if assigned then we have a ait_cut }
+           hp:=hp1;
            if assigned(hp) then
             begin
               if hp^.typ<>ait_cut then
@@ -827,10 +830,8 @@ unit ag386bin;
 end.
 {
   $Log$
-  Revision 1.7  1999-05-08 19:52:32  peter
-    + MessagePos() which is enhanced Message() function but also gets the
-      position info
-    * Removed comp warnings
+  Revision 1.8  1999-05-09 11:38:04  peter
+    * don't write .o and link if errors occure during assembling
 
   Revision 1.6  1999/05/07 00:36:58  pierre
     * added alignment code for .bss

+ 7 - 2
compiler/og386cff.pas

@@ -357,7 +357,9 @@ unit og386cff;
       var
         sec : tsection;
       begin
-        writetodisk;
+        { Only write the .o if there are no errors }
+        if errorcount=0 then
+          writetodisk;
         dispose(syms,done);
         dispose(strs,done);
         for sec:=low(tsection) to high(tsection) do
@@ -900,7 +902,10 @@ unit og386cff;
 end.
 {
   $Log$
-  Revision 1.4  1999-05-07 00:36:57  pierre
+  Revision 1.5  1999-05-09 11:38:05  peter
+    * don't write .o and link if errors occure during assembling
+
+  Revision 1.4  1999/05/07 00:36:57  pierre
     * added alignment code for .bss
     * stabs correct but externalbss disabled
       would need a special treatment in writestabs

+ 7 - 2
compiler/owar.pas

@@ -64,6 +64,7 @@ type
 implementation
 
 uses
+   verbose,
 {$ifdef Delphi}
    dmisc,
 {$endif Delphi}
@@ -138,7 +139,8 @@ end;
 
 destructor tarobjectwriter.done;
 begin
-  writear;
+  if Errorcount=0 then
+   writear;
   dispose(arData,done);
   dispose(symreloc,done);
   dispose(symstr,done);
@@ -276,7 +278,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.2  1999-05-04 21:44:53  florian
+  Revision 1.3  1999-05-09 11:38:06  peter
+    * don't write .o and link if errors occure during assembling
+
+  Revision 1.2  1999/05/04 21:44:53  florian
     * changes to compile it with Delphi 4.0
 
   Revision 1.1  1999/05/01 13:24:26  peter

+ 20 - 2
compiler/owbase.pas

@@ -37,6 +37,7 @@ type
     opened : boolean;
     buf    : pchar;
     bufidx : longint;
+    size   : longint;
     procedure writebuf;
   end;
 
@@ -56,6 +57,7 @@ begin
   getmem(buf,bufsize);
   bufidx:=0;
   opened:=false;
+  size:=0;
 end;
 
 
@@ -76,16 +78,28 @@ begin
   if ioresult<>0 then
    exit;
   bufidx:=0;
+  size:=0;
   opened:=true;
 end;
 
 
 procedure tobjectwriter.close;
+var
+  i : longint;
 begin
   if bufidx>0 then
    writebuf;
   system.close(f);
+{ Remove if size is 0 }
+  if size=0 then
+   begin
+     {$I-}
+      system.erase(f);
+     {$I+}
+     i:=ioresult;
+   end;
   opened:=false;
+  size:=0;
 end;
 
 
@@ -107,6 +121,7 @@ var
   left,
   idx : longint;
 begin
+  inc(size,len);
   p:=pchar(@b);
   idx:=0;
   while len>0 do
@@ -133,7 +148,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.1  1999-05-01 13:24:26  peter
+  Revision 1.2  1999-05-09 11:38:07  peter
+    * don't write .o and link if errors occure during assembling
+
+  Revision 1.1  1999/05/01 13:24:26  peter
     * merged nasm compiler
     * old asm moved to oldasm/
 
@@ -143,4 +161,4 @@ end.
   Revision 1.1  1999/03/08 14:51:11  peter
     + smartlinking for ag386bin
 
-}
+}

+ 21 - 2
compiler/pmodules.pas

@@ -63,7 +63,7 @@ unit pmodules;
           Linker.MakeSharedLibrary
         else
           if (cs_create_staticlib in aktmoduleswitches) or
-	     ((cs_smartlink in aktmoduleswitches) and target_asm.needar) then
+             ((cs_smartlink in aktmoduleswitches) and target_asm.needar) then
             Linker.MakeStaticLibrary(SmartLinkFilesCnt);
       end;
 
@@ -1186,6 +1186,14 @@ unit pmodules;
           { assemble }
             create_objectfile;
           end;
+
+         { leave when we got an error }
+         if (Errorcount>0) and not status.skip_error then
+          begin
+            Message1(unit_f_errors_in_unit,tostr(Errorcount));
+            status.skip_error:=true;
+            exit;
+          end;
       end;
 
 
@@ -1334,6 +1342,14 @@ unit pmodules;
          { assemble and link }
          create_objectfile;
 
+         { leave when we got an error }
+         if (Errorcount>0) and not status.skip_error then
+          begin
+            Message1(unit_f_errors_in_unit,tostr(Errorcount));
+            status.skip_error:=true;
+            exit;
+          end;
+
          { create the executable when we are at level 1 }
          if (compile_level=1) then
           begin
@@ -1356,7 +1372,10 @@ unit pmodules;
 end.
 {
   $Log$
-  Revision 1.118  1999-05-03 18:03:28  peter
+  Revision 1.119  1999-05-09 11:38:08  peter
+    * don't write .o and link if errors occure during assembling
+
+  Revision 1.118  1999/05/03 18:03:28  peter
     * no ar.exe running field in target_asm
 
   Revision 1.117  1999/05/01 13:24:32  peter