From f34e2067eb09c1f5dd6e5b7bf98125924265b24f Mon Sep 17 00:00:00 2001 From: peter Date: Sun, 9 May 1999 11:38:04 +0000 Subject: [PATCH] * don't write .o and link if errors occure during assembling --- compiler/ag386bin.pas | 15 ++++++++------- compiler/og386cff.pas | 9 +++++++-- compiler/owar.pas | 9 +++++++-- compiler/owbase.pas | 22 ++++++++++++++++++++-- compiler/pmodules.pas | 23 +++++++++++++++++++++-- 5 files changed, 63 insertions(+), 15 deletions(-) diff --git a/compiler/ag386bin.pas b/compiler/ag386bin.pas index 12689c9f18..8201ffb8ae 100644 --- a/compiler/ag386bin.pas +++ b/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 diff --git a/compiler/og386cff.pas b/compiler/og386cff.pas index f1f8e563e2..0f2bf0a18d 100644 --- a/compiler/og386cff.pas +++ b/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 diff --git a/compiler/owar.pas b/compiler/owar.pas index 2c3d8bcf1f..fbd42d0b84 100644 --- a/compiler/owar.pas +++ b/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 diff --git a/compiler/owbase.pas b/compiler/owbase.pas index 428c38b1c2..8708cb12a8 100644 --- a/compiler/owbase.pas +++ b/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 -} \ No newline at end of file +} diff --git a/compiler/pmodules.pas b/compiler/pmodules.pas index 1d3fd4fa98..2066857fdd 100644 --- a/compiler/pmodules.pas +++ b/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