On Wed, Oct 01, 2008 at 08:25:54PM +0200, Jonas Maebe wrote: > It's a good start, but this patch is not ready to be committed: > a) it is limited to 10 suppressions > b) people have to look up the error number in the message file first > c) if you change the limitation in a), the code will become exponentially > slower do to having to go over the entire suppression array every time a > message has to be shown > > A better approach may be to add a method to TMessage (in the cmsg.pas unit) > to clear the verbosity level (replace all verbosity indicators with '_'). > And to add an option to the compiler to also show the message number when > printing output (so people can use this to get the numbers of the messages > they want to suppress). > >> 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. > > It is automatically generated from compiler/msg/errore.msg (a plain text > file) when you make the compiler. So just a patch to > compiler/msg/errore.msg is fine. Hi
Here is another attempt which respects your comments. Cmdline option: -vm showns msg numbers in listing -vm11004m1018 disables showing msg numbers 11004 and 1018 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) @@ -74,6 +74,7 @@ const msgfilename : string = ''; + ShowMsgNo : boolean = false; procedure SetRedirectFile(const fn:string); function SetVerbosity(const s:string):boolean; @@ -177,7 +178,34 @@ writeln(status.reportbugfile,'FPC bug report file'); end; + procedure ClearMessagesVerbosity(const s: string; var i: integer); + var + j, code : integer; + w: longint; + begin + inc(i); + + if (s[i]<'0') or (s[i]>'9') then + begin + ShowMsgNo := true; + Exit; + end; + + j := i; + while i<=length(s) do + begin + if (s[i]<'0') or (s[i]>'9') then + Break; + inc(i); + end; + val(copy(s, j, i-j), w, code); + if code=0 then + msg^.ClearVerbosity(w); + + dec(i); + end; + function CheckVerbosity(v:longint):boolean; begin result:=do_checkverbosity(v); @@ -296,6 +324,7 @@ else status.verbosity:=status.verbosity or V_TimeStamps; 'V' : PrepareReport; + 'M' : ClearMessagesVerbosity(s, i); end; inc(i); end; @@ -512,6 +541,7 @@ idx,i,v : longint; dostop : boolean; doqueue : boolean; + s1: ansistring; begin {Reset} dostop:=false; @@ -520,7 +550,7 @@ {Parse options} idx:=pos('_',s); if idx=0 then - v:=V_Normal + v:=V_None else if (idx >= 1) And (idx <= 5) then begin @@ -598,6 +628,11 @@ UpdateStatus; { Fix replacements } DefaultReplacements(s); + if ShowMsgNo then + begin + Str(w, s1); + s := s1 + ' ' + s; + end; if doqueue then begin onqueue(s,v,w); Index: cmsgs.pas =================================================================== --- cmsgs.pas (revision 11839) +++ cmsgs.pas (working copy) @@ -52,6 +52,7 @@ procedure ClearIdx; procedure CreateIdx; function GetPChar(nr:longint):pchar; + function ClearVerbosity(nr:longint):pchar; function Get(nr:longint;const args:array of string):ansistring; end; @@ -374,6 +375,14 @@ GetPChar:=msgidx[nr div 1000]^[nr mod 1000]; end; +function TMessage.ClearVerbosity(nr:longint):pchar; +var + hp: pchar; +begin + hp := GetPChar(nr); + if hp<>nil then + hp^ := '_'; +end; function TMessage.Get(nr:longint;const args:array of string):ansistring; var Index: comphook.pas =================================================================== --- comphook.pas (revision 11839) +++ comphook.pas (working copy) @@ -375,7 +375,7 @@ function def_CheckVerbosity(v:longint):boolean; begin result:=status.use_bugreport or - ((status.verbosity and (v and V_LevelMask))=(v and V_LevelMask)); + ((status.verbosity and (v and V_LevelMask))<>0); end; procedure def_initsymbolinfo; Index: msg/errore.msg =================================================================== --- msg/errore.msg (revision 11839) +++ msg/errore.msg (working copy) @@ -2754,6 +2754,7 @@ **2*_b : Write file names messages with full path **2*_v : Write fpcdebug.txt with p : Write tree.log with parse tree **2*_ lots of debugging info +**2*_m<x> : Don't show msg number <x>. Without <x> shows msg numbers 3*1W<x>_Target-specific options (targets) A*1W<x>_Target-specific options (targets) P*1W<x>_Target-specific options (targets)
_______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel