On Mon, Sep 29, 2008 at 11:49:29AM +0200, Jonas Maebe wrote:

>
> On 29 Sep 2008, at 11:41, Paul Ishenin wrote:
>
>> Jonas Maebe ??????????:
>>> That's just a hack, and you have to regenerate the message file for every 
>>> new FPC release.
>>
>> Ofcource, but what can we do simple fpc users ;)
>
> Submit a patch. The message handling code really isn't rocket science. It's 
> pretty much all in compiler/verbose.pas
In the attachment is a little patch. With cmdline option -vm05024,05025
you can suppress messages with idx 05024 and 05025.

But I'am not sure if really realized msgtxt.inc rocket science :). That is why 
I do not
change fpc help message in the patch.

Petr

-- 
Ing. Petr Kristan
.
EPOS PRO s.r.o., Bozeny Nemcove 2625, 530 02 Pardubice
tel: +420 466335223    Czech Republic (Eastern Europe) 
fax: +420 466510709
Index: verbose.pas
===================================================================
--- verbose.pas	(revision 11839)
+++ verbose.pas	(working copy)
@@ -68,6 +68,7 @@
     var
       msg : pmessage;
       paraprintnodetree : byte;
+      suppres_messages_array : array [0..9] of longint;
 
     type
       tmsgqueueevent = procedure(s:string;v,w:longint) of object;
@@ -177,7 +178,45 @@
          writeln(status.reportbugfile,'FPC bug report file');
       end;
 
+    procedure FillSuppressMessagesArray(const s: string; var i: integer);
+      var
+        c : char;
+        j, code, idx : integer;
+        w: longint;
 
+      procedure InsertW;
+      begin
+        val(copy(s, j, i-j), w, code);
+        if (code=0) and (idx<=High(suppres_messages_array)) then
+        begin
+          suppres_messages_array[idx] := w;
+          inc(idx);
+        end;
+        j := i + 1;
+      end;
+
+      begin
+        inc(i);
+
+        idx := 0;
+        FillChar(suppres_messages_array, SizeOf(suppres_messages_array), 0);
+
+        j := i;
+        while i<=length(s) do
+        begin
+          case s[i] of
+            ',': InsertW;
+            '0'..'9':;
+          else
+            Break;
+          end;
+          inc(i);
+        end;
+        InsertW;
+
+        dec(i);
+      end;
+
     function CheckVerbosity(v:longint):boolean;
       begin
         result:=do_checkverbosity(v);
@@ -296,6 +335,7 @@
                        else
                          status.verbosity:=status.verbosity or V_TimeStamps;
                  'V' : PrepareReport;
+                 'M' : FillSuppressMessagesArray(s, i);
                  end;
                 inc(i);
              end;
@@ -512,6 +552,7 @@
         idx,i,v : longint;
         dostop  : boolean;
         doqueue : boolean;
+        showcomment : boolean;
       begin
       {Reset}
         dostop:=false;
@@ -603,8 +644,17 @@
           onqueue(s,v,w);
           exit;
         end;
+      { Check messages suppresion array }
+        showcomment := true;
+        for i := 0 to High(suppres_messages_array) do 
+          if suppres_messages_array[i] = 0 then
+            Break
+          else if suppres_messages_array[i] = w then begin
+            showcomment := false;
+            Break;
+          end;
       { show comment }
-        if do_comment(v,s) or dostop then
+        if (showcomment and do_comment(v,s)) or dostop then
           raise ECompilerAbort.Create;
         if (status.errorcount>=status.maxerrorcount) and not status.skip_error then
          begin
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to