Browse Source

* -Se<x> option extended to increase errorcount for
warning,notes or hints

peter 25 năm trước cách đây
mục cha
commit
d9cef95ac7
3 tập tin đã thay đổi với 113 bổ sung42 xóa
  1. 8 1
      compiler/comphook.pas
  2. 7 9
      compiler/options.pas
  3. 98 32
      compiler/verbose.pas

+ 8 - 1
compiler/comphook.pas

@@ -62,6 +62,9 @@ type
   { Settings for the output }
     verbosity     : longint;
     maxerrorcount : longint;
+    errorwarning,
+    errornote,
+    errorhint,
     skip_error,
     use_stderr,
     use_redir,
@@ -295,7 +298,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.21  2000-02-09 13:22:50  peter
+  Revision 1.22  2000-05-10 13:40:19  peter
+    * -Se<x> option extended to increase errorcount for
+      warning,notes or hints
+
+  Revision 1.21  2000/02/09 13:22:50  peter
     * log truncated
 
   Revision 1.20  2000/01/07 01:14:23  peter

+ 7 - 9
compiler/options.pas

@@ -700,14 +700,8 @@ begin
                         'c' : initmoduleswitches:=initmoduleswitches+[cs_support_c_operators];
                         'd' : initmodeswitches:=delphimodeswitches;
                         'e' : begin
-                                val(copy(more,j+1,length(more)-j),l,code);
-                                if (code<>0) then
-                                 SetMaxErrorCount(1)
-                                else
-                                 begin
-                                   SetMaxErrorCount(l);
-                                   break;
-                                 end;
+                                SetErrorFlags(more);
+                                break;
                               end;
                         'g' : initmoduleswitches:=initmoduleswitches+[cs_support_goto];
                         'h' : initlocalswitches:=initlocalswitches+[cs_ansistrings];
@@ -1451,7 +1445,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.66  2000-04-24 13:34:29  peter
+  Revision 1.67  2000-05-10 13:40:19  peter
+    * -Se<x> option extended to increase errorcount for
+      warning,notes or hints
+
+  Revision 1.66  2000/04/24 13:34:29  peter
     * added enhancedraise define
 
   Revision 1.65  2000/04/10 11:36:19  pierre

+ 98 - 32
compiler/verbose.pas

@@ -71,7 +71,7 @@ procedure LoadMsgFile(const fn:string);
 procedure Stop;
 procedure ShowStatus;
 function  ErrorCount:longint;
-procedure SetMaxErrorCount(count:longint);
+procedure SetErrorFlags(const s:string);
 procedure GenerateError;
 procedure Internalerror(i:longint);
 procedure Comment(l:longint;s:string);
@@ -313,9 +313,41 @@ begin
 end;
 
 
-procedure SetMaxErrorCount(count:longint);
+procedure SetErrorFlags(const s:string);
+var
+  code : word;
+  i,j,l : longint;
 begin
-  status.maxerrorcount:=count;
+{ empty string means error count = 1 for backward compatibility (PFV) }
+  if s='' then
+   begin
+     status.maxerrorcount:=1;
+     exit;
+   end;
+  i:=0;
+  while (i<length(s)) do
+   begin
+     inc(i);
+     case s[i] of
+       '0'..'9' :
+          begin
+            j:=i;
+            while (j<=length(s)) and (s[j] in ['0'..'9']) do
+             inc(j);
+            val(copy(s,i,j-i),l,code);
+            if code<>0 then
+             l:=1;
+            status.maxerrorcount:=l;
+            i:=j;
+          end;
+        'w','W' :
+          status.errorwarning:=true;
+        'n','N' :
+          status.errornote:=true;
+        'h','H' :
+          status.errorhint:=true;
+     end;
+   end;
 end;
 
 
@@ -339,7 +371,10 @@ var
   dostop : boolean;
 begin
   dostop:=((l and V_Fatal)<>0);
-  if (l and V_Error)<>0 then
+  if ((l and V_Error)<>0) or
+     (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);
 { Create status info }
   UpdateStatus;
@@ -375,34 +410,61 @@ begin
       for i:=1 to idx do
        begin
          case upcase(s[i]) of
-          'F' : begin
-                  v:=v or V_Fatal;
-                  inc(status.errorcount);
-                  dostop:=true;
-                end;
-          'E' : begin
-                  v:=v or V_Error;
-                  inc(status.errorcount);
-                end;
-          'O' : v:=v or V_Normal;
-
+          'F' :
+            begin
+              v:=v or V_Fatal;
+              inc(status.errorcount);
+              dostop:=true;
+            end;
+          'E' :
+            begin
+              v:=v or V_Error;
+              inc(status.errorcount);
+            end;
+          'O' :
+            v:=v or V_Normal;
           'W':
-            v:=v or V_Warning;
-
-          'N' : v:=v or V_Note;
-          'H' : v:=v or V_Hint;
-          'I' : v:=v or V_Info;
-          'L' : v:=v or V_Status;
-          'U' : v:=v or V_Used;
-          'T' : v:=v or V_Tried;
-          'M' : v:=v or V_Macro;
-          'P' : v:=v or V_Procedure;
-          'C' : v:=v or V_Conditional;
-          'D' : v:=v or V_Debug;
-          'B' : v:=v or V_Declarations;
-          'X' : v:=v or V_Executable;
-          'Z' : v:=v or V_Assem;
-          'S' : dostop:=true;
+            begin
+              v:=v or V_Warning;
+              if status.errorwarning then
+               inc(status.errorcount);
+            end;
+          'N' :
+            begin
+              v:=v or V_Note;
+              if status.errornote then
+               inc(status.errorcount);
+            end;
+          'H' :
+            begin
+              v:=v or V_Hint;
+              if status.errorhint then
+               inc(status.errorcount);
+            end;
+          'I' :
+            v:=v or V_Info;
+          'L' :
+            v:=v or V_Status;
+          'U' :
+            v:=v or V_Used;
+          'T' :
+            v:=v or V_Tried;
+          'M' :
+            v:=v or V_Macro;
+          'P' :
+            v:=v or V_Procedure;
+          'C' :
+            v:=v or V_Conditional;
+          'D' :
+            v:=v or V_Debug;
+          'B' :
+            v:=v or V_Declarations;
+          'X' :
+            v:=v or V_Executable;
+          'Z' :
+            v:=v or V_Assem;
+          'S' :
+            dostop:=true;
           '_' : ;
          end;
        end;
@@ -518,7 +580,11 @@ end.
 
 {
   $Log$
-  Revision 1.50  2000-04-01 10:46:29  hajny
+  Revision 1.51  2000-05-10 13:40:19  peter
+    * -Se<x> option extended to increase errorcount for
+      warning,notes or hints
+
+  Revision 1.50  2000/04/01 10:46:29  hajny
     * logfile appended if exists
 
   Revision 1.49  2000/03/12 08:24:45  daniel