Browse Source

On preproc errors, show preprocessor output so far.

Martijn Laan 5 năm trước cách đây
mục cha
commit
ad20849af5

+ 3 - 5
Projects/Compile.pas

@@ -1158,17 +1158,16 @@ begin
   end;
   end;
 
 
   try
   try
+    Output := TStringList.Create;
     IncludeStack := nil;
     IncludeStack := nil;
-    Output := nil;
     try
     try
       IncludeStack := TStringList.Create;
       IncludeStack := TStringList.Create;
-      Output := TStringList.Create;
       ProcessLines(Params.Filename, 0);
       ProcessLines(Params.Filename, 0);
+    finally
       LastBuiltinPreprocOutput := Output.Text;
       LastBuiltinPreprocOutput := Output.Text;
       Params.PreprocOutput := PChar(LastBuiltinPreprocOutput);
       Params.PreprocOutput := PChar(LastBuiltinPreprocOutput);
-    finally
-      Output.Free;
       IncludeStack.Free;
       IncludeStack.Free;
+      Output.Free;
     end;
     end;
     Result := ispeSuccess;
     Result := ispeSuccess;
   except
   except
@@ -9246,7 +9245,6 @@ function ISCompileScript(const Params: TCompileScriptParamsEx;
 var
 var
   SetupCompiler: TSetupCompiler;
   SetupCompiler: TSetupCompiler;
   P: PChar;
   P: PChar;
-  Data: TCompilerCallbackData;
   P2: Integer;
   P2: Integer;
 begin
 begin
   if not CheckParams(Params) then begin
   if not CheckParams(Params) then begin

+ 2 - 2
Projects/ISPP/IsppPreprocess.pas

@@ -275,11 +275,11 @@ begin
         while Preprocessor.GetNext(LineFilename, LineNumber, LineText) do
         while Preprocessor.GetNext(LineFilename, LineNumber, LineText) do
           Params.LineOutProc(Params.CompilerData, PChar(LineFilename),
           Params.LineOutProc(Params.CompilerData, PChar(LineFilename),
             LineNumber, PChar(LineText));
             LineNumber, PChar(LineText));
-        LastPreprocOutput := Preprocessor.GetAll;
-        Params.PreprocOutput := PChar(LastPreprocOutput);
         Result := ispeSuccess;
         Result := ispeSuccess;
       end;
       end;
     finally
     finally
+      LastPreprocOutput := Preprocessor.GetAll;
+      Params.PreprocOutput := PChar(LastPreprocOutput);
       Preprocessor.Free;
       Preprocessor.Free;
     end;
     end;
   except
   except