Sfoglia il codice sorgente

Increase status.errorcount only inside GenerateError procedure, to simplify debugging

git-svn-id: trunk@23398 -
pierre 12 anni fa
parent
commit
6d8b1e03d7
3 ha cambiato i file con 14 aggiunte e 10 eliminazioni
  1. 4 1
      compiler/comphook.pas
  2. 3 2
      compiler/parser.pas
  3. 7 7
      compiler/verbose.pas

+ 4 - 1
compiler/comphook.pas

@@ -79,7 +79,10 @@ type
     currentmodulestate : string[20];
   { Total Status }
     compiledlines : longint;  { the number of lines which are compiled }
-    errorcount,
+    errorcount,               { this field should never be increased directly,
+                                use Verbose.GenerateError procedure to do this,
+                                this allows easier error catching using GDB by
+                                adding a single breakpoint at this procedure }
     countWarnings,
     countNotes,
     countHints    : longint;  { number of found errors/warnings/notes/hints }

+ 3 - 2
compiler/parser.pas

@@ -359,8 +359,9 @@ implementation
              on Exception do
                begin
                  { Increase errorcounter to prevent some
-                   checks during cleanup }
-                 inc(status.errorcount);
+                   checks during cleanup,
+                   but use GenerateError procedure for this. }
+                 GenerateError;
                  raise;
                end;
            end;

+ 7 - 7
compiler/verbose.pas

@@ -569,7 +569,7 @@ implementation
       begin
         UpdateStatus;
         do_internalerror(i);
-        inc(status.errorcount);
+        GenerateError;
         raise ECompilerAbort.Create;
       end;
 
@@ -584,7 +584,7 @@ implementation
            (status.errorwarning and ((l and V_Warning)<>0)) or
            (status.errornote and ((l and V_Note)<>0)) or
            (status.errorhint and ((l and V_Hint)<>0)) then
-         inc(status.errorcount)
+         GenerateError
         else
          if l and V_Warning <> 0 then
           inc(status.countWarnings)
@@ -652,7 +652,7 @@ implementation
                 'F' :
                   begin
                     v:=v or V_Fatal;
-                    inc(status.errorcount);
+                    GenerateError;
                     dostop:=true;
                   end;
                 'E','W','N','H':
@@ -666,7 +666,7 @@ implementation
                     if st=ms_error then
                       begin
                         v:=v or V_Error;
-                        inc(status.errorcount);
+                        GenerateError;
                       end
                     else if st<>ms_off then
                       case ch of
@@ -675,7 +675,7 @@ implementation
                            v:=v or V_Warning;
                            if CheckVerbosity(V_Warning) then
                              if status.errorwarning then
-                              inc(status.errorcount)
+                              GenerateError
                              else
                               inc(status.countWarnings);
                          end;
@@ -684,7 +684,7 @@ implementation
                            v:=v or V_Note;
                            if CheckVerbosity(V_Note) then
                              if status.errornote then
-                              inc(status.errorcount)
+                              GenerateError
                              else
                               inc(status.countNotes);
                          end;
@@ -693,7 +693,7 @@ implementation
                            v:=v or V_Hint;
                            if CheckVerbosity(V_Hint) then
                              if status.errorhint then
-                              inc(status.errorcount)
+                              GenerateError
                              else
                               inc(status.countHints);
                          end;